Commit 559bda52 authored by Edric Milaret's avatar Edric Milaret Committed by Guillaume Roguez

windows: add wizard at first startup

Refs #71987

Change-Id: I051c384c41b08af3fd65b83da25861d2fa52895d
parent 4bba46d1
......@@ -33,7 +33,8 @@ SOURCES += main.cpp\
pivotviewwidget.cpp \
pivotcontrol.cpp \
videowidget.cpp \
utils.cpp
utils.cpp \
wizarddialog.cpp
HEADERS += mainwindow.h \
callwidget.h \
......@@ -48,7 +49,8 @@ HEADERS += mainwindow.h \
pivotviewwidget.h \
pivotcontrol.h \
videowidget.h \
utils.h
utils.h \
wizarddialog.h
FORMS += mainwindow.ui \
callwidget.ui \
......@@ -57,7 +59,8 @@ FORMS += mainwindow.ui \
mainbar.ui \
accountdetails.ui \
aboutdialog.ui \
pivotviewwidget.ui
pivotviewwidget.ui \
wizarddialog.ui
win32: LIBS += -lole32 -luuid -lshlwapi
......
......@@ -27,7 +27,7 @@
#include "fallbackpersoncollection.h"
#include "accountmodel.h"
#include "utils.h"
#include "wizarddialog.h"
CallWidget::CallWidget(QWidget *parent) :
NavWidget(Main ,parent),
......@@ -76,6 +76,7 @@ CallWidget::~CallWidget()
void
CallWidget::findRingAccount() {
auto a_count = AccountModel::instance()->rowCount();
auto found = false;
for (int i = 0; i < a_count; ++i) {
......@@ -90,9 +91,9 @@ CallWidget::findRingAccount() {
}
}
if (!found) {
AccountModel::instance()->add("RING", Account::Protocol::RING);
AccountModel::instance()->save();
Utils::CreateStartupLink();
WizardDialog *wizardDialog = new WizardDialog();
wizardDialog->exec();
delete wizardDialog;
findRingAccount();
}
}
......
/***************************************************************************
* Copyright (C) 2011-2015 by Savoir-Faire Linux *
* Copyright (C) 2015 by Savoir-Faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* *
* This program is free software; you can redistribute it and/or modify *
......
#include "wizarddialog.h"
#include "ui_wizarddialog.h"
#include "accountmodel.h"
#include "utils.h"
WizardDialog::WizardDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::WizardDialog)
{
ui->setupUi(this);
this->setWindowFlags(Qt::CustomizeWindowHint);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setFixedSize(this->width(),this->height());
ui->buttonBox->setEnabled(false);
}
WizardDialog::~WizardDialog()
{
delete ui;
}
void
WizardDialog::on_buttonBox_accepted()
{
AccountModel::instance()->add(ui->usernameEdit->text(), Account::Protocol::RING);
AccountModel::instance()->save();
Utils::CreateStartupLink();
}
void
WizardDialog::on_usernameEdit_textChanged(const QString &arg1)
{
ui->buttonBox->setEnabled(!arg1.isEmpty());
}
#ifndef WIZARDDIALOG_H
#define WIZARDDIALOG_H
#include <QDialog>
namespace Ui {
class WizardDialog;
}
class WizardDialog : public QDialog
{
Q_OBJECT
public:
explicit WizardDialog(QWidget *parent = 0);
~WizardDialog();
private slots:
void on_buttonBox_accepted();
void on_usernameEdit_textChanged(const QString &arg1);
private:
Ui::WizardDialog *ui;
};
#endif // WIZARDDIALOG_H
This diff is collapsed.
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