mirror of
https://github.com/debauchee/barrier.git
synced 2026-07-17 03:20:40 +08:00
remove activation, serial, trial garbage. shame on you all!
This commit is contained in:
@@ -21,7 +21,7 @@ add_executable (barrier WIN32
|
||||
)
|
||||
|
||||
include_directories (./src)
|
||||
target_link_libraries (barrier shared)
|
||||
target_link_libraries (barrier)
|
||||
|
||||
if (WIN32)
|
||||
include_directories ($ENV{BONJOUR_SDK_HOME}/Include)
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
#include "ActivationDialog.h"
|
||||
#include "ui_ActivationDialog.h"
|
||||
#include "CancelActivationDialog.h"
|
||||
#include "AppConfig.h"
|
||||
#include "WebClient.h"
|
||||
#include <shared/EditionType.h>
|
||||
#include "ActivationNotifier.h"
|
||||
#include "MainWindow.h"
|
||||
#include "QUtility.h"
|
||||
#include "LicenseManager.h"
|
||||
#include "FailedLoginDialog.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QThread>
|
||||
#include <iostream>
|
||||
|
||||
ActivationDialog::ActivationDialog(QWidget* parent, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ActivationDialog),
|
||||
m_appConfig(&appConfig),
|
||||
m_LicenseManager (&licenseManager)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
refreshSerialKey();
|
||||
time_t currentTime = ::time(0);
|
||||
if (!m_LicenseManager->serialKey().isExpired(currentTime)) {
|
||||
ui->m_trialWidget->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void ActivationDialog::refreshSerialKey()
|
||||
{
|
||||
ui->m_pTextEditSerialKey->setText(m_appConfig->serialKey());
|
||||
ui->m_pTextEditSerialKey->setFocus();
|
||||
ui->m_pTextEditSerialKey->moveCursor(QTextCursor::End);
|
||||
ui->m_trialLabel->setText(tr("<html><head/><body><p>Your trial has "
|
||||
"expired. <a href=\"https://symless.com/"
|
||||
"barrier/trial/thanks?id=%1\"><span "
|
||||
"style=\"text-decoration: underline; "
|
||||
"color:#0000ff;\">Buy now!</span></a>"
|
||||
"</p></body></html>")
|
||||
.arg (m_appConfig->serialKey()));
|
||||
}
|
||||
|
||||
ActivationDialog::~ActivationDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ActivationDialog::reject()
|
||||
{
|
||||
if (m_LicenseManager->activeEdition() == kUnregistered) {
|
||||
CancelActivationDialog cancelActivationDialog(this);
|
||||
if (QDialog::Accepted == cancelActivationDialog.exec()) {
|
||||
m_LicenseManager->skipActivation();
|
||||
m_appConfig->activationHasRun(true);
|
||||
m_appConfig->saveSettings();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void ActivationDialog::accept()
|
||||
{
|
||||
QMessageBox message;
|
||||
m_appConfig->activationHasRun(true);
|
||||
m_appConfig->saveSettings();
|
||||
|
||||
std::pair<bool, QString> result;
|
||||
try {
|
||||
SerialKey serialKey (ui->m_pTextEditSerialKey->toPlainText().
|
||||
trimmed().toStdString());
|
||||
result = m_LicenseManager->setSerialKey(serialKey);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
message.critical(this, "Unknown Error",
|
||||
tr("An error occurred while trying to activate Barrier. "
|
||||
"Please contact the helpdesk, and provide the "
|
||||
"following information:\n\n%1").arg(e.what()));
|
||||
refreshSerialKey();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!result.first) {
|
||||
message.critical(this, "Activation failed",
|
||||
tr("%1").arg(result.second));
|
||||
refreshSerialKey();
|
||||
return;
|
||||
}
|
||||
|
||||
m_LicenseManager->notifyActivation("serial:" + m_appConfig->serialKey());
|
||||
Edition edition = m_LicenseManager->activeEdition();
|
||||
time_t daysLeft = m_LicenseManager->serialKey().daysLeft(::time(0));
|
||||
if (edition != kUnregistered) {
|
||||
QString thanksMessage = tr("Thanks for trying %1! %5\n\n%2 day%3 of "
|
||||
"your trial remain%4").
|
||||
arg (m_LicenseManager->getEditionName(edition)).
|
||||
arg (daysLeft).
|
||||
arg ((daysLeft == 1) ? "" : "s").
|
||||
arg ((daysLeft == 1) ? "s" : "");
|
||||
|
||||
if (edition == kPro) {
|
||||
thanksMessage = thanksMessage.arg("If you're using SSL, "
|
||||
"remember to activate all of your devices.");
|
||||
} else {
|
||||
thanksMessage = thanksMessage.arg("");
|
||||
}
|
||||
|
||||
if (m_LicenseManager->serialKey().isTrial()) {
|
||||
message.information(this, "Thanks!", thanksMessage);
|
||||
}
|
||||
else {
|
||||
message.information(this, "Activated!",
|
||||
tr("Thanks for activating %1!").arg
|
||||
(m_LicenseManager->getEditionName(edition)));
|
||||
}
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef ACTIVATIONDIALOG_H
|
||||
#define ACTIVATIONDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <LicenseManager.h>
|
||||
|
||||
namespace Ui {
|
||||
class ActivationDialog;
|
||||
}
|
||||
|
||||
class AppConfig;
|
||||
|
||||
class ActivationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ActivationDialog(QWidget *parent, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager);
|
||||
~ActivationDialog();
|
||||
|
||||
public slots:
|
||||
void reject();
|
||||
void accept();
|
||||
|
||||
protected:
|
||||
void refreshSerialKey();
|
||||
|
||||
private:
|
||||
Ui::ActivationDialog *ui;
|
||||
AppConfig* m_appConfig;
|
||||
LicenseManager* m_LicenseManager;
|
||||
};
|
||||
|
||||
#endif // ACTIVATIONDIALOG_H
|
||||
@@ -1,163 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ActivationDialog</class>
|
||||
<widget class="QDialog" name="ActivationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>410</width>
|
||||
<height>211</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Activate Barrier</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Serial key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>This can be found on your <a href="https://symless.com/account/?source=gui"><span style=" text-decoration: underline; color:#0000ff;">account</span></a> page.</p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="m_pTextEditSerialKey">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_trialWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<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>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Barrier.qrc">:/res/icons/16x16/money.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_trialLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Your trial has expired. <a href="http://symless.com/pricing?src=gui"><span style=" text-decoration: underline; color:#0000ff;">Buy now!</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<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>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>m_pTextEditSerialKey</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="Barrier.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ActivationDialog</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>ActivationDialog</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>
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* barrier -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Barrier Seamless Inc.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ActivationNotifier.h"
|
||||
|
||||
#include "CoreInterface.h"
|
||||
|
||||
ActivationNotifier::ActivationNotifier(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void ActivationNotifier::setIdentity(QString identity)
|
||||
{
|
||||
m_Identity = identity;
|
||||
}
|
||||
|
||||
void ActivationNotifier::setUpdateInfo(QString const& fromVersion,
|
||||
QString const& toVersion,
|
||||
QString const& serialKey)
|
||||
{
|
||||
m_fromVersion = fromVersion;
|
||||
m_toVersion = toVersion;
|
||||
m_serialKey = serialKey;
|
||||
}
|
||||
|
||||
void ActivationNotifier::notify()
|
||||
{
|
||||
CoreInterface coreInterface;
|
||||
try {
|
||||
coreInterface.notifyActivation(m_Identity);
|
||||
}
|
||||
catch (...) {
|
||||
// catch all exceptions and fails silently
|
||||
}
|
||||
}
|
||||
|
||||
void ActivationNotifier::notifyUpdate()
|
||||
{
|
||||
try {
|
||||
CoreInterface coreInterface;
|
||||
coreInterface.notifyUpdate(m_fromVersion, m_toVersion,
|
||||
m_serialKey);
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* barrier -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Barrier Seamless Inc.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ACTIVATIONNOTIFIER_H
|
||||
#define ACTIVATIONNOTIFIER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class ActivationNotifier : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ActivationNotifier(QObject *parent = 0);
|
||||
|
||||
void setIdentity(QString identity);
|
||||
void setUpdateInfo(QString const& fromVersion,
|
||||
QString const& toVersion, QString const& serialKey);
|
||||
|
||||
public slots:
|
||||
void notify();
|
||||
void notifyUpdate();
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
||||
private:
|
||||
QString m_Identity;
|
||||
QString m_fromVersion;
|
||||
QString m_toVersion;
|
||||
QString m_serialKey;
|
||||
};
|
||||
|
||||
#endif // ACTIVATIONNOTIFIER_H
|
||||
@@ -59,8 +59,7 @@ AppConfig::AppConfig(QSettings* settings) :
|
||||
m_ElevateMode(defaultElevateMode),
|
||||
m_AutoConfigPrompted(false),
|
||||
m_CryptoEnabled(false),
|
||||
m_AutoHide(false),
|
||||
m_LastExpiringWarningTime(0)
|
||||
m_AutoHide(false)
|
||||
{
|
||||
Q_ASSERT(m_pSettings);
|
||||
|
||||
@@ -156,14 +155,8 @@ void AppConfig::loadSettings()
|
||||
}
|
||||
m_ElevateMode = static_cast<ElevateMode>(elevateMode.toInt());
|
||||
m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
|
||||
m_Edition = static_cast<Edition>(settings().value("edition", kUnregistered).toInt());
|
||||
m_ActivateEmail = settings().value("activateEmail", "").toString();
|
||||
m_CryptoEnabled = settings().value("cryptoEnabled", true).toBool();
|
||||
m_AutoHide = settings().value("autoHide", false).toBool();
|
||||
m_Serialkey = settings().value("serialKey", "").toString().trimmed();
|
||||
m_lastVersion = settings().value("lastVersion", "Unknown").toString();
|
||||
m_LastExpiringWarningTime = settings().value("lastExpiringWarningTime", 0).toInt();
|
||||
m_ActivationHasRun = settings().value("activationHasRun", false).toBool();
|
||||
}
|
||||
|
||||
void AppConfig::saveSettings()
|
||||
@@ -183,36 +176,11 @@ void AppConfig::saveSettings()
|
||||
settings().setValue("elevateMode", m_ElevateMode == ElevateAlways);
|
||||
settings().setValue("elevateModeEnum", static_cast<int>(m_ElevateMode));
|
||||
settings().setValue("autoConfigPrompted", m_AutoConfigPrompted);
|
||||
settings().setValue("edition", m_Edition);
|
||||
settings().setValue("cryptoEnabled", m_CryptoEnabled);
|
||||
settings().setValue("autoHide", m_AutoHide);
|
||||
settings().setValue("serialKey", m_Serialkey);
|
||||
settings().setValue("lastVersion", m_lastVersion);
|
||||
settings().setValue("lastExpiringWarningTime", m_LastExpiringWarningTime);
|
||||
settings().setValue("activationHasRun", m_ActivationHasRun);
|
||||
settings().sync();
|
||||
}
|
||||
|
||||
bool AppConfig::activationHasRun() const
|
||||
{
|
||||
return m_ActivationHasRun;
|
||||
}
|
||||
|
||||
AppConfig& AppConfig::activationHasRun(bool value)
|
||||
{
|
||||
m_ActivationHasRun = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
QString AppConfig::lastVersion() const
|
||||
{
|
||||
return m_lastVersion;
|
||||
}
|
||||
|
||||
void AppConfig::setLastVersion(QString version) {
|
||||
m_lastVersion = version;
|
||||
}
|
||||
|
||||
QSettings &AppConfig::settings() { return *m_pSettings; }
|
||||
|
||||
void AppConfig::setScreenName(const QString &s) { m_ScreenName = s; }
|
||||
@@ -247,29 +215,6 @@ void AppConfig::setAutoConfigPrompted(bool prompted)
|
||||
m_AutoConfigPrompted = prompted;
|
||||
}
|
||||
|
||||
void AppConfig::setEdition(Edition e) {
|
||||
m_Edition = e;
|
||||
}
|
||||
|
||||
Edition AppConfig::edition() const { return m_Edition; }
|
||||
|
||||
QString AppConfig::setSerialKey(QString serial) {
|
||||
using std::swap;
|
||||
swap (serial, m_Serialkey);
|
||||
return serial;
|
||||
}
|
||||
|
||||
void AppConfig::clearSerialKey()
|
||||
{
|
||||
m_Serialkey.clear();
|
||||
}
|
||||
|
||||
QString AppConfig::serialKey() { return m_Serialkey; }
|
||||
|
||||
int AppConfig::lastExpiringWarningTime() const { return m_LastExpiringWarningTime; }
|
||||
|
||||
void AppConfig::setLastExpiringWarningTime(int t) { m_LastExpiringWarningTime = t; }
|
||||
|
||||
QString AppConfig::barriersName() const { return m_BarriersName; }
|
||||
|
||||
QString AppConfig::barriercName() const { return m_BarriercName; }
|
||||
@@ -285,7 +230,7 @@ void AppConfig::setCryptoEnabled(bool e) {
|
||||
}
|
||||
|
||||
bool AppConfig::getCryptoEnabled() const {
|
||||
return (edition() == kPro) && m_CryptoEnabled;
|
||||
return m_CryptoEnabled;
|
||||
}
|
||||
|
||||
void AppConfig::setAutoHide(bool b) { m_AutoHide = b; }
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include "ElevateMode.h"
|
||||
#include <shared/EditionType.h>
|
||||
|
||||
// this should be incremented each time a new page is added. this is
|
||||
// saved to settings when the user finishes running the wizard. if
|
||||
@@ -39,8 +38,9 @@
|
||||
// 6: ssl plugin 'ns' v1.2
|
||||
// 7: serial key activation
|
||||
// 8: Visual Studio 2015 support
|
||||
// 9: synergy->barrier and de-commercialized
|
||||
//
|
||||
const int kWizardVersion = 8;
|
||||
const int kWizardVersion = 9;
|
||||
|
||||
class QSettings;
|
||||
class SettingsDialog;
|
||||
@@ -79,13 +79,6 @@ class AppConfig: public QObject
|
||||
void setAutoConfig(bool autoConfig);
|
||||
bool autoConfigPrompted();
|
||||
void setAutoConfigPrompted(bool prompted);
|
||||
void setEdition(Edition);
|
||||
Edition edition() const;
|
||||
QString setSerialKey(QString serial);
|
||||
void clearSerialKey();
|
||||
QString serialKey();
|
||||
int lastExpiringWarningTime() const;
|
||||
void setLastExpiringWarningTime(int t);
|
||||
|
||||
QString barriersName() const;
|
||||
QString barriercName() const;
|
||||
@@ -102,13 +95,7 @@ class AppConfig: public QObject
|
||||
void setAutoHide(bool b);
|
||||
bool getAutoHide();
|
||||
|
||||
bool activationHasRun() const;
|
||||
AppConfig& activationHasRun(bool value);
|
||||
|
||||
QString lastVersion() const;
|
||||
|
||||
void saveSettings();
|
||||
void setLastVersion(QString version);
|
||||
|
||||
protected:
|
||||
QSettings& settings();
|
||||
@@ -139,14 +126,8 @@ protected:
|
||||
bool m_AutoConfig;
|
||||
ElevateMode m_ElevateMode;
|
||||
bool m_AutoConfigPrompted;
|
||||
Edition m_Edition;
|
||||
QString m_ActivateEmail;
|
||||
bool m_CryptoEnabled;
|
||||
bool m_AutoHide;
|
||||
QString m_Serialkey;
|
||||
QString m_lastVersion;
|
||||
int m_LastExpiringWarningTime;
|
||||
bool m_ActivationHasRun;
|
||||
|
||||
static const char m_BarriersName[];
|
||||
static const char m_BarriercName[];
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#include "CancelActivationDialog.h"
|
||||
#include "ui_CancelActivationDialog.h"
|
||||
|
||||
CancelActivationDialog::CancelActivationDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CancelActivationDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
CancelActivationDialog::~CancelActivationDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef CANCELACTIVATIONDIALOG_H
|
||||
#define CANCELACTIVATIONDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class CancelActivationDialog;
|
||||
}
|
||||
|
||||
class CancelActivationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CancelActivationDialog(QWidget *parent = 0);
|
||||
~CancelActivationDialog();
|
||||
|
||||
private:
|
||||
Ui::CancelActivationDialog *ui;
|
||||
};
|
||||
|
||||
#endif // CANCELACTIVATIONDIALOG_H
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CancelActivationDialog</class>
|
||||
<widget class="QDialog" name="CancelActivationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>165</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Cancel Activation</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Are you sure?
|
||||
|
||||
If you don't activate Barrier you'll be missing out on some great features.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="https://symless.com/pricing?source=gui"><span style=" text-decoration: underline; color:#0000ff;">Buy now</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CancelActivationDialog</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>CancelActivationDialog</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>
|
||||
@@ -1,15 +0,0 @@
|
||||
#include "FailedLoginDialog.h"
|
||||
#include "ui_FailedLoginDialog.h"
|
||||
|
||||
FailedLoginDialog::FailedLoginDialog(QWidget *parent, QString message):
|
||||
QDialog(parent),
|
||||
ui(new Ui::FailedLoginDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->messageLabel->setText(ui->messageLabel->text().arg(message));
|
||||
}
|
||||
|
||||
FailedLoginDialog::~FailedLoginDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef FAILEDLOGINDIALOG_H
|
||||
#define FAILEDLOGINDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QString>
|
||||
|
||||
namespace Ui {
|
||||
class FailedLoginDialog;
|
||||
}
|
||||
|
||||
class FailedLoginDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FailedLoginDialog(QWidget *parent = 0, QString message = "");
|
||||
~FailedLoginDialog();
|
||||
|
||||
private:
|
||||
Ui::FailedLoginDialog *ui;
|
||||
};
|
||||
|
||||
#endif // FAILEDLOGINDIALOG_H
|
||||
@@ -1,108 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FailedLoginDialog</class>
|
||||
<widget class="QDialog" name="FailedLoginDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>165</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Activation Error</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>120</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>382</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="https://symless.com/account/reset/?source=gui"><span style=" text-decoration: underline; color:#0000ff;">Forgotten your password?</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="messageLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>382</width>
|
||||
<height>72</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>An error occurred while trying to activate Barrier. The Symless server returned the following error:
|
||||
|
||||
%1</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>label_2</zorder>
|
||||
<zorder>messageLabel</zorder>
|
||||
<zorder>buttonBox</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>FailedLoginDialog</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>FailedLoginDialog</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>
|
||||
@@ -1,168 +0,0 @@
|
||||
/*
|
||||
* barrier -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Barrier Seamless Inc.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "LicenseManager.h"
|
||||
#include "AppConfig.h"
|
||||
#include <ctime>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
#include <QThread>
|
||||
|
||||
LicenseManager::LicenseManager(AppConfig* appConfig) :
|
||||
m_AppConfig(appConfig),
|
||||
m_serialKey(appConfig->edition()) {
|
||||
}
|
||||
|
||||
std::pair<bool, QString>
|
||||
LicenseManager::setSerialKey(SerialKey serialKey, bool acceptExpired)
|
||||
{
|
||||
std::pair<bool, QString> ret (true, "");
|
||||
time_t currentTime = ::time(0);
|
||||
|
||||
if (!acceptExpired && serialKey.isExpired(currentTime)) {
|
||||
ret.first = false;
|
||||
ret.second = "Serial key expired";
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (serialKey != m_serialKey) {
|
||||
using std::swap;
|
||||
swap (serialKey, m_serialKey);
|
||||
m_AppConfig->setSerialKey(QString::fromStdString
|
||||
(m_serialKey.toString()));
|
||||
emit serialKeyChanged(m_serialKey);
|
||||
|
||||
if (serialKey.isTrial()) {
|
||||
emit endTrial(false);
|
||||
}
|
||||
|
||||
if (m_serialKey.edition() != serialKey.edition()) {
|
||||
m_AppConfig->setEdition(m_serialKey.edition());
|
||||
emit editionChanged(m_serialKey.edition());
|
||||
}
|
||||
|
||||
if (m_serialKey.isTrial()) {
|
||||
if (m_serialKey.isExpired(currentTime)) {
|
||||
emit endTrial(true);
|
||||
} else {
|
||||
emit beginTrial(m_serialKey.isExpiring(currentTime));
|
||||
}
|
||||
}
|
||||
|
||||
m_AppConfig->saveSettings();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
LicenseManager::notifyUpdate(QString fromVersion, QString toVersion) {
|
||||
if ((fromVersion == "Unknown")
|
||||
&& (m_serialKey == SerialKey(kUnregistered))) {
|
||||
return;
|
||||
}
|
||||
|
||||
ActivationNotifier* notifier = new ActivationNotifier();
|
||||
notifier->setUpdateInfo (fromVersion, toVersion,
|
||||
QString::fromStdString(m_serialKey.toString()));
|
||||
|
||||
QThread* thread = new QThread();
|
||||
connect(notifier, SIGNAL(finished()), thread, SLOT(quit()));
|
||||
connect(notifier, SIGNAL(finished()), notifier, SLOT(deleteLater()));
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
notifier->moveToThread(thread);
|
||||
thread->start();
|
||||
|
||||
QMetaObject::invokeMethod(notifier, "notifyUpdate",
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
Edition
|
||||
LicenseManager::activeEdition() const
|
||||
{
|
||||
return m_serialKey.edition();
|
||||
}
|
||||
|
||||
QString
|
||||
LicenseManager::activeEditionName() const
|
||||
{
|
||||
return getEditionName(activeEdition(), m_serialKey.isTrial());
|
||||
}
|
||||
|
||||
SerialKey
|
||||
LicenseManager::serialKey() const
|
||||
{
|
||||
return m_serialKey;
|
||||
}
|
||||
|
||||
void LicenseManager::refresh()
|
||||
{
|
||||
if (!m_AppConfig->serialKey().isEmpty()) {
|
||||
try {
|
||||
SerialKey serialKey (m_AppConfig->serialKey().toStdString());
|
||||
setSerialKey(serialKey, true);
|
||||
} catch (...) {
|
||||
m_AppConfig->clearSerialKey();
|
||||
m_AppConfig->saveSettings();
|
||||
}
|
||||
}
|
||||
if (m_serialKey.isExpired(::time(0))) {
|
||||
emit endTrial(true);
|
||||
}
|
||||
}
|
||||
|
||||
void LicenseManager::skipActivation()
|
||||
{
|
||||
notifyActivation ("skip:unknown");
|
||||
}
|
||||
|
||||
QString
|
||||
LicenseManager::getEditionName(Edition const edition, bool trial)
|
||||
{
|
||||
std::string name ("Barrier");
|
||||
switch (edition) {
|
||||
case kUnregistered:
|
||||
name += " (UNREGISTERED)";
|
||||
return QString::fromUtf8 (name.c_str(), name.size());
|
||||
case kBasic:
|
||||
name += " Basic";
|
||||
break;
|
||||
default:
|
||||
name += " Pro";
|
||||
}
|
||||
if (trial) {
|
||||
name += " (Trial)";
|
||||
}
|
||||
return QString::fromUtf8 (name.c_str(), name.size());
|
||||
}
|
||||
|
||||
void LicenseManager::notifyActivation(QString identity)
|
||||
{
|
||||
ActivationNotifier* notifier = new ActivationNotifier();
|
||||
notifier->setIdentity(identity);
|
||||
|
||||
QThread* thread = new QThread();
|
||||
connect(notifier, SIGNAL(finished()), thread, SLOT(quit()));
|
||||
connect(notifier, SIGNAL(finished()), notifier, SLOT(deleteLater()));
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
notifier->moveToThread(thread);
|
||||
thread->start();
|
||||
|
||||
QMetaObject::invokeMethod(notifier, "notify", Qt::QueuedConnection);
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* barrier -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Barrier Seamless Inc.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <shared/EditionType.h>
|
||||
#include <shared/SerialKey.h>
|
||||
#include <ActivationNotifier.h>
|
||||
#include <utility>
|
||||
|
||||
class AppConfig;
|
||||
|
||||
class LicenseManager: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LicenseManager(AppConfig* appConfig);
|
||||
std::pair<bool, QString> setSerialKey(SerialKey serialKey,
|
||||
bool acceptExpired = false);
|
||||
void refresh();
|
||||
Edition activeEdition() const;
|
||||
QString activeEditionName() const;
|
||||
SerialKey serialKey() const;
|
||||
void skipActivation();
|
||||
void notifyUpdate(QString fromVersion, QString toVersion);
|
||||
static QString getEditionName(Edition edition, bool trial = false);
|
||||
void notifyActivation(QString identity);
|
||||
|
||||
private:
|
||||
AppConfig* m_AppConfig;
|
||||
SerialKey m_serialKey;
|
||||
|
||||
signals:
|
||||
void serialKeyChanged (SerialKey) const;
|
||||
void editionChanged (Edition) const;
|
||||
void beginTrial (bool expiring) const;
|
||||
void endTrial (bool expired) const;
|
||||
};
|
||||
@@ -26,12 +26,9 @@
|
||||
#include "AboutDialog.h"
|
||||
#include "ServerConfigDialog.h"
|
||||
#include "SettingsDialog.h"
|
||||
#include "ActivationDialog.h"
|
||||
#include "ZeroconfService.h"
|
||||
#include "DataDownloader.h"
|
||||
#include "CommandProcess.h"
|
||||
#include "LicenseManager.h"
|
||||
#include <shared/EditionType.h>
|
||||
#include "QUtility.h"
|
||||
#include "ProcessorArch.h"
|
||||
#include "SslCertificate.h"
|
||||
@@ -76,11 +73,9 @@ static const char* barrierIconFiles[] =
|
||||
":/res/icons/16x16/barrier-transfering.png"
|
||||
};
|
||||
|
||||
MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager) :
|
||||
MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||
m_Settings(settings),
|
||||
m_AppConfig(&appConfig),
|
||||
m_LicenseManager(&licenseManager),
|
||||
m_pBarrier(NULL),
|
||||
m_BarrierState(barrierDisconnected),
|
||||
m_ServerConfig(&m_Settings, 5, 3, m_AppConfig->screenName(), this),
|
||||
@@ -101,8 +96,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||
m_BonjourInstall(NULL),
|
||||
m_SuppressEmptyServerWarning(false),
|
||||
m_ExpectedRunningState(kStopped),
|
||||
m_pSslCertificate(NULL),
|
||||
m_ActivationDialogRunning(false)
|
||||
m_pSslCertificate(NULL)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@@ -138,33 +132,12 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||
|
||||
m_pComboServerList->hide();
|
||||
m_pLabelPadlock->hide();
|
||||
m_trialWidget->hide();
|
||||
|
||||
connect (this, SIGNAL(windowShown()),
|
||||
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
||||
|
||||
connect (m_LicenseManager, SIGNAL(editionChanged(Edition)),
|
||||
this, SLOT(setEdition(Edition)), Qt::QueuedConnection);
|
||||
|
||||
connect (m_LicenseManager, SIGNAL(beginTrial(bool)),
|
||||
this, SLOT(beginTrial(bool)), Qt::QueuedConnection);
|
||||
|
||||
connect (m_LicenseManager, SIGNAL(endTrial(bool)),
|
||||
this, SLOT(endTrial(bool)), Qt::QueuedConnection);
|
||||
|
||||
connect (m_AppConfig, SIGNAL(sslToggled(bool)),
|
||||
this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
||||
|
||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||
m_LicenseManager->refresh();
|
||||
|
||||
QString lastVersion = m_AppConfig->lastVersion();
|
||||
QString currentVersion = m_VersionChecker.getVersion();
|
||||
if (lastVersion != currentVersion) {
|
||||
m_AppConfig->setLastVersion (currentVersion);
|
||||
m_AppConfig->saveSettings();
|
||||
m_LicenseManager->notifyUpdate (lastVersion, currentVersion);
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -291,8 +264,6 @@ void MainWindow::createMenuBar()
|
||||
m_pMenuFile->addAction(m_pActionStartBarrier);
|
||||
m_pMenuFile->addAction(m_pActionStopBarrier);
|
||||
m_pMenuFile->addSeparator();
|
||||
m_pMenuFile->addAction(m_pActivate);
|
||||
m_pMenuFile->addSeparator();
|
||||
m_pMenuFile->addAction(m_pActionSave);
|
||||
m_pMenuFile->addSeparator();
|
||||
m_pMenuFile->addAction(m_pActionQuit);
|
||||
@@ -431,7 +402,6 @@ void MainWindow::updateFromLogLine(const QString &line)
|
||||
// TODO: this code makes Andrew cry
|
||||
checkConnected(line);
|
||||
checkFingerprint(line);
|
||||
checkLicense(line);
|
||||
}
|
||||
|
||||
void MainWindow::checkConnected(const QString& line)
|
||||
@@ -456,14 +426,6 @@ void MainWindow::checkConnected(const QString& line)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::checkLicense(const QString &line)
|
||||
{
|
||||
if (line.contains("trial has expired")) {
|
||||
licenseManager().refresh();
|
||||
raiseActivationDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::checkFingerprint(const QString& line)
|
||||
{
|
||||
QRegExp fingerprintRegex(".*server fingerprint: ([A-F0-9:]+)");
|
||||
@@ -532,8 +494,12 @@ void MainWindow::restartBarrier()
|
||||
|
||||
void MainWindow::proofreadInfo()
|
||||
{
|
||||
setEdition(m_AppConfig->edition()); // Why is this here?
|
||||
|
||||
if (m_AppConfig->getCryptoEnabled()) {
|
||||
m_pSslCertificate = new SslCertificate(this);
|
||||
m_pSslCertificate->generateCertificate();
|
||||
}
|
||||
updateLocalFingerprint();
|
||||
saveSettings();
|
||||
int oldState = m_BarrierState;
|
||||
m_BarrierState = barrierDisconnected;
|
||||
setBarrierState((qBarrierState)oldState);
|
||||
@@ -552,14 +518,6 @@ void MainWindow::clearLog()
|
||||
|
||||
void MainWindow::startBarrier()
|
||||
{
|
||||
SerialKey serialKey = m_LicenseManager->serialKey();
|
||||
time_t currentTime = ::time(0);
|
||||
if (serialKey.isExpired(currentTime)) {
|
||||
if (QDialog::Rejected == raiseActivationDialog()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool desktopMode = appConfig().processMode() == Desktop;
|
||||
bool serviceMode = appConfig().processMode() == Service;
|
||||
|
||||
@@ -804,10 +762,6 @@ bool MainWindow::serverArgs(QStringList& args, QString& app)
|
||||
#endif
|
||||
args << "-c" << configFilename << "--address" << address();
|
||||
|
||||
if (!appConfig().serialKey().isEmpty()) {
|
||||
args << "--serial-key" << appConfig().serialKey();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1054,68 +1008,6 @@ void MainWindow::serverDetected(const QString name)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setEdition(Edition edition)
|
||||
{
|
||||
setWindowTitle(m_LicenseManager->getEditionName (edition));
|
||||
if (m_AppConfig->getCryptoEnabled()) {
|
||||
m_pSslCertificate = new SslCertificate(this);
|
||||
m_pSslCertificate->generateCertificate();
|
||||
}
|
||||
updateLocalFingerprint();
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
void MainWindow::beginTrial(bool isExpiring)
|
||||
{
|
||||
//Hack
|
||||
//if (isExpiring) {
|
||||
time_t daysLeft = m_LicenseManager->serialKey().daysLeft(::time(0));
|
||||
QString expiringNotice ("<html><head/><body><p><span style=\""
|
||||
"font-weight:600;\">%1</span> day%3 of "
|
||||
"your %2 trial remain%5. <a href="
|
||||
"\"https://symless.com/barrier/trial/thanks?id=%4\">"
|
||||
"<span style=\"text-decoration: underline;"
|
||||
" color:#0000ff;\">Buy now!</span></a>"
|
||||
"</p></body></html>");
|
||||
expiringNotice = expiringNotice
|
||||
.arg (daysLeft)
|
||||
.arg (LicenseManager::getEditionName
|
||||
(m_LicenseManager->activeEdition()))
|
||||
.arg ((daysLeft == 1) ? "" : "s")
|
||||
.arg (QString::fromStdString
|
||||
(m_LicenseManager->serialKey().toString()))
|
||||
.arg ((daysLeft == 1) ? "s" : "");
|
||||
this->m_trialLabel->setText(expiringNotice);
|
||||
this->m_trialWidget->show();
|
||||
//}
|
||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||
}
|
||||
|
||||
void MainWindow::endTrial(bool isExpired)
|
||||
{
|
||||
if (isExpired) {
|
||||
QString expiredNotice (
|
||||
"<html><head/><body><p>Your %1 trial has expired. <a href="
|
||||
"\"https://symless.com/barrier/trial/thanks?id=%2\">"
|
||||
"<span style=\"text-decoration: underline;color:#0000ff;\">"
|
||||
"Buy now!</span></a></p></body></html>"
|
||||
);
|
||||
expiredNotice = expiredNotice
|
||||
.arg(LicenseManager::getEditionName
|
||||
(m_LicenseManager->activeEdition()))
|
||||
.arg(QString::fromStdString
|
||||
(m_LicenseManager->serialKey().toString()));
|
||||
|
||||
this->m_trialLabel->setText(expiredNotice);
|
||||
this->m_trialWidget->show();
|
||||
stopBarrier();
|
||||
m_AppConfig->activationHasRun(false);
|
||||
} else {
|
||||
this->m_trialWidget->hide();
|
||||
}
|
||||
setWindowTitle (m_LicenseManager->activeEditionName());
|
||||
}
|
||||
|
||||
void MainWindow::updateLocalFingerprint()
|
||||
{
|
||||
if (m_AppConfig->getCryptoEnabled() && Fingerprint::local().fileExists()) {
|
||||
@@ -1129,12 +1021,6 @@ void MainWindow::updateLocalFingerprint()
|
||||
}
|
||||
}
|
||||
|
||||
LicenseManager&
|
||||
MainWindow::licenseManager() const
|
||||
{
|
||||
return *m_LicenseManager;
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
||||
{
|
||||
m_pGroupServer->setChecked(!on);
|
||||
@@ -1199,14 +1085,6 @@ void MainWindow::on_m_pActionSettings_triggered()
|
||||
void MainWindow::autoAddScreen(const QString name)
|
||||
{
|
||||
if (!m_ServerConfig.ignoreAutoConfigClient()) {
|
||||
if (m_ActivationDialogRunning) {
|
||||
// TODO: refactor this code
|
||||
// add this screen to the pending list and check this list until
|
||||
// users finish activation dialog
|
||||
m_PendingClientNames.append(name);
|
||||
return;
|
||||
}
|
||||
|
||||
int r = m_ServerConfig.autoAddScreen(name);
|
||||
if (r != kAutoAddScreenOk) {
|
||||
switch (r) {
|
||||
@@ -1242,11 +1120,6 @@ void MainWindow::on_m_pButtonConfigureServer_clicked()
|
||||
showConfigureServer();
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pActivate_triggered()
|
||||
{
|
||||
raiseActivationDialog();
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pButtonApply_clicked()
|
||||
{
|
||||
restartBarrier();
|
||||
@@ -1456,38 +1329,9 @@ void MainWindow::bonjourInstallFinished()
|
||||
m_pCheckBoxAutoConfig->setChecked(true);
|
||||
}
|
||||
|
||||
int MainWindow::raiseActivationDialog()
|
||||
{
|
||||
if (m_ActivationDialogRunning) {
|
||||
return QDialog::Rejected;
|
||||
}
|
||||
ActivationDialog activationDialog (this, appConfig(), licenseManager());
|
||||
m_ActivationDialogRunning = true;
|
||||
connect (&activationDialog, SIGNAL(finished(int)),
|
||||
this, SLOT(on_activationDialogFinish()), Qt::QueuedConnection);
|
||||
int result = activationDialog.exec();
|
||||
m_ActivationDialogRunning = false;
|
||||
if (!m_PendingClientNames.empty()) {
|
||||
foreach (const QString& name, m_PendingClientNames) {
|
||||
autoAddScreen(name);
|
||||
}
|
||||
|
||||
m_PendingClientNames.clear();
|
||||
}
|
||||
if (result == QDialog::Accepted) {
|
||||
restartBarrier();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void MainWindow::on_windowShown()
|
||||
{
|
||||
time_t currentTime = ::time(0);
|
||||
if (!m_AppConfig->activationHasRun()
|
||||
&& ((m_AppConfig->edition() == kUnregistered) ||
|
||||
(m_LicenseManager->serialKey().isExpired(currentTime)))) {
|
||||
raiseActivationDialog();
|
||||
}
|
||||
// removed activation garbage; leaving stub to be optimized out
|
||||
}
|
||||
|
||||
QString MainWindow::getProfileRootForArg()
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "VersionChecker.h"
|
||||
#include "IpcClient.h"
|
||||
#include "Ipc.h"
|
||||
#include "ActivationDialog.h"
|
||||
|
||||
#include <QMutex>
|
||||
|
||||
@@ -58,7 +57,6 @@ class ZeroconfService;
|
||||
class DataDownloader;
|
||||
class CommandProcess;
|
||||
class SslCertificate;
|
||||
class LicenseManager;
|
||||
|
||||
class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
{
|
||||
@@ -66,7 +64,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
|
||||
friend class QBarrierApplication;
|
||||
friend class SetupWizard;
|
||||
friend class ActivationDialog;
|
||||
friend class SettingsDialog;
|
||||
|
||||
public:
|
||||
@@ -95,8 +92,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
};
|
||||
|
||||
public:
|
||||
MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||
LicenseManager& licenseManager);
|
||||
MainWindow(QSettings& settings, AppConfig& appConfig);
|
||||
~MainWindow();
|
||||
|
||||
public:
|
||||
@@ -118,14 +114,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
void updateZeroconfService();
|
||||
void serverDetected(const QString name);
|
||||
void updateLocalFingerprint();
|
||||
LicenseManager& licenseManager() const;
|
||||
|
||||
int raiseActivationDialog();
|
||||
|
||||
public slots:
|
||||
void setEdition(Edition edition);
|
||||
void beginTrial(bool isExpiring);
|
||||
void endTrial(bool isExpired);
|
||||
void appendLogRaw(const QString& text);
|
||||
void appendLogInfo(const QString& text);
|
||||
void appendLogDebug(const QString& text);
|
||||
@@ -141,7 +131,6 @@ public slots:
|
||||
bool on_m_pActionSave_triggered();
|
||||
void on_m_pActionAbout_triggered();
|
||||
void on_m_pActionSettings_triggered();
|
||||
void on_m_pActivate_triggered();
|
||||
void barrierFinished(int exitCode, QProcess::ExitStatus);
|
||||
void trayActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
void stopBarrier();
|
||||
@@ -185,7 +174,6 @@ public slots:
|
||||
void promptAutoConfig();
|
||||
QString getProfileRootForArg();
|
||||
void checkConnected(const QString& line);
|
||||
void checkLicense(const QString& line);
|
||||
void checkFingerprint(const QString& line);
|
||||
bool autoHide();
|
||||
QString getTimeStamp();
|
||||
@@ -197,7 +185,6 @@ public slots:
|
||||
private:
|
||||
QSettings& m_Settings;
|
||||
AppConfig* m_AppConfig;
|
||||
LicenseManager* m_LicenseManager;
|
||||
QProcess* m_pBarrier;
|
||||
int m_BarrierState;
|
||||
ServerConfig m_ServerConfig;
|
||||
@@ -223,7 +210,6 @@ public slots:
|
||||
qRuningState m_ExpectedRunningState;
|
||||
QMutex m_StopDesktopMutex;
|
||||
SslCertificate* m_pSslCertificate;
|
||||
bool m_ActivationDialogRunning;
|
||||
QStringList m_PendingClientNames;
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -27,57 +27,6 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="m_trialWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<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>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Barrier.qrc">:/res/icons/16x16/warning.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_trialLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">%1</span> days of your Barrier Pro trial remain. <a href="http://symless.com/pricing?src=gui"><span style=" text-decoration: underline; color:#0000ff;">Buy now!</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<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>
|
||||
<widget class="QWidget" name="m_pWidgetUpdate" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@@ -532,14 +481,6 @@
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_pActivate">
|
||||
<property name="text">
|
||||
<string>Activate</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Activate</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Barrier.qrc"/>
|
||||
|
||||
@@ -63,7 +63,6 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||
#endif
|
||||
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||
m_pCheckBoxEnableCrypto->setEnabled(m_appConfig.edition() == kPro);
|
||||
}
|
||||
|
||||
void SettingsDialog::accept()
|
||||
|
||||
@@ -176,9 +176,6 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="m_pCheckBoxEnableCrypto">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use &SSL encryption</string>
|
||||
</property>
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#include "SetupWizard.h"
|
||||
#include "MainWindow.h"
|
||||
#include "WebClient.h"
|
||||
#include "ActivationNotifier.h"
|
||||
#include "LicenseManager.h"
|
||||
#include "QBarrierApplication.h"
|
||||
#include "QUtility.h"
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#define TRAY_RETRY_WAIT 2000
|
||||
|
||||
#include "QBarrierApplication.h"
|
||||
#include "LicenseManager.h"
|
||||
#include "MainWindow.h"
|
||||
#include "AppConfig.h"
|
||||
#include "SetupWizard.h"
|
||||
@@ -91,12 +90,10 @@ int main(int argc, char* argv[])
|
||||
|
||||
QSettings settings;
|
||||
AppConfig appConfig (&settings);
|
||||
qRegisterMetaType<Edition>("Edition");
|
||||
LicenseManager licenseManager (&appConfig);
|
||||
|
||||
app.switchTranslator(appConfig.language());
|
||||
|
||||
MainWindow mainWindow(settings, appConfig, licenseManager);
|
||||
MainWindow mainWindow(settings, appConfig);
|
||||
SetupWizard setupWizard(mainWindow, true);
|
||||
|
||||
if (appConfig.wizardShouldRun())
|
||||
|
||||
Reference in New Issue
Block a user