mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
2008-08-06 Stefan Jahn <stefan@lkcc.org>
* dialogs/digisettingsdialog.cpp (slotOk): Transfering digital setting into the appropriate textdoc. * textdoc.cpp (saveSettings, loadSettings): Implemented load/save functionality for digital setting (e.g. simulation time).
This commit is contained in:
parent
be6f020795
commit
bbf2efb520
2
NEWS
2
NEWS
@ -26,6 +26,8 @@ files.
|
||||
Version 0.0.15
|
||||
--------------
|
||||
|
||||
* simulation time for digital files (Verilog and VHDL) now stored in
|
||||
additional configuration file
|
||||
* Czech translation of the internal help system
|
||||
* new components: EPFL-EKV NMOS/PMOS V2.6, rectangular waveguide
|
||||
* new libraries added: PMOSFETs, NMOSFETs, Regulators, Varistors and
|
||||
|
@ -1,3 +1,11 @@
|
||||
2008-08-06 Stefan Jahn <stefan@lkcc.org>
|
||||
|
||||
* dialogs/digisettingsdialog.cpp (slotOk): Transfering digital
|
||||
setting into the appropriate textdoc.
|
||||
|
||||
* textdoc.cpp (saveSettings, loadSettings): Implemented load/save
|
||||
functionality for digital setting (e.g. simulation time).
|
||||
|
||||
2008-05-05 Stefan Jahn <stefan@lkcc.org>
|
||||
|
||||
* qucs.cpp (saveAs): Using single directory variable for both Open
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <qbuttongroup.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qvgroupbox.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include "digisettingsdialog.h"
|
||||
#include "textdoc.h"
|
||||
@ -48,7 +50,7 @@ DigiSettingsDialog::DigiSettingsDialog(TextDoc *Doc_)
|
||||
|
||||
QButtonGroup *toggleGroup = new QButtonGroup();
|
||||
simRadio = new QRadioButton(tr("Simulation"), setGroup);
|
||||
simRadio->setChecked(true);
|
||||
simRadio->setChecked(Doc->simulation);
|
||||
|
||||
QHBox *hb1 = new QHBox(setGroup);
|
||||
hb1->setSpacing(5);
|
||||
@ -67,12 +69,14 @@ DigiSettingsDialog::DigiSettingsDialog(TextDoc *Doc_)
|
||||
hb3->setSpacing(5);
|
||||
NameLabel = new QLabel(tr("Library Name:"), hb3);
|
||||
NameEdit = new QLineEdit(hb3);
|
||||
NameEdit->setText(Doc->Library);
|
||||
|
||||
setGroup->addSpace(15);
|
||||
QHBox *hb2 = new QHBox(setGroup);
|
||||
hb2->setSpacing(5);
|
||||
LibLabel = new QLabel(tr("Libraries:"), hb2);
|
||||
LibEdit = new QLineEdit(hb2);
|
||||
LibEdit->setText(Doc->Libraries);
|
||||
|
||||
all->addSpacing(5);
|
||||
all->addStretch();
|
||||
@ -83,6 +87,10 @@ DigiSettingsDialog::DigiSettingsDialog(TextDoc *Doc_)
|
||||
connect(ButtonOk, SIGNAL(clicked()), SLOT(slotOk()));
|
||||
connect(ButtonCancel, SIGNAL(clicked()), SLOT(reject()));
|
||||
|
||||
simRadio->setChecked(Doc->simulation);
|
||||
comRadio->setChecked(!Doc->simulation);
|
||||
slotChangeMode(!Doc->simulation);
|
||||
|
||||
ButtonOk->setDefault(true);
|
||||
setFocusProxy(TimeEdit);
|
||||
TimeEdit->setFocus();
|
||||
@ -107,9 +115,25 @@ void DigiSettingsDialog::slotOk()
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if(Doc->Libraries != LibEdit->text()) {
|
||||
QStringList lst = QStringList::split(' ',LibEdit->text());
|
||||
Doc->Libraries = lst.join(" ");
|
||||
changed = true;
|
||||
}
|
||||
if(Doc->simulation != simRadio->isChecked()) {
|
||||
Doc->simulation = simRadio->isChecked();
|
||||
changed = true;
|
||||
}
|
||||
if(Doc->Libraries != NameEdit->text()) {
|
||||
QString lib = NameEdit->text().stripWhiteSpace();
|
||||
Doc->Library = lib;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if(changed)
|
||||
if(changed) {
|
||||
Doc->SetChanged = true;
|
||||
Doc->slotSetChanged();
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,6 @@ bool saveApplSettings(QucsApp *qucs)
|
||||
return false;
|
||||
}
|
||||
|
||||
QString Line;
|
||||
QTextStream stream(&file);
|
||||
|
||||
stream << "Settings file, Qucs " PACKAGE_VERSION "\n"
|
||||
|
@ -43,6 +43,11 @@ TextDoc::TextDoc(QucsApp *App_, const QString& Name_) : QucsDoc(App_, Name_)
|
||||
setFont(TextFont);
|
||||
setCurrentFont(TextFont);
|
||||
|
||||
simulation = true;
|
||||
Library = "";
|
||||
Libraries = "";
|
||||
SetChanged = false;
|
||||
|
||||
tmpPosX = tmpPosY = 1; // set to 1 to trigger line highlighting
|
||||
Scale = (float)TextFont.pointSize();
|
||||
setUndoDepth(QucsSettings.maxUndo);
|
||||
@ -77,6 +82,58 @@ TextDoc::~TextDoc()
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------
|
||||
bool TextDoc::saveSettings(void)
|
||||
{
|
||||
QFile file(DocName + ".cfg");
|
||||
if(!file.open(IO_WriteOnly))
|
||||
return false;
|
||||
|
||||
QTextStream stream(&file);
|
||||
|
||||
stream << "VHDL settings file, Qucs " PACKAGE_VERSION "\n"
|
||||
<< "Simulation=" << simulation << "\n"
|
||||
<< "Duration=" << SimTime << "\n"
|
||||
<< "Module=" << (!simulation) << "\n"
|
||||
<< "Library=" << Library << "\n"
|
||||
<< "Libraries=" << Libraries << "\n";
|
||||
|
||||
file.close();
|
||||
SetChanged = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------
|
||||
bool TextDoc::loadSettings(void)
|
||||
{
|
||||
QFile file(DocName + ".cfg");
|
||||
if(!file.open(IO_ReadOnly))
|
||||
return false;
|
||||
|
||||
QTextStream stream(&file);
|
||||
QString Line, Setting;
|
||||
|
||||
bool ok;
|
||||
while(!stream.atEnd()) {
|
||||
Line = stream.readLine();
|
||||
Setting = Line.section('=',0,0);
|
||||
Line = Line.section('=',1).stripWhiteSpace();
|
||||
if(Setting == "Simulation") {
|
||||
simulation = Line.toInt(&ok);
|
||||
} else if(Setting == "Duration") {
|
||||
SimTime = Line;
|
||||
} else if(Setting == "Module") {
|
||||
} else if(Setting == "Library") {
|
||||
Library = Line;
|
||||
} else if(Setting == "Libraries") {
|
||||
Libraries = Line;
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------
|
||||
void TextDoc::setName(const QString& Name_)
|
||||
{
|
||||
@ -122,11 +179,9 @@ void TextDoc::slotCursorPosChanged(int x, int y)
|
||||
// ---------------------------------------------------
|
||||
void TextDoc::slotSetChanged()
|
||||
{
|
||||
if(isModified()) {
|
||||
if(!DocChanged) {
|
||||
App->DocumentTab->setTabIconSet(this, QPixmap(smallsave_xpm));
|
||||
DocChanged = true;
|
||||
}
|
||||
if((isModified() && !DocChanged) || SetChanged) {
|
||||
App->DocumentTab->setTabIconSet(this, QPixmap(smallsave_xpm));
|
||||
DocChanged = true;
|
||||
}
|
||||
else if(DocChanged) {
|
||||
App->DocumentTab->setTabIconSet(this, QPixmap(empty_xpm));
|
||||
@ -150,12 +205,16 @@ bool TextDoc::load()
|
||||
slotSetChanged();
|
||||
file.close();
|
||||
lastSaved = QDateTime::currentDateTime();
|
||||
|
||||
loadSettings();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------
|
||||
int TextDoc::save()
|
||||
{
|
||||
saveSettings();
|
||||
|
||||
QFile file(DocName);
|
||||
if(!file.open(IO_WriteOnly))
|
||||
return -1;
|
||||
|
@ -48,6 +48,14 @@ public:
|
||||
void outcommmentSelected();
|
||||
QFont TextFont;
|
||||
|
||||
bool simulation; // simulation or module
|
||||
QString Library; // library this document belongs to
|
||||
QString Libraries; // libraries to be linked with
|
||||
bool SetChanged;
|
||||
|
||||
bool loadSettings(void);
|
||||
bool saveSettings(void);
|
||||
|
||||
public slots:
|
||||
void slotCursorPosChanged(int, int);
|
||||
void slotSetChanged();
|
||||
|
Loading…
x
Reference in New Issue
Block a user