diff options
author | Ken Moore <ken@ixsystems.com> | 2016-10-20 12:05:22 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-10-20 12:05:22 -0400 |
commit | 36df3d58e25beb06f16fdf821f18fe8a4bcce2ae (patch) | |
tree | 137dfbf9c48f0eba2f4a58d0f3d22f7e870f0c2a | |
parent | Make sure all the translation files are synced to the sources. (diff) | |
download | lumina-36df3d58e25beb06f16fdf821f18fe8a4bcce2ae.tar.gz lumina-36df3d58e25beb06f16fdf821f18fe8a4bcce2ae.tar.bz2 lumina-36df3d58e25beb06f16fdf821f18fe8a4bcce2ae.zip |
Finish up the last couple buttons/actions related to the new Tray UI.
1) If closing the main window while an operation is running, hide it instead until the file operation is finished - then close.
2) Fix the icon on the show errors button
3) Hook up the show errors button to show a scroll dialog with the errors.
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/MainUI.cpp | 25 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/MainUI.h | 9 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/OPWidget.cpp | 13 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/OPWidget.h | 2 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/TrayUI.cpp | 7 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/TrayUI.h | 3 |
6 files changed, 51 insertions, 8 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp index 02533271..128c4cd5 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp @@ -20,7 +20,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ //just to silence/fix some Qt connect warnings in QtConcurrent //qRegisterMetaType< QVector<int> >("QVector<int>"); //qRegisterMetaType< QList<QPersistentModelIndex> >("QList<QPersistentModelIndex>"); - + waitingToClose = false; ui->setupUi(this); ui->menuGit->setVisible( GIT::isAvailable() ); @@ -106,6 +106,7 @@ QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); RebuildDeviceMenu(); //Make sure we start on the browser page TRAY = new TrayUI(this); + connect(TRAY, SIGNAL(JobsFinished()), this, SLOT(TrayJobsFinished()) ); if(DEBUG){ qDebug() << " - Done with init"; } } @@ -187,7 +188,7 @@ void MainUI::OpenDirs(QStringList dirs){ //Double check that there is at least 1 dir loaded //qDebug() << "OpenDirs:" << DWLIST.length() << dirs << invalid << tabBar->currentIndex(); if(DWLIST.isEmpty()){ OpenDirs(QStringList()); } - + waitingToClose = false; } void MainUI::setupIcons(){ @@ -944,3 +945,23 @@ void MainUI::TabNameChanged(QString id, QString name){ } } } + +void MainUI::TrayJobsFinished(){ + if(waitingToClose){ this->close(); } +} + +//============= +// PROTECTED +//============= +void MainUI::closeEvent(QCloseEvent *ev){ + //See if the tray is active or not first + if(TRAY!=0){ + if(TRAY->isVisible() && !waitingToClose){ + this->hide(); + ev->ignore(); + waitingToClose = true; + return; + } + } + QMainWindow::closeEvent(ev); //continue normal close routine +} diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.h b/src-qt5/desktop-utils/lumina-fm/MainUI.h index 0ed9c44b..2b4c0d7b 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.h +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.h @@ -88,9 +88,10 @@ private: MultimediaWidget *MW; SlideshowWidget *SW; TrayUI *TRAY; + bool waitingToClose; - QSettings *settings; - QShortcut *nextTabLShort, *nextTabRShort, *togglehiddenfilesShort, *focusDirWidgetShort; + QSettings *settings; + QShortcut *nextTabLShort, *nextTabRShort, *togglehiddenfilesShort, *focusDirWidgetShort; //QCompleter *dirCompleter; //Simplification Functions @@ -169,6 +170,8 @@ private slots: //file info in status bar void DisplayStatusBar(QString); + void TrayJobsFinished(); + signals: void Si_AdaptStatusBar(QFileInfoList fileList, QString path, QString messageFolders, QString messageFiles); @@ -179,6 +182,8 @@ protected: QMainWindow::resizeEvent(ev); //just in case the window needs to see the event too } + void closeEvent(QCloseEvent *ev); + }; #endif diff --git a/src-qt5/desktop-utils/lumina-fm/OPWidget.cpp b/src-qt5/desktop-utils/lumina-fm/OPWidget.cpp index 3e842b90..3638e2a8 100644 --- a/src-qt5/desktop-utils/lumina-fm/OPWidget.cpp +++ b/src-qt5/desktop-utils/lumina-fm/OPWidget.cpp @@ -7,16 +7,19 @@ #include "OPWidget.h" #include "ui_OPWidget.h" +#include "ScrollDialog.h" + OPWidget::OPWidget(QWidget *parent) : QWidget(parent), ui(new Ui::OPWidget()){ starttime = endtime = -1; WA = new QWidgetAction(0); WA->setDefaultWidget(this); worker = 0; workthread = 0; + dlg = 0; //Now create the widget ui->setupUi(this); ui->tool_close->setIcon( LXDG::findIcon("dialog-close","view-close") ); - ui->tool_showerrors->setIcon(LXDG::findIcon("view-search","")); + ui->tool_showerrors->setIcon(LXDG::findIcon("dialog-warning","")); //connect the widget buttons connect(ui->tool_close, SIGNAL(clicked()), this, SLOT(closeWidget()) ); connect(ui->tool_showerrors, SIGNAL(clicked()), this, SLOT(showErrors()) ); @@ -26,6 +29,7 @@ OPWidget::~OPWidget(){ if(worker!=0){ worker->stopped = true; worker->deleteLater(); } if(workthread!=0){ workthread->quit(); workthread->wait(); delete workthread; } WA->deleteLater(); + if(dlg!=0){ dlg->deleteLater(); } } QWidgetAction* OPWidget::widgetAction(){ @@ -87,7 +91,12 @@ void OPWidget::closeWidget(){ void OPWidget::showErrors(){ qDebug() << "Errors:" << Errors; - //TODO + if(dlg==0){ + dlg = new ScrollDialog(); //need this to persist outside this function + dlg->setWindowTitle(tr("File Operation Errors")); + dlg->setText( Errors.join("\n") ); + } + dlg->showNormal(); } void OPWidget::opFinished(QStringList errors){ diff --git a/src-qt5/desktop-utils/lumina-fm/OPWidget.h b/src-qt5/desktop-utils/lumina-fm/OPWidget.h index 600df4b7..13fb3cb3 100644 --- a/src-qt5/desktop-utils/lumina-fm/OPWidget.h +++ b/src-qt5/desktop-utils/lumina-fm/OPWidget.h @@ -10,6 +10,7 @@ #define _LUMINA_FILE_MANAGER_FILE_OP_OPWIDGET_H #include "FODialog.h" +#include "ScrollDialog.h" namespace Ui{ class OPWidget; }; @@ -36,6 +37,7 @@ public slots: private: Ui::OPWidget *ui; + ScrollDialog *dlg; //Main Objects QWidgetAction *WA; FOWorker *worker; diff --git a/src-qt5/desktop-utils/lumina-fm/TrayUI.cpp b/src-qt5/desktop-utils/lumina-fm/TrayUI.cpp index 8e796c68..f7034d54 100644 --- a/src-qt5/desktop-utils/lumina-fm/TrayUI.cpp +++ b/src-qt5/desktop-utils/lumina-fm/TrayUI.cpp @@ -12,6 +12,7 @@ TrayUI::TrayUI(QObject *parent) : QSystemTrayIcon(parent){ this->setContextMenu( new QMenu() ); this->setIcon(LXDG::findIcon("Insight-FileManager","")); + connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(TrayActivated())); } TrayUI::~TrayUI(){ @@ -38,6 +39,10 @@ void TrayUI::createOP( FILEOP type, QStringList oldF, QStringList newF){ QTimer::singleShot(0, OP, SLOT(startOperation()) ); } +void TrayUI::TrayActivated(){ + this->contextMenu()->popup( this->geometry().center() ); +} + //Operation Widget Responses void TrayUI::OperationClosed(QString ID){ for(int i=0; i<OPS.length(); i++){ @@ -68,7 +73,7 @@ void TrayUI::OperationFinished(QString ID){ //qDebug() << " -- Errors:" << err << "Duration:" << OPS[i]->duration(); //Assemble the notification (if more than 1 second to perform operation) if(OPS[i]->duration()>1){ - this->showMessage( tr("Finished"), err ? tr("Errors during operation. Click to view details") : tr("No Errors"), err ? QSystemTrayIcon::Warning : QSystemTrayIcon::Information); + this->showMessage( tr("Finished"), err ? tr("Errors during operation. Click to view details") : "", err ? QSystemTrayIcon::Warning : QSystemTrayIcon::Information); } //Close the widget if no errors if(!err){ OperationClosed(ID); } diff --git a/src-qt5/desktop-utils/lumina-fm/TrayUI.h b/src-qt5/desktop-utils/lumina-fm/TrayUI.h index 38a99f7a..4210784a 100644 --- a/src-qt5/desktop-utils/lumina-fm/TrayUI.h +++ b/src-qt5/desktop-utils/lumina-fm/TrayUI.h @@ -31,7 +31,8 @@ private: void createOP( FILEOP, QStringList oldF, QStringList newF); private slots: - + void TrayActivated(); + //Operation Widget Responses void OperationClosed(QString ID); void OperationStarted(QString ID); |