24 #include <QGridLayout>
25 #include <QVBoxLayout>
34 #include <QColorDialog>
35 #include <QFontDialog>
37 #include <QPushButton>
40 #include <QMessageBox>
46 : QDialog(parent, name)
49 setWindowTitle(tr(
"Edit Qucs Properties"));
51 Expr.setPattern(
"[\\w_]+");
54 all =
new QVBoxLayout(
this);
55 QTabWidget *t =
new QTabWidget();
60 QWidget *appSettingsTab =
new QWidget(t);
61 QGridLayout *appSettingsGrid =
new QGridLayout(appSettingsTab);
63 appSettingsGrid->addWidget(
new QLabel(tr(
"Font (set after reload):"), appSettingsTab), 0,0);
68 appSettingsGrid->addWidget(
new QLabel(tr(
"Document Background Color:"), appSettingsTab) ,1,0);
73 appSettingsGrid->addWidget(
new QLabel(tr(
"Language (set after reload):"), appSettingsTab) ,2,0);
98 val200 =
new QIntValidator(0, 200,
this);
99 appSettingsGrid->addWidget(
new QLabel(tr(
"maximum undo operations:"), appSettingsTab) ,3,0);
104 appSettingsGrid->addWidget(
new QLabel(tr(
"text editor:"), appSettingsTab) ,4,0);
106 editorEdit->setToolTip(tr(
"Set to qucs, qucsedit or the path to your favorite text editor."));
109 appSettingsGrid->addWidget(
new QLabel(tr(
"start wiring when clicking open node:"), appSettingsTab) ,5,0);
114 appSettingsGrid->addWidget(
new QLabel(tr(
"Load documents from future versions ")));
119 t->addTab(appSettingsTab, tr(
"Settings"));
123 QWidget *editorTab =
new QWidget(t);
124 QGridLayout *editorGrid =
new QGridLayout(editorTab);
126 editorGrid->addMultiCellWidget(
new QLabel(tr(
"Colors for Syntax Highlighting:"), editorTab), 0,0,0,1);
128 ColorComment =
new QPushButton(tr(
"Comment"), editorTab);
134 ColorString =
new QPushButton(tr(
"String"), editorTab);
140 ColorInteger =
new QPushButton(tr(
"Integer Number"), editorTab);
146 ColorReal =
new QPushButton(tr(
"Real Number"), editorTab);
176 ColorTask =
new QPushButton(tr(
"Task"), editorTab);
183 t->addTab(editorTab, tr(
"Source Code Editor"));
187 QWidget *fileTypesTab =
new QWidget(t);
188 QGridLayout *fileTypesGrid =
new QGridLayout(fileTypesTab);
190 QLabel *note =
new QLabel(
191 tr(
"Register filename extensions here in order to\nopen files with an appropriate program."));
192 fileTypesGrid->addWidget(note,0,0,1,2);
198 QTableWidgetItem *item1 =
new QTableWidgetItem();
199 QTableWidgetItem *item2 =
new QTableWidgetItem();
204 item1->setText(tr(
"Suffix"));
205 item2->setText(tr(
"Program"));
218 QTableWidgetItem *suffix =
new QTableWidgetItem(QString((*it).section(
'/',0,0)));
219 QTableWidgetItem *program =
new QTableWidgetItem(QString((*it).section(
'/',1,1)));
220 suffix->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
221 program->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
227 QLabel *l5 =
new QLabel(tr(
"Suffix:"), fileTypesTab);
228 fileTypesGrid->addWidget(l5,1,1);
234 QLabel *l6 =
new QLabel(tr(
"Program:"), fileTypesTab);
235 fileTypesGrid->addWidget(l6,2,1);
239 QPushButton *AddButt =
new QPushButton(tr(
"Set"));
240 fileTypesGrid->addWidget(AddButt,3,1);
242 QPushButton *RemoveButt =
new QPushButton(tr(
"Remove"));
243 fileTypesGrid->addWidget(RemoveButt,3,2);
246 fileTypesGrid->setRowStretch(3,4);
247 t->addTab(fileTypesTab, tr(
"File Types"));
251 QWidget *locationsTab =
new QWidget(t);
252 QGridLayout *locationsGrid =
new QGridLayout(locationsTab);
254 QLabel *note2 =
new QLabel(
255 tr(
"Edit the standard paths and external applications"));
256 locationsGrid->addWidget(note2,0,0,1,2);
258 locationsGrid->addWidget(
new QLabel(tr(
"Qucs Home:"), locationsTab) ,1,0);
259 homeEdit =
new QLineEdit(locationsTab);
260 locationsGrid->addWidget(
homeEdit,1,1);
261 QPushButton *HomeButt =
new QPushButton(
"...");
262 locationsGrid->addWidget(HomeButt, 1, 2);
265 locationsGrid->addWidget(
new QLabel(tr(
"AdmsXml Path:"), locationsTab) ,2,0);
268 QPushButton *AdmsXmlButt =
new QPushButton(
"...");
269 locationsGrid->addWidget(AdmsXmlButt, 2, 2);
272 locationsGrid->addWidget(
new QLabel(tr(
"ASCO Path:"), locationsTab) ,3,0);
273 ascoEdit =
new QLineEdit(locationsTab);
274 locationsGrid->addWidget(
ascoEdit,3,1);
275 QPushButton *ascoButt =
new QPushButton(
"...");
276 locationsGrid->addWidget(ascoButt, 3, 2);
279 locationsGrid->addWidget(
new QLabel(tr(
"Octave Path:"), locationsTab) ,4,0);
282 QPushButton *OctaveButt =
new QPushButton(
"...");
283 locationsGrid->addWidget(OctaveButt, 4, 2);
291 QTableWidgetItem *pitem1 =
new QTableWidgetItem();
295 pitem1->setText(tr(
"Subcircuit Search Path List"));
304 QPushButton *AddPathButt =
new QPushButton(
"Add Path");
305 locationsGrid->addWidget(AddPathButt, 5, 2);
306 connect(AddPathButt, SIGNAL(clicked()), SLOT(
slotAddPath()));
308 QPushButton *AddPathSubFolButt =
new QPushButton(
"Add Path With SubFolders");
309 locationsGrid->addWidget(AddPathSubFolButt, 6, 2);
312 QPushButton *RemovePathButt =
new QPushButton(
"Remove Path");
313 locationsGrid->addWidget(RemovePathButt , 7, 2);
314 connect(RemovePathButt, SIGNAL(clicked()), SLOT(
slotRemovePath()));
320 t->addTab(locationsTab, tr(
"Locations"));
325 QHBoxLayout *Butts =
new QHBoxLayout();
326 Butts->setSpacing(3);
328 all->addLayout(Butts);
330 QPushButton *OkButt =
new QPushButton(tr(
"OK"));
331 Butts->addWidget(OkButt);
332 connect(OkButt, SIGNAL(clicked()), SLOT(
slotOK()));
333 QPushButton *ApplyButt =
new QPushButton(tr(
"Apply"));
334 Butts->addWidget(ApplyButt);
335 connect(ApplyButt, SIGNAL(clicked()), SLOT(
slotApply()));
336 QPushButton *CancelButt =
new QPushButton(tr(
"Cancel"));
337 Butts->addWidget(CancelButt);
338 connect(CancelButt, SIGNAL(clicked()), SLOT(reject()));
339 QPushButton *DefaultButt =
new QPushButton(tr(
"Default Values"));
340 Butts->addWidget(DefaultButt);
345 OkButt->setDefault(
true);
393 QMessageBox::critical(
this, tr(
"Error"),
394 tr(
"This suffix is already registered!"));
401 QTableWidgetItem *newSuffix =
new QTableWidgetItem(QString(
Input_Suffix->text()));
402 newSuffix->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
405 QTableWidgetItem *newProgram =
new QTableWidgetItem(
Input_Program->text());
407 newProgram->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
440 bool changed =
false;
449 if(w->inherits(
"QTextEdit"))
450 ((
TextDoc*)w)->viewport()->setPaletteBackgroundColor(
453 ((
Schematic*)w)->viewport()->setPaletteBackgroundColor(
563 QFont tmpFont = QFontDialog::getFont(&ok,
Font,
this);
574 QColor c = QColorDialog::getColor(
586 BGColorButton->setPaletteBackgroundColor(QColor(255,250,225));
591 ColorReal->setPaletteForegroundColor(Qt::darkMagenta);
596 ColorTask->setPaletteForegroundColor(Qt::darkRed);
606 QColor c = QColorDialog::getColor(
615 QColor c = QColorDialog::getColor(
624 QColor c = QColorDialog::getColor(
633 QColor c = QColorDialog::getColor(
634 ColorReal->paletteForegroundColor(),
this);
642 QColor c = QColorDialog::getColor(
651 QColor c = QColorDialog::getColor(
660 QColor c = QColorDialog::getColor(
669 QColor c = QColorDialog::getColor(
678 QColor c = QColorDialog::getColor(
679 ColorTask->paletteForegroundColor(),
this);
695 QFileDialog fileDialog(
this, tr(
"Select the home directory"),
homeEdit->text() );
696 fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
697 fileDialog.setFileMode(QFileDialog::DirectoryOnly);
699 homeEdit->setText(fileDialog.selectedFile());
704 QFileDialog fileDialog(
this, tr(
"Select the admsXml bin directory"),
admsXmlEdit->text() );
705 fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
706 fileDialog.setFileMode(QFileDialog::DirectoryOnly);
713 QFileDialog fileDialog(
this, tr(
"Select the ASCO bin directory"),
ascoEdit->text() );
714 fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
715 fileDialog.setFileMode(QFileDialog::DirectoryOnly);
717 ascoEdit->setText(fileDialog.selectedFile());
722 QFileDialog fileDialog(
this, tr(
"Select the octave bin directory"),
octaveEdit->text() );
723 fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
724 fileDialog.setFileMode(QFileDialog::DirectoryOnly);
726 octaveEdit->setText(fileDialog.selectedFile());
737 fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
738 fileDialog.setFileMode(QFileDialog::DirectoryOnly);
740 if (fileDialog.exec())
756 fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
757 fileDialog.setFileMode(QFileDialog::DirectoryOnly);
762 if (fileDialog.exec())
765 QDirIterator pathIter(fileDialog.selectedFile(), QDirIterator::Subdirectories);
766 while (pathIter.hasNext())
768 path = pathIter.next();
769 pathfinfo = pathIter.fileInfo();
771 if (pathfinfo.isDir() && !pathfinfo.isSymLink() && !path.endsWith(
"."))
791 QList<QTableWidgetItem *> selectedPaths =
pathsTableWidget->selectedItems();
793 foreach (QTableWidgetItem * item, selectedPaths)
795 QString path = item->text();
822 QTableWidgetItem *path =
new QTableWidgetItem(pathstr);
823 path->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QLineEdit * Input_Program
void slotAddPathWithSubFolders()
void updateSpiceNameHash(void)
Definition of the TextDoc class.
QTableWidget * pathsTableWidget
tQucsSettings QucsSettings
void slotOctaveDirBrowse()
QPushButton * ColorInteger
QucsSettingsDialog(QucsApp *parent=0, const char *name=0)
Definitions and declarations for the main application.
QPushButton * BGColorButton
QComboBox * LanguageCombo
QPushButton * ColorCharacter
QPushButton * ColorComment
void slotTableClicked(int, int)
bool saveApplSettings(QucsApp *qucs)
void slotColorAttribute()
QPushButton * ColorAttribute
QPushButton * ColorDirective
QPushButton * ColorDataType
QRegExpValidator * Validator
QTableWidget * fileTypesTableWidget
void slotPathTableClicked(int, int)
void slotAdmsXmlDirBrowse()
QCheckBox * checkLoadFromFutureVersions
void slotColorCharacter()
The TextDoc class definition.
void slotColorDirective()
QPushButton * ColorString
void updatePathList(void)
void slotRemoveFileType()
void updateSchNameHash(void)