Merge branch 'dev' into ss/impl

This commit is contained in:
pokamest 2021-01-10 20:52:04 +03:00
commit ba686556d2
11 changed files with 126 additions and 96 deletions

View file

@ -27,16 +27,17 @@
#endif
MainWindow::MainWindow(QWidget *parent) :
#ifdef Q_OS_WIN
#ifdef Q_OS_WIN
CFramelessWindow(parent),
#else
#else
QMainWindow(parent),
#endif
#endif
ui(new Ui::MainWindow),
m_settings(new Settings),
m_vpnConnection(nullptr)
m_vpnConnection(nullptr),
m_settings(new Settings)
{
ui->setupUi(this);
ui->label_error_text->clear();
ui->widget_tittlebar->installEventFilter(this);
ui->stackedWidget_main->setSpeed(200);
@ -209,10 +210,10 @@ void MainWindow::onPushButtonNewServerConnectWithNewData(bool)
serverCredentials.password = ui->lineEdit_new_server_password->text();
bool ok = installServer(serverCredentials,
ui->page_new_server,
ui->progressBar_new_server_connection,
ui->pushButton_new_server_connect_with_new_data,
ui->label_new_server_wait_info);
ui->page_new_server,
ui->progressBar_new_server_connection,
ui->pushButton_new_server_connect_with_new_data,
ui->label_new_server_wait_info);
if (ok) {
m_settings->setServerCredentials(serverCredentials);
@ -375,8 +376,7 @@ void MainWindow::onConnectionStateChanged(VpnProtocol::ConnectionState state)
void MainWindow::onVpnProtocolError(ErrorCode errorCode)
{
// TODO fix crash on Windows when starting vpn and another vpn already connected
//QMessageBox::critical(this, APPLICATION_NAME, errorString(errorCode));
ui->label_error_text->setText(errorString(errorCode));
}
void MainWindow::onPushButtonConnectClicked(bool checked)
@ -507,13 +507,13 @@ void MainWindow::setTrayState(VpnProtocol::ConnectionState state)
setTrayIcon(QString(resourcesPath).arg(DisconnectedTrayIconName));
}
//#ifdef Q_OS_MAC
// // Get theme from current user (note, this app can be launched as root application and in this case this theme can be different from theme of real current user )
// bool darkTaskBar = MacOSFunctions::instance().isMenuBarUseDarkTheme();
// darkTaskBar = forceUseBrightIcons ? true : darkTaskBar;
// resourcesPath = ":/images_mac/tray_icon/%1";
// useIconName = useIconName.replace(".png", darkTaskBar ? "@2x.png" : " dark@2x.png");
//#endif
//#ifdef Q_OS_MAC
// // Get theme from current user (note, this app can be launched as root application and in this case this theme can be different from theme of real current user )
// bool darkTaskBar = MacOSFunctions::instance().isMenuBarUseDarkTheme();
// darkTaskBar = forceUseBrightIcons ? true : darkTaskBar;
// resourcesPath = ":/images_mac/tray_icon/%1";
// useIconName = useIconName.replace(".png", darkTaskBar ? "@2x.png" : " dark@2x.png");
//#endif
}
@ -528,6 +528,7 @@ void MainWindow::onTrayActivated(QSystemTrayIcon::ActivationReason reason)
void MainWindow::onConnect()
{
ui->label_error_text->clear();
ui->pushButton_connect->setChecked(true);
qApp->processEvents();

View file

@ -267,7 +267,7 @@ QStackedWidget QWidget {
</string>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="page_start">
<widget class="QLabel" name="label_23">
@ -1140,6 +1140,28 @@ color: #181922;
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_error_text">
<property name="geometry">
<rect>
<x>0</x>
<y>300</y>
<width>381</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>Error text</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_sites">
<property name="styleSheet">