# HG changeset patch # User thomas_-_s # Date 1243597630 0 # Node ID e3ff3c85d27117368fab661452554b893ed7d40e # Parent 2af225b848bbb172b378dc329d6326afd75fc29d Added a class for retrieving info about the operating system and use this for logging info. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@961 59b1889a-e5ac-428c-b0c7-476e01d41282 diff -r 2af225b848bb -r e3ff3c85d271 UniversalIndentGUI.pro --- a/UniversalIndentGUI.pro Thu May 28 10:20:05 2009 +0000 +++ b/UniversalIndentGUI.pro Fri May 29 11:47:10 2009 +0000 @@ -187,6 +187,7 @@ src/UiGuiLogger.h \ src/UiGuiSettings.h \ src/UiGuiSettingsDialog.h \ + src/UiGuiSystemInfo.h \ src/UiGuiVersion.h \ src/UpdateCheckDialog.h @@ -212,6 +213,7 @@ src/UiGuiLogger.cpp \ src/UiGuiSettings.cpp \ src/UiGuiSettingsDialog.cpp \ + src/UiGuiSystemInfo.cpp \ src/UiGuiVersion.cpp \ src/UpdateCheckDialog.cpp diff -r 2af225b848bb -r e3ff3c85d271 UniversalIndentGUI_NPP.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UniversalIndentGUI_NPP.pro Fri May 29 11:47:10 2009 +0000 @@ -0,0 +1,120 @@ +TEMPLATE = lib +CONFIG += plugin +QT += script + +TARGET = UniversalIndentGUI_NPP + +DEFINES += \ + UNIVERSALINDENTGUI_NPP_EXPORTS +DEFINES -= \ + _UNICODE \ + UNICODE + +DEPENDPATH += resources \ + src \ + src/UniversalIndentGUI_NPP \ + src/UniversalIndentGUI_NPP/NPPCommon \ + debug \ + release + +INCLUDEPATH += src \ + src/UniversalIndentGUI_NPP \ + src/UniversalIndentGUI_NPP/NPPCommon + +LIBS += -lshlwapi \ + +CONFIG(release, debug|release) { + +pipe2nul = ">NUL" +message(Updating language files) + +lupdate = lupdate +lrelease = lrelease +# Update translation files +message ( Updating universalindent.ts ) +system($${lupdate} src -ts ./translations/universalindent.ts -silent) +message ( Updating universalindent_de.ts ) +system($${lupdate} src -ts ./translations/universalindent_de.ts -silent) +message ( Updating universalindent_fr.ts ) +system($${lupdate} src -ts ./translations/universalindent_fr.ts -silent) +message ( Updating universalindent_ja_jp.ts ) +system($${lupdate} src -ts ./translations/universalindent_ja_jp.ts -silent) +message ( Updating universalindent_ru.ts ) +system($${lupdate} src -ts ./translations/universalindent_ru.ts -silent) +message ( Updating universalindent_uk.ts ) +system($${lupdate} src -ts ./translations/universalindent_uk.ts -silent) +message ( Updating universalindent_zh_TW.ts ) +system($${lupdate} src -ts ./translations/universalindent_zh_TW.ts -silent) + + +# Create translation binaries +message ( Creating translation binaries ) +system($${lrelease} ./translations/universalindent_de.ts -qm ./translations/universalindent_de.qm -silent) +system($${lrelease} ./translations/universalindent_fr.ts -qm ./translations/universalindent_fr.qm -silent) +system($${lrelease} ./translations/universalindent_ja_jp.ts -qm ./translations/universalindent_ja_jp.qm -silent) +system($${lrelease} ./translations/universalindent_ru.ts -qm ./translations/universalindent_ru.qm -silent) +system($${lrelease} ./translations/universalindent_uk.ts -qm ./translations/universalindent_uk.qm -silent) +system($${lrelease} ./translations/universalindent_zh_TW.ts -qm ./translations/universalindent_zh_TW.qm -silent) + +# Copy Qts own translation files to the local translation directory +message ( Copy Qts own translation files to the local translation directory ) +qtTranslationInstallDir = $$[QT_INSTALL_TRANSLATIONS] +win32:qtTranslationInstallDir = $$replace(qtTranslationInstallDir, /, \) +win32:system(copy $${qtTranslationInstallDir}\qt_de.qm .\translations\ /Y $$pipe2nul) +win32:system(copy $${qtTranslationInstallDir}\qt_fr.qm .\translations\ /Y $$pipe2nul) +win32:system(copy $${qtTranslationInstallDir}\qt_ja_jp.qm .\translations\ /Y $$pipe2nul) +win32:system(copy $${qtTranslationInstallDir}\qt_ru.qm .\translations\ /Y $$pipe2nul) +win32:system(copy $${qtTranslationInstallDir}\qt_uk.qm .\translations\ /Y $$pipe2nul) +win32:system(copy $${qtTranslationInstallDir}\qt_zh_TW.qm .\translations\ /Y $$pipe2nul) + +} + + +CONFIG(debug, debug|release) { + DESTDIR = ./debug_npp +} else { + DESTDIR = ./release_npp +} + +MOC_DIR = $${DESTDIR}/moc +UI_DIR = $${DESTDIR}/uic +OBJECTS_DIR = $${DESTDIR}/obj +RCC_DIR = $${DESTDIR}/qrc + +#message ( destdir is $${DESTDIR}. uic is $${UI_DIR}. moc is $${MOC_DIR}) + +FORMS += src/UiGuiLoggerDialog.ui + +# Input +HEADERS += \ +# src/AboutDialog.h \ +# src/AboutDialogGraphicsView.h \ + src/IndentHandler.h \ + src/SettingsPaths.h \ + src/TemplateBatchScript.h \ + src/UiGuiErrorMessage.h \ + src/UiGuiIniFileParser.h \ + src/UiGuiLogger.h \ + src/UiGuiSettings.h \ + src/UiGuiSystemInfo.h \ + src/UiGuiVersion.h \ + src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.h \ + src/UniversalIndentGUI_NPP/NPPCommon/PluginInterface.h \ + src/UniversalIndentGUI_NPP/NPPCommon/Scintilla.h + +SOURCES += \ +# src/AboutDialog.cpp \ +# src/AboutDialogGraphicsView.cpp \ + src/IndentHandler.cpp \ + src/SettingsPaths.cpp \ + src/TemplateBatchScript.cpp \ + src/UiGuiErrorMessage.cpp \ + src/UiGuiIniFileParser.cpp \ + src/UiGuiLogger.cpp \ + src/UiGuiSettings.cpp \ + src/UiGuiSystemInfo.cpp \ + src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp + + +RESOURCES += resources/Icons.qrc +RC_FILE = resources/programicon.rc diff -r 2af225b848bb -r e3ff3c85d271 src/IndentHandler.cpp --- a/src/IndentHandler.cpp Thu May 28 10:20:05 2009 +0000 +++ b/src/IndentHandler.cpp Fri May 29 11:47:10 2009 +0000 @@ -516,7 +516,7 @@ // Set the directory for the indenter execution indentProcess.setWorkingDirectory( QFileInfo(tempDirctoryStr).absoluteFilePath() ); - qDebug() << __LINE__ << " " << __FUNCTION__ << ": Will call the indenter in the directory " << QFileInfo(tempDirctoryStr).absoluteFilePath() << " using this commandline call: " << indenterCompleteCallString; + qDebug() << __LINE__ << " " << __FUNCTION__ << ": Will call the indenter in the directory " << indentProcess.workingDirectory() << " using this commandline call: " << indenterCompleteCallString; indentProcess.start(indenterCompleteCallString); diff -r 2af225b848bb -r e3ff3c85d271 src/UiGuiSystemInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/UiGuiSystemInfo.cpp Fri May 29 11:47:10 2009 +0000 @@ -0,0 +1,123 @@ +/*************************************************************************** + * 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 "UiGuiSystemInfo.h" + +#include +#include + +UiGuiSystemInfo::UiGuiSystemInfo() { +} + + +/*! + \brief Returns the operating system UiGUI is currently running on as one string. + + The String contains name and version of the os. E.g. Linux Ubuntu 9.04. + */ +QString UiGuiSystemInfo::getOperatingSystem() { + QString operatingSystemString = ""; + +#if defined(Q_WS_WIN) + switch ( QSysInfo::WindowsVersion ) { + case QSysInfo::WV_32s : + operatingSystemString = "Windows 3.1 with Win 32s"; + break; + case QSysInfo::WV_95 : + operatingSystemString = "Windows 95"; + break; + case QSysInfo::WV_98 : + operatingSystemString = "Windows 98"; + break; + case QSysInfo::WV_Me : + operatingSystemString = "Windows Me"; + break; + case QSysInfo::WV_NT : + operatingSystemString = "Windows NT (operating system version 4.0)"; + break; + case QSysInfo::WV_2000 : + operatingSystemString = "Windows 2000 (operating system version 5.0)"; + break; + case QSysInfo::WV_XP : + operatingSystemString = "Windows XP (operating system version 5.1)"; + break; + case QSysInfo::WV_2003 : + operatingSystemString = "Windows Server 2003, Windows Server 2003 R2, Windows Home Server, Windows XP Professional x64 Edition (operating system version 5.2)"; + break; + case QSysInfo::WV_VISTA : + operatingSystemString = "Windows Vista, Windows Server 2008 (operating system version 6.0)"; + break; + case QSysInfo::WV_WINDOWS7 : + operatingSystemString = "Windows 7 (operating system version 6.1)"; + break; + case QSysInfo::WV_CE : + operatingSystemString = "Windows CE"; + break; + case QSysInfo::WV_CENET : + operatingSystemString = "Windows CE .NET"; + break; + case QSysInfo::WV_CE_5 : + operatingSystemString = "Windows CE 5.x"; + break; + case QSysInfo::WV_CE_6 : + operatingSystemString = "Windows CE 6.x"; + break; + default : + operatingSystemString = "Unknown Windows operating system."; + break; + } +#elif defined(Q_WS_MAC) + switch ( QSysInfo::MacintoshVersion ) { + case QSysInfo::MV_9 : + operatingSystemString = "Mac OS 9 (unsupported)"; + break; + case QSysInfo::MV_10_0 : + operatingSystemString = "Mac OS X 10.0 Cheetah (unsupported)"; + break; + case QSysInfo::MV_10_1 : + operatingSystemString = "Mac OS X 10.1 Puma (unsupported)"; + break; + case QSysInfo::MV_10_2 : + operatingSystemString = "Mac OS X 10.2 Jaguar (unsupported)"; + break; + case QSysInfo::MV_10_3 : + operatingSystemString = "Mac OS X 10.3 Panther"; + break; + case QSysInfo::MV_10_4 : + operatingSystemString = "Mac OS X 10.4 Tiger"; + break; + case QSysInfo::MV_10_5 : + operatingSystemString = "Mac OS X 10.5 Leopard"; + break; + case QSysInfo::MV_10_6 : + operatingSystemString = "Mac OS X 10.6 Snow Leopard"; + break; + case QSysInfo::MV_Unknown : + operatingSystemString = "An unknown and currently unsupported platform"; + break; + default: + operatingSystemString = "Unknown Mac operating system."; + break; + } +#else + //TODO: Detect Unix, Linux etc. distro as described on http://www.novell.com/coolsolutions/feature/11251.html +#endif + + return operatingSystemString; +} \ No newline at end of file diff -r 2af225b848bb -r e3ff3c85d271 src/UiGuiSystemInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/UiGuiSystemInfo.h Fri May 29 11:47:10 2009 +0000 @@ -0,0 +1,33 @@ +/*************************************************************************** + * 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 UIGUISYSTEMINFO_H +#define UIGUISYSTEMINFO_H + +class QString; + +class UiGuiSystemInfo +{ +private: + UiGuiSystemInfo(); +public: + static QString getOperatingSystem(); +}; + +#endif // UIGUISYSTEMINFO_H diff -r 2af225b848bb -r e3ff3c85d271 src/UniversalIndentGUI.vcproj --- a/src/UniversalIndentGUI.vcproj Thu May 28 10:20:05 2009 +0000 +++ b/src/UniversalIndentGUI.vcproj Fri May 29 11:47:10 2009 +0000 @@ -267,6 +267,10 @@ > + + @@ -333,6 +337,10 @@ > + + diff -r 2af225b848bb -r e3ff3c85d271 src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp --- a/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp Thu May 28 10:20:05 2009 +0000 +++ b/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp Fri May 29 11:47:10 2009 +0000 @@ -22,6 +22,8 @@ #include "UniversalIndentGUI_NPP.h" #include "UiGuiLogger.h" +#include "UiGuiSystemInfo.h" +#include "UiGuiVersion.h" /* information for notepad */ CONST INT nbFunc = 3; @@ -65,6 +67,9 @@ // Force creation of an UiGuiLogger instance here, to avoid recursion with SettingsPaths init function. UiGuiLogger::getInstance(); qInstallMsgHandler( UiGuiLogger::messageHandler ); + UiGuiLogger::messageHandler( UiGuiInfoMsg, QString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toAscii() ); + UiGuiLogger::messageHandler( UiGuiInfoMsg, QString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toAscii() ); + #ifdef _DEBUG UiGuiLogger::getInstance()->setVerboseLevel(0); #endif diff -r 2af225b848bb -r e3ff3c85d271 src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.vcproj --- a/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.vcproj Thu May 28 10:20:05 2009 +0000 +++ b/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.vcproj Fri May 29 11:47:10 2009 +0000 @@ -240,6 +240,10 @@ > + + @@ -278,6 +282,10 @@ > + + diff -r 2af225b848bb -r e3ff3c85d271 src/main.cpp --- a/src/main.cpp Thu May 28 10:20:05 2009 +0000 +++ b/src/main.cpp Fri May 29 11:47:10 2009 +0000 @@ -25,6 +25,7 @@ #include "UiGuiIniFileParser.h" #include "UiGuiSettings.h" #include "UiGuiVersion.h" +#include "UiGuiSystemInfo.h" /*! /brief Entry point to UniversalIndentGUI application. @@ -55,6 +56,7 @@ UiGuiLogger::getInstance(); qInstallMsgHandler( UiGuiLogger::messageHandler ); UiGuiLogger::messageHandler( UiGuiInfoMsg, QString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toAscii() ); + UiGuiLogger::messageHandler( UiGuiInfoMsg, QString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toAscii() ); // Parse command line arguments. First parameter is the executable itself. for ( int i = 1; i < argc; i++ ) {