24 #include <qapplication.h>
26 #include <qtextcodec.h>
27 #include <qtranslator.h>
29 #include <qtextstream.h>
30 #include <qmessagebox.h>
33 #include <qtextcodec.h>
46 QFile file(QDir::homeDirPath()+QDir::convertSeparators (
"/.qucs/helprc"));
47 if(!file.open(IO_ReadOnly))
50 QTextStream stream(&file);
51 QString
Line, Setting;
52 while(!stream.atEnd()) {
53 Line = stream.readLine();
54 Setting = Line.section(
'=',0,0);
55 Line = Line.section(
'=',1,1);
56 if(Setting ==
"HelpWindow") {
57 QucsSettings.
x = Line.section(
",",0,0).toInt();
58 QucsSettings.
y = Line.section(
",",1,1).toInt();
59 QucsSettings.
dx = Line.section(
",",2,2).toInt();
60 QucsSettings.
dy = Line.section(
",",3,3).toInt();
66 file.setName(QDir::homeDirPath()+QDir::convertSeparators (
"/.qucs/qucsrc"));
67 if(!file.open(IO_ReadOnly))
70 QTextStream stream(&file);
71 QString
Line, Setting;
72 while(!stream.atEnd()) {
73 Line = stream.readLine();
74 Setting = Line.section(
'=',0,0);
75 Line = Line.section(
'=',1,1).stripWhiteSpace();
77 QucsSettings.
font.fromString(Line);
78 else if(Setting ==
"Language")
90 if(qucs->x() == QucsSettings.
x)
91 if(qucs->y() == QucsSettings.
y)
92 if(qucs->width() == QucsSettings.
dx)
93 if(qucs->height() == QucsSettings.
dy)
97 QFile file(QDir::homeDirPath()+QDir::convertSeparators (
"/.qucs/helprc"));
98 if(!file.open(IO_WriteOnly)) {
99 QMessageBox::warning(0, QObject::tr(
"Warning"),
100 QObject::tr(
"Cannot save settings !"));
105 QTextStream stream(&file);
107 stream <<
"Settings file, Qucs Help System " PACKAGE_VERSION
"\n"
108 <<
"HelpWindow=" << qucs->x() <<
',' << qucs->y() <<
','
109 << qucs->width() <<
',' << qucs->height() <<
'\n';
122 int main(
int argc,
char *argv[])
127 QucsSettings.
dx = 640;
128 QucsSettings.
dy = 400;
129 QucsSettings.
font = QFont(
"Helvetica", 12);
132 char * var = getenv (
"QUCSDIR");
134 QDir QucsDir = QDir (var);
135 QString QucsDirStr = QucsDir.canonicalPath ();
137 QDir::convertSeparators (QucsDirStr +
"/share/qucs/docs/");
139 QDir::convertSeparators (QucsDirStr +
"/share/qucs/bitmaps/");
141 QDir::convertSeparators (QucsDirStr +
"/share/qucs/lang/");
143 QucsSettings.
DocDir = DOCDIR;
145 QucsSettings.
LangDir = LANGUAGEDIR;
150 QApplication a(argc, argv);
151 a.setFont(QucsSettings.
font);
153 QTranslator tor( 0 );
154 QString locale = QucsSettings.
Language;
156 locale = QTextCodec::locale();
157 tor.load( QString(
"qucs_") + locale, QucsSettings.
LangDir);
158 a.installTranslator( &tor );
162 int p = locale.find (
'_');
173 if(argc > 1) Page = argv[1];
176 a.setMainWidget(qucs);
177 qucs->resize(QucsSettings.
dx, QucsSettings.
dy);
178 qucs->move(QucsSettings.
x, QucsSettings.
y);
180 int result = a.exec();