From e015a528b5f8d9f59ecdecdf6ff36f943b999bb0 Mon Sep 17 00:00:00 2001 From: Erkin Date: Tue, 27 Mar 2018 12:41:45 +0600 Subject: [PATCH 01/17] call wrapper for lsb_release, current os info function --- SubutaiControlCenter.pro | 2 +- commons/include/OsBranchConsts.h | 1 + commons/src/OsBranchConsts.cpp | 23 +++++++++++++++++++++++ hub/include/SystemCallWrapper.h | 2 ++ hub/src/SystemCallWrapper.cpp | 21 +++++++++++++++++++++ 5 files changed, 48 insertions(+), 1 deletion(-) diff --git a/SubutaiControlCenter.pro b/SubutaiControlCenter.pro index 62720578..dd7a6e10 100644 --- a/SubutaiControlCenter.pro +++ b/SubutaiControlCenter.pro @@ -141,7 +141,7 @@ DEFINES += TRAY_VERSION=\\\"$$TRAY_VERSION\\\" GIT_BRANCH_STR = $$system(git rev-parse --abbrev-ref HEAD) DEFINES += GIT_BRANCH=\\\"$$GIT_BRANCH_STR\\\" -GBV=BT_DEV +GBV=BT_PROD equals(GIT_BRANCH_STR, "master") { GBV=BT_MASTER } diff --git a/commons/include/OsBranchConsts.h b/commons/include/OsBranchConsts.h index 4dbefb6e..59209322 100644 --- a/commons/include/OsBranchConsts.h +++ b/commons/include/OsBranchConsts.h @@ -83,4 +83,5 @@ const QString& x2goclient_url(); const QString& current_branch_name(); const QString& branch_name_str(); const QString& base_interface_name(); +void current_os_info(std::vector >& v); #endif // OSBRANCHCONSTS_H diff --git a/commons/src/OsBranchConsts.cpp b/commons/src/OsBranchConsts.cpp index 462abcd0..16023ee0 100644 --- a/commons/src/OsBranchConsts.cpp +++ b/commons/src/OsBranchConsts.cpp @@ -2,6 +2,8 @@ #include #include +#include +#include "SystemCallWrapper.h" template const QString& p2p_kurjun_file_name_temp_internal(); @@ -712,3 +714,24 @@ const QString& base_interface_name() { return base_interface_name_internal< Os2Type >(); } + +//////////////////////////////////////////////////////////////////////////// + +void current_os_info(std::vector >& v){ + v.clear(); + switch (CURRENT_OS) { + case OS_WIN: + v.push_back(std::make_pair("TYPE", "Windows")); + v.push_back(std::make_pair("VERSION:",QSysInfo::productVersion()); + break; + case OS_MAC: + v.push_back(std::make_pair("TYPE", "Mac")); + v.push_back(std::make_pair("VERSION:",QSysInfo::productVersion()); + break; + case OS_LINUX: + v.push_back(std::make_pair("TYPE", "Linux")); + break; + default: + break; + } +} diff --git a/hub/include/SystemCallWrapper.h b/hub/include/SystemCallWrapper.h index 29506498..944db0dc 100644 --- a/hub/include/SystemCallWrapper.h +++ b/hub/include/SystemCallWrapper.h @@ -157,6 +157,8 @@ class CSystemCallWrapper { static system_call_wrapper_error_t install_oracle_virtualbox(const QString &dir, const QString &file_name); + static QStringList lsb_release(); + static system_call_wrapper_error_t run_sshpass_in_terminal(const QString &user, const QString &ip, const QString &port, diff --git a/hub/src/SystemCallWrapper.cpp b/hub/src/SystemCallWrapper.cpp index 8a7a979e..9e953466 100644 --- a/hub/src/SystemCallWrapper.cpp +++ b/hub/src/SystemCallWrapper.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -2155,3 +2156,23 @@ CSystemCallWrapper::container_ip_from_ifconfig_analog(const QString &port, return res; } //////////////////////////////////////////////////////////////////////////// +QStringList CSystemCallWrapper::lsb_release(){ + qDebug() + <<"Taking info about system on Linux"; + + QString cmd = "lsb_release"; + QStringList args("-a"); + system_call_res_t res = CSystemCallWrapper::ssystem_th(cmd, args, true, true, 10000); + + qDebug() + <<"Result about system on Linux:" + <<"Exit code: "< Date: Tue, 27 Mar 2018 12:57:50 +0600 Subject: [PATCH 02/17] os info detailed for linux --- commons/src/OsBranchConsts.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/commons/src/OsBranchConsts.cpp b/commons/src/OsBranchConsts.cpp index 16023ee0..c997275e 100644 --- a/commons/src/OsBranchConsts.cpp +++ b/commons/src/OsBranchConsts.cpp @@ -719,17 +719,30 @@ base_interface_name() { void current_os_info(std::vector >& v){ v.clear(); + QString flag; + QStringList output; switch (CURRENT_OS) { case OS_WIN: v.push_back(std::make_pair("TYPE", "Windows")); - v.push_back(std::make_pair("VERSION:",QSysInfo::productVersion()); + v.push_back(std::make_pair("VERSION:",QSysInfo::productVersion())); break; case OS_MAC: v.push_back(std::make_pair("TYPE", "Mac")); - v.push_back(std::make_pair("VERSION:",QSysInfo::productVersion()); + v.push_back(std::make_pair("VERSION:", QSysInfo::productVersion())); break; case OS_LINUX: v.push_back(std::make_pair("TYPE", "Linux")); + output = CSystemCallWrapper::lsb_release(); + flag=""; + for (auto s : output){ + if(s == "Codename:"){ + flag = "code"; + continue; + } + else if(flag == "code") + v.push_back(std::make_pair("CODE",s)); + flag = ""; + } break; default: break; From a58e74ee4fec0b26a3e2887f5b77aa799ad7e642 Mon Sep 17 00:00:00 2001 From: Erkin Date: Tue, 27 Mar 2018 16:45:22 +0600 Subject: [PATCH 03/17] check before refenrencing #762 --- hub/src/DlgEnvironment.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hub/src/DlgEnvironment.cpp b/hub/src/DlgEnvironment.cpp index 668e43c7..27ef7b80 100644 --- a/hub/src/DlgEnvironment.cpp +++ b/hub/src/DlgEnvironment.cpp @@ -29,6 +29,8 @@ DlgEnvironment::DlgEnvironment(QWidget *parent) : void DlgEnvironment::select_all(bool checked) { for (CHubContainer cont : env.containers()) { + if(selected_conts.find(cont.id()) == selected_conts.end()) + continue; QCheckBox *current_check_box = selected_conts[cont.id()]; current_check_box->setChecked(checked); } @@ -40,6 +42,8 @@ void DlgEnvironment::upload_selected() { ui->btn_upload_selected->setEnabled(false); ui->btn_upload_selected->setText(tr("Loading..")); for (CHubContainer cont : env.containers()) { + if(selected_conts.find(cont.id()) == selected_conts.end()) + continue; QCheckBox *current_check_box = selected_conts[cont.id()]; if (current_check_box->isChecked()) { @@ -59,6 +63,8 @@ void DlgEnvironment::desktop_selected() { ui->btn_desktop_selected->setEnabled(false); ui->btn_desktop_selected->setText(tr("Opening X2Go-Client..")); for (CHubContainer cont : env.containers()) { + if(selected_conts.find(cont.id()) == selected_conts.end()) + continue; QCheckBox *current_check_box = selected_conts[cont.id()]; if (current_check_box->isChecked()) { @@ -77,6 +83,8 @@ void DlgEnvironment::ssh_selected() { ui->btn_ssh_selected->setEnabled(false); ui->btn_ssh_selected->setText(tr("Running ssh commands..")); for (CHubContainer cont : env.containers()) { + if(selected_conts.find(cont.id()) == selected_conts.end()) + continue; QCheckBox *current_check_box = selected_conts[cont.id()]; if (current_check_box->isChecked()) { @@ -124,8 +132,8 @@ void DlgEnvironment::addEnvironment(const CEnvironment *_env) { timer->setInterval(7000); connect(timer, &QTimer::timeout, this, &DlgEnvironment::check_environment_status); timer->start(); - check_environment_status(); + timers.push_back(timer); } ////////////////////////////////////////////////////////////////////////// @@ -137,6 +145,11 @@ void DlgEnvironment::addContainer(const CHubContainer *cont) { QLabel *cont_desktop_info = new QLabel(cont->is_desktop() ? cont->desk_env().isEmpty() ? "MATE" : cont->desk_env() : "No Desktop", this); QCheckBox *cont_select = new QCheckBox("READY" , this); + labels.push_back(cont_name); + labels.push_back(cont_rhip_port); + labels.push_back(cont_desktop_info); + checkboxs.push_back(cont_select); + cont_name->setTextInteractionFlags(Qt::TextSelectableByMouse); cont_rhip_port->setTextInteractionFlags(Qt::TextSelectableByMouse); cont_desktop_info->setTextInteractionFlags(Qt::TextSelectableByMouse); @@ -254,6 +267,8 @@ void DlgEnvironment::check_buttons() { bool connected_to_swarm = (env.healthy() & (swarm_status == P2PController::CONNECTION_SUCCESS)); if(connected_to_swarm){ for (CHubContainer cont : env.containers()) { + if(selected_conts.find(cont.id()) == selected_conts.end()) + continue; QCheckBox *current_check_box = selected_conts[cont.id()]; if(current_check_box->checkState() == Qt::Checked){ if(current_check_box->text() != "READY"){ From 70908e2cf3c0d36185f91569ea14801dd1ec7bdb Mon Sep 17 00:00:00 2001 From: Erkin Date: Tue, 27 Mar 2018 18:28:55 +0600 Subject: [PATCH 04/17] vb packages --- commons/src/OsBranchConsts.cpp | 73 ++++++++++++++++++++-------------- hub/src/SystemCallWrapper.cpp | 5 ++- 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/commons/src/OsBranchConsts.cpp b/commons/src/OsBranchConsts.cpp index c997275e..1b98a928 100644 --- a/commons/src/OsBranchConsts.cpp +++ b/commons/src/OsBranchConsts.cpp @@ -53,28 +53,42 @@ p2p_kurjun_package_name() { return p2p_kurjun_package_name_temp_internal, Os2Type >(); } ////////////////////////////////////////////////////////////////////////////////////////// -template const QString& oracle_virtualbox_kurjun_package_name_temp_internal(); - -#define oracle_virtualbox_kurjun_package_name_def(BT_TYPE, OS_TYPE, STRING) \ - template<> \ - const QString& oracle_virtualbox_kurjun_package_name_temp_internal, Os2Type >() { \ - static QString res(STRING); \ - return res; \ - } - -oracle_virtualbox_kurjun_package_name_def(BT_MASTER, OS_MAC, "VirtualBox.pkg") -oracle_virtualbox_kurjun_package_name_def(BT_MASTER, OS_WIN, "VirtualBox-5.2.8-121009-Win.exe") -oracle_virtualbox_kurjun_package_name_def(BT_MASTER, OS_LINUX, "virtualBox-5.2.8-Linux_amd64.run") -oracle_virtualbox_kurjun_package_name_def(BT_DEV, OS_LINUX, "subutai-p2p-dev.deb") -oracle_virtualbox_kurjun_package_name_def(BT_DEV, OS_MAC, "VirtualBox.pkg") -oracle_virtualbox_kurjun_package_name_def(BT_DEV, OS_WIN, "VirtualBox-5.2.8-121009-Win.exe") -oracle_virtualbox_kurjun_package_name_def(BT_PROD, OS_LINUX, "virtualBox-5.2.8-Linux_amd64.run") -oracle_virtualbox_kurjun_package_name_def(BT_PROD, OS_MAC, "VirtualBox.pkg") -oracle_virtualbox_kurjun_package_name_def(BT_PROD, OS_WIN, "VirtualBox-5.2.8-121009-Win.exe") - const QString & oracle_virtualbox_kurjun_package_name() { - return oracle_virtualbox_kurjun_package_name_temp_internal, Os2Type >(); + static std::vector > info; + static QString kurjun_file = "not_found"; + if(info.empty()) + current_os_info(info); + if(info.empty()) + return kurjun_file; + //first check type of os + QString type = info.begin()->second; + if(type == "Windows") + kurjun_file = "VirtualBox-5.2.8-121009-Win.exe"; + else if(type == "Mac") + kurjun_file = "VirtualBox.pkg"; + if(kurjun_file != "not_found") + return kurjun_file; + if(info.size() < 2 || info[0].second != "Linux") + return kurjun_file; + QString codename = info[1].second; + if(codename == "bionic") + kurjun_file = "virtualbox-5.2_5.2.8-121009_Ubuntu_bionic_amd64.deb"; + else if(codename == "zesty") + kurjun_file = ""; + else if(codename == "yakkety") + kurjun_file = ""; + else if(codename == "xenial") + kurjun_file = "virtualbox-5.2_5.2.8-121009_Ubuntu_xenial_amd64.deb"; + else if(codename == "trusty") + kurjun_file = ""; + else if(codename == "stretch") + kurjun_file = ""; + else if(codename == "jessie") + kurjun_file = ""; + else if(codename == "wheezy") + kurjun_file = ""; + return kurjun_file; } ////////////////////////////////////////////////////////////////////////////////////////// template const QString& x2go_kurjun_package_name_temp_internal(); @@ -719,7 +733,7 @@ base_interface_name() { void current_os_info(std::vector >& v){ v.clear(); - QString flag; + QString flag, st; QStringList output; switch (CURRENT_OS) { case OS_WIN: @@ -733,15 +747,16 @@ void current_os_info(std::vector >& v){ case OS_LINUX: v.push_back(std::make_pair("TYPE", "Linux")); output = CSystemCallWrapper::lsb_release(); - flag=""; for (auto s : output){ - if(s == "Codename:"){ - flag = "code"; - continue; - } - else if(flag == "code") - v.push_back(std::make_pair("CODE",s)); - flag = ""; + flag = st = ""; + for (int i = 0; i < s.length(); i++) + if(s[i] == '\t'){ + flag = st; + st = ""; + } + else st += s[i]; + if(flag == "Codename:") + v.push_back(std::make_pair("CODE", st)); } break; default: diff --git a/hub/src/SystemCallWrapper.cpp b/hub/src/SystemCallWrapper.cpp index 9e953466..b9994e19 100644 --- a/hub/src/SystemCallWrapper.cpp +++ b/hub/src/SystemCallWrapper.cpp @@ -1167,7 +1167,7 @@ system_call_wrapper_error_t install_oracle_virtualbox_internal Date: Tue, 27 Mar 2018 19:58:36 +0600 Subject: [PATCH 05/17] install libssl1.0-dev --- SubutaiControlCenter.pro | 2 +- hub/include/DlgLogin.h | 1 + hub/include/DlgNotification.h | 3 +- hub/include/SystemCallWrapper.h | 4 ++ hub/src/DlgAbout.cpp | 4 -- hub/src/DlgLogin.cpp | 12 +++++ hub/src/DlgNotification.cpp | 5 +- hub/src/SystemCallWrapper.cpp | 89 +++++++++++++++++++++++++++++++++ 8 files changed, 112 insertions(+), 8 deletions(-) diff --git a/SubutaiControlCenter.pro b/SubutaiControlCenter.pro index dd7a6e10..432ab328 100644 --- a/SubutaiControlCenter.pro +++ b/SubutaiControlCenter.pro @@ -155,7 +155,7 @@ equals(GIT_BRANCH_STR, "head") { } equals(GIT_BRANCH_STR, "dev") { - GBV=BT_DEV + GBV=BT_PROD } DEFINES += CURRENT_BRANCH=$$GBV diff --git a/hub/include/DlgLogin.h b/hub/include/DlgLogin.h index 268598dc..fcb0030f 100644 --- a/hub/include/DlgLogin.h +++ b/hub/include/DlgLogin.h @@ -27,6 +27,7 @@ class DlgLogin : public QDialog * \brief Run dialog in different modes. When "Remember me" flag checked - it tries to login without dialog. */ void run_dialog(QSplashScreen *sc); + void solve_libssl(); private slots: void btn_ok_released(); diff --git a/hub/include/DlgNotification.h b/hub/include/DlgNotification.h index 64f5f162..bcea39fa 100644 --- a/hub/include/DlgNotification.h +++ b/hub/include/DlgNotification.h @@ -22,7 +22,8 @@ class DlgNotification : public QDialog public: enum NOTIFICATION_ACTION_TYPE{N_UPDATE_P2P = 0, N_UPDATE_TRAY, N_UPDATE_RH, N_UPDATE_RHM, - N_SETTINGS, N_GO_TO_HUB, N_NOTF_HISTORY, N_RESTART_TRAY, N_ABOUT, N_NO_ACTION, N_START_P2P, N_INSTALL_P2P}; + N_SETTINGS, N_GO_TO_HUB, N_NOTF_HISTORY, N_RESTART_TRAY, N_ABOUT, N_NO_ACTION, + N_START_P2P, N_INSTALL_P2P, N_RESOLVE_LIBSSL}; explicit DlgNotification(size_t notification_level, diff --git a/hub/include/SystemCallWrapper.h b/hub/include/SystemCallWrapper.h index 944db0dc..98591dfc 100644 --- a/hub/include/SystemCallWrapper.h +++ b/hub/include/SystemCallWrapper.h @@ -157,6 +157,10 @@ class CSystemCallWrapper { static system_call_wrapper_error_t install_oracle_virtualbox(const QString &dir, const QString &file_name); + static system_call_res_t run_linux_script(QStringList args); + + static system_call_wrapper_error_t install_libssl(); + static QStringList lsb_release(); static system_call_wrapper_error_t run_sshpass_in_terminal(const QString &user, diff --git a/hub/src/DlgAbout.cpp b/hub/src/DlgAbout.cpp index d80c4a2f..006afa5c 100644 --- a/hub/src/DlgAbout.cpp +++ b/hub/src/DlgAbout.cpp @@ -389,10 +389,6 @@ DlgAboutInitializer::do_initialization() { //////////////////////////////////////////////////////////////////////////// void DlgAbout::install_finished(const QString &file_id, bool success){ qDebug()<<"Install finished for"<component_name(file_id)), - DlgNotification::N_NO_ACTION); - } if (m_dct_fpb.find(file_id) == m_dct_fpb.end()) return; m_dct_fpb[file_id].btn->setEnabled(false); m_dct_fpb[file_id].pb->setEnabled(false); diff --git a/hub/src/DlgLogin.cpp b/hub/src/DlgLogin.cpp index 576fcaf9..ec669cdd 100644 --- a/hub/src/DlgLogin.cpp +++ b/hub/src/DlgLogin.cpp @@ -5,6 +5,7 @@ #include "RestWorker.h" #include #include "OsBranchConsts.h" +#include "NotificationObserver.h" DlgLogin::DlgLogin(QWidget *parent) : QDialog(parent), @@ -145,3 +146,14 @@ DlgLogin::cb_show_pass_state_changed(int st) QLineEdit::PasswordEchoOnEdit : QLineEdit::Password); } //////////////////////////////////////////////////////////////////////////// + +void DlgLogin::solve_libssl(){ + std::vector > info; + current_os_info(info); + if(info.empty()) + return; + if(info.size() < 2) + return; + CNotificationObserver::Instance()->Error(tr("Error in using libssl libraries. Press button to resolve it."), DlgNotification::N_ABOUT); + +} diff --git a/hub/src/DlgNotification.cpp b/hub/src/DlgNotification.cpp index 44084d3c..78de1dd9 100644 --- a/hub/src/DlgNotification.cpp +++ b/hub/src/DlgNotification.cpp @@ -26,7 +26,7 @@ DlgNotification::DlgNotification( std::function call_func; } action_handler[] = { {"Update P2P", [](){update_system::CHubComponentsUpdater::Instance()->force_update_p2p();}}, - {"Update Control Center",[](){update_system::CHubComponentsUpdater::Instance()->force_update_tray();}}, + {"Update",[](){update_system::CHubComponentsUpdater::Instance()->force_update_tray();}}, {"Update Resource Host", [](){update_system::CHubComponentsUpdater::Instance()->force_update_rh();}}, {"Update RH Management", [](){update_system::CHubComponentsUpdater::Instance()->force_update_rhm();}}, {"Settings", [](){TrayControlWindow::Instance()->show_settings_dialog();}}, @@ -46,7 +46,8 @@ DlgNotification::DlgNotification( "You can get the %1 daemon from here."). arg(current_branch_name()).arg(p2p_package_url()), DlgNotification::N_SETTINGS); emit P2PStatus_checker::Instance().p2p_status(P2PStatus_checker::P2P_LOADING);}}, - {"Install P2P", [](){update_system::CHubComponentsUpdater::Instance()->install_p2p();}} + {"Install P2P", [](){update_system::CHubComponentsUpdater::Instance()->install_p2p();}}, + {"Resolve", [](){system_call_wrapper_error_t res = CSystemCallWrapper::install_libssl(); UNUSED_ARG(res);}} }; if (action_type == N_NO_ACTION) diff --git a/hub/src/SystemCallWrapper.cpp b/hub/src/SystemCallWrapper.cpp index b9994e19..4d578da6 100644 --- a/hub/src/SystemCallWrapper.cpp +++ b/hub/src/SystemCallWrapper.cpp @@ -1212,6 +1212,95 @@ system_call_wrapper_error_t CSystemCallWrapper::install_oracle_virtualbox(const return install_oracle_virtualbox_internal > (dir, file_name); } //////////////////////////////////////////////////////////////////////////////////////////////////////// +system_call_wrapper_error_t CSystemCallWrapper::install_libssl(){ + QString gksu_path; + system_call_wrapper_error_t scr = CSystemCallWrapper::which("gksu", gksu_path); + if (scr != SCWE_SUCCESS) { + QString err_msg = QObject::tr ("Couldn't find gksu command"); + qCritical() << err_msg; + CNotificationObserver::Error(err_msg, DlgNotification::N_NO_ACTION); + return SCWE_WHICH_CALL_FAILED; + } + + QString sh_path; + scr = CSystemCallWrapper::which("sh", sh_path); + if (scr != SCWE_SUCCESS) { + QString err_msg = QObject::tr ("Couldn't find sh command"); + qCritical() << err_msg; + CNotificationObserver::Error(err_msg, DlgNotification::N_NO_ACTION); + return SCWE_WHICH_CALL_FAILED; + } + + QStringList lst_temp = QStandardPaths::standardLocations(QStandardPaths::TempLocation); + + if (lst_temp.empty()) { + QString err_msg = QObject::tr ("Couldn't get standard temporary location"); + qCritical() << err_msg; + CNotificationObserver::Info(err_msg, DlgNotification::N_SETTINGS); + return SCWE_CREATE_PROCESS; + } + + QString tmpFilePath = + lst_temp[0] + QDir::separator() + "install_libssl1.0-dev.sh"; + + qDebug() << tmpFilePath; + + QFile tmpFile(tmpFilePath); + if (!tmpFile.open(QFile::Truncate | QFile::ReadWrite)) { + QString err_msg = QObject::tr ("Couldn't create install script temp file. %1") + .arg(tmpFile.errorString()); + qCritical() << err_msg; + CNotificationObserver::Info(err_msg, DlgNotification::N_SETTINGS); + return SCWE_CREATE_PROCESS; + } + + QByteArray install_script = QString( + "#!/bin/bash\n" + "apt-get install libssl1.0-dev") + .toUtf8(); + + if (tmpFile.write(install_script) != install_script.size()) { + QString err_msg = QObject::tr ("Couldn't write install script to temp file") + .arg(tmpFile.errorString()); + qCritical() << err_msg; + CNotificationObserver::Info(err_msg, DlgNotification::N_SETTINGS); + return SCWE_CREATE_PROCESS; + } + + tmpFile.close(); // save + + if (!QFile::setPermissions( + tmpFilePath, + QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | + QFile::ReadUser | QFile::WriteUser | QFile::ExeUser | + QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup | + QFile::ReadOther | QFile::WriteOther | QFile::ExeOther)) { + QString err_msg = QObject::tr ("Couldn't set exe permission to reload script file"); + qCritical() << err_msg; + CNotificationObserver::Error(err_msg, DlgNotification::N_SETTINGS); + return SCWE_CREATE_PROCESS; + } + + system_call_res_t cr2; + QStringList args2; + args2 << sh_path << tmpFilePath; + cr2 = CSystemCallWrapper::ssystem_th(gksu_path, args2, true, true, 97); + qDebug() + <<"libssl1.0 installation finished" + <<"error code:"< system_call_wrapper_error_t run_sshpass_in_terminal_internal(const QString &user, const QString &ip, From 4e1f6fa7f7e340f73a1317b61582a73824879e11 Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 10:16:20 +0600 Subject: [PATCH 06/17] libbls notification --- hub/src/DlgLogin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hub/src/DlgLogin.cpp b/hub/src/DlgLogin.cpp index ec669cdd..e287dbda 100644 --- a/hub/src/DlgLogin.cpp +++ b/hub/src/DlgLogin.cpp @@ -99,6 +99,7 @@ DlgLogin::login() { ui->lbl_status->setText(QString("%1 : %2"). arg(tr("Unknown error. Code")). arg(err_code)); + solve_libssl(); break; } return false; @@ -154,6 +155,6 @@ void DlgLogin::solve_libssl(){ return; if(info.size() < 2) return; - CNotificationObserver::Instance()->Error(tr("Error in using libssl libraries. Press button to resolve it."), DlgNotification::N_ABOUT); + CNotificationObserver::Instance()->Error(tr("Error in using libssl libraries. Press button to resolve it."), DlgNotification::N_RESOLVE_LIBSSL); } From 3a171451e676f18a4b8c8113585e14e4511bf38a Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 11:51:14 +0600 Subject: [PATCH 07/17] install dependency tricky --- commons/src/OsBranchConsts.cpp | 6 +- hub/forms/DlgAbout.ui.autosave | 386 ++++++++++++++++++++++++++ hub/src/SystemCallWrapper.cpp | 21 +- hub/src/updater/IUpdaterComponent.cpp | 12 +- 4 files changed, 411 insertions(+), 14 deletions(-) create mode 100644 hub/forms/DlgAbout.ui.autosave diff --git a/commons/src/OsBranchConsts.cpp b/commons/src/OsBranchConsts.cpp index 1b98a928..27859e3d 100644 --- a/commons/src/OsBranchConsts.cpp +++ b/commons/src/OsBranchConsts.cpp @@ -81,11 +81,11 @@ oracle_virtualbox_kurjun_package_name() { else if(codename == "xenial") kurjun_file = "virtualbox-5.2_5.2.8-121009_Ubuntu_xenial_amd64.deb"; else if(codename == "trusty") - kurjun_file = ""; + kurjun_file = "virtualbox-5.2_5.2.8-121009_Ubuntu_trusty_amd64.deb"; else if(codename == "stretch") - kurjun_file = ""; + kurjun_file = "virtualbox-5.2_5.2.8-121009_Debian_stretch_amd64.deb"; else if(codename == "jessie") - kurjun_file = ""; + kurjun_file = "virtualbox-5.2_5.2.8-121009_Debian_jessie_amd64.deb"; else if(codename == "wheezy") kurjun_file = ""; return kurjun_file; diff --git a/hub/forms/DlgAbout.ui.autosave b/hub/forms/DlgAbout.ui.autosave new file mode 100644 index 00000000..f606955e --- /dev/null +++ b/hub/forms/DlgAbout.ui.autosave @@ -0,0 +1,386 @@ + + + DlgAbout + + + + 0 + 0 + 541 + 289 + + + + About subutai tray + + + + :/hub/about.png:/hub/about.png + + + + + + + + + + 7 + + + 0 + + + + + + + Recheck + + + + + + + Collecting data: + + + + + + + + + + + undefined + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + undefined + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Control Center-test version: + + + + + + + false + + + + 0 + 0 + + + + 0 + + + + + + + false + + + + 0 + 0 + + + + 0 + + + + + + + X2Go-Client + + + + + + + false + + + + 0 + 0 + + + + Update Management + + + + + + + false + + + + 0 + 0 + + + + 0 + + + + + + + undefined + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + false + + + + 0 + 0 + + + + Update P2P + + + + + + + false + + + 0 + + + + + + + false + + + Update X2Go-Client + + + + + + + undefined + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Management version: + + + + + + + + 0 + 0 + + + + Chrome version: + + + + + + + false + + + + 0 + 0 + + + + Update Control Center + + + + + + + false + + + + 0 + 0 + + + + Update RH + + + + + + + false + + + Update Vagrant + + + + + + + Vagrant + + + + + + + undefined + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + false + + + + 0 + 0 + + + + 0 + + + + + + + false + + + 0 + + + + + + + undefined + + + + + + + undefined + + + + + + + P2P version: + + + + + + + RH version: + + + + + + + Oracle VirtualBox + + + + + + + undefined + + + + + + + false + + + Update VirtualBox + + + + + + + false + + + 0 + + + + + + + + + + + + + + + + diff --git a/hub/src/SystemCallWrapper.cpp b/hub/src/SystemCallWrapper.cpp index 4d578da6..75fe665a 100644 --- a/hub/src/SystemCallWrapper.cpp +++ b/hub/src/SystemCallWrapper.cpp @@ -1007,6 +1007,7 @@ system_call_wrapper_error_t install_vagrant_internal >(const QByteArray install_script = QString( "#!/bin/bash\n" + "apt-get install -f;" "dpkg -i %1") .arg(file_info) .toUtf8(); @@ -1036,13 +1037,21 @@ system_call_wrapper_error_t install_vagrant_internal >(const system_call_res_t cr2; QStringList args2; args2 << sh_path << tmpFilePath; - cr2 = CSystemCallWrapper::ssystem(gksu_path, args2, false, true, 60000); + + qDebug()<<"Vagrant installation started" + <<"gksu_path:"<Error(tr("x2go-client installation failed"), DlgNotification::N_NO_ACTION); - else CNotificationObserver::Instance()->Info(tr("x2go-client has been installed."), DlgNotification::N_NO_ACTION); + CNotificationObserver::Instance()->Error(tr("X2Go-Client installation failed. It might be dependency problems. Install again, CC will solve them, or you can install it manualy."), DlgNotification::N_NO_ACTION); + else CNotificationObserver::Instance()->Info(tr("X2Go-Client has been installed. Congratulations!"), DlgNotification::N_NO_ACTION); } ///////////////////////////////////////////////////////////////// @@ -198,8 +198,9 @@ void CUpdaterComponentVAGRANT::update_post_action(bool success){ UNUSED_ARG(success); } ///////////////////////////////////////////////////////////////// -void CUpdaterComponentVAGRANT::install_post_interntal(bool success){ - if(success) CNotificationObserver::Instance()->Info(tr("vagrant has been installed."), DlgNotification::N_NO_ACTION); +void CUpdaterComponentVAGRANT::install_post_interntal(bool success){if(!success) + CNotificationObserver::Instance()->Error(tr("Vagrant installation failed. It might be dependency problems. Install again, CC will solve them, or you can install it manualy."), DlgNotification::N_NO_ACTION); + else CNotificationObserver::Instance()->Info(tr("Vagrant has been installed. Congratulations!"), DlgNotification::N_NO_ACTION); } ////////////////////////////////////////////////////////////////// @@ -267,5 +268,6 @@ void CUpdaterComponentORACLE_VIRTUALBOX::update_post_action(bool success){ } ///////////////////////////////////////////////////////////////// void CUpdaterComponentORACLE_VIRTUALBOX::install_post_interntal(bool success){ - if(success) CNotificationObserver::Instance()->Info(tr("Oracle VirtualBox has been installed."), DlgNotification::N_NO_ACTION); + CNotificationObserver::Instance()->Error(tr("Virtualbox installation failed. It might be dependency problems. Install again, CC will solve them, or you can install it manualy."), DlgNotification::N_NO_ACTION); + else CNotificationObserver::Instance()->Info(tr("Virtualbox has been installed. Congratulations!"), DlgNotification::N_NO_ACTION); } From bb5a1639c64fd4712cd8eb962c6375202820dafb Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 11:51:52 +0600 Subject: [PATCH 08/17] remove autosave --- hub/forms/DlgAbout.ui.autosave | 386 --------------------------------- 1 file changed, 386 deletions(-) delete mode 100644 hub/forms/DlgAbout.ui.autosave diff --git a/hub/forms/DlgAbout.ui.autosave b/hub/forms/DlgAbout.ui.autosave deleted file mode 100644 index f606955e..00000000 --- a/hub/forms/DlgAbout.ui.autosave +++ /dev/null @@ -1,386 +0,0 @@ - - - DlgAbout - - - - 0 - 0 - 541 - 289 - - - - About subutai tray - - - - :/hub/about.png:/hub/about.png - - - - - - - - - - 7 - - - 0 - - - - - - - Recheck - - - - - - - Collecting data: - - - - - - - - - - - undefined - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - undefined - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Control Center-test version: - - - - - - - false - - - - 0 - 0 - - - - 0 - - - - - - - false - - - - 0 - 0 - - - - 0 - - - - - - - X2Go-Client - - - - - - - false - - - - 0 - 0 - - - - Update Management - - - - - - - false - - - - 0 - 0 - - - - 0 - - - - - - - undefined - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - false - - - - 0 - 0 - - - - Update P2P - - - - - - - false - - - 0 - - - - - - - false - - - Update X2Go-Client - - - - - - - undefined - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Management version: - - - - - - - - 0 - 0 - - - - Chrome version: - - - - - - - false - - - - 0 - 0 - - - - Update Control Center - - - - - - - false - - - - 0 - 0 - - - - Update RH - - - - - - - false - - - Update Vagrant - - - - - - - Vagrant - - - - - - - undefined - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - false - - - - 0 - 0 - - - - 0 - - - - - - - false - - - 0 - - - - - - - undefined - - - - - - - undefined - - - - - - - P2P version: - - - - - - - RH version: - - - - - - - Oracle VirtualBox - - - - - - - undefined - - - - - - - false - - - Update VirtualBox - - - - - - - false - - - 0 - - - - - - - - - - - - - - - - From 7bab46cd8e2b81c45dd98d30fe7aa9401c80ded9 Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 12:12:28 +0600 Subject: [PATCH 09/17] mark fo dev --- hub/forms/DlgAbout.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/forms/DlgAbout.ui b/hub/forms/DlgAbout.ui index f811c0b0..bdcca4a3 100644 --- a/hub/forms/DlgAbout.ui +++ b/hub/forms/DlgAbout.ui @@ -73,7 +73,7 @@ - Control Center version: + Control CenteR version: From f4c1ae25ae80857f642465047e07701c186d9e87 Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 12:40:27 +0600 Subject: [PATCH 10/17] stop p2p function #766 --- hub/include/DlgNotification.h | 2 +- hub/include/SystemCallWrapper.h | 5 ++- hub/src/SystemCallWrapper.cpp | 63 ++++++++++++++++----------- hub/src/updater/IUpdaterComponent.cpp | 3 +- 4 files changed, 44 insertions(+), 29 deletions(-) diff --git a/hub/include/DlgNotification.h b/hub/include/DlgNotification.h index bcea39fa..e82f2c6e 100644 --- a/hub/include/DlgNotification.h +++ b/hub/include/DlgNotification.h @@ -23,7 +23,7 @@ class DlgNotification : public QDialog enum NOTIFICATION_ACTION_TYPE{N_UPDATE_P2P = 0, N_UPDATE_TRAY, N_UPDATE_RH, N_UPDATE_RHM, N_SETTINGS, N_GO_TO_HUB, N_NOTF_HISTORY, N_RESTART_TRAY, N_ABOUT, N_NO_ACTION, - N_START_P2P, N_INSTALL_P2P, N_RESOLVE_LIBSSL}; + N_START_P2P, N_INSTALL_P2P, N_RESOLVE_LIBSSL, N_STOP_P2P}; explicit DlgNotification(size_t notification_level, diff --git a/hub/include/SystemCallWrapper.h b/hub/include/SystemCallWrapper.h index 98591dfc..f4f51f69 100644 --- a/hub/include/SystemCallWrapper.h +++ b/hub/include/SystemCallWrapper.h @@ -10,7 +10,8 @@ //give type for restart p2p enum restart_p2p_type{ UPDATED_P2P=0, //when p2p updated, stop and start - STOPPED_P2P //when p2p is stopped, start + STOPPED_P2P, //when p2p is stopped, start + STARTED_P2P //when p2p is started, stop }; // if you are going to change this - change method @@ -157,7 +158,7 @@ class CSystemCallWrapper { static system_call_wrapper_error_t install_oracle_virtualbox(const QString &dir, const QString &file_name); - static system_call_res_t run_linux_script(QStringList args); + static void run_linux_script(QStringList args); static system_call_wrapper_error_t install_libssl(); diff --git a/hub/src/SystemCallWrapper.cpp b/hub/src/SystemCallWrapper.cpp index 75fe665a..dc98c1cc 100644 --- a/hub/src/SystemCallWrapper.cpp +++ b/hub/src/SystemCallWrapper.cpp @@ -408,21 +408,29 @@ system_call_wrapper_error_t restart_p2p_service_internal >( CNotificationObserver::Info(err_msg, DlgNotification::N_SETTINGS); break; } - - QByteArray restart_script = type==UPDATED_P2P ? QString( - "#!/bin/bash\n" - "%1 disable p2p.service\n" - "%1 stop p2p.service\n" - "%1 enable p2p.service\n" - "%1 start p2p.service\n") - .arg(systemctl_path) - .toUtf8() : QString( - "#!/bin/bash\n" - "%1 enable p2p.service\n" - "%1 start p2p.service\n") - .arg(systemctl_path) - .toUtf8(); - + QByteArray restart_script; + switch (type){ + case UPDATED_P2P: + restart_script = QString( + "#!/bin/bash\n" + "%1 disable p2p.service\n" + "%1 stop p2p.service\n" + "%1 enable p2p.service\n" + "%1 start p2p.service\n").toUtf8(); + break; + case STOPPED_P2P: + restart_script = QString( + "#!/bin/bash\n" + "%1 enable p2p.service\n" + "%1 start p2p.service\n").toUtf8(); + break; + case STARTED_P2P: + restart_script = QString( + "#!/bin/bash\n" + "%1 disable p2p.service\n" + "%1 stop p2p.service\n").toUtf8(); + break; + } if (tmpFile.write(restart_script) != restart_script.size()) { QString err_msg = QObject::tr("Couldn't write restart script to temp file") .arg(tmpFile.errorString()); @@ -454,7 +462,6 @@ system_call_wrapper_error_t restart_p2p_service_internal >( .arg(cr.exit_code) .arg(CSystemCallWrapper::scwe_error_to_str(cr2.res)); qCritical() << err_msg; - CNotificationObserver::Info(err_msg, DlgNotification::N_SETTINGS); break; } *res_code = RSE_SUCCESS; @@ -477,9 +484,10 @@ system_call_wrapper_error_t restart_p2p_service_internal >( args1 << "start" << "Subutai P2P"; system_call_res_t res; - if(type==UPDATED_P2P) + if(type != STOPPED_P2P) res = CSystemCallWrapper::ssystem_th(cmd, args0, true, true); - res = CSystemCallWrapper::ssystem_th(cmd, args1, true, true); + if(type != STARTED_P2P) + res = CSystemCallWrapper::ssystem_th(cmd, args1, true, true); *res_code = RSE_SUCCESS; return res.res; } @@ -496,12 +504,17 @@ system_call_wrapper_error_t restart_p2p_service_internal >( "/Library/LaunchDaemons/io.subutai.p2p.daemon.plist;" " launchctl load /Library/LaunchDaemons/io.subutai.p2p.daemon.plist\"" " with administrator privileges" : - args << "-e" - << "do shell script \"launchctl load " - "/Library/LaunchDaemons/io.subutai.p2p.daemon.plist\"" - " with administrator privileges"; - system_call_res_t res = + type == STOPPED_P2P ? + args << "-e" + << "do shell script \"launchctl load " + "/Library/LaunchDaemons/io.subutai.p2p.daemon.plist\"" + " with administrator privileges" : + args << "-e" + << "do shell script \"launchctl unload " + "/Library/LaunchDaemons/io.subutai.p2p.daemon.plist\"" + " with administrator privileges"; + system_call_res_t res = CSystemCallWrapper::ssystem_th(cmd, args, true, true); *res_code = RSE_SUCCESS; return res.res; @@ -1040,7 +1053,7 @@ system_call_wrapper_error_t install_vagrant_internal >(const qDebug()<<"Vagrant installation started" <<"gksu_path:"<Error(tr("Virtualbox installation failed. It might be dependency problems. Install again, CC will solve them, or you can install it manualy."), DlgNotification::N_NO_ACTION); + if(!success) + CNotificationObserver::Instance()->Error(tr("Virtualbox installation failed. It might be dependency problems. Install again, CC will solve them, or you can install it manualy."), DlgNotification::N_NO_ACTION); else CNotificationObserver::Instance()->Info(tr("Virtualbox has been installed. Congratulations!"), DlgNotification::N_NO_ACTION); } From 238409648d43f6687f27a636e02971a67eb5f121 Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 14:12:31 +0600 Subject: [PATCH 11/17] stop p2p button --- hub/src/DlgNotification.cpp | 6 +++++- hub/src/SystemCallWrapper.cpp | 11 +++++------ hub/src/TrayControlWindow.cpp | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/hub/src/DlgNotification.cpp b/hub/src/DlgNotification.cpp index 78de1dd9..0b416ab1 100644 --- a/hub/src/DlgNotification.cpp +++ b/hub/src/DlgNotification.cpp @@ -47,7 +47,11 @@ DlgNotification::DlgNotification( arg(current_branch_name()).arg(p2p_package_url()), DlgNotification::N_SETTINGS); emit P2PStatus_checker::Instance().p2p_status(P2PStatus_checker::P2P_LOADING);}}, {"Install P2P", [](){update_system::CHubComponentsUpdater::Instance()->install_p2p();}}, - {"Resolve", [](){system_call_wrapper_error_t res = CSystemCallWrapper::install_libssl(); UNUSED_ARG(res);}} + {"Resolve", [](){system_call_wrapper_error_t res = CSystemCallWrapper::install_libssl(); UNUSED_ARG(res);}}, + {"Stop P2P", [](){ + int rse_err; + CSystemCallWrapper::restart_p2p_service(&rse_err, restart_p2p_type::STARTED_P2P); + }} }; if (action_type == N_NO_ACTION) diff --git a/hub/src/SystemCallWrapper.cpp b/hub/src/SystemCallWrapper.cpp index dc98c1cc..51c4a70d 100644 --- a/hub/src/SystemCallWrapper.cpp +++ b/hub/src/SystemCallWrapper.cpp @@ -386,7 +386,7 @@ system_call_wrapper_error_t restart_p2p_service_internal >( } for (QString str : cr.out) { - if (str.indexOf("p2p.service") == -1) continue; + if (str.indexOf("p2p.service") == -1 && type != STOPPED_P2P) continue; QStringList lst_temp = QStandardPaths::standardLocations(QStandardPaths::TempLocation); @@ -416,26 +416,25 @@ system_call_wrapper_error_t restart_p2p_service_internal >( "%1 disable p2p.service\n" "%1 stop p2p.service\n" "%1 enable p2p.service\n" - "%1 start p2p.service\n").toUtf8(); + "%1 start p2p.service\n").arg(systemctl_path).toUtf8(); break; case STOPPED_P2P: restart_script = QString( "#!/bin/bash\n" "%1 enable p2p.service\n" - "%1 start p2p.service\n").toUtf8(); + "%1 start p2p.service\n").arg(systemctl_path).toUtf8(); break; case STARTED_P2P: restart_script = QString( "#!/bin/bash\n" "%1 disable p2p.service\n" - "%1 stop p2p.service\n").toUtf8(); + "%1 stop p2p.service\n").arg(systemctl_path).toUtf8(); break; } if (tmpFile.write(restart_script) != restart_script.size()) { QString err_msg = QObject::tr("Couldn't write restart script to temp file") .arg(tmpFile.errorString()); qCritical() << err_msg; - CNotificationObserver::Info(err_msg, DlgNotification::N_SETTINGS); break; } tmpFile.close(); // save @@ -455,7 +454,7 @@ system_call_wrapper_error_t restart_p2p_service_internal >( system_call_res_t cr2; QStringList args2; args2 << sh_path << tmpFilePath; - cr2 = CSystemCallWrapper::ssystem(gksu_path, args2, false, true, 60000); + cr2 = CSystemCallWrapper::ssystem(gksu_path, args2, true, true, 60000); tmpFile.remove(); if (cr2.exit_code != 0 || cr2.res != SCWE_SUCCESS) { QString err_msg = QObject::tr ("Couldn't reload p2p.service. ec = %1, err = %2") diff --git a/hub/src/TrayControlWindow.cpp b/hub/src/TrayControlWindow.cpp index ee1747e7..a259bcb9 100644 --- a/hub/src/TrayControlWindow.cpp +++ b/hub/src/TrayControlWindow.cpp @@ -552,7 +552,7 @@ void TrayControlWindow::launch_p2p(){ "Press start to launch P2P daemon"), DlgNotification::N_START_P2P); break; case P2PStatus_checker::P2P_RUNNING : - CNotificationObserver::Info(QObject::tr("P2P is running"), DlgNotification::N_NO_ACTION); + CNotificationObserver::Info(QObject::tr("P2P is running. Stop and start it, if you have troubles."), DlgNotification::N_STOP_P2P); break; case P2PStatus_checker::P2P_LOADING : CNotificationObserver::Info(QObject::tr("P2P daemon is loading"), DlgNotification::N_NO_ACTION); From 8cffa0d45e3191d5d261428d396d46386f73afad Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 14:36:57 +0600 Subject: [PATCH 12/17] solve libssl --- hub/src/DlgLogin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/src/DlgLogin.cpp b/hub/src/DlgLogin.cpp index e287dbda..81089e40 100644 --- a/hub/src/DlgLogin.cpp +++ b/hub/src/DlgLogin.cpp @@ -93,13 +93,13 @@ DlgLogin::login() { ui->lbl_status->setText(QString("%1 : %2"). arg(tr("Network error. Code")). arg(CCommons::NetworkErrorToString(network_err))); + solve_libssl(); break; default: ui->lbl_status->setVisible(true); ui->lbl_status->setText(QString("%1 : %2"). arg(tr("Unknown error. Code")). arg(err_code)); - solve_libssl(); break; } return false; From 656beec946fad8d52998478fa28a24fdebc282a5 Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 15:24:33 +0600 Subject: [PATCH 13/17] resolve libssl problem --- hub/forms/DlgLogin.ui | 75 ++++++++++++++++++--------------- hub/include/TrayControlWindow.h | 6 +-- hub/src/DlgLogin.cpp | 12 +++++- 3 files changed, 54 insertions(+), 39 deletions(-) diff --git a/hub/forms/DlgLogin.ui b/hub/forms/DlgLogin.ui index 61ee13b7..16f310eb 100644 --- a/hub/forms/DlgLogin.ui +++ b/hub/forms/DlgLogin.ui @@ -20,6 +20,31 @@ + + + + + + Sign in + + + + + + + Register + + + + + + + Cancel + + + + + @@ -48,6 +73,19 @@ + + + + lbl_status + + + Qt::RichText + + + Qt::AlignCenter + + + @@ -122,41 +160,10 @@ - - - - - - Sign in - - - - - - - Register - - - - - - - Cancel - - - - - - - + + - lbl_status - - - Qt::RichText - - - Qt::AlignCenter + Resolve diff --git a/hub/include/TrayControlWindow.h b/hub/include/TrayControlWindow.h index 120bb2a6..f77fc4c7 100644 --- a/hub/include/TrayControlWindow.h +++ b/hub/include/TrayControlWindow.h @@ -33,7 +33,7 @@ class TrayControlWindow : public QMainWindow public: explicit TrayControlWindow(QWidget *parent = 0); - virtual ~TrayControlWindow(); + virtual ~TrayControlWindow(); P2PStatus_checker::P2P_STATUS p2p_current_status; static TrayControlWindow* Instance(){ static TrayControlWindow *tcw = new TrayControlWindow(); @@ -86,7 +86,7 @@ class TrayControlWindow : public QMainWindow QAction *m_act_notifications_history; QSystemTrayIcon* m_sys_tray_icon; - QMenu* m_tray_menu; + QMenu* m_tray_menu; QAction *m_act_p2p_status; // p2p status @@ -98,7 +98,7 @@ class TrayControlWindow : public QMainWindow void get_sys_tray_icon_coordinates_for_dialog(int &src_x, int &src_y, int &dst_x, int &dst_y, int dlg_w, int dlg_h, bool use_cursor_position); - void fill_launch_menu(); + void fill_launch_menu(); /*tray icon end*/ diff --git a/hub/src/DlgLogin.cpp b/hub/src/DlgLogin.cpp index 81089e40..23594cf4 100644 --- a/hub/src/DlgLogin.cpp +++ b/hub/src/DlgLogin.cpp @@ -15,6 +15,7 @@ DlgLogin::DlgLogin(QWidget *parent) : ui->setupUi(this); ui->lbl_status->setText(""); ui->lbl_status->setVisible(false); + ui->btn_resolve->hide(); ui->lbl_register_link->setText(QString("%2").arg(hub_register_url()).arg(tr("Register"))); ui->lbl_register_link->setTextFormat(Qt::RichText); @@ -155,6 +156,13 @@ void DlgLogin::solve_libssl(){ return; if(info.size() < 2) return; - CNotificationObserver::Instance()->Error(tr("Error in using libssl libraries. Press button to resolve it."), DlgNotification::N_RESOLVE_LIBSSL); - + ui->btn_resolve->show(); + connect(ui->btn_resolve, &QPushButton::released, [this](){ + this->ui->btn_resolve->setText(tr("Resolving...")); + system_call_wrapper_error_t res = CSystemCallWrapper::install_libssl(); + if(res == SCWE_SUCCESS) + CCommons::RestartTray(); + this->ui->btn_resolve->setText(tr("Resolve")); + ui->btn_resolve->hide(); + }); } From 86ac5bb23cd60ccee2501241363b8a118f93dedc Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 16:20:55 +0600 Subject: [PATCH 14/17] add flags to close, minimize, maximize --- SubutaiControlCenter.pro | 2 +- hub/include/updater/HubComponentsUpdater.h | 5 +++++ hub/src/TrayControlWindow.cpp | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/SubutaiControlCenter.pro b/SubutaiControlCenter.pro index 432ab328..f27c6888 100644 --- a/SubutaiControlCenter.pro +++ b/SubutaiControlCenter.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui network websockets +QT += core gui network websockets quick CONFIG += c++11 diff --git a/hub/include/updater/HubComponentsUpdater.h b/hub/include/updater/HubComponentsUpdater.h index 77f54626..3191f455 100644 --- a/hub/include/updater/HubComponentsUpdater.h +++ b/hub/include/updater/HubComponentsUpdater.h @@ -5,9 +5,12 @@ #include #include #include +#include #include #include "updater/IUpdaterComponent.h" +#include "NotificationObserver.h" +#include "DlgNotification.h" #include "SystemCallWrapper.h" #include "SettingsManager.h" @@ -246,6 +249,8 @@ class SilentPackageInstallerVAGRANT : public QObject{ this, &SilentPackageInstallerVAGRANT::deleteLater); connect(thread, &QThread::finished, thread, &QThread::deleteLater); + connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, + [](){CNotificationObserver::Instance()->Info("Hello mazafaka",DlgNotification::N_NO_ACTION);}); this->moveToThread(thread); thread->start(); } diff --git a/hub/src/TrayControlWindow.cpp b/hub/src/TrayControlWindow.cpp index a259bcb9..11208d21 100644 --- a/hub/src/TrayControlWindow.cpp +++ b/hub/src/TrayControlWindow.cpp @@ -908,6 +908,12 @@ void TrayControlWindow::show_dialog(QDialog* (*pf_dlg_create)(QWidget*), if (iter == m_dct_active_dialogs.end()) { QDialog* dlg = pf_dlg_create(this); dlg->setWindowTitle(title); + Qt::WindowFlags flags = 0; + flags = Qt::Window; + flags |= Qt::WindowMinimizeButtonHint; + flags |= Qt::WindowMaximizeButtonHint; + flags |= Qt::WindowCloseButtonHint; + dlg->setWindowFlags(flags); m_dct_active_dialogs[dlg->windowTitle()] = dlg; int src_x, src_y, dst_x, dst_y; From 8688c55e328011c20163162a9ca271f0332cbae0 Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 16:22:37 +0600 Subject: [PATCH 15/17] remove comments --- hub/include/updater/HubComponentsUpdater.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/hub/include/updater/HubComponentsUpdater.h b/hub/include/updater/HubComponentsUpdater.h index 3191f455..d9ec44d1 100644 --- a/hub/include/updater/HubComponentsUpdater.h +++ b/hub/include/updater/HubComponentsUpdater.h @@ -249,8 +249,6 @@ class SilentPackageInstallerVAGRANT : public QObject{ this, &SilentPackageInstallerVAGRANT::deleteLater); connect(thread, &QThread::finished, thread, &QThread::deleteLater); - connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, - [](){CNotificationObserver::Instance()->Info("Hello mazafaka",DlgNotification::N_NO_ACTION);}); this->moveToThread(thread); thread->start(); } From 18b8b4d06ce32a978b62c74d7fc331e931d2c2bf Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 17:35:36 +0600 Subject: [PATCH 16/17] dev branch as default --- SubutaiControlCenter.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SubutaiControlCenter.pro b/SubutaiControlCenter.pro index f27c6888..2bc9ad22 100644 --- a/SubutaiControlCenter.pro +++ b/SubutaiControlCenter.pro @@ -141,7 +141,7 @@ DEFINES += TRAY_VERSION=\\\"$$TRAY_VERSION\\\" GIT_BRANCH_STR = $$system(git rev-parse --abbrev-ref HEAD) DEFINES += GIT_BRANCH=\\\"$$GIT_BRANCH_STR\\\" -GBV=BT_PROD +GBV=BT_DEV equals(GIT_BRANCH_STR, "master") { GBV=BT_MASTER } @@ -155,7 +155,7 @@ equals(GIT_BRANCH_STR, "head") { } equals(GIT_BRANCH_STR, "dev") { - GBV=BT_PROD + GBV=BT_DEV } DEFINES += CURRENT_BRANCH=$$GBV From 56205c42f3b8c970a56f42eb15c5c078a4da0410 Mon Sep 17 00:00:00 2001 From: Erkin Date: Wed, 28 Mar 2018 17:38:00 +0600 Subject: [PATCH 17/17] remove my mark --- hub/forms/DlgAbout.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hub/forms/DlgAbout.ui b/hub/forms/DlgAbout.ui index bdcca4a3..f811c0b0 100644 --- a/hub/forms/DlgAbout.ui +++ b/hub/forms/DlgAbout.ui @@ -73,7 +73,7 @@ - Control CenteR version: + Control Center version: