Commit b37aa1fc authored by Edric Milaret's avatar Edric Milaret

linux: allow linux compilation

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