1 #include <QApplication>
12 int main(
int argc,
char* argv[] )
14 QApplication application( argc, argv );
21 return application.exec();
35 setWindowTitle(
"UltraScan Configuration" );
40 QBoxLayout* topbox =
new QVBoxLayout(
this );
41 topbox->setContentsMargins ( 2, 2, 2, 2 );
42 topbox->setSpacing ( 2 );
45 topbox->addWidget( banner );
47 QLabel* paths =
us_banner( tr(
"Directories" ) );
48 paths->setAlignment ( Qt::AlignVCenter | Qt::AlignLeft );
49 topbox->addWidget( paths );
52 QGridLayout* directories =
new QGridLayout();
57 QFontMetrics* fm =
new QFontMetrics ( *f );
58 int w = fm->width( tr(
"Temporary Directory:" ) ) + 20;
68 int le_w = fm->width( browser ) + 20;
71 directories->addWidget(
le_browser, row++, 1 );
80 le_w = qMax( fm->width( workDir ) + 20, le_w );
83 directories->addWidget( le_workDir, row++, 1 );
84 connect( le_workDir, SIGNAL( editingFinished() ),
94 le_w = qMax( fm->width( importDir ) + 20, le_w );
97 directories->addWidget( le_importDir, row++, 1 );
98 connect( le_importDir, SIGNAL( editingFinished() ),
104 directories->addWidget(
pb_tmpDir, row, 0 );
108 le_w = qMax( fm->width( tmpDir ) + 20, le_w );
111 directories->addWidget( le_tmpDir, row++, 1 );
112 connect( le_tmpDir, SIGNAL( editingFinished() ),
116 le_workDir ->setMinimumWidth( le_w );
117 le_importDir ->setMinimumWidth( le_w );
118 le_tmpDir ->setMinimumWidth( le_w );
120 topbox->addLayout( directories );
122 QLabel* misc =
us_banner( tr(
"Miscellaneous Settings" ) );
123 misc->setAlignment ( Qt::AlignVCenter | Qt::AlignLeft );
124 topbox->addWidget( misc );
128 QGridLayout* otherSettings =
new QGridLayout();
131 QLabel* lb_disk_db =
us_label(
"Default Data Location:" );
132 otherSettings->addWidget( lb_disk_db, row, 0 );
139 QLabel* color =
us_label(
"Color Preferences:" );
140 otherSettings->addWidget( color, row, 0 );
143 otherSettings->addWidget(
pb_color, row++, 1 );
148 otherSettings->addWidget( font, row, 0 );
151 otherSettings->addWidget(
pb_font, row++, 1 );
155 QLabel*
db =
us_label(
"Database Preferences:" );
156 otherSettings->addWidget(db, row, 0 );
159 otherSettings->addWidget(
pb_db, row++, 1 );
163 QLabel* password =
us_label(
"Master Password:" );
164 otherSettings->addWidget( password, row, 0 );
172 otherSettings->addWidget( advanced, row, 0 );
178 topbox->addLayout( otherSettings );
182 connect(
pb_help, SIGNAL( clicked() ),
this, SLOT(
help() ) );
185 connect(
pb_save, SIGNAL( clicked() ),
this, SLOT(
save() ) );
188 connect(
pb_cancel, SIGNAL( clicked() ),
this, SLOT( close() ) );
190 QBoxLayout* buttons =
new QHBoxLayout();
194 topbox->addLayout( buttons );
215 QMessageBox::information(
this,
216 tr(
"Settings Saved" ),
217 tr(
"The settings were successfully saved" ) );
260 QString browser = QFileDialog::getOpenFileName(
this,
261 tr(
"Select desired browser application" ),
le_browser->text() );
263 if ( browser !=
"" )
le_browser->setText( browser );
269 QString dir = QFileDialog::getExistingDirectory(
this,
270 tr(
"Select desired base work directory" ),
le_workDir->text() );
282 QString dir = QFileDialog::getExistingDirectory(
this,
283 tr(
"Select desired imports directory" ),
le_importDir->text() );
295 QString dir = QFileDialog::getExistingDirectory(
this,
296 tr(
"Select desired temporary directory" ),
le_tmpDir->text() );
317 le_tmpDir ->setText( work_dir +
"/tmp" );