diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/cresmgr.cpp | 13 | ||||
-rw-r--r-- | src/util/cresmgr.h | 13 | ||||
-rw-r--r-- | src/util/directory.cpp | 23 | ||||
-rw-r--r-- | src/util/directory.h | 4 | ||||
-rw-r--r-- | src/util/tool.h | 96 |
5 files changed, 87 insertions, 62 deletions
diff --git a/src/util/cresmgr.cpp b/src/util/cresmgr.cpp index 80d9d2c..56fe5b1 100644 --- a/src/util/cresmgr.cpp +++ b/src/util/cresmgr.cpp @@ -136,6 +136,11 @@ const QString icon = "tile_vert.svg"; const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_G); const char* actionName = "windowAutoTileVertical_action"; } +namespace autoTile { +const QString icon = "tile_auto.svg"; +const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_I); +const char* actionName = "windowAutoTile_action"; +} namespace autoCascade { const QString icon = "cascade_auto.svg"; const QKeySequence accel(Qt::CTRL + Qt::ALT + Qt::Key_J); @@ -152,6 +157,11 @@ const QString icon = "tile_vert.svg"; const QKeySequence accel(Qt::CTRL + Qt::Key_G); const char* actionName = "windowTileVertical_action"; } +namespace tile { +const QString icon = "tile.svg"; +const QKeySequence accel(Qt::CTRL + Qt::Key_I); +const char* actionName = "windowTile_action"; +} namespace cascade { const QString icon = "cascade.svg"; const QKeySequence accel(Qt::CTRL + Qt::Key_J); @@ -236,6 +246,9 @@ const QString icon = "displayconfig.svg"; } namespace general { +const QString removemoduleicon = "fileclose"; +const QString addmoduleicon = "plus"; +const QString replacemoduleicon = "checkbox"; namespace search { const QString icon = "find.svg"; const QKeySequence accel(Qt::CTRL + Qt::Key_N); diff --git a/src/util/cresmgr.h b/src/util/cresmgr.h index 6f001b9..0d239f0 100644 --- a/src/util/cresmgr.h +++ b/src/util/cresmgr.h @@ -140,6 +140,11 @@ extern const QString icon; extern const QKeySequence accel; extern const char* actionName; } +namespace autoTile { +extern const QString icon; +extern const QKeySequence accel; +extern const char* actionName; +} namespace autoCascade { extern const QString icon; extern const QKeySequence accel; @@ -156,6 +161,11 @@ extern const QString icon; extern const QKeySequence accel; extern const char* actionName; } +namespace tile { +extern const QString icon; +extern const QKeySequence accel; +extern const char* actionName; +} namespace cascade { extern const QString icon; extern const QKeySequence accel; @@ -246,6 +256,9 @@ extern const QString icon; } namespace general { +extern const QString removemoduleicon; +extern const QString addmoduleicon; +extern const QString replacemoduleicon; namespace search { extern const QString icon; extern const QKeySequence accel; diff --git a/src/util/directory.cpp b/src/util/directory.cpp index c307066..809b435 100644 --- a/src/util/directory.cpp +++ b/src/util/directory.cpp @@ -48,7 +48,7 @@ QDir cachedSharedSwordDir; static const char* BIBLETIME = "Bibletime"; static const char* SWORD_DIR = "Sword"; #else -static const char* BIBLETIME =".bibletime"; +static const char* BIBLETIME = ".bibletime"; static const char* SWORD_DIR = ".sword"; #endif } // anonymous namespace @@ -70,16 +70,16 @@ bool initDirectoryCache() { return false; } - cachedSharedSwordDir = QDir(getenv("ALLUSERSPROFILE")); // sword dir for Windows only + cachedSharedSwordDir = QDir(getenv("ALLUSERSPROFILE")); // sword dir for Windows only if (!cachedSharedSwordDir.cd("Application Data")) { qWarning() << "Cannot find ALLUSERSPROFILE\\Application Data"; return false; - } + } if (!cachedSharedSwordDir.cd(SWORD_DIR)) { if (!cachedSharedSwordDir.mkdir(SWORD_DIR) || !cachedSharedSwordDir.cd(SWORD_DIR)) { - qWarning() << "Cannot find ALLUSERSPROFILE\\Application Data\\Sword"; - return false; - } + qWarning() << "Cannot find ALLUSERSPROFILE\\Application Data\\Sword"; + return false; + } } #endif @@ -277,15 +277,14 @@ void copyRecursive(const QString &src, const QString &dest) { } } -QString convertDirSeparators(const QString& path) -{ - QString result = path; +QString convertDirSeparators(const QString& path) { + QString result = path; #ifdef Q_WS_WIN - result.replace("/", "\\"); + result.replace("/", "\\"); #else - result.replace("\\", "/"); + result.replace("\\", "/"); #endif - return result; + return result; } #ifdef Q_WS_WIN diff --git a/src/util/directory.h b/src/util/directory.h index 9666c14..1b460d0 100644 --- a/src/util/directory.h +++ b/src/util/directory.h @@ -55,14 +55,14 @@ unsigned long getDirSizeRecursive(const QString &dir); */ void copyRecursive(const QString &src, const QString &dest); -/** Convert directory path separators to those for each platform +/** Convert directory path separators to those for each platform * Windows = "\", Others = "/" */ QString convertDirSeparators(const QString& path); #ifdef Q_WS_WIN // Windows only directories -/** Return the path to the sword dir., Windows only +/** Return the path to the sword dir., Windows only C:\Program Files\BibleTime\share\sword */ QDir getApplicationSwordDir(); diff --git a/src/util/tool.h b/src/util/tool.h index 838616a..9dc753f 100644 --- a/src/util/tool.h +++ b/src/util/tool.h @@ -22,58 +22,58 @@ class QWidget; namespace util { namespace tool { - /** - * Converts HTML text to plain text. - * This function converts some HTML tags in text (e.g. <br/> to \n) - * @return The text withput HTML tags and with converted <br/> to \n - */ - QString htmlToText(const QString&); - /** - * Converts text to HTML converting some text commands into HTML tags (e.g. \n to <br/>) - * @return The HTML formatted text we got after changing \n to <br/> - */ - QString textToHTML(const QString&); - /** - * Creates the file filename and put the text of parameter "text" into the file. - * @return True if saving was sucessful, otherwise false - */ - bool savePlainFile( const QString& filename, const QString& text, const bool& forceOverwrite = false, QTextCodec* fileCodec = QTextCodec::codecForLocale()); - /** - * Returns the icon used for the module given as aparameter. - */ - QIcon getIconForModule( CSwordModuleInfo* ); - /** - * Returns the name for the icon used for the module given as aparameter. - */ - QString getIconNameForModule( CSwordModuleInfo* ); +/** + * Converts HTML text to plain text. + * This function converts some HTML tags in text (e.g. <br/> to \n) + * @return The text withput HTML tags and with converted <br/> to \n + */ +QString htmlToText(const QString&); +/** +* Converts text to HTML converting some text commands into HTML tags (e.g. \n to <br/>) +* @return The HTML formatted text we got after changing \n to <br/> +*/ +QString textToHTML(const QString&); +/** +* Creates the file filename and put the text of parameter "text" into the file. +* @return True if saving was sucessful, otherwise false +*/ +bool savePlainFile( const QString& filename, const QString& text, const bool& forceOverwrite = false, QTextCodec* fileCodec = QTextCodec::codecForLocale()); +/** +* Returns the icon used for the module given as aparameter. +*/ +QIcon getIconForModule( CSwordModuleInfo* ); +/** +* Returns the name for the icon used for the module given as aparameter. +*/ +QString getIconNameForModule( CSwordModuleInfo* ); - /** Returns a label to explain difficult things of dialogs. - * This function returns a label with heading "heading" and explanation "text". This label should be used to - * explain difficult things of the GUI, e.g. in the optionsdialog. - */ - QLabel* explanationLabel(QWidget* parent, const QString& heading, const QString& text ); - /** - * Returns true if the character at position "pos" of text is inside an HTML tag. Returns false if it's not inside an HTML tag. - */ - bool inHTMLTag(int pos, QString & text); +/** Returns a label to explain difficult things of dialogs. +* This function returns a label with heading "heading" and explanation "text". This label should be used to +* explain difficult things of the GUI, e.g. in the optionsdialog. +*/ +QLabel* explanationLabel(QWidget* parent, const QString& heading, const QString& text ); +/** +* Returns true if the character at position "pos" of text is inside an HTML tag. Returns false if it's not inside an HTML tag. +*/ +bool inHTMLTag(int pos, QString & text); - /** Return the module's tooltip text - * @param module The module required for the tooltip - * @return The tooltip text for the passed module - */ - QString moduleToolTip(CSwordModuleInfo* module); +/** Return the module's tooltip text +* @param module The module required for the tooltip +* @return The tooltip text for the passed module +*/ +QString moduleToolTip(CSwordModuleInfo* module); - /** Return the module's tooltip text for a remote module - * @param module The module required for the tooltip - * @return The tooltip text for the passed module - */ - QString remoteModuleToolTip(CSwordModuleInfo* module, QString localVer); +/** Return the module's tooltip text for a remote module +* @param module The module required for the tooltip +* @return The tooltip text for the passed module +*/ +QString remoteModuleToolTip(CSwordModuleInfo* module, QString localVer); - /** - * Returns the width in pixels for a string which has mCount 'M' letters, using the specified widget's font. - * This can be used when setting the size for a widget. It may be better to roughly calculate the size based on some text width rather than use pixels directly. - */ - int mWidth(const QWidget* widget, int mCount); +/** +* Returns the width in pixels for a string which has mCount 'M' letters, using the specified widget's font. +* This can be used when setting the size for a widget. It may be better to roughly calculate the size based on some text width rather than use pixels directly. +*/ +int mWidth(const QWidget* widget, int mCount); } } |