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