summaryrefslogtreecommitdiff
path: root/EventDispatcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'EventDispatcher.cpp')
-rw-r--r--EventDispatcher.cpp291
1 files changed, 206 insertions, 85 deletions
diff --git a/EventDispatcher.cpp b/EventDispatcher.cpp
index 744bc6a..b2595fb 100644
--- a/EventDispatcher.cpp
+++ b/EventDispatcher.cpp
@@ -7,11 +7,13 @@
#include <QMessageBox>
#include <QWidget>
#include <QStorageInfo>
+#include <iostream>
#include "EventDispatcher.h"
#include "ExtraSocket.h"
#include "CompilerInfo.h"
#include "ThemesManager.h"
+#include "cpp11addition.h"
#ifdef Q_OS_UNIX
#include <unistd.h>
@@ -47,21 +49,54 @@ EventDispatcher::EventDispatcher()
qRegisterMetaType<Ultracopier::EngineActionInProgress>("Ultracopier::EngineActionInProgress");
qRegisterMetaType<QList<QUrl> >("QList<QUrl>");
qRegisterMetaType<Ultracopier::ItemOfCopyList>("Ultracopier::ItemOfCopyList");
- #ifdef ULTRACOPIER_CGMINER
- qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
- qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
- #endif
+ qRegisterMetaType<std::string>("std::string");
+ qRegisterMetaType<uint64_t>("uint64_t");
+ qRegisterMetaType<std::vector<Ultracopier::ProgressionItem> >("std::vector<Ultracopier::ProgressionItem>");
+ qRegisterMetaType<std::vector<Ultracopier::ReturnActionOnCopyList> >("std::vector<Ultracopier::ReturnActionOnCopyList>");
+ qRegisterMetaType<std::vector<std::string> >("std::vector<std::string>");
copyServer=new CopyListener(&optionDialog);
- connect(&localListener, &LocalListener::cli, &cliParser, &CliParser::cli,Qt::QueuedConnection);
- connect(ThemesManager::themesManager, &ThemesManager::newThemeOptions, &optionDialog, &OptionDialog::newThemeOptions);
- connect(&cliParser, &CliParser::newCopyWithoutDestination, copyServer, &CopyListener::copyWithoutDestination);
- connect(&cliParser, &CliParser::newCopy, copyServer, &CopyListener::copy);
- connect(&cliParser, &CliParser::newMoveWithoutDestination, copyServer, &CopyListener::moveWithoutDestination);
- connect(&cliParser, &CliParser::newMove, copyServer, &CopyListener::move);
- connect(copyServer, &CopyListener::newClientList, &optionDialog, &OptionDialog::newClientList);
+ if(!connect(&localListener, &LocalListener::cli, &cliParser, &CliParser::cli,Qt::QueuedConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(ThemesManager::themesManager, &ThemesManager::newThemeOptions, &optionDialog, &OptionDialog::newThemeOptions))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(&cliParser, &CliParser::newCopyWithoutDestination, copyServer, &CopyListener::copyWithoutDestination))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(&cliParser, &CliParser::newCopy, copyServer, &CopyListener::copy))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(&cliParser, &CliParser::newMoveWithoutDestination, copyServer, &CopyListener::moveWithoutDestination))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(&cliParser, &CliParser::newMove, copyServer, &CopyListener::move))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(copyServer, &CopyListener::newClientList, &optionDialog, &OptionDialog::newClientList))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
#ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
- connect(&cliParser, &CliParser::tryLoadPlugin, PluginsManager::pluginsManager, &PluginsManager::tryLoadPlugin);
+ if(!connect(&cliParser, &CliParser::tryLoadPlugin, PluginsManager::pluginsManager, &PluginsManager::tryLoadPlugin))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
#endif
copyMoveEventIdIndex=0;
backgroundIcon=NULL;
@@ -73,33 +108,33 @@ EventDispatcher::EventDispatcher()
#endif
copyEngineList=new CopyEngineManager(&optionDialog);
core=new Core(copyEngineList);
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
//show the ultracopier information
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Windows version: %1").arg(GetOSDisplayString()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Windows version: "+GetOSDisplayString());
#endif
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("ULTRACOPIER_VERSION: ")+ULTRACOPIER_VERSION);
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Qt version: %1 (%2)").arg(qVersion()).arg(QT_VERSION));
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("ULTRACOPIER_PLATFORM_NAME: ")+ULTRACOPIER_PLATFORM_NAME);
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Application path: %1 (%2)").arg(QCoreApplication::applicationFilePath()).arg(QCoreApplication::applicationPid()));
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,COMPILERINFO);
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Local socket: ")+ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME));
- #ifdef ULTRACOPIER_CGMINER
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("With cgminer"));
+ #ifdef __STDC_VERSION__
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"__STDC_VERSION__: "+std::to_string(__STDC_VERSION__));
#endif
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("ULTRACOPIER_VERSION: ")+ULTRACOPIER_VERSION);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("Qt version: ")+qVersion()+" "+std::to_string(QT_VERSION));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("ULTRACOPIER_PLATFORM_NAME: ")+ULTRACOPIER_PLATFORM_NAME.toStdString());
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Application path: "+QCoreApplication::applicationFilePath().toStdString()+" "+std::to_string(QCoreApplication::applicationPid()));
+ //ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,COMPILERINFO);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Local socket: "+ExtraSocket::pathSocket(ULTRACOPIER_SOCKETNAME));
#if defined(ULTRACOPIER_DEBUG) && defined(ULTRACOPIER_PLUGIN_ALL_IN_ONE)
- #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Version as all in one"));
- QObjectList objectList=QPluginLoader::staticInstances();
- int index=0;
- while(index<objectList.size())
- {
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("static plugin: %1").arg(objectList.at(index)->metaObject()->className()));
- index++;
- }
- #else
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("Version as all in one, direct"));
- #endif
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Version as all in one");
+ QObjectList objectList=QPluginLoader::staticInstances();
+ int index=0;
+ while(index<objectList.size())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"static plugin: "+objectList.at(index)->metaObject()->className().toStdString());
+ index++;
+ }
+ #else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Version as all in one, direct");
+ #endif
#endif
{
@@ -107,11 +142,11 @@ EventDispatcher::EventDispatcher()
int index=0;
while(index<mountedVolumesList.size())
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("mountSysPoint: %1").arg(mountedVolumesList.at(index).rootPath()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"mountSysPoint: "+mountedVolumesList.at(index).rootPath().toStdString());
index++;
}
if(mountedVolumesList.isEmpty())
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QStringLiteral("mountSysPoint is empty"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"mountSysPoint is empty");
}
//To lunch some initialization after QApplication::exec() to quit eventually
@@ -119,17 +154,17 @@ EventDispatcher::EventDispatcher()
lunchInitFunction.setSingleShot(true);
connect(&lunchInitFunction,&QTimer::timeout,this,&EventDispatcher::initFunction,Qt::QueuedConnection);
lunchInitFunction.start();
- if(OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("Last_version_used"))!=QVariant(QStringLiteral("na")) && OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("Last_version_used"))!=QVariant(ULTRACOPIER_VERSION))
+ if(OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!="na" && OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!=ULTRACOPIER_VERSION)
{
//then ultracopier have been updated
}
- OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("Last_version_used"),QVariant(ULTRACOPIER_VERSION));
- int a=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen")).toInt();
- if(a<0 || a>2)
- OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("ActionOnManualOpen"),QVariant(1));
- a=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen")).toInt();
- if(a<0 || a>5)
- OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("GroupWindowWhen"),QVariant(0));
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","Last_version_used",ULTRACOPIER_VERSION);
+ unsigned int a=stringtouint32(OptionEngine::optionEngine->getOptionValue("Ultracopier","ActionOnManualOpen"));
+ if(a>2)
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","ActionOnManualOpen","1");
+ a=stringtouint32(OptionEngine::optionEngine->getOptionValue("Ultracopier","GroupWindowWhen"));
+ if(a>5)
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","GroupWindowWhen","0");
#ifdef ULTRACOPIER_VERSION_ULTIMATE
#ifdef ULTRACOPIER_ILLEGAL
@@ -141,8 +176,8 @@ EventDispatcher::EventDispatcher()
{
while(1)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("ultimate key"));
- QString key=OptionEngine::optionEngine->getOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("key")).toString();
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ultimate key");
+ QString key=QString::fromStdString(OptionEngine::optionEngine->getOptionValue("Ultracopier","key"));
if(!key.isEmpty())
{
QCryptographicHash hash(QCryptographicHash::Sha224);
@@ -166,7 +201,7 @@ EventDispatcher::EventDispatcher()
const QByteArray &result=hash.result();
if(!result.isEmpty() && result.at(0)==0x00 && result.at(1)==0x00)
{
- OptionEngine::optionEngine->setOptionValue(QStringLiteral("Ultracopier"),QStringLiteral("key"),key);
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","key",key.toStdString());
break;
}
}
@@ -218,7 +253,7 @@ bool EventDispatcher::shouldBeClosed()
/// \brief Quit ultracopier
void EventDispatcher::quit()
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("Will quit ultracopier"));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Will quit ultracopier");
//disconnect(QCoreApplication::instance(),SIGNAL(aboutToQuit()),this,SLOT(quit()));
QCoreApplication::exit();
}
@@ -232,12 +267,36 @@ void EventDispatcher::initFunction()
return;
}
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Initialize the variable of event loop");
- connect(copyServer, &CopyListener::newCopyWithoutDestination, core, &Core::newCopyWithoutDestination,Qt::DirectConnection);
- connect(copyServer, &CopyListener::newCopy, core, &Core::newCopy,Qt::DirectConnection);
- connect(copyServer, &CopyListener::newMoveWithoutDestination, core, &Core::newMoveWithoutDestination,Qt::DirectConnection);
- connect(copyServer, &CopyListener::newMove, core, &Core::newMove,Qt::DirectConnection);
- connect(core, &Core::copyFinished, copyServer, &CopyListener::copyFinished,Qt::DirectConnection);
- connect(core, &Core::copyCanceled, copyServer, &CopyListener::copyCanceled,Qt::DirectConnection);
+ if(!connect(copyServer, &CopyListener::newCopyWithoutDestination, core, &Core::newCopyWithoutDestination,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(copyServer, &CopyListener::newCopy, core, &Core::newCopy,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(copyServer, &CopyListener::newMoveWithoutDestination, core, &Core::newMoveWithoutDestination,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(copyServer, &CopyListener::newMove, core, &Core::newMove,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(core, &Core::copyFinished, copyServer, &CopyListener::copyFinished,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(core, &Core::copyCanceled, copyServer, &CopyListener::copyCanceled,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
if(localListener.tryConnect())
{
stopIt=true;
@@ -252,43 +311,105 @@ void EventDispatcher::initFunction()
//connect the slot
//quit is for this object
// connect(core, &Core::newCanDoOnlyCopy, backgroundIcon, &SystrayIcon::newCanDoOnlyCopy,Qt::DirectConnection);
- connect(backgroundIcon, &SystrayIcon::quit,this,&EventDispatcher::quit);
+ if(!connect(backgroundIcon, &SystrayIcon::quit,this,&EventDispatcher::quit))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
//show option is for OptionEngine object
- connect(backgroundIcon, &SystrayIcon::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection);
- connect(&cliParser, &CliParser::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection);
- connect(copyServer, &CopyListener::listenerReady, backgroundIcon, &SystrayIcon::listenerReady,Qt::DirectConnection);
- connect(copyServer, &CopyListener::pluginLoaderReady, backgroundIcon, &SystrayIcon::pluginLoaderReady,Qt::DirectConnection);
- connect(backgroundIcon, &SystrayIcon::tryCatchCopy, copyServer, &CopyListener::listen,Qt::DirectConnection);
- connect(backgroundIcon, &SystrayIcon::tryUncatchCopy, copyServer, &CopyListener::close,Qt::DirectConnection);
- if(OptionEngine::optionEngine->getOptionValue("CopyListener","CatchCopyAsDefault").toBool())
+ if(!connect(backgroundIcon, &SystrayIcon::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(&cliParser, &CliParser::showOptions, &optionDialog, &OptionDialog::show,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(copyServer, &CopyListener::listenerReady, backgroundIcon, &SystrayIcon::listenerReady,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(copyServer, &CopyListener::pluginLoaderReady, backgroundIcon, &SystrayIcon::pluginLoaderReady,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(backgroundIcon, &SystrayIcon::tryCatchCopy, copyServer, &CopyListener::listen,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(backgroundIcon, &SystrayIcon::tryUncatchCopy, copyServer, &CopyListener::close,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(stringtobool(OptionEngine::optionEngine->getOptionValue("CopyListener","CatchCopyAsDefault")))
copyServer->listen();
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyServer.oneListenerIsLoaded(): "+QString::number(copyServer->oneListenerIsLoaded()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"copyServer.oneListenerIsLoaded(): "+std::to_string(copyServer->oneListenerIsLoaded()));
//backgroundIcon->readyToListen(copyServer.oneListenerIsLoaded());
#ifdef ULTRACOPIER_DEBUG
- connect(backgroundIcon, &SystrayIcon::saveBugReport, DebugEngine::debugEngine, &DebugEngine::saveBugReport,Qt::QueuedConnection);
+ if(!connect(backgroundIcon, &SystrayIcon::saveBugReport, DebugEngine::debugEngine, &DebugEngine::saveBugReport,Qt::QueuedConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
#endif
- connect(backgroundIcon, &SystrayIcon::addWindowCopyMove, core, &Core::addWindowCopyMove,Qt::DirectConnection);
- connect(backgroundIcon, &SystrayIcon::addWindowTransfer, core, &Core::addWindowTransfer,Qt::DirectConnection);
- connect(copyEngineList, &CopyEngineManager::addCopyEngine, backgroundIcon, &SystrayIcon::addCopyEngine,Qt::DirectConnection);
- connect(copyEngineList, &CopyEngineManager::removeCopyEngine, backgroundIcon, &SystrayIcon::removeCopyEngine,Qt::DirectConnection);
+ if(!connect(backgroundIcon, &SystrayIcon::addWindowCopyMove, core, &Core::addWindowCopyMove,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(backgroundIcon, &SystrayIcon::addWindowTransfer, core, &Core::addWindowTransfer,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(copyEngineList, &CopyEngineManager::addCopyEngine, backgroundIcon, &SystrayIcon::addCopyEngine,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
+ if(!connect(copyEngineList, &CopyEngineManager::removeCopyEngine, backgroundIcon, &SystrayIcon::removeCopyEngine,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
#ifdef ULTRACOPIER_INTERNET_SUPPORT
- connect(&internetUpdater,&InternetUpdater::newUpdate, backgroundIcon, &SystrayIcon::newUpdate);
+ if(!connect(&internetUpdater,&InternetUpdater::newUpdate, backgroundIcon, &SystrayIcon::newUpdate))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
#endif
copyEngineList->setIsConnected();
copyServer->resendState();
+
+ connect(&cliParser, &CliParser::showSystrayMessage, backgroundIcon,&SystrayIcon::showSystrayMessage,Qt::QueuedConnection);
}
//conntect the last chance signal before quit
- connect(QCoreApplication::instance(),&QCoreApplication::aboutToQuit,this,&EventDispatcher::quit,Qt::DirectConnection);
+ if(!connect(QCoreApplication::instance(),&QCoreApplication::aboutToQuit,this,&EventDispatcher::quit,Qt::DirectConnection))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
//connect the slot for the help dialog
- connect(backgroundIcon,&SystrayIcon::showHelp,&theHelp,&HelpDialog::show);
+ if(!connect(backgroundIcon,&SystrayIcon::showHelp,&theHelp,&HelpDialog::show))
+ {
+ std::cerr << "connect error at " << __FILE__ << ":" << std::to_string(__LINE__) << std::endl;
+ abort();
+ }
#ifdef ULTRACOPIER_DEBUG
DebugModel::debugModel->setupTheTimer();
#endif
}
#ifdef Q_OS_WIN32
-QString EventDispatcher::GetOSDisplayString()
+std::string EventDispatcher::GetOSDisplayString()
{
QString Os;
OSVERSIONINFOEX osvi;
@@ -304,8 +425,8 @@ QString EventDispatcher::GetOSDisplayString()
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
- if(bOsVersionInfoEx == NULL)
- return QStringLiteral("Os detection blocked");
+ if(bOsVersionInfoEx == 0)
+ return "Os detection blocked";
// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
@@ -501,12 +622,12 @@ QString EventDispatcher::GetOSDisplayString()
Os+=QStringLiteral("Windows (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
else Os+=QStringLiteral("Windows Server (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
}
- return Os;
+ return Os.toStdString();
}
#endif
#ifdef Q_OS_MAC
-QString EventDispatcher::GetOSDisplayString()
+std::string EventDispatcher::GetOSDisplayString()
{
QStringList key;
QStringList string;
@@ -520,12 +641,12 @@ QString EventDispatcher::GetOSDisplayString()
int errorColumn;
QDomDocument domDocument;
if (!domDocument.setContent(content, false, &errorStr,&errorLine,&errorColumn))
- return QStringLiteral("Mac OS X");
+ return "Mac OS X";
else
{
QDomElement root = domDocument.documentElement();
if(root.tagName()!=QStringLiteral("plist"))
- return QStringLiteral("Mac OS X");
+ return "Mac OS X";
else
{
if(root.isElement())
@@ -541,7 +662,7 @@ QString EventDispatcher::GetOSDisplayString()
if(SubChild2.isElement())
key << SubChild2.text();
else
- return QStringLiteral("Mac OS X");
+ return "Mac OS X";
SubChild2 = SubChild2.nextSiblingElement(QStringLiteral("key"));
}
SubChild2=SubChild.firstChildElement(QStringLiteral("string"));
@@ -550,29 +671,29 @@ QString EventDispatcher::GetOSDisplayString()
if(SubChild2.isElement())
string << SubChild2.text();
else
- return QStringLiteral("Mac OS X");
+ return "Mac OS X";
SubChild2 = SubChild2.nextSiblingElement(QStringLiteral("string"));
}
}
else
- return QStringLiteral("Mac OS X");
+ return "Mac OS X";
SubChild = SubChild.nextSiblingElement(QStringLiteral("property"));
}
}
else
- return QStringLiteral("Mac OS X");
+ return "Mac OS X";
}
}
}
if(key.size()!=string.size())
- return QStringLiteral("Mac OS X");
+ return "Mac OS X";
int index=0;
while(index<key.size())
{
if(key.at(index)==QStringLiteral("ProductVersion"))
- return QStringLiteral("Mac OS X ")+string.at(index);
+ return "Mac OS X "+string.at(index).toStdString();
index++;
}
- return QStringLiteral("Mac OS X");
+ return "Mac OS X";
}
#endif