19 #include <qapplication.h>
21 #include <qtextcodec.h>
22 #include <qtranslator.h>
24 #include <qtextstream.h>
25 #include <qmessagebox.h>
41 QFile file(QDir::homeDirPath()+QDir::convertSeparators (
"/.qucs/attenuatorrc"));
42 if(!file.open(IO_ReadOnly))
45 QTextStream stream(&file);
46 QString
Line, Setting;
47 while(!stream.atEnd()) {
48 Line = stream.readLine();
49 Setting = Line.section(
'=',0,0);
50 Line = Line.section(
'=',1,1);
51 if(Setting ==
"AttenuatorWindow") {
60 file.setName(QDir::homeDirPath()+QDir::convertSeparators (
"/.qucs/qucsrc"));
61 if(!file.open(IO_ReadOnly))
64 QTextStream stream(&file);
65 QString
Line, Setting;
66 while(!stream.atEnd()) {
67 Line = stream.readLine();
68 Setting = Line.section(
'=',0,0);
69 Line = Line.section(
'=',1,1).stripWhiteSpace();
72 else if(Setting ==
"Language")
89 QFile file(QDir::homeDirPath()+QDir::convertSeparators (
"/.qucs/attenuatorrc"));
90 if(!file.open(IO_WriteOnly)) {
91 QMessageBox::warning(0, QObject::tr(
"Warning"),
92 QObject::tr(
"Cannot save settings !"));
97 QTextStream stream(&file);
99 stream <<
"Settings file, Qucs Attenuator " PACKAGE_VERSION
"\n"
100 <<
"AttenuatorWindow=" << qucs->x() <<
',' << qucs->y() <<
'\n';
108 int main(
int argc,
char ** argv )
116 char * var = getenv (
"QUCSDIR");
118 QDir QucsDir = QDir (var);
119 QString QucsDirStr = QucsDir.canonicalPath ();
121 QDir::convertSeparators (QucsDirStr +
"/share/qucs/bitmaps/");
123 QDir::convertSeparators (QucsDirStr +
"/share/qucs/lang/");
131 QApplication a( argc, argv );
133 QTranslator tor( 0 );
136 lang = QTextCodec::locale();
138 a.installTranslator( &tor );
141 a.setMainWidget(qucs);
144 int result = a.exec();