diff --git a/CHANGELOG b/CHANGELOG index 044396ac..40e9a6df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Change Log +## [6.7.2] 7/3/2018 +* Renaming files +* Several environment bugs fixed + ## [6.7.1] 6/3/2018 * Renaming * Bug Fixes diff --git a/SubutaiControlCenter.pro b/SubutaiControlCenter.pro index 50e13ffd..6973b472 100644 --- a/SubutaiControlCenter.pro +++ b/SubutaiControlCenter.pro @@ -192,7 +192,7 @@ win32: { DEFINES += CURRENT_OS=OS_WIN DEFINES += RT_OS_WINDOWS LIBS += -lws2_32 -L$$PWD/libssh2/lib/win32 -llibssh2 - RC_FILE = tray.rc + RC_FILE = control-center.rc # LIBS += -lpthread # QMAKE_LFLAGS += -static-libstdc++ -static-libgcc } diff --git a/tray.rc b/control-center.rc similarity index 100% rename from tray.rc rename to control-center.rc diff --git a/hub/forms/DlgTransferFile.cpp b/hub/forms/DlgTransferFile.cpp index 35aaaad7..4091367f 100644 --- a/hub/forms/DlgTransferFile.cpp +++ b/hub/forms/DlgTransferFile.cpp @@ -31,7 +31,9 @@ void DlgTransferFile::Init() { ui->btn_upload_file->setToolTip("Upload selected files"); + ui->btn_upload_file->setIcon(QIcon(":/hub/upload-0.png")); ui->btn_download_file->setToolTip("Download selected files"); + ui->btn_download_file->setIcon(QIcon(":/hub/download.png")); ui->btn_refresh_local->setToolTip("Refresh current local directory"); ui->btn_refresh_remote->setToolTip("Refresh current remote directory"); @@ -206,6 +208,12 @@ void DlgTransferFile::set_buttons_enabled(bool enabled) { ui->btn_remote_back->setEnabled(enabled); } +void DlgTransferFile::set_remote_button_enabled(bool enabled){ + ui->btn_refresh_remote->setEnabled(enabled); + ui->btn_remote_back->setEnabled(enabled); + ui->btn_download_file->setEnabled(enabled); +} + void DlgTransferFile::transfer_finished(int tw_row, system_call_wrapper_error_t res, QStringList output) { static QIcon transfer_finished_icon(":/hub/GOOD"); static QIcon transfer_failed_icon(":/hub/BAD"); @@ -232,10 +240,12 @@ void DlgTransferFile::transfer_finished(int tw_row, system_call_wrapper_error_t else { file_to_transfer.setTransferFileStatus(FIlE_FAILED_TO_UPLOAD); if(res == SCWE_PERMISSION_DENIED) - twi_operation_status->setText("Permision denied"); + twi_operation_status->setToolTip("Permision denied"); else - twi_operation_status->setText("Failed to upload"); + twi_operation_status->setToolTip("Failed to upload"); twi_operation_status->setIcon(transfer_failed_icon); + if(file_to_transfer.fileInfo().fileName().contains("\\")) + twi_operation_status->setText("Invalid file name"); twi_operation_status->setToolTip( output.join(",") + " Error Code: " + CSystemCallWrapper::scwe_error_to_str(res)); @@ -255,8 +265,9 @@ void DlgTransferFile::transfer_finished(int tw_row, system_call_wrapper_error_t else twi_operation_status->setText("Failed to download"); twi_operation_status->setIcon(transfer_failed_icon); - twi_operation_status->setToolTip( - output.join(",") + + if(file_to_transfer.fileInfo().fileName().contains("\\")) + twi_operation_status->setText("Invalid file name"); + twi_operation_status->setToolTip(output.join(",") + " Error Code: " + CSystemCallWrapper::scwe_error_to_str(res)); } } @@ -596,7 +607,7 @@ void DlgTransferFile::local_back() { } void DlgTransferFile::remote_back() { - set_buttons_enabled(false); + set_remote_button_enabled(false); QStringList pwd = current_remote_dir.split("/"); QString new_dir = ""; // EXAMPLE: current_remote_dir= '/usr/bin/' @@ -607,7 +618,6 @@ void DlgTransferFile::remote_back() { new_dir.append("/"); current_remote_dir = new_dir; refresh_remote_file_system(); - set_buttons_enabled(true); } //////////////////////////////////////////////////////////////////////////////// @@ -703,7 +713,7 @@ void DlgTransferFile::refresh_remote_file_system() { << "Refresh remote file system" << current_remote_dir; - ui->btn_refresh_remote->setEnabled(false); + set_remote_button_enabled(false); ui->lbl_remote_files->setMovie(remote_movie); remote_movie->start(); @@ -731,7 +741,7 @@ void DlgTransferFile::output_from_remote_command(system_call_wrapper_error_t res add_file_remote(file_info); } remote_movie->stop(); - ui->btn_refresh_remote->setEnabled(true); + set_remote_button_enabled(true); if (res == SCWE_SUCCESS) { ui->lbl_remote_files->setStyleSheet(""); ui->lbl_remote_files->setText("Remote"); diff --git a/hub/forms/DlgTransferFile.h b/hub/forms/DlgTransferFile.h index 25ba321f..1611d2a2 100644 --- a/hub/forms/DlgTransferFile.h +++ b/hub/forms/DlgTransferFile.h @@ -415,6 +415,7 @@ class DlgTransferFile : public QDialog void file_was_dropped(const QString &file_path); void set_buttons_enabled(bool enabled); + void set_remote_button_enabled(bool enabled); void transfer_finished(int tw_row, system_call_wrapper_error_t res, QStringList output); void transfer_file(int tw_row); void start_transfer_files(); diff --git a/hub/forms/DlgTransferFile.ui b/hub/forms/DlgTransferFile.ui index 7adf1539..c45a633c 100644 --- a/hub/forms/DlgTransferFile.ui +++ b/hub/forms/DlgTransferFile.ui @@ -27,8 +27,8 @@ - - :/hub/upload.ico:/hub/upload.ico + + :/hub/upload-0.png:/hub/upload-0.png @@ -41,7 +41,7 @@ - + :/hub/download.png:/hub/download.png @@ -62,7 +62,7 @@ - + :/hub/back.png:/hub/back.png @@ -86,7 +86,7 @@ - + :/hub/refresh.png:/hub/refresh.png @@ -100,7 +100,7 @@ - + :/hub/refresh.png:/hub/refresh.png @@ -187,7 +187,7 @@ - + :/hub/back.png:/hub/back.png @@ -209,6 +209,10 @@
DlgTransferFile.h
- + + + + + diff --git a/hub/include/DlgEnvironment.h b/hub/include/DlgEnvironment.h index 943c2c01..f6754b06 100644 --- a/hub/include/DlgEnvironment.h +++ b/hub/include/DlgEnvironment.h @@ -22,7 +22,7 @@ class DlgEnvironment : public QDialog Ui::DlgEnvironment *ui; CEnvironment env; std::map selected_conts; - std::map dekstops_info; + std::map desktops_info; void addContainer(const CHubContainer*cont); void check_container_status(const CHubContainer *cont); @@ -33,6 +33,7 @@ class DlgEnvironment : public QDialog void desktop_selected(); void ssh_selected(); void select_all(bool checked); + void check_buttons(); signals: void ssh_to_container_sig(const CEnvironment*, const CHubContainer*); diff --git a/hub/include/SystemCallWrapper.h b/hub/include/SystemCallWrapper.h index 8f9188f6..0e48ee51 100644 --- a/hub/include/SystemCallWrapper.h +++ b/hub/include/SystemCallWrapper.h @@ -39,7 +39,8 @@ enum system_call_wrapper_error_t { SCWE_WHICH_CALL_FAILED, SCWE_PROCESS_CRASHED, SCWE_LAST, - SCWE_PERMISSION_DENIED + SCWE_PERMISSION_DENIED, + SCWE_WRONG_FILE_NAME }; //////////////////////////////////////////////////////////////////////////// diff --git a/hub/src/DlgEnvironment.cpp b/hub/src/DlgEnvironment.cpp index 818fa17e..ac56a776 100644 --- a/hub/src/DlgEnvironment.cpp +++ b/hub/src/DlgEnvironment.cpp @@ -150,6 +150,10 @@ void DlgEnvironment::addContainer(const CHubContainer *cont) { ui->cont_desktop_info->addWidget(cont_desktop_info); ui->cont_select->addWidget(cont_select); selected_conts[cont->id()] = cont_select; + desktops_info[cont->id()] = cont_desktop_info; + connect(cont_select, &QCheckBox::stateChanged, [this](){ + this->check_buttons(); + }); } ///////////////////////////////////////////////////////////////////////// @@ -158,22 +162,17 @@ void DlgEnvironment::change_cont_status(const CHubContainer *cont, int status) { QCheckBox *cont_checkbox = selected_conts[cont->id()]; if (status == 0) { - cont_checkbox->setCheckable(true); cont_checkbox->setText(tr("READY")); cont_checkbox->setStyleSheet("QCheckBox {color : green;}"); } else if (status == 1) { - //cont_checkbox->setCheckable(false); - //cont_checkbox->setChecked(false); cont_checkbox->setText(tr("CONNECTING")); cont_checkbox->setStyleSheet("QCheckBox {color : blue;}"); } else if (status == 2){ - //cont_checkbox->setCheckable(false); - //cont_checkbox->setChecked(false); cont_checkbox->setText(tr("FAILED")); cont_checkbox->setStyleSheet("QCheckBox {color : red;}"); } @@ -185,6 +184,7 @@ void DlgEnvironment::check_container_status(const CHubContainer *cont) { qDebug() << "Checking the status of container: " << cont->name() << " in " << env.name(); P2PController::P2P_CONNETION_STATUS cont_status = P2PController::Instance().is_ready(env, *cont); + desktops_info[cont->id()]->setText(QString(cont->is_desktop() ? cont->desk_env().isEmpty() ? "MATE" : cont->desk_env() : "No Desktop")); change_cont_status(cont, cont_status != P2PController::CONNECTION_SUCCESS); } @@ -209,8 +209,39 @@ void DlgEnvironment::check_environment_status() { change_cont_status(&cont, 2); } } + check_buttons(); } +//////////////////////////////////////////////////////////////////////////// +void DlgEnvironment::check_buttons() { + qDebug() + << "Checking which button I can press" << env.name(); + bool not_empty = false; + bool upload = true, ssh = true, desktop = true; + P2PController::P2P_CONNETION_STATUS + swarm_status = P2PController::Instance().is_swarm_connected(env); + bool connected_to_swarm = (env.healthy() & (swarm_status == P2PController::CONNECTION_SUCCESS)); + if(connected_to_swarm){ + for (CHubContainer cont : env.containers()) { + QCheckBox *current_check_box = selected_conts[cont.id()]; + if(current_check_box->checkState() == Qt::Checked){ + if(current_check_box->text() != "READY"){ + upload = ssh = desktop = false; + break; + } + if(!cont.is_desktop()) + desktop = false; + not_empty = true; + } + } + } + else{ + upload = ssh = desktop = false; + } + ui->btn_desktop_selected->setEnabled(desktop & not_empty); + ui->btn_upload_selected->setEnabled(upload & not_empty); + ui->btn_ssh_selected->setEnabled(ssh & not_empty); +} //////////////////////////////////////////////////////////////////////////// DlgEnvironment::~DlgEnvironment() { diff --git a/hub/src/RestWorker.cpp b/hub/src/RestWorker.cpp index 237f9492..0d0b57d0 100644 --- a/hub/src/RestWorker.cpp +++ b/hub/src/RestWorker.cpp @@ -230,7 +230,7 @@ void CRestWorker::update_my_peers() { connect(timer, &QTimer::timeout, [reply](){ CNotificationObserver::Instance()-> - Info("Connection timeout, can't connect to hub", DlgNotification::N_NO_ACTION); + Info("Connection timeout, can't connect to bazaar", DlgNotification::N_NO_ACTION); if (reply) reply->close(); }); @@ -273,7 +273,7 @@ void CRestWorker::update_environments() { connect(timer, &QTimer::timeout, [reply](){ CNotificationObserver::Instance()-> - Info("Connection timeout, can't connect to hub", DlgNotification::N_NO_ACTION); + Info("Connection timeout, can't connect to bazaar", DlgNotification::N_NO_ACTION); if (reply) reply->close(); }); @@ -305,7 +305,7 @@ void CRestWorker::update_balance() { connect(timer, &QTimer::timeout, [reply](){ CNotificationObserver::Instance()-> - Info("Connection timeout, can't connect to hub", DlgNotification::N_NO_ACTION); + Info("Connection timeout, can't connect to bazaar", DlgNotification::N_NO_ACTION); if (reply) reply->close(); }); diff --git a/hub/src/SettingsManager.cpp b/hub/src/SettingsManager.cpp index 8ec35073..51c78eaf 100644 --- a/hub/src/SettingsManager.cpp +++ b/hub/src/SettingsManager.cpp @@ -105,7 +105,7 @@ static void qvar_to_map_string_qvariant(const QVariant& var, void* field) { static const int DEFAULT_REFRESH_TIMEOUT_SEC = 20; static QString settings_file_path() { - static const QString settings_file = "subutai_tray.ini"; + static const QString settings_file = "subutai_control.ini"; QStringList lst_config= QStandardPaths::standardLocations(QStandardPaths::ConfigLocation); @@ -148,7 +148,7 @@ static QString subutai_path() { } } - dir_path = dir_path + QDir::separator() + QString("tray"); + dir_path = dir_path + QDir::separator() + QString("control-center"); QDir dir_tray(dir_path); if (!dir_tray.exists()) { if (!dir_tray.mkdir(dir_path)) { @@ -157,7 +157,7 @@ static QString subutai_path() { } } - return QDir::homePath() +QDir::separator() + QString(".subutai") + QDir::separator() + QString("tray"); + return QDir::homePath() +QDir::separator() + QString(".subutai") + QDir::separator() + QString("control-center"); } //////////////////////////////////////////////////////////////////////////// diff --git a/hub/src/SystemCallWrapper.cpp b/hub/src/SystemCallWrapper.cpp index 84446395..f1811814 100644 --- a/hub/src/SystemCallWrapper.cpp +++ b/hub/src/SystemCallWrapper.cpp @@ -213,13 +213,11 @@ std::pair CSystemCallWrapper::upload_f << "-S" << CSettingsManager::Instance().ssh_path() << "-i" << ssh_info.second << file_path - << QString("%1@%2:%3").arg(remote_user, ip, destination); + << QString("%1@%2:\"%3\"").arg(remote_user, ip, destination); qDebug() << "ARGS=" << args; system_call_res_t res = ssystem_th(cmd, args, true, true, 97); if (res.res == SCWE_SUCCESS && res.exit_code != 0) { - // if(res.exit_code == 1) - // return std::make_pair(SCWE_PERMISSION_DENIED, res.out); return std::make_pair(SCWE_CREATE_PROCESS, res.out); } return std::make_pair(res.res, res.out); @@ -239,10 +237,9 @@ std::pair CSystemCallWrapper::download << QString("%1@%2:\"%3\"").arg(remote_user, ip, remote_file_path) << local_destination; qDebug() << "ARGS=" << args; + system_call_res_t res = ssystem_th(cmd, args, true, true, 97); if (res.res == SCWE_SUCCESS && res.exit_code != 0) { - //if(res.exit_code == 1) - // return std::make_pair(SCWE_PERMISSION_DENIED, res.out); return std::make_pair(SCWE_CREATE_PROCESS, res.out); } return std::make_pair(res.res, res.out); diff --git a/hub/src/updater/IUpdaterComponent.cpp b/hub/src/updater/IUpdaterComponent.cpp index b8b397c8..6f9c9227 100644 --- a/hub/src/updater/IUpdaterComponent.cpp +++ b/hub/src/updater/IUpdaterComponent.cpp @@ -11,9 +11,9 @@ const QString IUpdaterComponent::P2P = "p2p"; const QString IUpdaterComponent::P2P = "p2p.exe"; #endif #ifndef RT_OS_WINDOWS -const QString IUpdaterComponent::TRAY = "SubutaiTray"; +const QString IUpdaterComponent::TRAY = "SubutaiControlCenter"; #else -const QString IUpdaterComponent::TRAY = "SubutaiTray.exe"; +const QString IUpdaterComponent::TRAY = "SubutaiControlCenter.exe"; #endif const QString IUpdaterComponent::RH = "resource_host"; @@ -23,7 +23,7 @@ const QString & IUpdaterComponent::component_id_to_user_view(const QString& id) { static std::map dct = { {P2P, "p2p"}, - {TRAY, "tray application"}, + {TRAY, "ControlCenter"}, {RH, "resource host"}, {RHMANAGEMENT, "resource host management"} }; diff --git a/main.cpp b/main.cpp index d62b96b6..3c403887 100644 --- a/main.cpp +++ b/main.cpp @@ -78,7 +78,7 @@ main(int argc, char *argv[]) { if (is_first && !QApplication::arguments().contains(CCommons::RESTARTED_ARG)) { QMessageBox* msg_box = new QMessageBox(QMessageBox::Information, QObject::tr("Already running"), - QObject::tr("One instance of tray application is already running"), + QObject::tr("One instance of control center application is already running"), QMessageBox::Ok); QObject::connect(msg_box, &QMessageBox::finished, msg_box, &QMessageBox::deleteLater); msg_box->exec(); diff --git "a/neo\\matrix" "b/neo\\matrix" new file mode 100644 index 00000000..e69de29b diff --git a/resources/resources.qrc b/resources/resources.qrc index bac0fdcc..b59bc8e7 100644 --- a/resources/resources.qrc +++ b/resources/resources.qrc @@ -57,6 +57,7 @@ add_blue.png refreshing.gif logo.png + upload-0.png diff --git a/resources/upload-0.png b/resources/upload-0.png new file mode 100644 index 00000000..4d27c36f Binary files /dev/null and b/resources/upload-0.png differ diff --git a/version b/version index 06a76599..2dd517aa 100644 --- a/version +++ b/version @@ -1 +1 @@ -6.7.1 +6.7.2