diff --git a/client/ui/framelesswindow.cpp b/client/ui/framelesswindow.cpp index 612f2e012..7f62df9af 100644 --- a/client/ui/framelesswindow.cpp +++ b/client/ui/framelesswindow.cpp @@ -7,6 +7,9 @@ #include #include #include +#include +#include + #ifdef Q_OS_WIN #include @@ -31,9 +34,10 @@ CFramelessWindow::CFramelessWindow(QWidget *parent) // setWindowFlag(Qt::WindowSystemMenuHint, true); // setWindowFlag() is not avaliable before Qt v5.9, so we should use setWindowFlags instead - setWindowFlags(windowFlags() | Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); - - setResizeable(m_bResizeable); + if (QOperatingSystemVersion::current() > QOperatingSystemVersion::Windows7) { + setWindowFlags(windowFlags() | Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); + setResizeable(m_bResizeable); + } } void CFramelessWindow::setResizeable(bool resizeable) @@ -99,6 +103,10 @@ void CFramelessWindow::addIgnoreWidget(QWidget* widget) bool CFramelessWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) { + if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::Windows7) { + return QMainWindow::nativeEvent(eventType, message, result); + } + //Workaround for known bug -> check Qt forum : https://forum.qt.io/topic/93141/qtablewidget-itemselectionchanged/13 #if (QT_VERSION == QT_VERSION_CHECK(5, 11, 1)) MSG* msg = *reinterpret_cast(message); diff --git a/client/ui/mainwindow.cpp b/client/ui/mainwindow.cpp index 26df831aa..2e0167d2c 100644 --- a/client/ui/mainwindow.cpp +++ b/client/ui/mainwindow.cpp @@ -44,13 +44,22 @@ MainWindow::MainWindow(QWidget *parent) : ui->stackedWidget_main->setSpeed(200); ui->stackedWidget_main->setAnimation(QEasingCurve::Linear); + bool needToHideCustomTitlebar = false; + if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::Windows7) { + needToHideCustomTitlebar = true; + } + #ifdef Q_OS_MAC - ui->widget_tittlebar->hide(); - resize(width(), height() - ui->stackedWidget_main->y()); - ui->stackedWidget_main->move(0,0); fixWidget(this); + needToHideCustomTitlebar = true; #endif + if (needToHideCustomTitlebar) { + ui->widget_tittlebar->hide(); + resize(width(), height() - ui->stackedWidget_main->y()); + ui->stackedWidget_main->move(0,0); + } + // Post initialization if (m_settings.haveAuthData()) { @@ -270,7 +279,7 @@ void MainWindow::onPushButtonNewServerConnectWithExistingCode(bool) { QString s = ui->lineEdit_start_existing_code->text(); s.replace("vpn://", ""); - QJsonObject o = QJsonDocument::fromJson(QByteArray::fromBase64(s.toUtf8())).object(); + QJsonObject o = QJsonDocument::fromJson(QByteArray::fromBase64(s.toUtf8(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals)).object(); ServerCredentials credentials; credentials.hostName = o.value("h").toString(); @@ -285,6 +294,8 @@ void MainWindow::onPushButtonNewServerConnectWithExistingCode(bool) arg(credentials.hostName). arg(credentials.port). arg(credentials.userName); + + //qDebug() << QString("Password") << credentials.password; } bool MainWindow::installServer(ServerCredentials credentials,