diff options
author | Ken Moore <moorekou@gmail.com> | 2016-04-25 13:08:12 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-04-25 13:08:12 -0400 |
commit | ed5ecf7ea7a482b4649e66ecb35fbc60af680684 (patch) | |
tree | acc0fa17d228259e847f55c678db9fb0a9b50f0c /src-qt5/core-utils/lumina-config/AppDialog.h | |
parent | Merge branch 'master' of github.com:pcbsd/lumina (diff) | |
download | lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.gz lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.bz2 lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.zip |
Rearrange the Lumina source tree quite a bit:
Now the utilites are arranged by category (core, core-utils, desktop-utils), so all the -utils may be excluded by a package system (or turned into separate packages) as needed.
Diffstat (limited to 'src-qt5/core-utils/lumina-config/AppDialog.h')
-rw-r--r-- | src-qt5/core-utils/lumina-config/AppDialog.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src-qt5/core-utils/lumina-config/AppDialog.h b/src-qt5/core-utils/lumina-config/AppDialog.h new file mode 100644 index 00000000..8c35d9b7 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/AppDialog.h @@ -0,0 +1,77 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2014, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This is the dialog for catching keyboard events and converting them to X11 keycodes +//=========================================== +#ifndef _LUMINA_FILE_MANAGER_APP_SELECT_DIALOG_H +#define _LUMINA_FILE_MANAGER_APP_SELECT_DIALOG_H + +#include <QDialog> +#include <QString> +#include <QList> +#include <QPoint> +#include <QDesktopWidget> +#include <QCursor> +#include <LuminaXDG.h> + +#include "ui_AppDialog.h" + +namespace Ui{ + class AppDialog; +}; + +class AppDialog : public QDialog{ + Q_OBJECT +private: + Ui::AppDialog *ui; + QList<XDGDesktop> APPS; + +public: + AppDialog(QWidget *parent = 0, QList<XDGDesktop> applist = QList<XDGDesktop>()) : QDialog(parent), ui(new Ui::AppDialog){ + ui->setupUi(this); //load the designer file + APPS = applist; //save this for later + appreset = false; + ui->comboBox->clear(); + for(int i=0; i<APPS.length(); i++){ + ui->comboBox->addItem( LXDG::findIcon(APPS[i].icon,"application-x-executable"), APPS[i].name ); + } + this->setWindowIcon( LXDG::findIcon("system-search","") ); + if(parent!=0){ + QPoint center = parent->geometry().center(); + this->move(center.x()-(this->width()/2), center.y()-(this->height()/2) ); + } + } + + ~AppDialog(){} + + void allowReset(bool allow){ + if(allow){ + ui->buttonBox->setStandardButtons(QDialogButtonBox::RestoreDefaults | QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + }else{ + ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + } + } + XDGDesktop appselected; //selected application (empty template for cancelled/reset) + bool appreset; //Did the user select to reset to defaults? + + +private slots: + void on_buttonBox_accepted(){ + appselected = APPS[ ui->comboBox->currentIndex() ]; + this->close(); + } + void on_buttonBox_rejected(){ + this->close(); + } + void on_buttonBox_clicked(QAbstractButton *button){ + if(ui->buttonBox->standardButton(button) == QDialogButtonBox::RestoreDefaults){ + appreset = true; + this->close(); + } + } +}; + +#endif |