summaryrefslogtreecommitdiffstats
path: root/src/SettingsPaths.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/SettingsPaths.cpp')
-rwxr-xr-xsrc/SettingsPaths.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/SettingsPaths.cpp b/src/SettingsPaths.cpp
index 27f9fca..f0b5b22 100755
--- a/src/SettingsPaths.cpp
+++ b/src/SettingsPaths.cpp
@@ -20,10 +20,10 @@
#include "SettingsPaths.h"
#include <tqcoreapplication.h>
-#include <tqfile.h>
-#include <tqdir.h>
+#include <tntqfile.h>
+#include <tntqdir.h>
#include <tqdiriterator.h>
-#include <tqstack.h>
+#include <tntqstack.h>
#include <tqtdebug.h>
#include <stdlib.h>
@@ -38,11 +38,11 @@
*/
bool SettingsPaths::_alreadyInitialized = false;
-QString SettingsPaths::_applicationBinaryPath = "";
-QString SettingsPaths::_settingsPath = "";
-QString SettingsPaths::_globalFilesPath = "";
-QString SettingsPaths::_indenterPath = "";
-QString SettingsPaths::_tempPath = "";
+TQString SettingsPaths::_applicationBinaryPath = "";
+TQString SettingsPaths::_settingsPath = "";
+TQString SettingsPaths::_globalFilesPath = "";
+TQString SettingsPaths::_indenterPath = "";
+TQString SettingsPaths::_tempPath = "";
bool SettingsPaths::_portableMode = false;
@@ -59,10 +59,10 @@ bool SettingsPaths::_portableMode = false;
void SettingsPaths::init() {
_alreadyInitialized = true;
- qDebug() << __LINE__ << " " << __FUNCTION__ << ": Initializing application paths.";
+ tqDebug() << __LINE__ << " " << __FUNCTION__ << ": Initializing application paths.";
// Get the applications binary path, with respect to MacOSXs use of the .app folder.
- _applicationBinaryPath = QCoreApplication::applicationDirPath();
+ _applicationBinaryPath = TQCoreApplication::applicationDirPath();
// Remove any trailing slashes
while ( _applicationBinaryPath.right(1) == "/" ) {
_applicationBinaryPath.chop(1);
@@ -86,9 +86,9 @@ void SettingsPaths::init() {
// If the "config" directory is a subdir of the applications binary path, use this one (portable mode)
_settingsPath = _applicationBinaryPath + "/config";
- if ( QFile::exists( _settingsPath ) ) {
+ if ( TQFile::exists( _settingsPath ) ) {
_portableMode = true;
- QDir dirCreator;
+ TQDir dirCreator;
_globalFilesPath = _applicationBinaryPath;
_indenterPath = _applicationBinaryPath + "/indenters";
dirCreator.mkpath( _settingsPath );
@@ -99,11 +99,11 @@ void SettingsPaths::init() {
// ... otherwise use the system specific global application data path.
else {
_portableMode = false;
- QDir dirCreator;
+ TQDir dirCreator;
#ifdef Q_OS_WIN
// Get the local users application settings directory.
// Remove any trailing slashes.
- _settingsPath = QDir::fromNativeSeparators( qgetenv("APPDATA") );
+ _settingsPath = TQDir::fromNativeSeparators( qgetenv("APPDATA") );
while ( _settingsPath.right(1) == "/" ) {
_settingsPath.chop(1);
}
@@ -113,7 +113,7 @@ void SettingsPaths::init() {
_globalFilesPath = _applicationBinaryPath;
#else
// Remove any trailing slashes.
- _settingsPath = QDir::homePath();
+ _settingsPath = TQDir::homePath();
while ( _settingsPath.right(1) == "/" ) {
_settingsPath.chop(1);
}
@@ -123,14 +123,14 @@ void SettingsPaths::init() {
dirCreator.mkpath( _settingsPath );
// If a highlighter config file does not exist in the users home config dir
// copy the default config file over there.
- if ( !QFile::exists(_settingsPath+"/UiGuiSyntaxHighlightConfig.ini") ) {
- QFile::copy( _globalFilesPath+"/config/UiGuiSyntaxHighlightConfig.ini", _settingsPath+"/UiGuiSyntaxHighlightConfig.ini" );
+ if ( !TQFile::exists(_settingsPath+"/UiGuiSyntaxHighlightConfig.ini") ) {
+ TQFile::copy( _globalFilesPath+"/config/UiGuiSyntaxHighlightConfig.ini", _settingsPath+"/UiGuiSyntaxHighlightConfig.ini" );
}
_indenterPath = _globalFilesPath + "/indenters";
- // On different systems it may be that "QDir::tempPath()" ends with a "/" or not. So check this.
+ // On different systems it may be that "TQDir::tempPath()" ends with a "/" or not. So check this.
// Remove any trailing slashes.
- _tempPath = QDir::tempPath();
+ _tempPath = TQDir::tempPath();
while ( _tempPath.right(1) == "/" ) {
_tempPath.chop(1);
}
@@ -144,15 +144,15 @@ void SettingsPaths::init() {
// to an important existing file which gets overwritten when UiGUI writes
// into this normally temporary but linked file.
char *pathTemplate = new char[_tempPath.length()+8];
- QByteArray pathTemplateQBA = QString(_tempPath + "-XXXXXX").toAscii();
+ TQByteArray pathTemplateTQBA = TQString(_tempPath + "-XXXXXX").toAscii();
delete [] pathTemplate;
- pathTemplate = pathTemplateQBA.data();
+ pathTemplate = pathTemplateTQBA.data();
pathTemplate = mkdtemp( pathTemplate );
_tempPath = pathTemplate;
#endif
}
- qDebug() << __LINE__ << " " << __FUNCTION__ << ": Paths are:" \
+ tqDebug() << __LINE__ << " " << __FUNCTION__ << ": Paths are:" \
"<ul><li>_applicationBinaryPath=" << _applicationBinaryPath \
<< "</li><li>_settingsPath=" << _settingsPath \
<< "</li><li>_globalFilesPath=" << _globalFilesPath \
@@ -165,7 +165,7 @@ void SettingsPaths::init() {
/*!
\brief Returns the path of the applications executable.
*/
-const QString SettingsPaths::getApplicationBinaryPath() {
+const TQString SettingsPaths::getApplicationBinaryPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
@@ -176,7 +176,7 @@ const QString SettingsPaths::getApplicationBinaryPath() {
/*!
\brief Returns the path where all settings are being/should be written to.
*/
-const QString SettingsPaths::getSettingsPath() {
+const TQString SettingsPaths::getSettingsPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
@@ -187,7 +187,7 @@ const QString SettingsPaths::getSettingsPath() {
/*!
\brief Returns the path where the files concerning all users reside. For example translations.
*/
-const QString SettingsPaths::getGlobalFilesPath() {
+const TQString SettingsPaths::getGlobalFilesPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
@@ -198,7 +198,7 @@ const QString SettingsPaths::getGlobalFilesPath() {
/*!
\brief Returns the path where the indenter executables reside.
*/
-const QString SettingsPaths::getIndenterPath() {
+const TQString SettingsPaths::getIndenterPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
@@ -209,7 +209,7 @@ const QString SettingsPaths::getIndenterPath() {
/*!
\brief Returns the path where the where all temporary data should be written to.
*/
-const QString SettingsPaths::getTempPath() {
+const TQString SettingsPaths::getTempPath() {
if ( !_alreadyInitialized ) {
SettingsPaths::init();
}
@@ -232,12 +232,12 @@ bool SettingsPaths::getPortableMode() {
\brief Completely deletes the created temporary directory with all of its content.
*/
void SettingsPaths::cleanAndRemoveTempDir() {
- QDirIterator dirIterator(_tempPath, QDirIterator::Subdirectories);
- QStack<QString> directoryStack;
+ TQDirIterator dirIterator(_tempPath, TQDirIterator::Subdirectories);
+ TQStack<TQString> directoryStack;
bool noErrorsOccurred = true;
while ( dirIterator.hasNext() ) {
- QString currentDirOrFile = dirIterator.next();
+ TQString currentDirOrFile = dirIterator.next();
// If this dummy call isn't done here, calling "dirIterator.fileInfo().isDir()" later somehow fails.
dirIterator.fileInfo();
@@ -246,30 +246,30 @@ void SettingsPaths::cleanAndRemoveTempDir() {
// So we changed into another parent directory and the one on the stack can be deleted
// since it must be empty.
if ( !directoryStack.isEmpty() && !currentDirOrFile.startsWith(directoryStack.top()) ) {
- QString dirToBeRemoved = directoryStack.pop();
- bool couldRemoveDir = QDir(dirToBeRemoved).rmdir(dirToBeRemoved);
+ TQString dirToBeRemoved = directoryStack.pop();
+ bool couldRemoveDir = TQDir(dirToBeRemoved).rmdir(dirToBeRemoved);
noErrorsOccurred &= couldRemoveDir;
if ( couldRemoveDir == false )
- qWarning() << __LINE__ << " " << __FUNCTION__ << "Could not remove the directory: " << dirToBeRemoved;
- //qDebug() << "Removing Dir " << directoryStack.pop();
+ tqWarning() << __LINE__ << " " << __FUNCTION__ << "Could not remove the directory: " << dirToBeRemoved;
+ //tqDebug() << "Removing Dir " << directoryStack.pop();
}
// If the iterator currently points to a directory push it onto the stack.
if ( dirIterator.fileInfo().isDir() ) {
directoryStack.push( currentDirOrFile );
- //qDebug() << "Pushing onto Stack " << currentDirOrFile;
+ //tqDebug() << "Pushing onto Stack " << currentDirOrFile;
}
// otherwise it must be a file, so delete it.
else {
- bool couldRemoveFile = QFile::remove( currentDirOrFile );
+ bool couldRemoveFile = TQFile::remove( currentDirOrFile );
noErrorsOccurred &= couldRemoveFile;
if ( couldRemoveFile == false )
- qWarning() << __LINE__ << " " << __FUNCTION__ << "Could not remove the file: " << currentDirOrFile;
- //qDebug() << "Removing File " << currentDirOrFile;
+ tqWarning() << __LINE__ << " " << __FUNCTION__ << "Could not remove the file: " << currentDirOrFile;
+ //tqDebug() << "Removing File " << currentDirOrFile;
}
}
}
- noErrorsOccurred &= QDir(_tempPath).rmdir(_tempPath);
+ noErrorsOccurred &= TQDir(_tempPath).rmdir(_tempPath);
if ( noErrorsOccurred == false )
- qWarning() << __LINE__ << " " << __FUNCTION__ << "While cleaning up the temp dir an error occurred.";
+ tqWarning() << __LINE__ << " " << __FUNCTION__ << "While cleaning up the temp dir an error occurred.";
}