Win7 fix
Connection import fix
This commit is contained in:
parent
65acdc8c09
commit
02f966bc67
2 changed files with 26 additions and 7 deletions
|
@ -7,6 +7,9 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
|
#include <QSysInfo>
|
||||||
|
#include <QOperatingSystemVersion>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -31,9 +34,10 @@ CFramelessWindow::CFramelessWindow(QWidget *parent)
|
||||||
// setWindowFlag(Qt::WindowSystemMenuHint, true);
|
// setWindowFlag(Qt::WindowSystemMenuHint, true);
|
||||||
// setWindowFlag() is not avaliable before Qt v5.9, so we should use setWindowFlags instead
|
// setWindowFlag() is not avaliable before Qt v5.9, so we should use setWindowFlags instead
|
||||||
|
|
||||||
setWindowFlags(windowFlags() | Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
|
if (QOperatingSystemVersion::current() > QOperatingSystemVersion::Windows7) {
|
||||||
|
setWindowFlags(windowFlags() | Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
|
||||||
setResizeable(m_bResizeable);
|
setResizeable(m_bResizeable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFramelessWindow::setResizeable(bool resizeable)
|
void CFramelessWindow::setResizeable(bool resizeable)
|
||||||
|
@ -99,6 +103,10 @@ void CFramelessWindow::addIgnoreWidget(QWidget* widget)
|
||||||
|
|
||||||
bool CFramelessWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
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
|
//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))
|
#if (QT_VERSION == QT_VERSION_CHECK(5, 11, 1))
|
||||||
MSG* msg = *reinterpret_cast<MSG**>(message);
|
MSG* msg = *reinterpret_cast<MSG**>(message);
|
||||||
|
|
|
@ -44,13 +44,22 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
ui->stackedWidget_main->setSpeed(200);
|
ui->stackedWidget_main->setSpeed(200);
|
||||||
ui->stackedWidget_main->setAnimation(QEasingCurve::Linear);
|
ui->stackedWidget_main->setAnimation(QEasingCurve::Linear);
|
||||||
|
|
||||||
|
bool needToHideCustomTitlebar = false;
|
||||||
|
if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::Windows7) {
|
||||||
|
needToHideCustomTitlebar = true;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
ui->widget_tittlebar->hide();
|
|
||||||
resize(width(), height() - ui->stackedWidget_main->y());
|
|
||||||
ui->stackedWidget_main->move(0,0);
|
|
||||||
fixWidget(this);
|
fixWidget(this);
|
||||||
|
needToHideCustomTitlebar = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (needToHideCustomTitlebar) {
|
||||||
|
ui->widget_tittlebar->hide();
|
||||||
|
resize(width(), height() - ui->stackedWidget_main->y());
|
||||||
|
ui->stackedWidget_main->move(0,0);
|
||||||
|
}
|
||||||
|
|
||||||
// Post initialization
|
// Post initialization
|
||||||
|
|
||||||
if (m_settings.haveAuthData()) {
|
if (m_settings.haveAuthData()) {
|
||||||
|
@ -270,7 +279,7 @@ void MainWindow::onPushButtonNewServerConnectWithExistingCode(bool)
|
||||||
{
|
{
|
||||||
QString s = ui->lineEdit_start_existing_code->text();
|
QString s = ui->lineEdit_start_existing_code->text();
|
||||||
s.replace("vpn://", "");
|
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;
|
ServerCredentials credentials;
|
||||||
credentials.hostName = o.value("h").toString();
|
credentials.hostName = o.value("h").toString();
|
||||||
|
@ -285,6 +294,8 @@ void MainWindow::onPushButtonNewServerConnectWithExistingCode(bool)
|
||||||
arg(credentials.hostName).
|
arg(credentials.hostName).
|
||||||
arg(credentials.port).
|
arg(credentials.port).
|
||||||
arg(credentials.userName);
|
arg(credentials.userName);
|
||||||
|
|
||||||
|
//qDebug() << QString("Password") << credentials.password;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::installServer(ServerCredentials credentials,
|
bool MainWindow::installServer(ServerCredentials credentials,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue