Skip to content

Commit

Permalink
Merge pull request #696 from subutai-io/fix
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
Erkin Matkaziev authored Mar 7, 2018
2 parents a06d08c + c4eb402 commit ef3b2bc
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 21 deletions.
26 changes: 18 additions & 8 deletions hub/forms/DlgTransferFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand All @@ -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));
Expand All @@ -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));
}
}
Expand Down Expand Up @@ -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/'
Expand All @@ -607,7 +618,6 @@ void DlgTransferFile::remote_back() {
new_dir.append("/");
current_remote_dir = new_dir;
refresh_remote_file_system();
set_buttons_enabled(true);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions hub/forms/DlgTransferFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions hub/forms/DlgTransferFile.ui
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>../../resources/upload-0.png</normaloff>../../resources/upload-0.png</iconset>
<iconset resource="../../resources/resources.qrc">
<normaloff>:/hub/upload-0.png</normaloff>:/hub/upload-0.png</iconset>
</property>
</widget>
</item>
Expand All @@ -41,7 +41,7 @@
<string/>
</property>
<property name="icon">
<iconset theme=":/hub/download" resource="../../resources/resources.qrc">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/hub/download.png</normaloff>:/hub/download.png</iconset>
</property>
</widget>
Expand Down
3 changes: 2 additions & 1 deletion hub/include/SystemCallWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
////////////////////////////////////////////////////////////////////////////

Expand Down
6 changes: 3 additions & 3 deletions hub/src/SettingsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand All @@ -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");
}
////////////////////////////////////////////////////////////////////////////

Expand Down
7 changes: 2 additions & 5 deletions hub/src/SystemCallWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,11 @@ std::pair<system_call_wrapper_error_t, QStringList> 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);
Expand All @@ -239,10 +237,9 @@ std::pair<system_call_wrapper_error_t, QStringList> 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);
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Empty file added neo\matrix
Empty file.

0 comments on commit ef3b2bc

Please sign in to comment.