gui: premium reminder feature

This commit is contained in:
Nick Bolton 2013-07-05 12:05:08 +00:00
parent 6919b68947
commit 6f97f1d186
6 changed files with 74 additions and 2 deletions

View File

@ -78,6 +78,57 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QWidget" name="m_pWidgetPremium" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>7</number>
</property>
<item>
<widget class="QLabel" name="m_pIconPremium">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="Synergy.qrc">:/res/icons/16x16/money.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabelPremium">
<property name="text">
<string>Please help us &lt;a href=&quot;https://synergy-foss.org/premium/register/?source=gui-notice&quot;&gt;fund this project&lt;/a&gt; if you like Synergy.</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="m_pSpacerPremium">
<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>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="m_pGroupServer"> <widget class="QGroupBox" name="m_pGroupServer">
<property name="sizePolicy"> <property name="sizePolicy">

View File

@ -50,5 +50,6 @@
<file>lang/gui_zh-CN.qm</file> <file>lang/gui_zh-CN.qm</file>
<file>lang/gui_zh-TW.qm</file> <file>lang/gui_zh-TW.qm</file>
<file>lang/Languages.xml</file> <file>lang/Languages.xml</file>
<file>icons/16x16/money.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

View File

@ -84,6 +84,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
m_pLabelScreenName->setText(getScreenName()); m_pLabelScreenName->setText(getScreenName());
m_pLabelIpAddresses->setText(getIPAddresses()); m_pLabelIpAddresses->setText(getIPAddresses());
updatePremiumInfo();
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
// ipc must always be enabled, so that we can disable command when switching to desktop mode. // ipc must always be enabled, so that we can disable command when switching to desktop mode.
connect(&m_IpcClient, SIGNAL(readLogLine(const QString&)), this, SLOT(appendLogRaw(const QString&))); connect(&m_IpcClient, SIGNAL(readLogLine(const QString&)), this, SLOT(appendLogRaw(const QString&)));
@ -749,6 +751,7 @@ void MainWindow::changeEvent(QEvent* event)
case QEvent::LanguageChange: case QEvent::LanguageChange:
retranslateUi(this); retranslateUi(this);
retranslateMenuBar(); retranslateMenuBar();
updatePremiumInfo();
break; break;
default: default:
@ -757,6 +760,20 @@ void MainWindow::changeEvent(QEvent* event)
} }
} }
void MainWindow::updatePremiumInfo()
{
if (m_AppConfig.isPremium())
{
m_pWidgetPremium->hide();
setWindowTitle(tr("Synergy Premium"));
}
else
{
m_pWidgetPremium->show();
setWindowTitle(tr("Synergy"));
}
}
bool MainWindow::on_m_pButtonBrowseConfigFile_clicked() bool MainWindow::on_m_pButtonBrowseConfigFile_clicked()
{ {
QString fileName = QFileDialog::getOpenFileName(this, tr("Browse for a synergys config file"), QString(), synergyConfigFilter); QString fileName = QFileDialog::getOpenFileName(this, tr("Browse for a synergys config file"), QString(), synergyConfigFilter);
@ -812,6 +829,7 @@ void MainWindow::on_m_pActionWizard_triggered()
{ {
SetupWizard wizard(*this, false); SetupWizard wizard(*this, false);
wizard.exec(); wizard.exec();
updatePremiumInfo();
} }
void MainWindow::on_m_pElevateCheckBox_toggled(bool checked) void MainWindow::on_m_pElevateCheckBox_toggled(bool checked)

View File

@ -144,6 +144,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void setFormEnabled(bool enabled); void setFormEnabled(bool enabled);
void changeEvent(QEvent* event); void changeEvent(QEvent* event);
void retranslateMenuBar(); void retranslateMenuBar();
void updatePremiumInfo();
private: private:
QSettings& m_Settings; QSettings& m_Settings;

View File

@ -26,8 +26,9 @@
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QNetworkReply> #include <QNetworkReply>
#define PREMIUM_AUTH_URL "https://synergy-foss.org/premium/json/auth/"
//#define PREMIUM_AUTH_URL "http://localhost/synergy/premium/json/auth/" //#define PREMIUM_AUTH_URL "http://localhost/synergy/premium/json/auth/"
#define PREMIUM_AUTH_URL "https://synergy-foss.org/premium/json/auth/"
#define PREMIUM_REGISTER_URL "https://synergy-foss.org/premium/register/?source=gui-wizard"
SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) : SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
m_MainWindow(mainWindow), m_MainWindow(mainWindow),
@ -112,7 +113,7 @@ bool SetupWizard::validateCurrentPage()
} }
else if (m_pRadioButtonPremiumRegister->isChecked()) else if (m_pRadioButtonPremiumRegister->isChecked())
{ {
const QUrl url(QString("https://synergy-foss.org/premium/register/?source=gui")); const QUrl url(QString(PREMIUM_REGISTER_URL));
QDesktopServices::openUrl(url); QDesktopServices::openUrl(url);
m_pRadioButtonPremiumLogin->setChecked(true); m_pRadioButtonPremiumLogin->setChecked(true);
return false; return false;