-
Notifications
You must be signed in to change notification settings - Fork 0
/
addentryform.cpp
48 lines (41 loc) · 1.13 KB
/
addentryform.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "addentryform.h"
#include <QDebug>
#include <QFileDialog>
AddEntryForm::AddEntryForm(QDialog *parent) :
QDialog(parent)
{
ui.setupUi(this);
exec();
}
AddEntryForm::~AddEntryForm()
{
// delete ui;
}
void AddEntryForm::on_btnChooseCmd_clicked()
{
qDebug()<<__func__;
e.cmd = QFileDialog::getOpenFileName(this,
tr("Choose command"), "/usr/bin", tr("Excutables (*)"));
ui.editChooseCommand->setText(e.cmd);
}
void AddEntryForm::on_btnChooseIcon_clicked()
{
qDebug()<<__func__;
e.ico = QFileDialog::getOpenFileName(this,
tr("Choose icon"), "/usr/share/icons/hicolor/48x48/apps/", tr("Icons (*.png *.jpg *.bmp *.ico *.svg)"));
ui.editChooseIcon->setText(e.ico);
}
void AddEntryForm::on_btnBoxOkCancel_accepted()
{
qDebug()<<__func__;
e.cmd = ui.editChooseCommand->text();
e.ico = ui.editChooseIcon->text();
if(ui.editChooseDecription->text().isEmpty())
e.descr = e.cmd;
else
e.descr = ui.editChooseDecription->text();
if(ui.editChooseTooltip->text().isEmpty())
e.tooltip= e.cmd;
else
e.tooltip= ui.editChooseTooltip->text();
}