diff --git a/RingWinClient.pro b/RingWinClient.pro index 2be72d92db262f100cef5aa33147e080c9140cf3..84232528723f98616215328db11e1a3723944755 100644 --- a/RingWinClient.pro +++ b/RingWinClient.pro @@ -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 diff --git a/callwidget.cpp b/callwidget.cpp index 4e444c090accd69b133966bff50a996744668aa3..3203714fca0cbc19ba1c5245d33f430f6276a7c7 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -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(); } } diff --git a/videowidget.h b/videowidget.h index 04564b7a2972e9d0e2bb41aafa7d464a6d647381..40ab2f422d15b3a33ff716a19bee468b9f428864 100644 --- a/videowidget.h +++ b/videowidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * 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 * diff --git a/wizarddialog.cpp b/wizarddialog.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bacd95972e5469de5f3f06620c4b3e90761bc4ee --- /dev/null +++ b/wizarddialog.cpp @@ -0,0 +1,37 @@ +#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()); +} diff --git a/wizarddialog.h b/wizarddialog.h new file mode 100644 index 0000000000000000000000000000000000000000..15004e77e771428b6449bba06894634df5437c78 --- /dev/null +++ b/wizarddialog.h @@ -0,0 +1,27 @@ +#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 diff --git a/wizarddialog.ui b/wizarddialog.ui new file mode 100644 index 0000000000000000000000000000000000000000..0ed6d260dce4afa9920eb36954abe693926aa19d --- /dev/null +++ b/wizarddialog.ui @@ -0,0 +1,509 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>WizardDialog</class> + <widget class="QDialog" name="WizardDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>462</width> + <height>336</height> + </rect> + </property> + <property name="palette"> + <palette> + <active> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QLabel" name="logo"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap>:/images/logo-ring-standard-coul.png</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Greetings ! Please enter a username</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="usernameEdit"> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>WizardDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>WizardDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui>