summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui.cpp8
-rw-r--r--src/main.cpp4
-rw-r--r--src/progress.cpp14
3 files changed, 22 insertions, 4 deletions
diff --git a/src/gui.cpp b/src/gui.cpp
index 67f961c..361d802 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -13,6 +13,8 @@
#include <QJsonArray>
#include <QCloseEvent>
+#include <iostream>
+
#include <signal.h>
static QString STATE_COPYING("COPYING"); // Still busy copying original file, new chunks are only accepted in already copied range
@@ -94,6 +96,7 @@ Gui::Gui(const QString &urlbase, const QString &uuid, int dnbd3pid, QWidget *par
item = new Progress(title, this);
_itemBox->addWidget(item);
_items.insert(title, item);
+ item->show();
}
item->setProgress(percent);
item->setCaption(title + QLatin1String(" ") + err);
@@ -159,6 +162,7 @@ void Gui::updateButtons()
void Gui::pushedCancel(bool)
{
if (_remoteState == STATE_ERROR) {
+ std::cerr << "[cowgui] User pressed cancel in error state" << std::endl;
_allowClose = true;
this->close();
return;
@@ -176,8 +180,10 @@ void Gui::pushedCancel(bool)
}
if (_dnbd3pid != 0 && _dnbd3pid != -1) {
// SIGQUIT tells dnbd3-fuse to stop uploading
+ std::cerr << "[cowgui] Sending QUIT to dnbd3-fuse to stop upload" << std::endl;
::kill(_dnbd3pid, SIGQUIT);
}
+ std::cerr << "[cowgui] Sending abort command to server" << std::endl;
_denyInteraction = true;
QNetworkReply *reply = _nam->post(QNetworkRequest(_urlAbort), QByteArray());
connect(reply, &QNetworkReply::finished, [reply, this]() {
@@ -201,6 +207,7 @@ void Gui::pushedCancel(bool)
void Gui::pushedOk(bool)
{
if (_remoteState == STATE_COMPLETELY_DONE || _remoteState == STATE_PROCESSING) {
+ std::cerr << "[cowgui] User pressed OK in done or processing state" << std::endl;
_allowClose = true;
this->close();
return;
@@ -212,6 +219,7 @@ void Gui::pushedOk(bool)
if (ret == QMessageBox::No)
return;
}
+ std::cerr << "[cowgui] Sending finalization request to server" << std::endl;
_denyInteraction = true;
QNetworkReply *reply = _nam->get(QNetworkRequest(_urlFinish));
connect(reply, &QNetworkReply::finished, [reply, this]() {
diff --git a/src/main.cpp b/src/main.cpp
index 51c9899..bbb70a5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,6 +3,7 @@
#include <QApplication>
#include <QCommandLineOption>
#include <QCommandLineParser>
+#include <iostream>
int main(int argc, char **argv)
{
@@ -10,7 +11,7 @@ int main(int argc, char **argv)
QCommandLineParser parser;
parser.setApplicationDescription(QObject::tr("CoW-GUI for dnbd3-fuse sessions"));
parser.addHelpOption();
- QCommandLineOption sessionOption(QStringList() << QLatin1String("session") << QLatin1String("s"),
+ QCommandLineOption sessionOption(QStringList() << QLatin1String("sessionid") << QLatin1String("s"),
QObject::tr("Session ID to use when talking to server"),
QLatin1String("sessionid"));
QCommandLineOption urlOption(QStringList() << QLatin1String("url") << QLatin1String("u"),
@@ -25,6 +26,7 @@ int main(int argc, char **argv)
parser.process(app);
if (!parser.isSet(sessionOption) || !parser.isSet(urlOption) || !parser.isSet(pidOption)) {
+ std::cerr << "Missing command line option!" << parser.isSet(sessionOption) << parser.isSet(urlOption) << parser.isSet(pidOption) << std::endl;
parser.showHelp();
return 1;
}
diff --git a/src/progress.cpp b/src/progress.cpp
index 6d01482..cf5328b 100644
--- a/src/progress.cpp
+++ b/src/progress.cpp
@@ -15,6 +15,14 @@ Progress::Progress(QString text, QWidget *parent)
l->setMargin(0);
setLayout(l);
_progress->setRange(0, 100);
+ _label->setMinimumHeight(16);
+ _progress->setMinimumHeight(16);
+ _label->show();
+ _progress->show();
+ l->addWidget(_label);
+ l->addWidget(_progress);
+ _label->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
+ _progress->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred));
}
Progress::~Progress()
@@ -26,8 +34,8 @@ void Progress::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
auto size = event->size();
- int width = size.width() - 150;
- if (width < 250) {
+ int width = size.width() - 110;
+ if (width < 120) {
width = size.width();
_progress->hide();
} else if (_progress->value() != -1) {
@@ -47,7 +55,7 @@ void Progress::setProgress(int percent)
_progress->setValue(percent);
if (_hidden) {
_hidden = false;
- if (_label->width() > 250) {
+ if (_label->width() > 200) {
_progress->show();
}
}