mirror of
https://github.com/deskflow/deskflow.git
synced 2026-07-07 21:07:23 +08:00
SYNERGY-969 Detect if Linux is running with Wayland, and display a wa… (#6999)
* SYNERGY-969 Detect if Linux is running with Wayland, and display a warning message *Add Waylend detect logic * SYNERGY-969 Detect if Linux is running with Wayland, and display a warning message *Add new files *Update changelog * SYNERGY-969 Detect if Linux is running with Wayland, and display a warning message *Remove debug code * SYNERGY-969 Detect if Linux is running with Wayland, and display a warning message *Fix code smells Co-authored-by: Andrii Batyiev <andrii-external@symless.com>
This commit is contained in:
parent
cb3f8af98c
commit
a53b17cce3
@ -27,6 +27,7 @@ Enhancements:
|
||||
- #6984 Update synergy UI. Client error messages
|
||||
- #6962 | #6965 Add macOS 10.13 builder
|
||||
- #6990 Change VersionChecker URL and include system language in the header
|
||||
- #6999 Detect if Linux is running with Wayland, and display a warning message
|
||||
===========
|
||||
|
||||
v1.13.1-stable
|
||||
|
||||
@ -21,5 +21,6 @@
|
||||
<file>image/welcome.png</file>
|
||||
<file>icons/64x64/folder.png</file>
|
||||
<file>fonts/Arial.ttf</file>
|
||||
<file>image/setupBlocker.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
src/gui/res/image/setupBlocker.png
Normal file
BIN
src/gui/res/image/setupBlocker.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
58
src/gui/src/SetupWizardBlocker.cpp
Normal file
58
src/gui/src/SetupWizardBlocker.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
*
|
||||
* 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 <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
#include "SetupWizardBlocker.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
static const std::vector<const char *> blockerTitels = {
|
||||
"No Wayland support",
|
||||
};
|
||||
|
||||
static const std::vector<const char *> blockerText = {
|
||||
"We have detected your system is using Wayland. It is not currently \n"
|
||||
"supported, but we are working on it. It's top of our priority list. \n"
|
||||
"\n"
|
||||
"Please switch to Xorg if you wish to continue using Synergy today.",
|
||||
};
|
||||
|
||||
SetupWizardBlocker::SetupWizardBlocker(MainWindow& mainWindow, qBlockerType type) :
|
||||
m_MainWindow(mainWindow)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
label_Title->setText(blockerTitels[static_cast<int>(type)]);
|
||||
|
||||
label_HelpInfo->setText(blockerText[static_cast<int>(type)]);
|
||||
|
||||
connect(m_pButtonSupport, &QPushButton::released, this, &SetupWizardBlocker::onlineSupport);
|
||||
connect(m_pButtonCancel, &QPushButton::released, this, &SetupWizardBlocker::cancel);
|
||||
}
|
||||
|
||||
void SetupWizardBlocker::onlineSupport()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://symless.com/help"));
|
||||
cancel();
|
||||
}
|
||||
|
||||
void SetupWizardBlocker::cancel()
|
||||
{
|
||||
QDialog::reject();
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
41
src/gui/src/SetupWizardBlocker.h
Normal file
41
src/gui/src/SetupWizardBlocker.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
*
|
||||
* 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 "ui_SetupWizardBlocker.h"
|
||||
#include <QDialog>
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class SetupWizardBlocker : public QDialog, public Ui::SetupWizardBlocker
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum class qBlockerType
|
||||
{
|
||||
waylandDetected
|
||||
};
|
||||
explicit SetupWizardBlocker(MainWindow& mainWindow, qBlockerType type);
|
||||
|
||||
protected:
|
||||
void onlineSupport();
|
||||
void cancel();
|
||||
|
||||
private:
|
||||
MainWindow& m_MainWindow;
|
||||
};
|
||||
177
src/gui/src/SetupWizardBlocker.ui
Normal file
177
src/gui/src/SetupWizardBlocker.ui
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SetupWizardBlocker</class>
|
||||
<widget class="QDialog" name="SetupWizardBlocker">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>720</width>
|
||||
<height>580</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>720</width>
|
||||
<height>580</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>720</width>
|
||||
<height>580</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>720</width>
|
||||
<height>580</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Setup Synergy</string>
|
||||
</property>
|
||||
<property name="windowOpacity">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_Image">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>278</x>
|
||||
<y>87</y>
|
||||
<width>165</width>
|
||||
<height>165</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../res/Synergy.qrc">:/res/image/setupBlocker.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>273</y>
|
||||
<width>720</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>18</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Test header</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_HelpInfo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>153</x>
|
||||
<y>321</y>
|
||||
<width>455</width>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>13</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>large text test large text test large text test</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="m_pButtonCancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>642</x>
|
||||
<y>540</y>
|
||||
<width>71</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>13</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="m_pButtonSupport">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>500</x>
|
||||
<y>540</y>
|
||||
<width>131</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>13</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Online support</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../res/Synergy.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -21,6 +21,7 @@
|
||||
#include "MainWindow.h"
|
||||
#include "AppConfig.h"
|
||||
#include "SetupWizard.h"
|
||||
#include "SetupWizardBlocker.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@ -98,6 +99,14 @@ int main(int argc, char* argv[])
|
||||
QObject::connect(dynamic_cast<QObject*>(&app), SIGNAL(aboutToQuit()),
|
||||
&mainWindow, SLOT(saveSettings()));
|
||||
|
||||
std::unique_ptr<SetupWizardBlocker> setupBlocker;
|
||||
if (qgetenv("XDG_SESSION_TYPE") == "wayland")
|
||||
{
|
||||
setupBlocker.reset(new SetupWizardBlocker(mainWindow, SetupWizardBlocker::qBlockerType::waylandDetected));
|
||||
setupBlocker->show();
|
||||
return QApplication::exec();
|
||||
}
|
||||
|
||||
std::unique_ptr<SetupWizard> setupWizard;
|
||||
if (appConfig.wizardShouldRun())
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user