Changeset 373:434967368de8 in SMSSender
- Timestamp:
- Apr 14, 2014 12:50:28 PM (7 years ago)
- Branch:
- separation-frontend-backend
- Location:
- frontend
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
frontend/business/settings_base.cpp
r356 r373 27 27 : m_storage(storage) 28 28 , ENCRYPT_PWD("d92voimod_:DowDiofpqldovD;Msin039Dmw93DiovdqQdopM049:") 29 #ifdef QT_DEBUG 30 , m_verboseOutput(true) 31 #else 32 , m_verboseOutput(false) 33 #endif 29 34 { 30 35 } 36 37 /************************* Per-execution settings *****************************/ 31 38 32 39 const QDir BaseSettings::getLocalePath() const { … … 70 77 } 71 78 79 bool BaseSettings::isVerboseOutput() const { 80 return m_verboseOutput; 81 } 82 83 void BaseSettings::setVerboseOutput(bool verbose) { 84 if (isVerboseOutput() == verbose) return; 85 86 m_verboseOutput = verbose; 87 emit settingChanged(VerboseOutput); 88 } 89 90 /************************** Persistent settings *******************************/ 91 72 92 bool BaseSettings::getCheckForUpdates(){ 73 93 return m_storage->readBool("", "checkForUpdates", true); -
frontend/business/settings_base.h
r319 r373 30 30 public: 31 31 enum Setting { 32 Locale = 0, 32 // Per-execution 33 VerboseOutput = 0, 33 34 34 CheckForUpdates = 1, 35 AddSuffix = 2, 36 SMSSuffix = 3, 37 ActiveAccountId = 4, 38 ShowSentConfirmation = 5, 35 // Persistent 36 Locale = 1000, 39 37 40 ProxyEnabled = 6, 41 ProxyType = 7, 42 ProxyHost = 8, 43 ProxyPort = 9, 44 ProxyAuthEnabled = 10, 45 ProxyUsername = 11, 46 ProxyPassword = 12, 38 CheckForUpdates = 1001, 39 AddSuffix = 1002, 40 SMSSuffix = 1003, 41 ActiveAccountId = 1004, 42 ShowSentConfirmation = 1005, 43 44 ProxyEnabled = 1006, 45 ProxyType = 1007, 46 ProxyHost = 1008, 47 ProxyPort = 1009, 48 ProxyAuthEnabled = 1010, 49 ProxyUsername = 1011, 50 ProxyPassword = 1012, 47 51 48 52 LastSetting = ProxyPassword … … 52 56 explicit BaseSettings(::Persistence::IMainStorage *storage); 53 57 54 public: 58 public: /* Per-execution settings */ 55 59 const QDir getLocalePath() const; 56 60 QLocale getLocale(); 57 61 QList<QLocale> getLocales(); 58 62 63 bool isVerboseOutput() const; 64 void setVerboseOutput(bool verbose); 65 66 public: /* Persistent settings */ 59 67 bool getCheckForUpdates(); 60 68 bool getAddSuffix(); … … 100 108 private: 101 109 const QString ENCRYPT_PWD; 110 111 bool m_verboseOutput; 102 112 }; 103 113 -
frontend/frontend-base.pro
r366 r373 34 34 business/groupmanager.h \ 35 35 business/libraryloader_base.h \ 36 business/outputhelper.h \ 36 37 business/settings.h \ 37 38 business/settings_base.h \ … … 60 61 business/groupmanager.cpp \ 61 62 business/libraryloader_base.cpp \ 63 business/outputhelper.cpp \ 62 64 business/settings_base.cpp \ 63 65 business/suffixmanager.cpp \ -
frontend/gui/bootstrap.cpp
r356 r373 28 28 #include "frontend/business/accountmanager.h" 29 29 #include "frontend/business/gatewaymanager.h" 30 #include "frontend/business/outputhelper.h" 31 #include "frontend/business/settings.h" 30 32 #include "frontend/business/suffixmanager.h" 31 33 #include "frontend/gui/business/libraryloader.h" … … 39 41 m_managerFactory->contactImporterManager(), *m_persistenceFactory, 40 42 m_managerFactory->guiManager())); 43 OutputHelper::init(m_managerFactory->settingsManager()); 41 44 42 45 connect(m_managerFactory->settingsManager(), SIGNAL(settingChanged(int)), … … 49 52 50 53 void Bootstrap::bootstrap() { 54 parseCommandLineArguments(QCoreApplication::arguments()); 55 51 56 loadLibraries(); 52 57 … … 56 61 57 62 initAccounts(); 63 } 64 65 void Bootstrap::parseCommandLineArguments(const QStringList &arguments) { 66 foreach (const QString &arg, arguments) { 67 if (arg == "--verbose") { 68 m_managerFactory->settingsManager()->setVerboseOutput(true); 69 } 70 } 58 71 } 59 72 … … 125 138 126 139 /** 127 * Crawls the directory 'kTranslationsPath' for files named 128 * [prefix].[language].qm and adds them to the pool of available translation 129 * files. 140 * Crawls the locale path for files named [prefix].[language].qm and adds them 141 * to the pool of available translation files. 130 142 */ 131 143 void Bootstrap::initTranslators() { -
frontend/gui/bootstrap.h
r356 r373 57 57 58 58 private: 59 void parseCommandLineArguments(const QStringList &arguments); 60 59 61 void loadLibraries(); 60 62 void initAccounts(); -
frontend/gui/smssender-gui.cpp
r317 r373 23 23 24 24 #include "common/domain/sversion.h" 25 #include "frontend/business/settings.h"26 25 #include "frontend/gui/bootstrap.h" 27 #include "frontend/gui/business/managerfactory.h"28 #include "frontend/gui/persistence/persistencefactory.h"29 26 #include "frontend/gui/ui/main.h" 30 27 31 #include <iostream>32 #if defined(Q_OS_WIN)33 #include <fstream>34 35 std::ofstream logfile;36 37 void OutputHandler(QtMsgType type, const char *msg) {38 switch (type) {39 #ifndef QT_NO_DEBUG_OUTPUT40 case QtDebugMsg:41 logfile << QTime::currentTime().toString().toAscii().data() << " Debug: " << msg << std::endl;42 break;43 #endif44 #ifndef QT_NO_WARNING_OUTPUT45 case QtWarningMsg:46 logfile << QTime::currentTime().toString().toAscii().data() << " Warning: " << msg << std::endl;47 break;48 #endif49 case QtCriticalMsg:50 logfile << QTime::currentTime().toString().toAscii().data() << " Critical: " << msg << std::endl;51 break;52 case QtFatalMsg:53 logfile << QTime::currentTime().toString().toAscii().data() << " Fatal: " << msg << std::endl;54 abort();55 }56 }57 #else58 QMutex outputMutex(QMutex::NonRecursive);59 void OutputHandler(QtMsgType type, const char *msg) {60 QMutexLocker locker(&outputMutex);61 62 QString strMsg(msg);63 strMsg.remove('"');64 65 switch (type) {66 case QtDebugMsg: {67 std::cout << "DEBUG: " << qPrintable(strMsg) << std::endl;68 break;69 }70 case QtWarningMsg: {71 std::cout << "WARNING: " << qPrintable(strMsg) << std::endl;72 break;73 }74 case QtCriticalMsg: {75 std::cerr << "CRITICAL: " << qPrintable(strMsg) << std::endl;76 break;77 }78 case QtFatalMsg: {79 std::cerr << "FATAL: " << qPrintable(strMsg) << std::endl;80 abort();81 }82 }83 }84 #endif85 28 86 29 int main(int argc, char *argv[]) { 87 #if defined(Q_OS_WIN) 88 QFile::remove("logfile.txt"); 89 logfile.open("logfile.txt", ios::app); 90 #endif 91 qInstallMsgHandler(OutputHandler); 92 93 Q_INIT_RESOURCE(common); 30 /* Q_INIT_RESOURCE(common); 31 Q_INIT_RESOURCE(common-gui); 32 Q_INIT_RESOURCE(gateways-common); 33 Q_INIT_RESOURCE(gateways-common-gui);*/ 94 34 95 35 qRegisterMetaType<EException>("EException"); 96 97 36 98 37 QApplication a(argc, argv);
Note: See TracChangeset
for help on using the changeset viewer.