Commit 4097d2f8 authored by Edric Milaret's avatar Edric Milaret

wizard: improve setup wizard

- Reduced overall size of the dialog
- Changed join the ring button to next
- Change style of the next button
- Allow user to create an account with 'Unknown' name
- Add a share button on main screen :
    This allow only to send the ringID in text form
    by mail, a real share callback to the system is
    impossible without being a native app.

Change-Id: I37235cd798b22ac4dd57b42b939f9e9541237dd6
Tuleap: #366
parent 9442a540
......@@ -335,7 +335,7 @@ CallWidget::findRingAccount()
}
if (!found) {
ui->ringIdLabel->setText(tr("NO RING ACCOUNT FOUND"));
WizardDialog *wizardDialog = new WizardDialog();
auto wizardDialog = new WizardDialog();
wizardDialog->exec();
delete wizardDialog;
}
......@@ -719,3 +719,9 @@ CallWidget::on_copyCMButton_clicked()
auto text = ui->contactMethodComboBox->currentText();
QApplication::clipboard()->setText(text);
}
void
CallWidget::on_shareButton_clicked()
{
Utils::InvokeMailto("Contact me on Ring", QStringLiteral("My RingId is : ") + ui->ringIdLabel->text());
}
......@@ -81,6 +81,7 @@ private slots:
void on_imBackButton_clicked();
void on_copyCMButton_clicked();
void on_smartList_clicked(const QModelIndex &index);
void on_shareButton_clicked();
private slots:
void callIncoming(Call* call);
......
......@@ -579,44 +579,125 @@
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="IdLabel" name="ringIdLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="lineWidth">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="topMargin">
<number>0</number>
</property>
<property name="text">
<string notr="true">id</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>5</number>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="IdLabel" name="ringIdLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string notr="true">id</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>5</number>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="shareButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Share your ring id</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/ic_share_white.png</normaloff>:/images/ic_share_white.png</iconset>
</property>
<property name="iconSize">
<size>
<width>30</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QLabel" name="label2">
......@@ -1398,6 +1479,7 @@
<height>0</height>
</size>
</property>
<zorder>stackedWidget</zorder>
</widget>
</item>
</layout>
......
......@@ -47,5 +47,6 @@
<file>images/ic_pause_white.svg</file>
<file>images/ic_content_copy_white.svg</file>
<file>images/ic_voicemail_white.svg</file>
<file>images/ic_share_white.png</file>
</qresource>
</RCC>
......@@ -130,17 +130,17 @@ QPushButton#hangupButton:pressed{
}
QPushButton#addToContactButton, QPushButton#imBackButton, QPushButton#copyCMButton{
QPushButton#addToContactButton, QPushButton#imBackButton, QPushButton#copyCMButton, QPushButton#shareButton{
background-color: #414141;
border-radius: 15px;
border:solid 1px;
}
QPushButton#imBackButton:hover, QPushButton#copyCMButton:hover{
QPushButton#imBackButton:hover, QPushButton#copyCMButton:hover, QPushButton#shareButton:hover{
background-color: #515151;
}
QPushButton#imBackButton:pressed, QPushButton#copyCMButton:pressed{
QPushButton#imBackButton:pressed, QPushButton#copyCMButton:pressed, QPushButton#shareButton:pressed{
background-color: #313131;
}
......@@ -178,5 +178,14 @@ QWidget#welcomePage, QWidget#messagingPage{
}
QPushButton#wizardButton{
background: transparent;
background-color: #3AC0D2;
border: 0px;
}
QPushButton#wizardButton:hover{
background-color: #4dc6d6;
}
QPushButton#wizardButton:pressed{
background-color: #34acbd;
}
......@@ -161,3 +161,12 @@ Utils::GetCurrentUserName() {
#endif
}
void
Utils::InvokeMailto(const QString& subject,
const QString& body,
const QString& attachement) {
auto addr = QString("mailto:?subject=%1&body=%2").arg(subject).arg(body);
if (not attachement.isEmpty())
addr += QString("&attachement=%1").arg(attachement);
ShellExecute(nullptr, L"open", addr.toStdWString().c_str(), NULL, NULL, SW_SHOWNORMAL);
}
......@@ -41,5 +41,6 @@ public:
static QString GenGUID();
static QString GetISODate();
static QString GetCurrentUserName();
static void InvokeMailto(const QString& subject, const QString& body, const QString& attachement = QString());
};
......@@ -32,12 +32,13 @@ WizardDialog::WizardDialog(QWidget *parent) :
{
ui->setupUi(this);
setFixedSize(this->width(),this->height());
Qt::WindowFlags flags = windowFlags();
flags = flags & (~Qt::WindowContextHelpButtonHint);
ui->wizardButton->setEnabled(false);
setWindowFlags(flags);
QPixmap logo(":/images/logo-ring-standard-coul.png");
ui->ringLogo->setPixmap(logo.scaledToHeight(100, Qt::SmoothTransformation));
ui->ringLogo->setPixmap(logo.scaledToHeight(65, Qt::SmoothTransformation));
ui->ringLogo->setAlignment(Qt::AlignHCenter);
ui->usernameEdit->setText(Utils::GetCurrentUserName());
......@@ -60,7 +61,10 @@ WizardDialog::accept()
Utils::CreateStartupLink();
auto account = AccountModel::instance().add(ui->usernameEdit->text(), Account::Protocol::RING);
account->setDisplayName(ui->usernameEdit->text());
if (not ui->usernameEdit->text().isEmpty())
account->setDisplayName(ui->usernameEdit->text());
else
account->setDisplayName(tr("Unknown"));
AccountModel::instance().ip2ip()->setRingtonePath(Utils::GetRingtonePath());
account->setRingtonePath(Utils::GetRingtonePath());
account->setUpnpEnabled(true);
......@@ -77,12 +81,6 @@ WizardDialog::endSetup(Account* a)
QDialog::accept();
}
void
WizardDialog::on_usernameEdit_textChanged(const QString &arg1)
{
ui->wizardButton->setEnabled(!arg1.isEmpty());
}
void
WizardDialog::closeEvent(QCloseEvent *event)
{
......
......@@ -38,7 +38,6 @@ public:
protected slots:
void closeEvent(QCloseEvent *event);
private slots:
void on_usernameEdit_textChanged(const QString &arg1);
void accept();
private:
......
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