-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
askSelectBrfDialog.cpp
87 lines (72 loc) · 2.08 KB
/
askSelectBrfDialog.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* OpenBRF -- by marco tarini. Provided under GNU General Public License */
#include "askSelectBrfDialog.h"
#include "ui_askSelectBrfDialog.h"
#include <QModelIndex>
AskSelectBRFDialog::AskSelectBRFDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AskSelectBRFDialog)
{
ui->setupUi(this);
connect(ui->countUsed,SIGNAL(clicked()),this,SLOT(countUsed()));
connect(ui->refresh,SIGNAL(clicked()),this,SLOT(refresh()));
connect(ui->listMod ,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(clickedOnList(QModelIndex)));
connect(ui->listUnref,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(clickedOnList(QModelIndex)));
connect(ui->listComm ,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(clickedOnList(QModelIndex)));
}
int AskSelectBRFDialog::doExec(){
ui->listMod->addItems(name[0]);
ui->listMod->setProperty("id",0);
ui->listUnref->addItems(name[1]);
ui->listUnref->setProperty("id",1);
ui->listComm->addItems(name[2]);
ui->listComm->setProperty("id",2);
loadMe.clear();
setResult(0);
return QDialog::exec();
}
AskSelectBRFDialog::~AskSelectBRFDialog()
{
delete ui;
}
void AskSelectBRFDialog::countUsed(){
setResult(1);
loadMe = QString("???1");
close();
}
void AskSelectBRFDialog::refresh(){
setResult(1);
loadMe = QString("???2");
close();
}
QPushButton* AskSelectBRFDialog::openModuleIniButton(){
return ui->openModuleIni;
}
void AskSelectBRFDialog::clickedOnList(QModelIndex i){
QObject* s = sender();
if (s) {
QVariant v = s->property("id");
if (v.isValid()) {
int k = v.toInt();
if (k>=0 && k<3) {
loadMe = path[k][i.row()];
setResult(0);
close();
}
}
}
}
void AskSelectBRFDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void AskSelectBRFDialog::addName(int k, QString _name, QString _path){
name[k].append(_name);
path[k].append(_path);
}