24 #include "ui_applicationdialog.h"
26 #include <QDialogButtonBox>
28 #include <QFileDialog>
30 #include <QMessageBox>
31 #include <QPushButton>
45 connect(
mUI->mButtons, &QDialogButtonBox::rejected,
this, &ApplicationDialog::reject);
49 setWindowTitle(title);
65 filter += tr(
"Executable files (*.exe);;All files(*.*)");
67 QString selectedFile = QFileDialog::getOpenFileName(
this,
68 tr(
"Select viewer application"),
72 if (!selectedFile.isEmpty()) {
74 QString path(QDir::toNativeSeparators(selectedFile));
75 mUI->mPath->setText(path);
81 if (
mUI->mName->text().isEmpty() ||
mUI->mPath->text().isEmpty()) {
82 QMessageBox msg(QMessageBox::Warning,
84 tr(
"You must specify a name, a path and optionally parameters for the application!"),
Dialog to edit a startable application.
Ui::ApplicationDialog * mUI
UI from the Qt designer.
ApplicationDialog(const QString &title, Application &app, QWidget *parent=nullptr)
Constructor.
void browse()
Slot to browse for an application.
~ApplicationDialog() override
Application & mApplication
Underlying Application.
A class containing information of the application to execute.
const QString & getParameters() const
Get application command line parameters.
void setPath(const QString &path)
Set application path.
void setName(const QString &name)
Set application name.
void setParameters(const QString ¶meters)
Set application command line parameters.
const QString & getPath() const
Get application path.
const QString & getName() const
Get application name.
QString getPath(const QString &type)
Obtains the path of specified type Returns the path of specified type if not empty.
#define SETTINGS_LAST_APP_PATH
void setPath(const QString &type, const QString &value)
Stores last used path of specified type Stores provided path as last used path for specified type.