summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt17
-rw-r--r--src/gui.cpp8
-rw-r--r--src/main.cpp4
-rw-r--r--src/progress.cpp14
4 files changed, 35 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a72808..172e213 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,15 @@
-cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
# project name
project(cowgui CXX)
set(CMAKE_CXX_STANDARD 11)
-set(CMAKE_BUILD_TYPE Debug)
+set(CMAKE_CONFIGURATION_TYPES Debug Release)
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+ message(STATUS "Build type is not set. Defaulting to ${CMAKE_BUILD_TYPE} build!")
+endif(NOT CMAKE_BUILD_TYPE)
+
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -Wextra -Werror -Wno-multichar -std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wno-multichar -std=c++11")
@@ -13,7 +18,7 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
-file(GLOB COWGUI_SOURCES src/*.cpp)
+file(GLOB COWGUI_SRCS src/*.cpp)
#file(GLOB_RECURSE COWGUI_MOC_HEADERS src/*.h)
#file(GLOB_RECURSE COWGUI_UIS src/ui/*.ui)
#file(GLOB_RECURSE COWGUI_RESOURCES src/*.qrc)
@@ -23,8 +28,12 @@ FIND_PACKAGE(Qt5 COMPONENTS Widgets Network REQUIRED)
#QT5_WRAP_UI(COWGUI_UI_HEADERS ${COWGUI_UIS})
#QT5_WRAP_CPP(COWGUI_MOC_SOURCES ${COWGUI_MOC_HEADERS})
+include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
add_executable(cowgui
- ${COWGUI_SOURCES}
+ ${COWGUI_SRCS}
# ${COWGUI_MOC_SOURCES}
# ${COWGUI_UI_HEADERS}
# ${COWGUI_RC_SOURCES}
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();
}
}