Mercurial > hg > forks > UniversalIndentGUI
changeset 687:b4aee13bc733
- Added a new class, that is responsible for logging of any kind and added some logging/debug output calls.
- Updated all ui files to the Qt Designer version 4.5.x.
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@956 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Wed, 27 May 2009 17:00:05 +0000 |
parents | dc9b1d274117 |
children | b5b686bac866 |
files | UniversalIndentGUI.pro UniversalIndentGUI.sln resources/Icons.qrc resources/document-properties.png src/AboutDialog.ui src/IndentHandler.cpp src/MainWindow.cpp src/MainWindow.ui src/SettingsPaths.cpp src/ToolBarWidget.ui src/UiGuiLogger.cpp src/UiGuiLogger.h src/UiGuiLoggerDialog.ui src/UiGuiSettingsDialog.ui src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp src/UpdateCheckDialog.ui src/main.cpp |
diffstat | 17 files changed, 436 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/UniversalIndentGUI.pro Wed May 20 13:52:12 2009 +0000 +++ b/UniversalIndentGUI.pro Wed May 27 17:00:05 2009 +0000 @@ -184,6 +184,7 @@ src/UiGuiHighlighter.h \ src/UiGuiIndentServer.h \ src/UiGuiIniFileParser.h \ + src/UiGuiLogger.h \ src/UiGuiSettings.h \ src/UiGuiSettingsDialog.h \ src/UiGuiVersion.h \ @@ -192,6 +193,7 @@ FORMS += src/MainWindow.ui \ src/ToolBarWidget.ui \ + src/UiGuiLoggerDialog.ui \ src/UiGuiSettingsDialog.ui \ src/AboutDialog.ui \ src/UpdateCheckDialog.ui @@ -207,6 +209,7 @@ src/UiGuiHighlighter.cpp \ src/UiGuiIndentServer.cpp \ src/UiGuiIniFileParser.cpp \ + src/UiGuiLogger.cpp \ src/UiGuiSettings.cpp \ src/UiGuiSettingsDialog.cpp \ src/UiGuiVersion.cpp \
--- a/UniversalIndentGUI.sln Wed May 20 13:52:12 2009 +0000 +++ b/UniversalIndentGUI.sln Wed May 27 17:00:05 2009 +0000 @@ -1,5 +1,5 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalIndentGUI", "src\UniversalIndentGUI.vcproj", "{CF521500-824E-4DB7-A7FA-F4A8B6BB008A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalIndentGUI_NPP", "src\UniversalIndentGUI_NPP\UniversalIndentGUI_NPP.vcproj", "{0A9F9D63-C282-4AE8-9F80-A6D5F541AD12}"
--- a/resources/Icons.qrc Wed May 20 13:52:12 2009 +0000 +++ b/resources/Icons.qrc Wed May 27 17:00:05 2009 +0000 @@ -14,6 +14,7 @@ <file>language-zh_TW.png</file> </qresource> <qresource prefix="/mainWindow" > + <file>document-properties.png</file> <file>Icon1.png</file> <file>universalIndentGUI.svg</file> <file>document-open.png</file>
--- a/src/AboutDialog.ui Wed May 20 13:52:12 2009 +0000 +++ b/src/AboutDialog.ui Wed May 27 17:00:05 2009 +0000 @@ -94,8 +94,8 @@ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt;">Version %1 rev.%2, %3 </span></p></body></html></string> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;">Version %1 rev.%2, %3 </span></p></body></html></string> </property> </widget> </item> @@ -120,13 +120,13 @@ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:9pt;">... is a cross platform compatible GUI for several code formatter, beautifier and indenter like GreatCode, AStyle (Artistic Styler), GNU Indent, BCPP and so on. Main feature is a live preview to directly see how the selected formatting option affects the source code.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:9pt;"><br />Written by : </span><a href="http://www.thomas-schweitzer.de"><span style=" font-family:'MS Shell Dlg 2'; font-size:9pt; text-decoration: underline; color:#0000ff;">Thomas Schweitzer</span></a></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:9pt;">Project Homepage : </span><a href="http://universalindent.sourceforge.net"><span style=" font-family:'MS Shell Dlg 2'; font-size:9pt; text-decoration: underline; color:#0000ff;">http://universalindent.sourceforge.net</span></a></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:9pt;">License: UniversalIndentGui is released under the GPL 2. For details read the included file LICENSE.GPL visit </span><a href="http://www.gnu.org/licenses/gpl.html"><span style=" font-family:'MS Shell Dlg 2'; font-size:9pt; text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/gpl.html</span></a><span style=" font-family:'MS Shell Dlg 2'; font-size:9pt;">.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:9pt;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:9pt;">Credits:</span></p></body></html></string> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">... is a cross platform compatible GUI for several code formatter, beautifier and indenter like GreatCode, AStyle (Artistic Styler), GNU Indent, BCPP and so on. Main feature is a live preview to directly see how the selected formatting option affects the source code.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;"><br />Written by : </span><a href="http://www.thomas-schweitzer.de"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">Thomas Schweitzer</span></a></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Project Homepage : </span><a href="http://universalindent.sourceforge.net"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">http://universalindent.sourceforge.net</span></a></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">License: UniversalIndentGui is released under the GPL 2. For details read the included file LICENSE.GPL visit </span><a href="http://www.gnu.org/licenses/gpl.html"><span style=" font-size:9pt; text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/gpl.html</span></a><span style=" font-size:9pt;">.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Credits:</span></p></body></html></string> </property> </widget> </item> @@ -190,6 +190,7 @@ </widget> <resources> <include location="../resources/Icons.qrc"/> + <include location="../resources/Icons.qrc"/> </resources> <connections> <connection>
--- a/src/IndentHandler.cpp Wed May 20 13:52:12 2009 +0000 +++ b/src/IndentHandler.cpp Wed May 27 17:00:05 2009 +0000 @@ -19,6 +19,9 @@ #include "IndentHandler.h" + +#include <QtDebug> + #include "UiGuiSettings.h" #ifdef Q_OS_WIN32 @@ -215,7 +218,7 @@ /*! \brief Returns the actions of the context menu used for some actions like saving the indenter config file. -*/ + */ QList<QAction*> IndentHandler::getIndenterMenuActions() { QList<QAction*> actionList; actionList << actionLoad_Indenter_Config_File << actionSave_Indenter_Config_File << actionCreateShellScript << actionResetIndenterParameters; @@ -350,7 +353,7 @@ The \a inputFileExtension has to be given as parameter so the called indenter can identify the programming language if needed. -*/ + */ QString IndentHandler::callJavaScriptIndenter(QString sourceCode) { QScriptEngine engine; @@ -374,7 +377,7 @@ The \a inputFileExtension has to be given as parameter so the called indenter can identify the programming language if needed. -*/ + */ QString IndentHandler::callExecutableIndenter(QString sourceCode, QString inputFileExtension) { Q_ASSERT_X( !inputFileName.isEmpty(), "callIndenter", "inputFileName is empty" ); // Q_ASSERT_X( !outputFileName.isEmpty(), "callIndenter", "outputFileName is empty" ); @@ -432,6 +435,8 @@ // the Unicode path on their own. // Because of this the path gets converted to Windows short paths using the 8.3 notation. + qDebug() << __LINE__ << " " << __FUNCTION__ << ": Temp dir before trying to convert it to short Windows path is" << tempDirctoryStr; + // At first convert the temp path to Windows like separators. QString tempDirctoryStrHelper = QDir::toNativeSeparators(tempDirctoryStr).replace("\\", "\\\\"); // Then convert the QString to a WCHAR array and NULL terminate it. @@ -452,7 +457,17 @@ tempDirctoryStrHelper = QString::fromWCharArray( buffer ); tempDirctoryStr = QDir::fromNativeSeparators(tempDirctoryStrHelper).replace("//", "/"); delete buffer; + + // Check whether the short path still contains some kind of non ascii characters. + if ( tempDirctoryStr.length() != tempDirctoryStr.toAscii().length() ) { + qWarning() << __LINE__ << " " << __FUNCTION__ << ": Shortened path still contains non ascii characters. Could cause some indenters not to work properly!"; + } } + else { + qWarning() << __LINE__ << " " << __FUNCTION__ << ": Couldn't retrieve a short version of the temporary path!"; + } + + qDebug() << __LINE__ << " " << __FUNCTION__ << ": Temp dir after trying to convert it to short Windows path is " << tempDirctoryStr; delete tempDirctoryWindowsStr; #endif
--- a/src/MainWindow.cpp Wed May 20 13:52:12 2009 +0000 +++ b/src/MainWindow.cpp Wed May 27 17:00:05 2009 +0000 @@ -20,6 +20,7 @@ #include "MainWindow.h" #include "UiGuiVersion.h" +#include "UiGuiLogger.h" //! \defgroup grp_MainWindow All concerning main window functionality. @@ -162,6 +163,7 @@ connect( actionExportPDF, SIGNAL(triggered()), this, SLOT(exportToPDF()) ); connect( actionExportHTML, SIGNAL(triggered()), this, SLOT(exportToHTML()) ); connect( actionCheck_for_update, SIGNAL(triggered()), updateCheckDialog, SLOT(checkForUpdateAndShowDialog()) ); + connect( actionShowLog, SIGNAL(triggered()), UiGuiLogger::getInstance(), SLOT(show()) ); // Init the menu for selecting one of the recently opened files. updateRecentlyOpenedList();
--- a/src/MainWindow.ui Wed May 20 13:52:12 2009 +0000 +++ b/src/MainWindow.ui Wed May 27 17:00:05 2009 +0000 @@ -45,7 +45,7 @@ <x>0</x> <y>0</y> <width>949</width> - <height>25</height> + <height>21</height> </rect> </property> <widget class="QMenu" name="menuIndenter"> @@ -114,6 +114,7 @@ <string>Help</string> </property> <addaction name="actionCheck_for_update"/> + <addaction name="actionShowLog"/> <addaction name="separator"/> <addaction name="actionAbout_UniversalIndentGUI"/> </widget> @@ -447,6 +448,21 @@ <string>Clear Recently Opened List</string> </property> </action> + <action name="actionShowLog"> + <property name="icon"> + <iconset resource="../resources/Icons.qrc"> + <normaloff>:/mainWindow/document-properties.png</normaloff>:/mainWindow/document-properties.png</iconset> + </property> + <property name="text"> + <string>Show Log</string> + </property> + <property name="toolTip"> + <string>Displays logging information.</string> + </property> + <property name="statusTip"> + <string>Displays logging info about the currently running UiGUI application.</string> + </property> + </action> </widget> <resources> <include location="../resources/Icons.qrc"/>
--- a/src/SettingsPaths.cpp Wed May 20 13:52:12 2009 +0000 +++ b/src/SettingsPaths.cpp Wed May 27 17:00:05 2009 +0000 @@ -55,6 +55,10 @@ In not portable mode (multiuser mode) only users home directory is used for writing config data. */ void SettingsPaths::init() { + alreadyInitialized = true; + + qDebug() << __LINE__ << " " << __FUNCTION__ << ": Initializing application paths."; + // Get the applications binary path, with respect to MacOSXs use of the .app folder. applicationBinaryPath = QCoreApplication::applicationDirPath(); // Remove any trailing slashes @@ -146,7 +150,13 @@ #endif } - alreadyInitialized = true; + qDebug() << __LINE__ << " " << __FUNCTION__ << ": Paths are:" \ + "<ul><li>applicationBinaryPath=" << applicationBinaryPath \ + << "</li><li>settingsPath=" << settingsPath \ + << "</li><li>globalFilesPath=" << globalFilesPath \ + << "</li><li>indenterPath=" << indenterPath \ + << "</li><li>tempPath=" << tempPath \ + << "</li><li>Running in portable mode=" << portableMode << "</li></ul>"; }
--- a/src/ToolBarWidget.ui Wed May 20 13:52:12 2009 +0000 +++ b/src/ToolBarWidget.ui Wed May 27 17:00:05 2009 +0000 @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>775</width> + <width>773</width> <height>34</height> </rect> </property>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/UiGuiLogger.cpp Wed May 27 17:00:05 2009 +0000 @@ -0,0 +1,147 @@ +/*************************************************************************** + * Copyright (C) 2006-2009 by Thomas Schweitzer * + * thomas-schweitzer(at)arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2.0 as * + * published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program in the file LICENSE.GPL; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "UiGuiLogger.h" + +#include <QDateTime> +#include <QFile> +#include <QUrl> +#include <QTextStream> +#include <QDesktopServices> + +#include "SettingsPaths.h" + +UiGuiLogger* UiGuiLogger::instance = NULL; + +/*! + \brief Returns the only existing instance of UiGuiLogger. If the instance doesn't exist, it will be created. + */ +UiGuiLogger* UiGuiLogger::getInstance() { + if ( instance == NULL ) + instance = new UiGuiLogger(); + + return instance; +} + + +/*! + \brief Initializes the dialog and sets the path to the log file in the systems temporary directory. + Sets the default verbose level to warning level. + */ +UiGuiLogger::UiGuiLogger() : QDialog() { + setupUi(this); + verboseLevel = QtWarningMsg; + + // On different systems it may be that "QDir::tempPath()" ends with a "/" or not. So check this. + // Remove any trailing slashes. + QString tempPath = QDir::tempPath(); + while ( tempPath.right(1) == "/" ) { + tempPath.chop(1); + } + logFile.setFileName( tempPath + "/UiGUI_log.html" ); + + connect( openLogFileFolderToolButton, SIGNAL(clicked()), this, SLOT(openLogFileFolder()) ); + + // Make the main application not to wait for the logging window to close. + setAttribute(Qt::WA_QuitOnClose, false); + +} + + +/*! + \brief Logs all incoming messages \a msg to the dialogs text edit and to the log file. + + Only messages whos \a type have a higher priority than the set verbose level are logged. + */ +void UiGuiLogger::messageHandler(QtMsgType type, const char *msg) { + if ( instance == NULL ) + instance = new UiGuiLogger(); + + // Only log messages that have a higher or equal priority than set with the verbose level. + if ( type < instance->verboseLevel ) + return; + + // Init log message with prepended date and time. + QString message = QDateTime::currentDateTime().toString(); + + // Depending on the QtMsgType prepend a different colored Debug, Warning, Critical or Fatal. + switch (type) { + case QtDebugMsg: + message += " <span style=\"font-weight:bold; color:black;\">Debug:</span> "; + break; + case QtWarningMsg: + message += " <span style=\"font-weight:bold; color:gold;\">Warning:</span> "; + break; + case QtCriticalMsg: + message += "<span style=\"font-weight:bold; color:red;\">Critical:</span> "; + break; + case QtFatalMsg: + message += " <span style=\"font-weight:bold; color:#D60000;\">Fatal:</span> "; + } + + // Append the ti UTF-8 back converted message parameter. + message += QString::fromUtf8( msg ) + "<br/>\n"; + + // Write the message to the log windows text edit. + instance->logTextEdit->append( message ); + + // Write/append the log message to the log file. + if ( instance->logFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append) ) { + QTextStream out(&instance->logFile); + out << message << "\n"; + instance->logFile.close(); + } + + // In case of a fatal error abort the application. + if ( type == QtFatalMsg ) + abort(); +} + + +/*! + \brief Calling this the verbose level can be set in a range from 0 to 3 + which is equal to debug, warning, critical and fatal priority. + */ +void UiGuiLogger::setVerboseLevel(int level) { + if ( level < 0 ) + verboseLevel = QtDebugMsg; + if ( level > 3 ) + verboseLevel = QtFatalMsg; + else + verboseLevel = QtMsgType(level); +} + + +/*! + \brief Deletes the existing instance of UiGuiLogger. + */ +void UiGuiLogger::deleteInstance() { + if ( instance != NULL ) { + delete instance; + instance = NULL; + } +} + + +/*! + \brief Opens the folder that contains the created log file with the name "UiGUI_log.html". + */ +void UiGuiLogger::openLogFileFolder() { + QDesktopServices::openUrl( QFileInfo( logFile ).absolutePath() ); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/UiGuiLogger.h Wed May 27 17:00:05 2009 +0000 @@ -0,0 +1,61 @@ +/*************************************************************************** + * Copyright (C) 2006-2009 by Thomas Schweitzer * + * thomas-schweitzer(at)arcor.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License version 2.0 as * + * published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program in the file LICENSE.GPL; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef UIGUILOGGER_H +#define UIGUILOGGER_H + +#include <QDialog> +#include <QFile> + +#include "ui_UiGuiLoggerDialog.h" + +/*! + \class UiGuiLogger + \brief This class handles any kind of data logging, for debugging and whatever purpose. + + Beneath being able of displaying a dialog window containing all log messages of the + current session, a log file in the systems temporary directory is used. Its name + is "UiGUI_log.html". + + Setting a verbose level allows to only write messages that have the selected minimum + priority to the log. + */ + +class UiGuiLogger : public QDialog, private Ui::UiGuiLoggerDialog +{ + Q_OBJECT + +public: + static UiGuiLogger* getInstance(); + static void messageHandler(QtMsgType type, const char *msg); + static void deleteInstance(); + void setVerboseLevel(int level); + +private: + UiGuiLogger(); + + static UiGuiLogger* instance; + QtMsgType verboseLevel; + QFile logFile; + +private slots: + void openLogFileFolder(); +}; + +#endif // UIGUILOGGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/UiGuiLoggerDialog.ui Wed May 27 17:00:05 2009 +0000 @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UiGuiLoggerDialog</class> + <widget class="QDialog" name="UiGuiLoggerDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1030</width> + <height>263</height> + </rect> + </property> + <property name="windowTitle"> + <string>Log</string> + </property> + <property name="windowIcon"> + <iconset resource="../resources/Icons.qrc"> + <normaloff>:/mainWindow/document-properties.png</normaloff>:/mainWindow/document-properties.png</iconset> + </property> + <layout class="QVBoxLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Logged messages</string> + </property> + </widget> + </item> + <item> + <widget class="QTextEdit" name="logTextEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QToolButton" name="cleanUpToolButton"> + <property name="toolTip"> + <string>Cleanup log</string> + </property> + <property name="text"> + <string>...</string> + </property> + <property name="icon"> + <iconset resource="../resources/Icons.qrc"> + <normaloff>:/mainWindow/edit-clear.png</normaloff>:/mainWindow/edit-clear.png</iconset> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="openLogFileFolderToolButton"> + <property name="toolTip"> + <string>Open folder containing log file.</string> + </property> + <property name="icon"> + <iconset resource="../resources/Icons.qrc"> + <normaloff>:/mainWindow/document-open.png</normaloff>:/mainWindow/document-open.png</iconset> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Close</set> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources> + <include location="../resources/Icons.qrc"/> + </resources> + <connections> + <connection> + <sender>UiGuiLoggerDialog</sender> + <signal>finished(int)</signal> + <receiver>UiGuiLoggerDialog</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel"> + <x>2</x> + <y>45</y> + </hint> + <hint type="destinationlabel"> + <x>5</x> + <y>59</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>clicked(QAbstractButton*)</signal> + <receiver>UiGuiLoggerDialog</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel"> + <x>419</x> + <y>280</y> + </hint> + <hint type="destinationlabel"> + <x>477</x> + <y>263</y> + </hint> + </hints> + </connection> + <connection> + <sender>cleanUpToolButton</sender> + <signal>clicked()</signal> + <receiver>logTextEdit</receiver> + <slot>clear()</slot> + <hints> + <hint type="sourcelabel"> + <x>27</x> + <y>282</y> + </hint> + <hint type="destinationlabel"> + <x>22</x> + <y>231</y> + </hint> + </hints> + </connection> + </connections> +</ui>
--- a/src/UiGuiSettingsDialog.ui Wed May 20 13:52:12 2009 +0000 +++ b/src/UiGuiSettingsDialog.ui Wed May 27 17:00:05 2009 +0000 @@ -9,7 +9,7 @@ <rect> <x>0</x> <y>0</y> - <width>409</width> + <width>410</width> <height>285</height> </rect> </property>
--- a/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp Wed May 20 13:52:12 2009 +0000 +++ b/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp Wed May 27 17:00:05 2009 +0000 @@ -21,6 +21,7 @@ /* include files */ #include "UniversalIndentGUI_NPP.h" +#include "UiGuiLogger.h" /* information for notepad */ CONST INT nbFunc = 3; @@ -57,6 +58,16 @@ indentHandler->setWindowIcon(QIcon(QString::fromUtf8(":/mainWindow/icon2.png"))); indentHandler->setParameterChangedCallback( NULL ); indentHandler->setWindowClosedCallback( showUiGUI ); + + // Setting UTF-8 as default 8-Bit encoding to ensure that qDebug does no false string conversion. + QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF-8") ); + QTextCodec::setCodecForLocale( QTextCodec::codecForName("UTF-8") ); + // Force creation of an UiGuiLogger instance here, to avoid recursion with SettingsPaths init function. + UiGuiLogger::getInstance(); + qInstallMsgHandler( UiGuiLogger::messageHandler ); +#ifdef _DEBUG + UiGuiLogger::getInstance()->setVerboseLevel(0); +#endif } /* Set function pointers */
--- a/src/UpdateCheckDialog.ui Wed May 20 13:52:12 2009 +0000 +++ b/src/UpdateCheckDialog.ui Wed May 27 17:00:05 2009 +0000 @@ -9,7 +9,7 @@ <rect> <x>0</x> <y>0</y> - <width>322</width> + <width>323</width> <height>108</height> </rect> </property>
--- a/src/main.cpp Wed May 20 13:52:12 2009 +0000 +++ b/src/main.cpp Wed May 27 17:00:05 2009 +0000 @@ -21,7 +21,7 @@ #include <QApplication> #include "UiGuiIndentServer.h" - +#include "UiGuiLogger.h" #include "UiGuiIniFileParser.h" #include "UiGuiSettings.h" @@ -81,6 +81,15 @@ } } + // Setting UTF-8 as default 8-Bit encoding to ensure that qDebug does no false string conversion. + QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF-8") ); + QTextCodec::setCodecForLocale( QTextCodec::codecForName("UTF-8") ); + // Force creation of an UiGuiLogger instance here, to avoid recursion with SettingsPaths init function. + UiGuiLogger::getInstance(); + qInstallMsgHandler( UiGuiLogger::messageHandler ); +#ifdef _DEBUG + UiGuiLogger::getInstance()->setVerboseLevel(0); +#endif // Set default values for all by UniversalIndentGUI used settings objects. QCoreApplication::setOrganizationName("UniversalIndentGUI"); @@ -118,6 +127,7 @@ } UiGuiSettings::deleteInstance(); + UiGuiLogger::deleteInstance(); return returnValue; }