summaryrefslogtreecommitdiff
path: root/EventDispatcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'EventDispatcher.cpp')
-rwxr-xr-x[-rw-r--r--]EventDispatcher.cpp103
1 files changed, 22 insertions, 81 deletions
diff --git a/EventDispatcher.cpp b/EventDispatcher.cpp
index c3fc61f..1e37592 100644..100755
--- a/EventDispatcher.cpp
+++ b/EventDispatcher.cpp
@@ -28,8 +28,6 @@
#include <tchar.h>
#include <stdio.h>
#include <strsafe.h>
- typedef void (WINAPI *PGNSI) (LPSYSTEM_INFO);
- typedef BOOL (WINAPI *PGPI) (DWORD, DWORD, DWORD, DWORD, PDWORD);
#endif
#ifdef Q_OS_MAC
#include <QStringList>
@@ -51,6 +49,7 @@ EventDispatcher::EventDispatcher()
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>");
+ qRegisterMetaType<QLocalSocket::LocalSocketError >("QLocalSocket::LocalSocketError");
copyServer=new CopyListener(&optionDialog);
if(!connect(&localListener, &LocalListener::cli, &cliParser, &CliParser::cli,Qt::QueuedConnection))
@@ -113,7 +112,7 @@ EventDispatcher::EventDispatcher()
#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("ULTRACOPIER_VERSION: ")+FacilityEngine::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()));
@@ -139,7 +138,24 @@ EventDispatcher::EventDispatcher()
int index=0;
while(index<mountedVolumesList.size())
{
+ #ifdef Q_OS_WIN32
+ const int typeint=GetDriveTypeA(mountedVolumesList.at(index).rootPath().toStdString().c_str());
+ std::string type("Unknown type ("+std::to_string(typeint)+")");
+ switch(typeint)
+ {
+ case 0: type="Cannot be determined";break;
+ case 1: type="Invalid root path/Not available";break;
+ case 2: type="Removable";break;
+ case 3: type="Fixed";break;
+ case 4: type="Network";break;
+ case 5: type="CD-ROM";break;
+ case 6: type="RAMDISK";break;
+ default:break;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"mountSysPoint: "+mountedVolumesList.at(index).rootPath().toStdString()+" "+type);
+ #else
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"mountSysPoint: "+mountedVolumesList.at(index).rootPath().toStdString());
+ #endif
index++;
}
if(mountedVolumesList.isEmpty())
@@ -151,11 +167,11 @@ EventDispatcher::EventDispatcher()
lunchInitFunction.setSingleShot(true);
connect(&lunchInitFunction,&QTimer::timeout,this,&EventDispatcher::initFunction,Qt::QueuedConnection);
lunchInitFunction.start();
- if(OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!="na" && OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!=ULTRACOPIER_VERSION)
+ if(OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!="na" && OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!=FacilityEngine::version())
{
//then ultracopier have been updated
}
- OptionEngine::optionEngine->setOptionValue("Ultracopier","Last_version_used",ULTRACOPIER_VERSION);
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","Last_version_used",FacilityEngine::version());
unsigned int a=stringtouint32(OptionEngine::optionEngine->getOptionValue("Ultracopier","ActionOnManualOpen"));
if(a>2)
OptionEngine::optionEngine->setOptionValue("Ultracopier","ActionOnManualOpen","1");
@@ -393,10 +409,7 @@ std::string EventDispatcher::GetOSDisplayString()
QString Os;
OSVERSIONINFOEX osvi;
SYSTEM_INFO si;
- PGNSI pGNSI;
- PGPI pGPI;
BOOL bOsVersionInfoEx;
- DWORD dwType;
ZeroMemory(&si, sizeof(SYSTEM_INFO));
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
@@ -406,15 +419,7 @@ std::string EventDispatcher::GetOSDisplayString()
if(bOsVersionInfoEx == 0)
return "Os detection blocked";
-
- // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
-
- pGNSI = (PGNSI) GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")),
- "GetNativeSystemInfo");
- if(NULL != pGNSI)
- pGNSI(&si);
- else GetSystemInfo(&si);
+ GetNativeSystemInfo(&si);
if(VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion>4)
{
@@ -443,70 +448,6 @@ std::string EventDispatcher::GetOSDisplayString()
else Os+=QStringLiteral("Windows Server (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
break;
}
-
- pGPI = (PGPI) GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")),
- "GetProductInfo");
-
- pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
-
- switch(dwType)
- {
- case PRODUCT_ULTIMATE:
- Os+=QStringLiteral("Ultimate Edition");
- break;
- case PRODUCT_PROFESSIONAL:
- Os+=QStringLiteral("Professional");
- break;
- case PRODUCT_HOME_PREMIUM:
- Os+=QStringLiteral("Home Premium Edition");
- break;
- case PRODUCT_HOME_BASIC:
- Os+=QStringLiteral("Home Basic Edition");
- break;
- case PRODUCT_ENTERPRISE:
- Os+=QStringLiteral("Enterprise Edition");
- break;
- case PRODUCT_BUSINESS:
- Os+=QStringLiteral("Business Edition");
- break;
- case PRODUCT_STARTER:
- Os+=QStringLiteral("Starter Edition");
- break;
- case PRODUCT_CLUSTER_SERVER:
- Os+=QStringLiteral("Cluster Server Edition");
- break;
- case PRODUCT_DATACENTER_SERVER:
- Os+=QStringLiteral("Datacenter Edition");
- break;
- case PRODUCT_DATACENTER_SERVER_CORE:
- Os+=QStringLiteral("Datacenter Edition (core installation)");
- break;
- case PRODUCT_ENTERPRISE_SERVER:
- Os+=QStringLiteral("Enterprise Edition");
- break;
- case PRODUCT_ENTERPRISE_SERVER_CORE:
- Os+=QStringLiteral("Enterprise Edition (core installation)");
- break;
- case PRODUCT_ENTERPRISE_SERVER_IA64:
- Os+=QStringLiteral("Enterprise Edition for Itanium-based Systems");
- break;
- case PRODUCT_SMALLBUSINESS_SERVER:
- Os+=QStringLiteral("Small Business Server");
- break;
- case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
- Os+=QStringLiteral("Small Business Server Premium Edition");
- break;
- case PRODUCT_STANDARD_SERVER:
- Os+=QStringLiteral("Standard Edition");
- break;
- case PRODUCT_STANDARD_SERVER_CORE:
- Os+=QStringLiteral("Standard Edition (core installation)");
- break;
- case PRODUCT_WEB_SERVER:
- Os+=QStringLiteral("Web Server Edition");
- break;
- }
}
else if(osvi.dwMajorVersion==5)
{