Sfoglia il codice sorgente

sort of bug squashing

master
hex 4 anni fa
parent
commit
b8150f6f06
4 ha cambiato i file con 17 aggiunte e 3 eliminazioni
  1. 1
    0
      include/window.h
  2. 4
    2
      src/pane.cpp
  3. 1
    0
      src/pane.h
  4. 11
    1
      src/window.cpp

+ 1
- 0
include/window.h Vedi File

@@ -18,6 +18,7 @@ public:
public slots:
void switchActivePane(hex::Pane* newPane);
void switchActiveTab(int newTab);
void changeFolder(const QString& newFolder);
private:
QPushButton *mButton;

+ 4
- 2
src/pane.cpp Vedi File

@@ -3,6 +3,7 @@
#include <QListView>
#include <QVBoxLayout>
#include <QFileSystemModel>
#include <iostream>

namespace hex {

@@ -36,17 +37,18 @@ void Pane::changeIndex(const QModelIndex& index) {
mView->setRootIndex(index);

emit pathChanged(mModel->filePath(index));
emit folderChanged(mModel->fileName(index));
} else {
//open file
}
}

void Pane::moveUp() {
changeIndex(mView->currentIndex().parent());
changeIndex(mView->rootIndex().parent());
}

QString Pane::getPath() {
return mModel->filePath(mView->currentIndex());
return mModel->filePath(mView->rootIndex());
}

}

+ 1
- 0
src/pane.h Vedi File

@@ -21,6 +21,7 @@ public slots:

signals:
void pathChanged(const QString& newPath);
void folderChanged(const QString& newFolder);

private:
QListView* mView;

+ 11
- 1
src/window.cpp Vedi File

@@ -36,12 +36,16 @@ Window::Window(QWidget *parent) :

QObject::connect(mTabWidget, &QTabWidget::currentChanged,
this, &Window::switchActiveTab);
mTabWidget->setCurrentIndex(0);
switchActiveTab(0);

this->setLayout(body);
}


void Window::switchActivePane(hex::Pane* newPane) {
//TODO: Replace this garbage. It's broken.

mPathBar->setText(newPane->getPath());
QObject::connect(mButton, &QPushButton::clicked,
newPane, &hex::Pane::moveUp);
@@ -49,9 +53,15 @@ void Window::switchActivePane(hex::Pane* newPane) {
// newPane, &hex::Pane::setPath);
QObject::connect(newPane, &hex::Pane::pathChanged,
mPathBar, &QLineEdit::setText);
QObject::connect(newPane, &hex::Pane::folderChanged,
this, &Window::changeFolder);
}

void Window::switchActiveTab(int newTab) {
std::cout << newTab;
switchActivePane(dynamic_cast<hex::Pane*>(mTabWidget->widget(newTab)));
}


void Window::changeFolder(const QString& newFolder) {
mTabWidget->setTabText(mTabWidget->currentIndex(), newFolder);
}

Loading…
Annulla
Salva