From d5d64f7617836096a4e9de81997ada7b6f220b47 Mon Sep 17 00:00:00 2001 From: cniehaus Date: Mon, 16 Sep 2002 10:45:04 +0000 Subject: yes, there is still a lot missing and it won't work for anyone due to a hardcoded path but at least in theorie (if you copy kmolweights to the correct position) it will work now. more to come this evening or so. --- (limited to 'noncore') diff --git a/noncore/apps/oxygen/calcdlg.ui b/noncore/apps/oxygen/calcdlg.ui index e0b19f9..5b0c53e 100644 --- a/noncore/apps/oxygen/calcdlg.ui +++ b/noncore/apps/oxygen/calcdlg.ui @@ -11,8 +11,8 @@ 0 0 - 218 - 274 + 275 + 357 @@ -34,10 +34,10 @@ geometry - 10 + 0 0 - 200 - 260 + 270 + 350 @@ -65,10 +65,10 @@ geometry - 2 - 2 - 180 - 220 + 0 + 0 + 260 + 320 @@ -80,26 +80,6 @@ Raised - QLabel - - name - TextLabel1_4 - - - geometry - - 1 - 1 - 298 - 16 - - - - text - Formula: - - - QLayoutWidget name @@ -109,12 +89,12 @@ geometry 0 - 50 - 175 - 30 + 0 + 260 + 320 - + margin 0 @@ -124,96 +104,103 @@ 6 - QPushButton + QLabel name - calculate + TextLabel1_4 text - Calculate + Formula: + + + + QLineEdit + + name + formula + + + + QLayoutWidget + + name + Layout7 + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + calculate + + + text + Calculate + + + + QPushButton + + name + clear_fields + + + text + Clear + + + - QPushButton + QLabel name - clear_fields + TextLabel2_4 text - Clear + Result: - - - - QLineEdit - - name - formula - - - geometry - - 0 - 20 - 170 - 22 - - - - - QMultiLineEdit - - name - anal_display - - - geometry - - 0 - 130 - 170 - 80 - - - - - QLineEdit - - name - result - - - geometry - - 0 - 100 - 170 - 22 - - - - - QLabel - - name - TextLabel2_4 - - - geometry - - 1 - 86 - 298 - 16 - - - - text - Result: - + + QLineEdit + + name + result + + + + QLabel + + name + TextLabel1 + + + text + Elemental composition (%): + + + + QMultiLineEdit + + name + anal_display + + + readOnly + true + + + diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp index e9b40d3..e40e2c7 100644 --- a/noncore/apps/oxygen/calcdlgui.cpp +++ b/noncore/apps/oxygen/calcdlgui.cpp @@ -16,9 +16,11 @@ calcDlgUI::calcDlgUI() : CalcDlg() { + this->showMaximized(); kmolcalc = new KMolCalc; connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); + result->setReadOnly( true ); } void calcDlgUI::calc() diff --git a/noncore/apps/oxygen/kmolcalc.cpp b/noncore/apps/oxygen/kmolcalc.cpp index 7257c4a..0ba52da 100644 --- a/noncore/apps/oxygen/kmolcalc.cpp +++ b/noncore/apps/oxygen/kmolcalc.cpp @@ -1,7 +1,7 @@ /* * kmolcalc.cpp * - * Copyright (C) 2000 Tomislav Gountchev + * Copyright (C) 2000,2001 Tomislav Gountchev * Copyright (C) 2002 Carsten Niehaus */ @@ -36,28 +36,9 @@ void KMolCalc::readElstable() { if (elstable) delete elstable; elstable = new QDict (197, TRUE); elstable->setAutoDelete(TRUE); - QStringList files = "/home/opie/opie/noncore/apps/oxigen/kmolweights"; - mwfile = "/home/opie/opie/noncore/apps/oxigen/kmolweights"; + mwfile = "/home/opie/opie/noncore/apps/oxygen/kmolweights"; QFile f(mwfile); - QString* latest_f = &mwfile; - for (uint i=0; i QFileInfo(QFile(*latest_f)).lastModified()) { - latest_f = &files[i]; - } - } - QFile lf(*latest_f); if (f.exists()) readMwfile(f); - if (!f.exists()) { - readMwfile(lf); - writeElstable(); - } else if (QFileInfo(f).lastModified() < QFileInfo(lf).lastModified()) { - // announce - QMessageBox::information - (0, "Warning:", "Found new global Mw file.\nLocal definitions will be updated.", QMessageBox::Ok); - readMwfile(lf); - writeElstable(); - } - } @@ -188,23 +169,6 @@ void KMolCalc::readMwfile(QFile& f) { } /** - * Save the element definitions file. - */ -void KMolCalc::writeElstable() { - QFile f(mwfile); - if (! f.open(IO_WriteOnly)) return; //ERROR - QTextStream fs (&f); - QString line; - QDictIterator it(*elstable); - while (it.current()) { - it.current()->writeOut(line); - fs << line << endl; - ++it; - } - f.close(); -} - -/** * Remove a group or element definition from ELSTABLE. */ void KMolCalc::undefineGroup (const QString& name) { diff --git a/noncore/apps/oxygen/kmolcalc.h b/noncore/apps/oxygen/kmolcalc.h index c3e02f3..c589133 100644 --- a/noncore/apps/oxygen/kmolcalc.h +++ b/noncore/apps/oxygen/kmolcalc.h @@ -78,11 +78,6 @@ public: void undefineGroup(const QString& name); /** - * Save the element definitions file. - */ - void writeElstable(); - - /** * Read the element definitions file and construct ELSTABLE. */ void readElstable(); -- cgit v0.9.0.2