Skip to content

Commit

Permalink
Merge branch 'ra3xdh:current' into use_ghdl_windows
Browse files Browse the repository at this point in the history
  • Loading branch information
iwbnwif authored Feb 10, 2024
2 parents 549a902 + 6e5868e commit 88ff864
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 29 deletions.
62 changes: 41 additions & 21 deletions qucs/dialogs/qucssettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,23 @@ QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent)
connect(AppFontButton, SIGNAL(clicked()), SLOT(slotAppFontDialog()));
appSettingsGrid->addWidget(AppFontButton,1,1);

appSettingsGrid->addWidget(new QLabel(tr("Text document font (set after reload):"), appSettingsTab), 2,0);
TextFontButton = new QPushButton(appSettingsTab);
connect(TextFontButton, SIGNAL(clicked()), SLOT(slotTextFontDialog()));
appSettingsGrid->addWidget(TextFontButton,2,1);

val50 = new QIntValidator(1, 50, this);
appSettingsGrid->addWidget(new QLabel(tr("Large font size:"), appSettingsTab), 2,0);
appSettingsGrid->addWidget(new QLabel(tr("Large font size:"), appSettingsTab), 3,0);
LargeFontSizeEdit = new QLineEdit(appSettingsTab);
LargeFontSizeEdit->setValidator(val50);
appSettingsGrid->addWidget(LargeFontSizeEdit,2,1);
appSettingsGrid->addWidget(LargeFontSizeEdit,3,1);

appSettingsGrid->addWidget(new QLabel(tr("Document Background Color:"), appSettingsTab) ,3,0);
appSettingsGrid->addWidget(new QLabel(tr("Document Background Color:"), appSettingsTab) ,4,0);
BGColorButton = new QPushButton(" ", appSettingsTab);
connect(BGColorButton, SIGNAL(clicked()), SLOT(slotBGColorDialog()));
appSettingsGrid->addWidget(BGColorButton,3,1);
appSettingsGrid->addWidget(BGColorButton,4,1);

appSettingsGrid->addWidget(new QLabel(tr("Language (set after reload):"), appSettingsTab) ,4,0);
appSettingsGrid->addWidget(new QLabel(tr("Language (set after reload):"), appSettingsTab) ,5,0);
LanguageCombo = new QComboBox(appSettingsTab);
LanguageCombo->insertItem(-1, tr("Ukrainian")+" (uk)");
LanguageCombo->insertItem(-1, tr("Turkish")+" (tr)");
Expand All @@ -119,59 +124,59 @@ QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent)
LanguageCombo->insertItem(-1, tr("Arabic")+" (ar)");
LanguageCombo->insertItem(-1, tr("English")+" (en)");
LanguageCombo->insertItem(-1, tr("system language"));
appSettingsGrid->addWidget(LanguageCombo,4,1);
appSettingsGrid->addWidget(LanguageCombo,5,1);

val200 = new QIntValidator(0, 200, this);
appSettingsGrid->addWidget(new QLabel(tr("Maximum undo operations:"), appSettingsTab) ,5,0);
appSettingsGrid->addWidget(new QLabel(tr("Maximum undo operations:"), appSettingsTab) ,6,0);
undoNumEdit = new QLineEdit(appSettingsTab);
undoNumEdit->setValidator(val200);
appSettingsGrid->addWidget(undoNumEdit,5,1);
appSettingsGrid->addWidget(undoNumEdit,6,1);

appSettingsGrid->addWidget(new QLabel(tr("Text editor:"), appSettingsTab) ,6,0);
appSettingsGrid->addWidget(new QLabel(tr("Text editor:"), appSettingsTab) ,7,0);
editorEdit = new QLineEdit(appSettingsTab);
editorEdit->setToolTip(tr("Set to qucs, qucsedit or the path to your favorite text editor."));
appSettingsGrid->addWidget(editorEdit,6,1);
appSettingsGrid->addWidget(editorEdit,7,1);

appSettingsGrid->addWidget(new QLabel(tr("Start wiring when clicking open node:"), appSettingsTab) ,7,0);
appSettingsGrid->addWidget(new QLabel(tr("Start wiring when clicking open node:"), appSettingsTab) ,8,0);
checkWiring = new QCheckBox(appSettingsTab);
appSettingsGrid->addWidget(checkWiring,7,1);
appSettingsGrid->addWidget(checkWiring,8,1);

appSettingsGrid->addWidget(new QLabel(tr("Load documents from future versions:")));
checkLoadFromFutureVersions = new QCheckBox(appSettingsTab);
checkLoadFromFutureVersions->setToolTip(tr("Try to load also documents created with newer versions of Qucs."));
appSettingsGrid->addWidget(checkLoadFromFutureVersions,8,1);
appSettingsGrid->addWidget(checkLoadFromFutureVersions,9,1);
checkLoadFromFutureVersions->setChecked(QucsSettings.IgnoreFutureVersion);

appSettingsGrid->addWidget(new QLabel(tr("Draw diagrams with anti-aliasing feature:")));
checkAntiAliasing = new QCheckBox(appSettingsTab);
checkAntiAliasing->setToolTip(tr("Use anti-aliasing for graphs for a smoother appearance."));
appSettingsGrid->addWidget(checkAntiAliasing,9,1);
appSettingsGrid->addWidget(checkAntiAliasing,10,1);
checkAntiAliasing->setChecked(QucsSettings.GraphAntiAliasing);

appSettingsGrid->addWidget(new QLabel(tr("Draw text with anti-aliasing feature:")));
checkTextAntiAliasing = new QCheckBox(appSettingsTab);
checkTextAntiAliasing->setToolTip(tr("Use anti-aliasing for text for a smoother appearance."));
appSettingsGrid->addWidget(checkTextAntiAliasing,10,1);
appSettingsGrid->addWidget(checkTextAntiAliasing,11,1);
checkTextAntiAliasing->setChecked(QucsSettings.TextAntiAliasing);

appSettingsGrid->addWidget(new QLabel(tr("Show trace name prefix on diagrams:")));
checkFullTraceNames = new QCheckBox(appSettingsTab);
checkFullTraceNames->setToolTip(tr("Show prefixes for trace names on diagrams like \"ngspice/\""));
appSettingsGrid->addWidget(checkFullTraceNames,11,1);
appSettingsGrid->addWidget(checkFullTraceNames,12,1);
checkFullTraceNames->setChecked(QucsSettings.fullTraceName);

QStringList lst_icons;
lst_icons<<"Automatic"<<"Light"<<"Dark";
PanelIconsCombo = new QComboBox;
PanelIconsCombo->addItems(lst_icons);
PanelIconsCombo->setCurrentIndex(QucsSettings.panelIconsTheme);
appSettingsGrid->addWidget(new QLabel(tr("Panel icons theme (set after reload):"),appSettingsTab),12,0);
appSettingsGrid->addWidget(PanelIconsCombo,12,1);
appSettingsGrid->addWidget(new QLabel(tr("Panel icons theme (set after reload):"),appSettingsTab),13,0);
appSettingsGrid->addWidget(PanelIconsCombo,13,1);
CompIconsCombo = new QComboBox;
CompIconsCombo->addItems(lst_icons);
CompIconsCombo->setCurrentIndex(QucsSettings.compIconsTheme);
appSettingsGrid->addWidget(new QLabel(tr("Components icons theme (set after reload):"),appSettingsTab),13,0);
appSettingsGrid->addWidget(CompIconsCombo,13,1);
appSettingsGrid->addWidget(new QLabel(tr("Components icons theme (set after reload):"),appSettingsTab),14,0);
appSettingsGrid->addWidget(CompIconsCombo,14,1);

t->addTab(appSettingsTab, tr("Settings"));

Expand Down Expand Up @@ -438,8 +443,10 @@ QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent)
// fill the fields with the Qucs-Properties
Font = QucsSettings.font;
AppFont = QucsSettings.appFont;
TextFont = QucsSettings.textFont;
FontButton->setText(Font.toString());
AppFontButton->setText(AppFont.toString());
TextFontButton->setText(TextFont.toString());
QString s = QString::number(QucsSettings.largeFontSize, 'f', 1);
LargeFontSizeEdit->setText(s);

Expand Down Expand Up @@ -576,6 +583,7 @@ void QucsSettingsDialog::slotApply()

QucsSettings.font=Font;
QucsSettings.appFont = AppFont;
QucsSettings.textFont = TextFont;

QucsSettings.panelIconsTheme = PanelIconsCombo->currentIndex();
QucsSettings.compIconsTheme = CompIconsCombo->currentIndex();
Expand Down Expand Up @@ -740,6 +748,17 @@ void QucsSettingsDialog::slotAppFontDialog()
}
}

void QucsSettingsDialog::slotTextFontDialog()
{
bool ok;
QFont tmpFont = QFontDialog::getFont(&ok, TextFont, this);
if(ok)
{
TextFont = tmpFont;
TextFontButton->setText(TextFont.toString());
}
}

// -----------------------------------------------------------
void QucsSettingsDialog::slotBGColorDialog()
{
Expand All @@ -759,9 +778,10 @@ void QucsSettingsDialog::slotDefaultValues()
QPalette p;
Font = QApplication::font();
AppFont = QucsSettings.sysDefaultFont;
Font.setPointSize(12);
TextFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
FontButton->setText(Font.toString());
AppFontButton->setText(AppFont.toString());
TextFontButton->setText(TextFont.toString());
LargeFontSizeEdit->setText(QString::number(16.0));

LanguageCombo->setCurrentIndex(0);
Expand Down
4 changes: 3 additions & 1 deletion qucs/dialogs/qucssettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private slots:
void slotApply();
void slotFontDialog();
void slotAppFontDialog();
void slotTextFontDialog();
void slotBGColorDialog();
void slotDefaultValues();
void slotAddFileType();
Expand Down Expand Up @@ -81,12 +82,13 @@ private slots:

QFont Font;
QFont AppFont;
QFont TextFont;
QCheckBox *checkWiring, *checkLoadFromFutureVersions,
*checkAntiAliasing, *checkTextAntiAliasing,
*checkFullTraceNames;
QComboBox *LanguageCombo;
QComboBox *PanelIconsCombo, *CompIconsCombo;
QPushButton *FontButton, *AppFontButton, *BGColorButton;
QPushButton *FontButton, *AppFontButton, *TextFontButton, *BGColorButton;
QLineEdit *LargeFontSizeEdit, *undoNumEdit, *editorEdit, *Input_Suffix,
*Input_Program, *homeEdit, *admsXmlEdit, *ascoEdit, *octaveEdit,
*OpenVAFEdit;
Expand Down
6 changes: 6 additions & 0 deletions qucs/extsimkernels/s2spice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ bool S2Spice::convertTouchstone(QTextStream *stream)

QString next_line;
while(in_stream.readLineInto(&next_line)) {
if (next_line.isEmpty()) continue;
if (next_line.at(0) == '#') break;
}

Expand Down Expand Up @@ -130,6 +131,11 @@ bool S2Spice::convertTouchstone(QTextStream *stream)
while(in_stream.readLineInto(&next_line)) {
if(next_line.isEmpty()) continue;
if(next_line.at(0)=='#') continue;
if(next_line.startsWith("!noise parameters")) {
err_text = "Noise simulation in S2P files is not supported!\n"
"Noise data ignored";
break;
}
if(next_line.at(0)=='!') continue;
tmp_lst = next_line.split(QRegularExpression("[ \\t]"), qucs::SkipEmptyParts);
if (tmp_lst.count() < 2*(ports*ports)+1) {
Expand Down
3 changes: 3 additions & 0 deletions qucs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ bool loadSettings()
if(settings.contains("dy"))QucsSettings.dy=settings.value("dy").toInt();
if(settings.contains("font"))QucsSettings.font.fromString(settings.value("font").toString());
if(settings.contains("appFont"))QucsSettings.appFont.fromString(settings.value("appFont").toString());
if(settings.contains("textFont"))QucsSettings.textFont.fromString(settings.value("textFont").toString());
if(settings.contains("LargeFontSize"))QucsSettings.largeFontSize=settings.value("LargeFontSize").toDouble(); // use toDouble() as it can interpret the string according to the current locale
if(settings.contains("maxUndo"))QucsSettings.maxUndo=settings.value("maxUndo").toInt();
if(settings.contains("NodeWiring"))QucsSettings.NodeWiring=settings.value("NodeWiring").toInt();
Expand Down Expand Up @@ -232,6 +233,7 @@ bool saveApplSettings()
settings.setValue("dy", QucsSettings.dy);
settings.setValue("font", QucsSettings.font.toString());
settings.setValue("appFont", QucsSettings.appFont.toString());
settings.setValue("textFont", QucsSettings.textFont.toString());
// store LargeFontSize as a string, so it will be also human-readable in the settings file (will be a @Variant() otherwise)
settings.setValue("LargeFontSize", QString::number(QucsSettings.largeFontSize));
settings.setValue("maxUndo", QucsSettings.maxUndo);
Expand Down Expand Up @@ -833,6 +835,7 @@ int main(int argc, char *argv[])
//QDesktopWidget *d = a.desktop();
QucsSettings.font = QApplication::font();
QucsSettings.appFont = QApplication::font();
QucsSettings.textFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
QucsSettings.font.setPointSize(12);
QSize size = QGuiApplication::primaryScreen()->size();
int w = size.width();
Expand Down
1 change: 1 addition & 0 deletions qucs/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct tQucsSettings {
int x, y, dx, dy; // position and size of main window
QFont font;
QFont appFont;
QFont textFont;
QFont sysDefaultFont;
float largeFontSize;
QColor BGColor; // background color of view area
Expand Down
9 changes: 6 additions & 3 deletions qucs/schematic_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1464,10 +1464,13 @@ bool Schematic::throughAllComps(QTextStream *stream, int& countInit,
S2Spice *conv = new S2Spice();
conv->setFile(f);
conv->setDeviceName(sub_name);
if (!conv->convertTouchstone(stream)) {
QMessageBox::warning(this,tr("Netlist error"),
conv->getErrText());
bool r = conv->convertTouchstone(stream);
QString msg = conv->getErrText();
if (!r) {
QMessageBox::warning(this,tr("Netlist error"), msg);
return false;
} else if (!msg.isEmpty()) {
QMessageBox::warning(this,tr("S2Spice warning"), msg);
}
delete conv;
}
Expand Down
5 changes: 1 addition & 4 deletions qucs/textdoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ Copyright (C) 2014 by Guilherme Brondani Torri <[email protected]>
*/
TextDoc::TextDoc(QucsApp *App_, const QString& Name_) : QPlainTextEdit(), QucsDoc(App_, Name_)
{
QFont font("Courier New", QucsSettings.font.pointSize());
font.setStyleHint(QFont::Courier);
font.setFixedPitch(true);
setFont(font);
setFont(QucsSettings.textFont);

simulation = true;
Library = "";
Expand Down

0 comments on commit 88ff864

Please sign in to comment.