Skip to content

Commit

Permalink
FIX FTP issue, file listing and directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ctlcltd committed Jan 20, 2024
1 parent fc26276 commit 2fc9ffc
Showing 10 changed files with 87 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -43,7 +43,8 @@ body:
label: Software version
description: What version of our software are you running?
options:
- 1.1
- 1.1.1
- 1.1.0
- 1.0
- 0.9
- 0.8
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,11 +5,20 @@ All notable changes to this project will be documented in this file.

## [v1.2.0]

**Version**: 1.2
**Version**: 1.2.0
**Release Date**: *unreleased*
**Full Changelog**: [v1.1.0...HEAD](https://github.com/ctlcltd/e2-sat-editor/compare/v1.1.0...HEAD)


## [v1.1.1]

**Version**: 1.1.1
**Release Date**: 2024-01-20
**Full Changelog**: [v1.1.0...v.1.1.1](https://github.com/ctlcltd/e2-sat-editor/compare/v1.1.0...v.1.1.1)

- Fix: FTP issue, file listing and directory


## [v1.1.0]

**Version**: 1.1
2 changes: 1 addition & 1 deletion dist/wasm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)

project(e2-sat-editor VERSION 1.1 LANGUAGES CXX)
project(e2-sat-editor VERSION 1.1.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7 changes: 7 additions & 0 deletions dist/xdg/io.github.ctlcltd.e2se.metainfo.xml
Original file line number Diff line number Diff line change
@@ -32,6 +32,13 @@
<binary>e2se-cli</binary>
</provides>
<releases>
<release version="1.1.1" date="2024-01-20">
<description>
<ul>
<li>Fix: FTP issue, file listing and directory</li>
</ul>
</description>
</release>
<release version="1.1.0" date="2024-01-15">
<description>
<ul>
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)

project(e2-sat-editor VERSION 1.1 LANGUAGES CXX)
project(e2-sat-editor VERSION 1.1.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2 changes: 1 addition & 1 deletion src/e2-sat-editor.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = 1.1.0
VERSION = 1.1.1
QMAKE_TARGET_BUNDLE_PREFIX = io.github.ctlcltd
QMAKE_BUNDLE = e2se
QMAKE_APPLICATION_BUNDLE_NAME = e2" "SAT" "Editor
4 changes: 2 additions & 2 deletions src/e2se_defs.h
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
* @link https://github.com/ctlcltd/e2-sat-editor
* @copyright e2 SAT Editor Team
* @author Leonardo Laureti
* @version 1.1
* @version 1.1.1
* @license MIT License
* @license GNU GPLv3 License
*/
@@ -17,7 +17,7 @@


// build target: debug, release
#define E2SE_BUILD E2SE_TARGET_DEBUG
#define E2SE_BUILD E2SE_TARGET_RELEASE

// portable application
// #define E2SE_PORTABLE
2 changes: 1 addition & 1 deletion src/gui/about.cpp
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ void about::layout()
aname->setStyleSheet("font-size: 24px");

QLabel* aver = new QLabel;
aver->setText(tr("Version %1").arg("1.1"));
aver->setText(tr("Version %1").arg("1.1.1"));
aver->setStyleSheet("font-size: 16px");

QLabel* aauts = new QLabel;
71 changes: 60 additions & 11 deletions src/gui/tab.cpp
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
* @link https://github.com/ctlcltd/e2-sat-editor
* @copyright e2 SAT Editor Team
* @author Leonardo Laureti
* @version 1.1
* @version 1.1.1
* @license MIT License
* @license GNU GPLv3 License
*/
@@ -14,6 +14,7 @@
#include <cmath>
#include <algorithm>
#include <filesystem>
#include <sstream>

#include <QtGlobal>
#include <QGuiApplication>
@@ -63,7 +64,7 @@
#include "editMarker.h"
#include "printable.h"

using std::pair, std::to_string, std::sort;
using std::pair, std::stringstream, std::to_string, std::sort;

using namespace e2se;

@@ -1774,7 +1775,9 @@ void tab::ftpUpload()

for (auto & x : this->ftp_files)
{
std::filesystem::path fpath = std::filesystem::path(x.first);
string fname = x.first;

std::filesystem::path fpath = std::filesystem::path(fname);
string basedir = fpath.parent_path().u8string();
string filename = fpath.filename().u8string();

@@ -1783,9 +1786,7 @@ void tab::ftpUpload()
try {
ftih->upload_data(basedir, filename, x.second);
} catch (std::runtime_error& err) {
this->ftp_files.clear();
QMetaObject::invokeMethod(this->cwid, [=]() { ftih->showError(err.what()); }, Qt::QueuedConnection);
return;
this->ftp_errors.emplace(fname, err.what());
} catch (...) {
this->ftp_files.clear();
QMetaObject::invokeMethod(this->cwid, [=]() { this->ftpGenericError("FTP Error"); }, Qt::QueuedConnection);
@@ -1794,8 +1795,33 @@ void tab::ftpUpload()
}
});
thread->connect(thread, &QThread::finished, [=]() {
if (! this->ftp_errors.empty())
{
string optk, fn;
QStringList errors;

for (auto & x : this->ftp_errors)
{
stringstream ss (x.second);
string optv;
std::getline(ss, optk, '\t');
std::getline(ss, optv, '\t');
std::getline(ss, fn, '\t');
QString err = QString(QApplication::layoutDirection() == Qt::RightToLeft ? "%2 :%1" : "%1: %2").arg(optv.data()).arg(x.first.data());
errors.append(err);
}

string error_msg = optk + '\t' + errors.join("\n").toStdString() + '\t' + fn;

QMetaObject::invokeMethod(this->cwid, [=]() { ftih->showError(error_msg); }, Qt::QueuedConnection);

this->ftp_errors.clear();
}

if (this->ftp_files.empty())
{
return;
}

int files_count = int (this->ftp_files.size());
QMetaObject::invokeMethod(this->cwid, [=]() { this->ftpStbUploadNotify(files_count); }, Qt::QueuedConnection);
@@ -1853,9 +1879,9 @@ void tab::ftpDownload()
return;
}

for (string & w : ftih->ftdb)
for (string & fname : ftih->ftdb)
{
std::filesystem::path fpath = std::filesystem::path(w);
std::filesystem::path fpath = std::filesystem::path(fname);
string basedir = fpath.parent_path().u8string();
string filename = fpath.filename().u8string();

@@ -1866,9 +1892,7 @@ void tab::ftpDownload()
try {
ftih->download_data(basedir, filename, file);
} catch (std::runtime_error& err) {
this->ftp_files.clear();
QMetaObject::invokeMethod(this->cwid, [=]() { ftih->showError(err.what()); }, Qt::QueuedConnection);
return;
this->ftp_errors.emplace(fname, err.what());
} catch (...) {
this->ftp_files.clear();
QMetaObject::invokeMethod(this->cwid, [=]() { this->ftpGenericError("FTP Error"); }, Qt::QueuedConnection);
@@ -1879,8 +1903,33 @@ void tab::ftpDownload()
}
});
thread->connect(thread, &QThread::finished, [=]() {
if (! this->ftp_errors.empty())
{
string optk, fn;
QStringList errors;

for (auto & x : this->ftp_errors)
{
stringstream ss (x.second);
string optv;
std::getline(ss, optk, '\t');
std::getline(ss, optv, '\t');
std::getline(ss, fn, '\t');
QString err = QString(QApplication::layoutDirection() == Qt::RightToLeft ? "%2 :%1" : "%1: %2").arg(optv.data()).arg(x.first.data());
errors.append(err);
}

string error_msg = optk + '\t' + errors.join("\n").toStdString() + '\t' + fn;

QMetaObject::invokeMethod(this->cwid, [=]() { ftih->showError(error_msg); }, Qt::QueuedConnection);

this->ftp_errors.clear();
}

if (this->ftp_files.empty())
{
return;
}

for (auto & x : this->ftp_files)
{
3 changes: 2 additions & 1 deletion src/gui/tab.h
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
* @link https://github.com/ctlcltd/e2-sat-editor
* @copyright e2 SAT Editor Team
* @author Leonardo Laureti
* @version 1.1
* @version 1.1.1
* @license MIT License
* @license GNU GPLv3 License
*/
@@ -165,6 +165,7 @@ class tab : protected e2se::log_factory
QComboBox* ftp_combo;

unordered_map<string, e2se_ftpcom::ftpcom::ftpcom_file> ftp_files;
unordered_map<string, string> ftp_errors;
unordered_map<string, e2db::e2db_file> files;

// stored gui bit flags

0 comments on commit 2fc9ffc

Please sign in to comment.