#5657 Refresh UI when synergys reports trial expired
This commit is contained in:
parent
99dbdc5eb3
commit
5a34da3ce0
|
@ -411,12 +411,12 @@ void MainWindow::appendLogRaw(const QString& text)
|
||||||
foreach(QString line, text.split(QRegExp("\r|\n|\r\n"))) {
|
foreach(QString line, text.split(QRegExp("\r|\n|\r\n"))) {
|
||||||
if (!line.isEmpty()) {
|
if (!line.isEmpty()) {
|
||||||
m_pLogOutput->append(line);
|
m_pLogOutput->append(line);
|
||||||
updateStateFromLogLine(line);
|
updateFromLogLine(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateStateFromLogLine(const QString &line)
|
void MainWindow::updateFromLogLine(const QString &line)
|
||||||
{
|
{
|
||||||
checkConnected(line);
|
checkConnected(line);
|
||||||
checkFingerprint(line);
|
checkFingerprint(line);
|
||||||
|
@ -444,6 +444,13 @@ void MainWindow::checkConnected(const QString& line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::checkLicense(const QString &line)
|
||||||
|
{
|
||||||
|
if (line.contains("trial has expired")) {
|
||||||
|
m_SubscriptionManager->refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::checkFingerprint(const QString& line)
|
void MainWindow::checkFingerprint(const QString& line)
|
||||||
{
|
{
|
||||||
QRegExp fingerprintRegex(".*server fingerprint: ([A-F0-9:]+)");
|
QRegExp fingerprintRegex(".*server fingerprint: ([A-F0-9:]+)");
|
||||||
|
|
|
@ -62,174 +62,175 @@ class SubscriptionManager;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
friend class QSynergyApplication;
|
friend class QSynergyApplication;
|
||||||
friend class SetupWizard;
|
friend class SetupWizard;
|
||||||
friend class ActivationDialog;
|
friend class ActivationDialog;
|
||||||
friend class SettingsDialog;
|
friend class SettingsDialog;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum qSynergyState
|
enum qSynergyState
|
||||||
{
|
{
|
||||||
synergyDisconnected,
|
synergyDisconnected,
|
||||||
synergyConnecting,
|
synergyConnecting,
|
||||||
synergyConnected,
|
synergyConnected,
|
||||||
synergyTransfering
|
synergyTransfering
|
||||||
};
|
};
|
||||||
|
|
||||||
enum qSynergyType
|
enum qSynergyType
|
||||||
{
|
{
|
||||||
synergyClient,
|
synergyClient,
|
||||||
synergyServer
|
synergyServer
|
||||||
};
|
};
|
||||||
|
|
||||||
enum qLevel {
|
enum qLevel {
|
||||||
Error,
|
Error,
|
||||||
Info
|
Info
|
||||||
};
|
};
|
||||||
|
|
||||||
enum qRuningState {
|
enum qRuningState {
|
||||||
kStarted,
|
kStarted,
|
||||||
kStopped
|
kStopped
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QSettings& settings, AppConfig& appConfig,
|
MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||||
SubscriptionManager& subscriptionManager);
|
SubscriptionManager& subscriptionManager);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
int synergyType() const { return m_pGroupClient->isChecked() ? synergyClient : synergyServer; }
|
int synergyType() const { return m_pGroupClient->isChecked() ? synergyClient : synergyServer; }
|
||||||
int synergyState() const { return m_SynergyState; }
|
int synergyState() const { return m_SynergyState; }
|
||||||
QString hostname() const { return m_pLineEditHostname->text(); }
|
QString hostname() const { return m_pLineEditHostname->text(); }
|
||||||
QString configFilename();
|
QString configFilename();
|
||||||
QString address();
|
QString address();
|
||||||
QString appPath(const QString& name);
|
QString appPath(const QString& name);
|
||||||
void open();
|
void open();
|
||||||
void clearLog();
|
void clearLog();
|
||||||
VersionChecker& versionChecker() { return m_VersionChecker; }
|
VersionChecker& versionChecker() { return m_VersionChecker; }
|
||||||
QString getScreenName();
|
QString getScreenName();
|
||||||
ServerConfig& serverConfig() { return m_ServerConfig; }
|
ServerConfig& serverConfig() { return m_ServerConfig; }
|
||||||
void showConfigureServer(const QString& message);
|
void showConfigureServer(const QString& message);
|
||||||
void showConfigureServer() { showConfigureServer(""); }
|
void showConfigureServer() { showConfigureServer(""); }
|
||||||
void autoAddScreen(const QString name);
|
void autoAddScreen(const QString name);
|
||||||
void updateZeroconfService();
|
void updateZeroconfService();
|
||||||
void serverDetected(const QString name);
|
void serverDetected(const QString name);
|
||||||
void updateLocalFingerprint();
|
void updateLocalFingerprint();
|
||||||
SubscriptionManager& subscriptionManager() const;
|
SubscriptionManager& subscriptionManager() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setEdition(Edition edition);
|
void setEdition(Edition edition);
|
||||||
void beginTrial(bool isExpiring);
|
void beginTrial(bool isExpiring);
|
||||||
void endTrial(bool isExpired);
|
void endTrial(bool isExpired);
|
||||||
void appendLogRaw(const QString& text);
|
void appendLogRaw(const QString& text);
|
||||||
void appendLogInfo(const QString& text);
|
void appendLogInfo(const QString& text);
|
||||||
void appendLogDebug(const QString& text);
|
void appendLogDebug(const QString& text);
|
||||||
void appendLogError(const QString& text);
|
void appendLogError(const QString& text);
|
||||||
void startSynergy();
|
void startSynergy();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void sslToggled(bool enabled);
|
void sslToggled(bool enabled);
|
||||||
void on_m_pGroupClient_toggled(bool on);
|
void on_m_pGroupClient_toggled(bool on);
|
||||||
void on_m_pGroupServer_toggled(bool on);
|
void on_m_pGroupServer_toggled(bool on);
|
||||||
bool on_m_pButtonBrowseConfigFile_clicked();
|
bool on_m_pButtonBrowseConfigFile_clicked();
|
||||||
void on_m_pButtonConfigureServer_clicked();
|
void on_m_pButtonConfigureServer_clicked();
|
||||||
bool on_m_pActionSave_triggered();
|
bool on_m_pActionSave_triggered();
|
||||||
void on_m_pActionAbout_triggered();
|
void on_m_pActionAbout_triggered();
|
||||||
void on_m_pActionSettings_triggered();
|
void on_m_pActionSettings_triggered();
|
||||||
void on_m_pActivate_triggered();
|
void on_m_pActivate_triggered();
|
||||||
void synergyFinished(int exitCode, QProcess::ExitStatus);
|
void synergyFinished(int exitCode, QProcess::ExitStatus);
|
||||||
void trayActivated(QSystemTrayIcon::ActivationReason reason);
|
void trayActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
void stopSynergy();
|
void stopSynergy();
|
||||||
void logOutput();
|
void logOutput();
|
||||||
void logError();
|
void logError();
|
||||||
void updateFound(const QString& version);
|
void updateFound(const QString& version);
|
||||||
void bonjourInstallFinished();
|
void bonjourInstallFinished();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSettings& settings() { return m_Settings; }
|
QSettings& settings() { return m_Settings; }
|
||||||
AppConfig& appConfig() { return *m_AppConfig; }
|
AppConfig& appConfig() { return *m_AppConfig; }
|
||||||
QProcess* synergyProcess() { return m_pSynergy; }
|
QProcess* synergyProcess() { return m_pSynergy; }
|
||||||
void setSynergyProcess(QProcess* p) { m_pSynergy = p; }
|
void setSynergyProcess(QProcess* p) { m_pSynergy = p; }
|
||||||
void initConnections();
|
void initConnections();
|
||||||
void createMenuBar();
|
void createMenuBar();
|
||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
void createTrayIcon();
|
void createTrayIcon();
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void setIcon(qSynergyState state);
|
void setIcon(qSynergyState state);
|
||||||
void setSynergyState(qSynergyState state);
|
void setSynergyState(qSynergyState state);
|
||||||
bool checkForApp(int which, QString& app);
|
bool checkForApp(int which, QString& app);
|
||||||
bool clientArgs(QStringList& args, QString& app);
|
bool clientArgs(QStringList& args, QString& app);
|
||||||
bool serverArgs(QStringList& args, QString& app);
|
bool serverArgs(QStringList& args, QString& app);
|
||||||
void setStatus(const QString& status);
|
void setStatus(const QString& status);
|
||||||
void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors);
|
void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors);
|
||||||
void onModeChanged(bool startDesktop, bool applyService);
|
void onModeChanged(bool startDesktop, bool applyService);
|
||||||
void updateStateFromLogLine(const QString& line);
|
void updateFromLogLine(const QString& line);
|
||||||
QString getIPAddresses();
|
QString getIPAddresses();
|
||||||
void stopService();
|
void stopService();
|
||||||
void stopDesktop();
|
void stopDesktop();
|
||||||
void changeEvent(QEvent* event);
|
void changeEvent(QEvent* event);
|
||||||
void retranslateMenuBar();
|
void retranslateMenuBar();
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
bool isServiceRunning(QString name);
|
bool isServiceRunning(QString name);
|
||||||
#else
|
#else
|
||||||
bool isServiceRunning();
|
bool isServiceRunning();
|
||||||
#endif
|
#endif
|
||||||
bool isBonjourRunning();
|
bool isBonjourRunning();
|
||||||
void downloadBonjour();
|
void downloadBonjour();
|
||||||
void promptAutoConfig();
|
void promptAutoConfig();
|
||||||
QString getProfileRootForArg();
|
QString getProfileRootForArg();
|
||||||
void checkConnected(const QString& line);
|
void checkConnected(const QString& line);
|
||||||
void checkFingerprint(const QString& line);
|
void checkLicense(const QString& line);
|
||||||
bool autoHide();
|
void checkFingerprint(const QString& line);
|
||||||
QString getTimeStamp();
|
bool autoHide();
|
||||||
void restartSynergy();
|
QString getTimeStamp();
|
||||||
void proofreadInfo();
|
void restartSynergy();
|
||||||
|
void proofreadInfo();
|
||||||
|
|
||||||
void showEvent (QShowEvent*);
|
void showEvent (QShowEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings& m_Settings;
|
QSettings& m_Settings;
|
||||||
AppConfig* m_AppConfig;
|
AppConfig* m_AppConfig;
|
||||||
SubscriptionManager* m_SubscriptionManager;
|
SubscriptionManager* m_SubscriptionManager;
|
||||||
QProcess* m_pSynergy;
|
QProcess* m_pSynergy;
|
||||||
int m_SynergyState;
|
int m_SynergyState;
|
||||||
ServerConfig m_ServerConfig;
|
ServerConfig m_ServerConfig;
|
||||||
QTemporaryFile* m_pTempConfigFile;
|
QTemporaryFile* m_pTempConfigFile;
|
||||||
QSystemTrayIcon* m_pTrayIcon;
|
QSystemTrayIcon* m_pTrayIcon;
|
||||||
QMenu* m_pTrayIconMenu;
|
QMenu* m_pTrayIconMenu;
|
||||||
bool m_AlreadyHidden;
|
bool m_AlreadyHidden;
|
||||||
VersionChecker m_VersionChecker;
|
VersionChecker m_VersionChecker;
|
||||||
IpcClient m_IpcClient;
|
IpcClient m_IpcClient;
|
||||||
QMenuBar* m_pMenuBar;
|
QMenuBar* m_pMenuBar;
|
||||||
QMenu* m_pMenuFile;
|
QMenu* m_pMenuFile;
|
||||||
QMenu* m_pMenuEdit;
|
QMenu* m_pMenuEdit;
|
||||||
QMenu* m_pMenuWindow;
|
QMenu* m_pMenuWindow;
|
||||||
QMenu* m_pMenuHelp;
|
QMenu* m_pMenuHelp;
|
||||||
ZeroconfService* m_pZeroconfService;
|
ZeroconfService* m_pZeroconfService;
|
||||||
DataDownloader* m_pDataDownloader;
|
DataDownloader* m_pDataDownloader;
|
||||||
QMessageBox* m_DownloadMessageBox;
|
QMessageBox* m_DownloadMessageBox;
|
||||||
QAbstractButton* m_pCancelButton;
|
QAbstractButton* m_pCancelButton;
|
||||||
QMutex m_UpdateZeroconfMutex;
|
QMutex m_UpdateZeroconfMutex;
|
||||||
bool m_SuppressAutoConfigWarning;
|
bool m_SuppressAutoConfigWarning;
|
||||||
CommandProcess* m_BonjourInstall;
|
CommandProcess* m_BonjourInstall;
|
||||||
bool m_SuppressEmptyServerWarning;
|
bool m_SuppressEmptyServerWarning;
|
||||||
qRuningState m_ExpectedRunningState;
|
qRuningState m_ExpectedRunningState;
|
||||||
QMutex m_StopDesktopMutex;
|
QMutex m_StopDesktopMutex;
|
||||||
SslCertificate* m_pSslCertificate;
|
SslCertificate* m_pSslCertificate;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||||
void on_m_pComboServerList_currentIndexChanged(QString );
|
void on_m_pComboServerList_currentIndexChanged(QString );
|
||||||
void on_m_pButtonApply_clicked();
|
void on_m_pButtonApply_clicked();
|
||||||
void installBonjour();
|
void installBonjour();
|
||||||
void on_windowShown();
|
void on_windowShown();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void windowShown();
|
void windowShown();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -456,7 +456,7 @@ Server::switchScreen(BaseClientProxy* dst,
|
||||||
|
|
||||||
// if trial is expired, exit the process
|
// if trial is expired, exit the process
|
||||||
if (!m_args.m_serial.isExpired(std::time(0))) {
|
if (!m_args.m_serial.isExpired(std::time(0))) {
|
||||||
LOG((CLOG_ERR "trial is expired, aborting server"));
|
LOG((CLOG_ERR "trial has expired, aborting server"));
|
||||||
exit(kExitSuccess);
|
exit(kExitSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue