diff options
Diffstat (limited to 'bibletime/frontend/cprofile.cpp')
-rw-r--r-- | bibletime/frontend/cprofile.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/bibletime/frontend/cprofile.cpp b/bibletime/frontend/cprofile.cpp index 309329e..7c26278 100644 --- a/bibletime/frontend/cprofile.cpp +++ b/bibletime/frontend/cprofile.cpp @@ -12,11 +12,11 @@ #include "cprofile.h" //Qt includes -#include <qdom.h> -#include <qfile.h> -#include <qstring.h> -#include <qtextstream.h> -#include <qregexp.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqstring.h> +#include <tqtextstream.h> +#include <tqregexp.h> //KDE includes #include <kstandarddirs.h> @@ -26,7 +26,7 @@ namespace Profile { -CProfile::CProfile( const QString& file, const QString& name ): +CProfile::CProfile( const TQString& file, const TQString& name ): m_name(name.isEmpty() ? i18n("unknown") : name), m_filename(file), m_fullscreen(false), @@ -38,7 +38,7 @@ m_geometry(10,20,640,480) { } else if (m_filename.isEmpty() && !name.isEmpty()) { m_filename = name; - m_filename.replace(QRegExp("\\s=#."),"_"); + m_filename.replace(TQRegExp("\\s=#."),"_"); KStandardDirs stdDirs; m_filename = stdDirs.saveLocation("data", "bibletime/sessions/") + m_filename + ".xml"; init(m_filename); @@ -53,20 +53,20 @@ CProfile::~CProfile() { } /** Loads the profile from the file given in the constructor. */ -QPtrList<CProfileWindow> CProfile::load() { - QFile file(m_filename); +TQPtrList<CProfileWindow> CProfile::load() { + TQFile file(m_filename); if (!file.exists()) - return QPtrList<CProfileWindow>(); + return TQPtrList<CProfileWindow>(); - QDomDocument doc; + TQDomDocument doc; if (file.open(IO_ReadOnly)) { - QTextStream t( &file ); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t( &file ); + t.setEncoding(TQTextStream::UnicodeUTF8); doc.setContent(t.read()); file.close(); } - QDomElement document = doc.documentElement(); + TQDomElement document = doc.documentElement(); if( document.tagName() != "BibleTimeProfile" && document.tagName() != "BibleTime" ) { //BibleTime was used in syntax version 1.0 qWarning("CProfile::load: Missing BibleTime doc"); return m_profileWindows; @@ -79,8 +79,8 @@ QPtrList<CProfileWindow> CProfile::load() { //load settings of the main window { // see if there's a section with the name MAINWINDOW - QDomElement elem = document.firstChild().toElement(); - QDomElement mainWindow; + TQDomElement elem = document.firstChild().toElement(); + TQDomElement mainWindow; while (!elem.isNull()) { if (elem.tagName() == "MAINWINDOW") { mainWindow = elem; @@ -90,8 +90,8 @@ QPtrList<CProfileWindow> CProfile::load() { } if (!mainWindow.isNull()) { //was found setFullscreen( (bool)mainWindow.attribute("fullscreen").toInt()); - QDomElement object = mainWindow.namedItem("GEOMETRY").toElement(); - QRect rect; + TQDomElement object = mainWindow.namedItem("GEOMETRY").toElement(); + TQRect rect; if(!object.isNull()) { if (object.hasAttribute("x")) { rect.setX(object.attribute("x").toInt()); @@ -115,7 +115,7 @@ QPtrList<CProfileWindow> CProfile::load() { } m_profileWindows.clear(); - QDomElement elem = document.firstChild().toElement(); + TQDomElement elem = document.firstChild().toElement(); while (!elem.isNull()) { CProfileWindow* p = 0; if (elem.tagName() == "BIBLE") { @@ -144,9 +144,9 @@ QPtrList<CProfileWindow> CProfile::load() { p->setFocus( static_cast<bool>(elem.attribute("hasFocus").toInt()) ); } - QRect rect; + TQRect rect; - QDomElement object = elem.namedItem("GEOMETRY").toElement(); + TQDomElement object = elem.namedItem("GEOMETRY").toElement(); if(!object.isNull()) { if (object.hasAttribute("x")) { rect.setX(object.attribute("x").toInt()); @@ -169,8 +169,8 @@ QPtrList<CProfileWindow> CProfile::load() { object = elem.namedItem("MODULES").toElement(); if(!object.isNull()) { if (object.hasAttribute("list")) { - const QString sep = object.hasAttribute("separator") ? object.attribute("separator") : "|"; - QStringList modules = QStringList::split(sep, object.attribute("list")); + const TQString sep = object.hasAttribute("separator") ? object.attribute("separator") : "|"; + TQStringList modules = TQStringList::split(sep, object.attribute("list")); p->setModules(modules); } } @@ -198,27 +198,27 @@ QPtrList<CProfileWindow> CProfile::load() { } /** Saves the profile to the file given in the constructor. */ -const bool CProfile::save(QPtrList<CProfileWindow> windows) { +const bool CProfile::save(TQPtrList<CProfileWindow> windows) { /** Save the settings using a XML file * Save the CProfileWindow objects using a XML file which name is in m_filename */ bool ret = false; - QDomDocument doc("DOC"); + TQDomDocument doc("DOC"); doc.appendChild( doc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) ); - QDomElement content = doc.createElement("BibleTimeProfile"); + TQDomElement content = doc.createElement("BibleTimeProfile"); content.setAttribute("syntaxVersion", CURRENT_SYNTAX_VERSION); content.setAttribute("name", m_name); doc.appendChild(content); //save mainwindow settings { - QDomElement mainWindow = doc.createElement("MAINWINDOW"); + TQDomElement mainWindow = doc.createElement("MAINWINDOW"); mainWindow.setAttribute("fullscreen", fullscreen()); - QDomElement geometry = doc.createElement("GEOMETRY"); + TQDomElement geometry = doc.createElement("GEOMETRY"); mainWindow.appendChild(geometry); - const QRect r = this->geometry(); + const TQRect r = this->geometry(); geometry.setAttribute("x",r.x()); geometry.setAttribute("y",r.y()); geometry.setAttribute("width",r.width()); @@ -229,7 +229,7 @@ const bool CProfile::save(QPtrList<CProfileWindow> windows) { } for (CProfileWindow* p = windows.first(); p; p = windows.next()) { - QDomElement window; + TQDomElement window; switch (p->type()) { case CSwordModuleInfo::Bible: window = doc.createElement("BIBLE"); @@ -253,8 +253,8 @@ const bool CProfile::save(QPtrList<CProfileWindow> windows) { window.setAttribute("hasFocus", p->hasFocus()); //save geomtery - const QRect r = p->geometry(); - QDomElement geometry = doc.createElement("GEOMETRY"); + const TQRect r = p->geometry(); + TQDomElement geometry = doc.createElement("GEOMETRY"); geometry.setAttribute("x",r.x()); geometry.setAttribute("y",r.y()); geometry.setAttribute("width",r.width()); @@ -262,16 +262,16 @@ const bool CProfile::save(QPtrList<CProfileWindow> windows) { geometry.setAttribute("isMaximized",static_cast<int>(p->maximized())); window.appendChild( geometry ); - QDomElement modules = doc.createElement("MODULES"); + TQDomElement modules = doc.createElement("MODULES"); modules.setAttribute("separator", "|"); modules.setAttribute("list", p->modules().join("|")); window.appendChild( modules ); - QDomElement key = doc.createElement("KEY"); + TQDomElement key = doc.createElement("KEY"); key.setAttribute("name", p->key()); window.appendChild( key ); - QDomElement scrollbars = doc.createElement("SCROLLBARS"); + TQDomElement scrollbars = doc.createElement("SCROLLBARS"); scrollbars.setAttribute("horizontal", p->scrollbarPositions().horizontal); scrollbars.setAttribute("vertical", p->scrollbarPositions().vertical); window.appendChild( scrollbars ); @@ -279,11 +279,11 @@ const bool CProfile::save(QPtrList<CProfileWindow> windows) { content.appendChild( window ); } - QFile file(m_filename); + TQFile file(m_filename); if ( file.open(IO_WriteOnly) ) { ret = true; - QTextStream t( &file ); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t( &file ); + t.setEncoding(TQTextStream::UnicodeUTF8); t << doc.toString(); file.close(); } @@ -299,66 +299,66 @@ const bool CProfile::save() { } /** Returns the filename used for this profile. */ -const QString& CProfile::filename() { +const TQString& CProfile::filename() { return m_filename; } /** Returns the name of this profile. */ -const QString& CProfile::name() { +const TQString& CProfile::name() { return m_name; } /** Initializes the XML for the first time (use to create a new profile) */ -void CProfile::init(const QString file) { - const QString oldFile = m_filename; +void CProfile::init(const TQString file) { + const TQString oldFile = m_filename; m_filename = file; - save(QPtrList<CProfileWindow>()); + save(TQPtrList<CProfileWindow>()); m_filename = oldFile; } /** Changes the name of this profile. */ -void CProfile::setName( const QString& newName ) { +void CProfile::setName( const TQString& newName ) { m_name = newName; saveBasics(); //save chanegd name } /** Loads the basic settings requires for proper operation. */ void CProfile::loadBasics() { - QFile file(m_filename); + TQFile file(m_filename); if (!file.exists()) return; - QDomDocument doc; + TQDomDocument doc; if (file.open(IO_ReadOnly)) { - QTextStream t( &file ); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t( &file ); + t.setEncoding(TQTextStream::UnicodeUTF8); doc.setContent(t.read()); file.close(); } - QDomElement document = doc.documentElement(); + TQDomElement document = doc.documentElement(); if (document.hasAttribute("name")) m_name = document.attribute("name"); } void CProfile::saveBasics() { - QFile file(m_filename); + TQFile file(m_filename); if (!file.exists()) return; - QDomDocument doc; + TQDomDocument doc; if (file.open(IO_ReadOnly)) { - QTextStream t(&file); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t(&file); + t.setEncoding(TQTextStream::UnicodeUTF8); doc.setContent(t.read()); file.close(); } - QDomElement document = doc.documentElement(); + TQDomElement document = doc.documentElement(); document.setAttribute("name", m_name); if (file.open(IO_WriteOnly)) { - QTextStream t( &file ); - t.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream t( &file ); + t.setEncoding(TQTextStream::UnicodeUTF8); t << doc.toString(); file.close(); } @@ -385,12 +385,12 @@ void CProfile::setMaximized( const bool maximized ) { } /** Returns the geometry of the main window */ -const QRect CProfile::geometry() { +const TQRect CProfile::geometry() { return m_geometry; } /** Stes the geoemtry of the main window */ -void CProfile::setGeometry( const QRect rect ) { +void CProfile::setGeometry( const TQRect rect ) { m_geometry = rect; } |