-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetparamsdialog.cpp
More file actions
145 lines (103 loc) · 3.03 KB
/
Copy pathsetparamsdialog.cpp
File metadata and controls
145 lines (103 loc) · 3.03 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include "setparamsdialog.h"
#include "ui_setparamsdialog.h"
#include "myglobalvars.h"
#include <QFile>
#include <QFileDialog>
#include <QTextStream>
#include <QMessageBox>
SetParamsDialog::SetParamsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SetParamsDialog)
{
ui->setupUi(this);
ui->frameAddNew->hide();
//set background color
QPalette pal = this->palette();
QLinearGradient gradient(0, 0, 0, 400);
gradient.setColorAt(0, QColor(120, 255, 255));
gradient.setColorAt(0.7, QColor(180, 255, 255));
gradient.setColorAt(1, QColor(230, 255, 255));
pal.setBrush(QPalette::Window, QBrush(gradient));
this->setPalette(pal);
//Finished setting background
#ifdef __linux__
ui->label_4->setText("Operating system : Linux");
#elif _WIN32
ui->label_4->setText("Operating system : Windows");
#elif __APPLE__
ui->label_4->setText("Operating system : Apple");
#else
ui->label_4->setText("Operating system : Not recognized!");
#endif
QFile propfile(propertiesFile);
if (propfile.exists())
load_properties();
else
on_restoredefaults_clicked();
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults),SIGNAL(clicked()),SLOT(on_restoredefaults_clicked()));
}
void SetParamsDialog::on_pushButtonAddNew_clicked()
{
const QString EngineName=ui->lineEditName->text();
ui->comboBoxEngine->insertItem(ui->comboBoxEngine->count()-1,EngineName);
}
void SetParamsDialog::on_comboBoxEngine_currentIndexChanged(int index)
{
int engineNum = ui->comboBoxEngine->count();
if (index==engineNum-1)
{
ui->frameAddNew->show();
ui->lineEditVal_4->clear();
ui->lineEditVal_6->clear();
}else
ui->frameAddNew->hide();
}
void SetParamsDialog::on_restoredefaults_clicked()
{
QMessageBox::StandardButton overwriteCondition = QMessageBox::question(this,"Default Setting","Reset to default? All changes will be lost!",QMessageBox::Yes|QMessageBox::No);
if (overwriteCondition==QMessageBox::No)
return;
QFile propfile(propertiesFile);
if (!propfile.open(QFile::WriteOnly | QFile::Text))
{
QMessageBox::warning(this,"Error","Cannot open property file.");
return;
}
QTextStream propStream (&propfile);
propStream<<"Default"<<'\n';
#ifdef __linux__
ui->comboBoxEngine->clear();
#elif _WIN32
ui->comboBoxEngine->clear();
#elif __APPLE__
ui->comboBoxEngine->clear();
#else
#endif
propStream.flush();
propfile.close();
}
void SetParamsDialog::load_properties()
{
}
void SetParamsDialog::save_properties()
{
}
SetParamsDialog::~SetParamsDialog()
{
delete ui;
}
void SetParamsDialog::on_buttonBox_accepted()
{
save_properties();
}
void SetParamsDialog::on_toolButtonJSIM_clicked()
{
QString SimFile = QFileDialog::getOpenFileName(this, tr("Open Netlist File..."),QString(), tr("Netlist Files (*.js *.inp);;All Files (*)"));
if (!SimFile.isEmpty())
{
}
else
{
QMessageBox::warning(this,"Error","No simulation engine is selected.");
}
}