Commit 3658736c authored by Edric Milaret's avatar Edric Milaret Committed by Nicolas Jager

wizard: automatic alias suggestion

- Also fix some code style issue
- Change Q_OS_WIN32 macro to more general Q_OS_WIN

Change-Id: I54c646b52e07ffee7ad7f078528b106e12ff32f2
Tuleap: #334
parent 31484f1a
...@@ -123,7 +123,7 @@ AccountDetails::setAccount(Account* currentAccount) { ...@@ -123,7 +123,7 @@ AccountDetails::setAccount(Account* currentAccount) {
if (not currentAccount_->tlsPrivateKey().isEmpty()) if (not currentAccount_->tlsPrivateKey().isEmpty())
ui->lrcfg_tlsPrivateKeyCertificate->setText(currentAccount_->tlsPrivateKey()); ui->lrcfg_tlsPrivateKeyCertificate->setText(currentAccount_->tlsPrivateKey());
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
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_->setTlsPrivateKey; certMap_[ui->lrcfg_tlsPrivateKeyCertificate->objectName()] = &currentAccount_->setTlsPrivateKey;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <QLibraryInfo> #include <QLibraryInfo>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>
#endif #endif
...@@ -45,7 +45,7 @@ REGISTER_MEDIA(); ...@@ -45,7 +45,7 @@ REGISTER_MEDIA();
void void
Console() Console()
{ {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
AllocConsole(); AllocConsole();
freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr); freopen("CONOUT$", "w", stderr);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "media/text.h" #include "media/text.h"
#include "media/textrecording.h" #include "media/textrecording.h"
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>
#include <QWinThumbnailToolBar> #include <QWinThumbnailToolBar>
#include <QWinThumbnailToolButton> #include <QWinThumbnailToolButton>
...@@ -40,9 +40,7 @@ ...@@ -40,9 +40,7 @@
#include "callmodel.h" #include "callmodel.h"
#include <windows.h> MainWindow::MainWindow(QWidget* parent) :
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::MainWindow), ui(new Ui::MainWindow),
mwToolBar_(new MainWindowToolBar) mwToolBar_(new MainWindowToolBar)
...@@ -56,7 +54,7 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -56,7 +54,7 @@ MainWindow::MainWindow(QWidget *parent) :
GlobalSystemTray& sysIcon = GlobalSystemTray::instance(); GlobalSystemTray& sysIcon = GlobalSystemTray::instance();
sysIcon.setIcon(icon); sysIcon.setIcon(icon);
QMenu *menu = new QMenu(); QMenu* menu = new QMenu();
auto configAction = new QAction("Configuration", this); auto configAction = new QAction("Configuration", this);
menu->addAction(configAction); menu->addAction(configAction);
...@@ -75,7 +73,7 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -75,7 +73,7 @@ MainWindow::MainWindow(QWidget *parent) :
navStack_->onNavigationRequested(ScreenEnum::ConfScreen); navStack_->onNavigationRequested(ScreenEnum::ConfScreen);
}); });
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
HMENU sysMenu = ::GetSystemMenu((HWND) winId(), FALSE); HMENU sysMenu = ::GetSystemMenu((HWND) winId(), FALSE);
if (sysMenu != NULL) { if (sysMenu != NULL) {
::AppendMenuA(sysMenu, MF_SEPARATOR, 0, 0); ::AppendMenuA(sysMenu, MF_SEPARATOR, 0, 0);
...@@ -123,7 +121,7 @@ MainWindow::~MainWindow() ...@@ -123,7 +121,7 @@ MainWindow::~MainWindow()
} }
void void
MainWindow::onRingEvent(const QString &uri) MainWindow::onRingEvent(const QString& uri)
{ {
this->showNormal(); this->showNormal();
if (not uri.isEmpty()) { if (not uri.isEmpty()) {
...@@ -134,12 +132,12 @@ MainWindow::onRingEvent(const QString &uri) ...@@ -134,12 +132,12 @@ MainWindow::onRingEvent(const QString &uri)
} }
bool bool
MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) MainWindow::nativeEvent(const QByteArray& eventType, void* message, long* result)
{ {
Q_UNUSED(eventType) Q_UNUSED(eventType)
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
MSG *msg = (MSG*) message; MSG* msg = (MSG*) message;
if (msg->message == WM_SYSCOMMAND) { if (msg->message == WM_SYSCOMMAND) {
if ((msg->wParam & 0xfff0) == IDM_ABOUTBOX) { if ((msg->wParam & 0xfff0) == IDM_ABOUTBOX) {
...@@ -151,6 +149,9 @@ MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result ...@@ -151,6 +149,9 @@ MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result
return true; return true;
} }
} }
#else
Q_UNUSED(message)
Q_UNUSED(result)
#endif #endif
return false; return false;
} }
...@@ -163,7 +164,7 @@ MainWindow::trayActivated(QSystemTrayIcon::ActivationReason reason) ...@@ -163,7 +164,7 @@ MainWindow::trayActivated(QSystemTrayIcon::ActivationReason reason)
} }
void void
MainWindow::onIncomingCall(Call *call) MainWindow::onIncomingCall(Call* call)
{ {
Q_UNUSED(call); Q_UNUSED(call);
QWidget::showNormal(); QWidget::showNormal();
...@@ -172,10 +173,10 @@ MainWindow::onIncomingCall(Call *call) ...@@ -172,10 +173,10 @@ MainWindow::onIncomingCall(Call *call)
void void
MainWindow::createThumbBar() MainWindow::createThumbBar()
{ {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
QWinThumbnailToolBar *thumbbar = new QWinThumbnailToolBar(this); QWinThumbnailToolBar* thumbbar = new QWinThumbnailToolBar(this);
thumbbar->setWindow(this->windowHandle()); thumbbar->setWindow(this->windowHandle());
QWinThumbnailToolButton *settings = new QWinThumbnailToolButton(thumbbar); QWinThumbnailToolButton* settings = new QWinThumbnailToolButton(thumbbar);
settings->setToolTip("Settings"); settings->setToolTip("Settings");
QIcon icon(":/images/settings.png"); QIcon icon(":/images/settings.png");
settings->setIcon(icon); settings->setIcon(icon);
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "utils.h" #include "utils.h"
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
#include <lmcons.h> #include <lmcons.h>
#include <shobjidl.h> #include <shobjidl.h>
#include <shlguid.h> #include <shlguid.h>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
bool bool
Utils::CreateStartupLink() Utils::CreateStartupLink()
{ {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
TCHAR szPath[MAX_PATH]; TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, MAX_PATH); GetModuleFileName(NULL, szPath, MAX_PATH);
...@@ -49,7 +49,7 @@ Utils::CreateStartupLink() ...@@ -49,7 +49,7 @@ Utils::CreateStartupLink()
bool bool
Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) { Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
HRESULT hres; HRESULT hres;
IShellLink* psl; IShellLink* psl;
...@@ -71,13 +71,15 @@ Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) { ...@@ -71,13 +71,15 @@ Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) {
} }
return hres; return hres;
#else #else
Q_UNUSED(lpszPathObj)
Q_UNUSED(lpszPathLink)
return true; return true;
#endif #endif
} }
void void
Utils::DeleteStartupLink() { Utils::DeleteStartupLink() {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
TCHAR startupPath[MAX_PATH]; TCHAR startupPath[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath); SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath);
...@@ -90,7 +92,7 @@ Utils::DeleteStartupLink() { ...@@ -90,7 +92,7 @@ Utils::DeleteStartupLink() {
bool bool
Utils::CheckStartupLink() { Utils::CheckStartupLink() {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
TCHAR startupPath[MAX_PATH]; TCHAR startupPath[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath); SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, startupPath);
...@@ -104,7 +106,7 @@ Utils::CheckStartupLink() { ...@@ -104,7 +106,7 @@ Utils::CheckStartupLink() {
QString QString
Utils::GetRingtonePath() { Utils::GetRingtonePath() {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
TCHAR workingDirectory[MAX_PATH]; TCHAR workingDirectory[MAX_PATH];
GetCurrentDirectory(MAX_PATH, workingDirectory); GetCurrentDirectory(MAX_PATH, workingDirectory);
...@@ -119,7 +121,7 @@ Utils::GetRingtonePath() { ...@@ -119,7 +121,7 @@ Utils::GetRingtonePath() {
QString QString
Utils::GenGUID() { Utils::GenGUID() {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
GUID gidReference; GUID gidReference;
wchar_t *str; wchar_t *str;
HRESULT hCreateGuid = CoCreateGuid(&gidReference); HRESULT hCreateGuid = CoCreateGuid(&gidReference);
...@@ -129,7 +131,7 @@ Utils::GenGUID() { ...@@ -129,7 +131,7 @@ Utils::GenGUID() {
return gStr.remove("{").remove("}").toLower(); return gStr.remove("{").remove("}").toLower();
} }
else else
return QString(""); return QString();
#else #else
return QString(""); return QString("");
#endif #endif
...@@ -137,13 +139,25 @@ Utils::GenGUID() { ...@@ -137,13 +139,25 @@ Utils::GenGUID() {
QString QString
Utils::GetISODate() { Utils::GetISODate() {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
SYSTEMTIME lt; SYSTEMTIME lt;
GetSystemTime(&lt); GetSystemTime(&lt);
return QString("%1-%2-%3T%4:%5:%6Z").arg(lt.wYear).arg(lt.wMonth,2,10,QChar('0')).arg(lt.wDay,2,10,QChar('0')) return QString("%1-%2-%3T%4:%5:%6Z").arg(lt.wYear).arg(lt.wMonth,2,10,QChar('0')).arg(lt.wDay,2,10,QChar('0'))
.arg(lt.wHour,2,10,QChar('0')).arg(lt.wMinute,2,10,QChar('0')).arg(lt.wSecond,2,10,QChar('0')); .arg(lt.wHour,2,10,QChar('0')).arg(lt.wMinute,2,10,QChar('0')).arg(lt.wSecond,2,10,QChar('0'));
#else #else
return QString(""); return QString();
#endif
}
QString
Utils::GetCurrentUserName() {
#ifdef Q_OS_WIN
wchar_t username[UNLEN+1];
DWORD username_len = UNLEN+1;
GetUserName(username, &username_len);
return QString::fromWCharArray(username, username_len);
#else
return QString();
#endif #endif
} }
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
//Needed for OS detection //Needed for OS detection
#include <QtGlobal> #include <QtGlobal>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>
#else //LINUX #else //LINUX
#define LPCWSTR char* #define LPCWSTR char*
...@@ -40,5 +40,6 @@ public: ...@@ -40,5 +40,6 @@ public:
static QString GetRingtonePath(); static QString GetRingtonePath();
static QString GenGUID(); static QString GenGUID();
static QString GetISODate(); static QString GetISODate();
static QString GetCurrentUserName();
}; };
...@@ -39,6 +39,8 @@ WizardDialog::WizardDialog(QWidget *parent) : ...@@ -39,6 +39,8 @@ WizardDialog::WizardDialog(QWidget *parent) :
QPixmap logo(":/images/logo-ring-standard-coul.png"); QPixmap logo(":/images/logo-ring-standard-coul.png");
ui->ringLogo->setPixmap(logo.scaledToHeight(100, Qt::SmoothTransformation)); ui->ringLogo->setPixmap(logo.scaledToHeight(100, Qt::SmoothTransformation));
ui->ringLogo->setAlignment(Qt::AlignHCenter); ui->ringLogo->setAlignment(Qt::AlignHCenter);
ui->usernameEdit->setText(Utils::GetCurrentUserName());
} }
WizardDialog::~WizardDialog() WizardDialog::~WizardDialog()
......
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