Skip to content
Snippets Groups Projects
Commit b37aa1fc authored by Edric Milaret's avatar Edric Milaret
Browse files

linux: allow linux compilation

Change-Id: I5c63bd19b403973d26343cbc7b47fac38347c1c8
parent 77dd698d
No related branches found
No related tags found
No related merge requests found
...@@ -201,9 +201,11 @@ AccountDetails::setAccount(Account* currentAccount) { ...@@ -201,9 +201,11 @@ AccountDetails::setAccount(Account* currentAccount) {
if (currentAccount_->tlsPrivateKeyCertificate()) if (currentAccount_->tlsPrivateKeyCertificate())
ui->lrcfg_tlsPrivateKeyCertificate->setText(currentAccount_->tlsPrivateKeyCertificate()->path().fileName()); ui->lrcfg_tlsPrivateKeyCertificate->setText(currentAccount_->tlsPrivateKeyCertificate()->path().fileName());
#ifdef Q_OS_WIN32
certMap_[ui->lrcfg_tlsCaListCertificate->objectName()] = &currentAccount_->setTlsCaListCertificate; certMap_[ui->lrcfg_tlsCaListCertificate->objectName()] = &currentAccount_->setTlsCaListCertificate;
certMap_[ui->lrcfg_tlsCertificate->objectName()] = &currentAccount_->setTlsCertificate; certMap_[ui->lrcfg_tlsCertificate->objectName()] = &currentAccount_->setTlsCertificate;
certMap_[ui->lrcfg_tlsPrivateKeyCertificate->objectName()] = &currentAccount_->setTlsPrivateKeyCertificate; certMap_[ui->lrcfg_tlsPrivateKeyCertificate->objectName()] = &currentAccount_->setTlsPrivateKeyCertificate;
#endif
ui->srtpEnabled->disconnect(); ui->srtpEnabled->disconnect();
connect(ui->srtpEnabled, &QCheckBox::toggled, [=](bool checked) { connect(ui->srtpEnabled, &QCheckBox::toggled, [=](bool checked) {
......
...@@ -29,13 +29,16 @@ ...@@ -29,13 +29,16 @@
#include <QThread> #include <QThread>
#ifdef Q_OS_WIN32
#include <windows.h> #include <windows.h>
#endif
REGISTER_MEDIA(); REGISTER_MEDIA();
void void
Console() Console()
{ {
#ifdef Q_OS_WIN32
AllocConsole(); AllocConsole();
freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr); freopen("CONOUT$", "w", stderr);
...@@ -46,6 +49,7 @@ Console() ...@@ -46,6 +49,7 @@ Console()
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coordInfo); SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coordInfo);
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE),ENABLE_QUICK_EDIT_MODE| ENABLE_EXTENDED_FLAGS); SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE),ENABLE_QUICK_EDIT_MODE| ENABLE_EXTENDED_FLAGS);
#endif
} }
int int
......
...@@ -18,9 +18,17 @@ ...@@ -18,9 +18,17 @@
#include "utils.h" #include "utils.h"
#ifdef Q_OS_WIN32
#include <lmcons.h>
#include <shobjidl.h>
#include <shlguid.h>
#include <shlobj.h>
#include <shlwapi.h>
#endif
bool bool
Utils::CreateStartupLink() { Utils::CreateStartupLink() {
#ifdef Q_OS_WIN32
TCHAR szPath[MAX_PATH]; TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, MAX_PATH); GetModuleFileName(NULL, szPath, MAX_PATH);
...@@ -33,10 +41,14 @@ Utils::CreateStartupLink() { ...@@ -33,10 +41,14 @@ Utils::CreateStartupLink() {
linkPath += TEXT("\\Ring.lnk"); linkPath += TEXT("\\Ring.lnk");
return Utils::CreateLink(programPath.c_str(), linkPath.c_str()); return Utils::CreateLink(programPath.c_str(), linkPath.c_str());
#else
return true;
#endif
} }
bool bool
Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) { Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) {
#ifdef Q_OS_WIN32
HRESULT hres; HRESULT hres;
IShellLink* psl; IShellLink* psl;
...@@ -57,10 +69,14 @@ Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) { ...@@ -57,10 +69,14 @@ Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) {
psl->Release(); psl->Release();
} }
return hres; return hres;
#else
return true;
#endif
} }
void void
Utils::DeleteStartupLink() { Utils::DeleteStartupLink() {
#ifdef Q_OS_WIN32
TCHAR startupPath[MAX_PATH]; TCHAR startupPath[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath); SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath);
...@@ -68,20 +84,26 @@ Utils::DeleteStartupLink() { ...@@ -68,20 +84,26 @@ Utils::DeleteStartupLink() {
linkPath += TEXT("\\Ring.lnk"); linkPath += TEXT("\\Ring.lnk");
DeleteFile(linkPath.c_str()); DeleteFile(linkPath.c_str());
#endif
} }
bool bool
Utils::CheckStartupLink() { Utils::CheckStartupLink() {
#ifdef Q_OS_WIN32
TCHAR startupPath[MAX_PATH]; TCHAR startupPath[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath); SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath);
std::wstring linkPath(startupPath); std::wstring linkPath(startupPath);
linkPath += TEXT("\\Ring.lnk"); linkPath += TEXT("\\Ring.lnk");
return PathFileExists(linkPath.c_str()); return PathFileExists(linkPath.c_str());
#else
return true;
#endif
} }
QString QString
Utils::GetRingtonePath() { Utils::GetRingtonePath() {
#ifdef Q_OS_WIN32
TCHAR workingDirectory[MAX_PATH]; TCHAR workingDirectory[MAX_PATH];
GetCurrentDirectory(MAX_PATH, workingDirectory); GetCurrentDirectory(MAX_PATH, workingDirectory);
...@@ -89,5 +111,8 @@ Utils::GetRingtonePath() { ...@@ -89,5 +111,8 @@ Utils::GetRingtonePath() {
ringtonePath += "\\ringtones\\konga.ul"; ringtonePath += "\\ringtones\\konga.ul";
return ringtonePath; return ringtonePath;
#else
return QString("/usr/local");
#endif
} }
...@@ -19,12 +19,14 @@ ...@@ -19,12 +19,14 @@
#ifndef UTILS_H #ifndef UTILS_H
#define UTILS_H #define UTILS_H
//Needed for OS detection
#include <QtGlobal>
#ifdef Q_OS_WIN32
#include <windows.h> #include <windows.h>
#include <lmcons.h> #else //LINUX
#include <shobjidl.h> #define LPCWSTR char*
#include <shlguid.h> #endif
#include <shlobj.h>
#include <shlwapi.h>
#include <string> #include <string>
#include <QString> #include <QString>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment