Skip to content

Commit

Permalink
GUI: Add logging for opening and closing
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpm54 authored and DrMcCoy committed May 22, 2018
1 parent 5e92d83 commit 7d5b853
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ MainWindow::MainWindow(QWidget *parent, const char *title, const QSize &size, co
QObject::connect(_panelResourceInfo, &PanelResourceInfo::exportTGAClicked, this, &MainWindow::exportTGA);
QObject::connect(_panelResourceInfo, &PanelResourceInfo::exportBMUMP3Clicked, this, &MainWindow::exportBMUMP3);
QObject::connect(_panelResourceInfo, &PanelResourceInfo::exportWAVClicked, this, &MainWindow::exportWAV);
QObject::connect(_panelResourceInfo, &PanelResourceInfo::log, this, &MainWindow::slotLog);
resInfoFrame->setFrameShape(QFrame::StyledPanel);
resInfoFrame->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
resInfoFrame->setFixedHeight(140);
Expand Down Expand Up @@ -214,6 +215,10 @@ MainWindow::MainWindow(QWidget *parent, const char *title, const QSize &size, co
open(qpath);
}

void MainWindow::slotLog(const QString &text) {
_log->append(text);
}

void MainWindow::slotOpenDirectory() {
QString dir = QFileDialog::getExistingDirectory(this,
tr("Open directory"),
Expand Down Expand Up @@ -241,6 +246,8 @@ void MainWindow::slotClose() {
_treeView->setModel(nullptr);
_treeModel.reset(nullptr);
_currentItem = nullptr;

_log->append(tr("Closed directory: %1").arg(_rootPath));
_rootPath = "";

_actionClose->setEnabled(false);
Expand Down Expand Up @@ -280,6 +287,8 @@ void MainWindow::open(const QString &path) {
// Enters populate thread in here.
_treeModel->populate(_files.getRoot());

_log->append(tr("Set root: %1").arg(path));

_actionClose->setEnabled(true);
}

Expand Down
3 changes: 3 additions & 0 deletions src/gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class MainWindow : public QMainWindow {
MainWindow(QWidget *parent, const char *title, const QSize &size, const char *path);

private /*slots*/:
void slotLog(const QString &text);
W_SLOT(slotLog, W_Access::Private)

void slotOpenDirectory();
W_SLOT(slotOpenDirectory, W_Access::Private)

Expand Down

0 comments on commit 7d5b853

Please sign in to comment.