[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [imagewriter/make-it-cool] /: use ECM for debug setup, implement ButtonBox and remove old buttons
From: Jonathan Riddell <null () kde ! org>
Date: 2017-03-09 12:00:39
Message-ID: E1clwkJ-0004H2-55 () code ! kde ! org
[Download RAW message or body]
Git commit 223279fdf90eafa84b73be77bda68a9f688744b1 by Jonathan Riddell.
Committed on 09/03/2017 at 12:00.
Pushed by jriddell into branch 'make-it-cool'.
use ECM for debug setup, implement ButtonBox and remove old buttons
M +1 -0 CMakeLists.txt
M +6 -0 imagewriter/CMakeLists.txt
M +0 -2 imagewriter/common.h
M +5 -12 imagewriter/maindialog.cpp
M +8 -106 imagewriter/maindialog.ui
https://commits.kde.org/imagewriter/223279fdf90eafa84b73be77bda68a9f688744b1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a6d366..b37264a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,7 @@ include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMPackageConfigHelpers)
include(ECMOptionalAddSubdirectory)
+include(ECMQtDeclareLoggingCategory)
option(ROSA_BRANDING "Build with ROSA branding" OFF)
diff --git a/imagewriter/CMakeLists.txt b/imagewriter/CMakeLists.txt
index 35da8d0..65b777d 100644
--- a/imagewriter/CMakeLists.txt
+++ b/imagewriter/CMakeLists.txt
@@ -13,6 +13,12 @@ set(imagewriter_SRCS
)
ki18n_wrap_ui(imagewriter_SRCS maindialog.ui)
+ecm_qt_declare_logging_category(imagewriter_SRCS
+ HEADER imagewriter_debug.h
+ IDENTIFIER IMAGEWRITER_LOG
+ CATEGORY_NAME org.kde.imagewriter
+ DEFAULT_SEVERITY Debug)
+
add_executable(imagewriter ${imagewriter_SRCS})
if (ROSA_BRANDING)
diff --git a/imagewriter/common.h b/imagewriter/common.h
index 5bae048..ca33bdb 100644
--- a/imagewriter/common.h
+++ b/imagewriter/common.h
@@ -31,8 +31,6 @@
class UsbDevice;
-Q_DECLARE_LOGGING_CATEGORY(IMAGEWRITER);
-
// Default unit to be used when displaying file/device sizes (MB)
const quint64 DEFAULT_UNIT = 1048576;
diff --git a/imagewriter/maindialog.cpp b/imagewriter/maindialog.cpp
index c7f6afc..59286e0 100644
--- a/imagewriter/maindialog.cpp
+++ b/imagewriter/maindialog.cpp
@@ -36,6 +36,7 @@
#include "ui_maindialog.h"
#include "imagewriter.h"
#include "usbdevice.h"
+#include "imagewriter_debug.h"
MainDialog::MainDialog(QWidget *parent) :
QDialog(parent),
@@ -68,12 +69,13 @@ MainDialog::MainDialog(QWidget *parent) :
ui->deviceRefreshButton->setIcon(QIcon::fromTheme("view-refresh"));
m_writeButton = ui->buttonBox->button(QDialogButtonBox::Yes);
m_clearButton = ui->buttonBox->button(QDialogButtonBox::Reset);
- m_cancelButton = ui->buttonBox->button(QDialogButtonBox::Reset);
+ m_cancelButton = ui->buttonBox->button(QDialogButtonBox::Cancel);
m_clearButton->setText(i18n("Clear USB Disk"));
m_writeButton->setText(i18n("Write"));
connect(m_writeButton, &QPushButton::clicked, this, \
&MainDialog::writeImageToDevice); m_clearButton->setText("Wipe USB Disk");
+ connect(m_clearButton, &QPushButton::clicked, this, &MainDialog::clearDevice);
m_cancelButton->hide();
// Remove the Context Help button and add the Minimize button to the titlebar
setWindowFlags((windowFlags() | Qt::CustomizeWindowHint | \
Qt::WindowMinimizeButtonHint) & ~Qt::WindowContextHelpButtonHint); @@ -130,7 +132,6 \
@@ void MainDialog::preprocessImageFile(const QString& newImageFile) m_ImageFile = \
newImageFile;
ui->imageEdit->setText(QDir::toNativeSeparators(m_ImageFile) + " " + i18n("(%1 \
MiB)", QString::number(alignNumberDiv(m_ImageSize, DEFAULT_UNIT)))); // Enable the \
Write button (if there are USB flash disks present)
- ui->writeButton->setEnabled(ui->deviceList->count() > 0);
m_writeButton->setEnabled(ui->deviceList->count() > 0);
}
@@ -288,10 +289,8 @@ void MainDialog::enumFlashDevices()
ui->deviceList->setEnabled(true);
// Update the Write button enabled/disabled state
m_writeButton->setEnabled((ui->deviceList->count() > 0) && (m_ImageFile != ""));
- ui->writeButton->setEnabled((ui->deviceList->count() > 0) && (m_ImageFile != \
"")); // Update the Clear button enabled/disabled state
m_clearButton->setEnabled(ui->deviceList->count() > 0);
- ui->clearButton->setEnabled(ui->deviceList->count() > 0);
}
// Starts writing data to the device
@@ -339,8 +338,8 @@ void MainDialog::writeToDevice(bool zeroing)
// If the Cancel button is pressed, inform the writer to stop the operation
// Using DirectConnection because the thread does not read its own event queue \
until completion + m_cancelButton->show();
connect(m_cancelButton, &QPushButton::clicked, writer, \
&ImageWriter::cancelWriting, Qt::DirectConnection);
- connect(ui->cancelButton, &QPushButton::clicked, writer, \
&ImageWriter::cancelWriting, Qt::DirectConnection);
// Each time a block is written, update the progress bar
connect(writer, &ImageWriter::blockWritten, this, \
&MainDialog::updateProgressBar); @@ -396,10 +395,7 @@ void \
MainDialog::showWritingProgress(int maxValue)
ui->progressBarSpacer->changeSize(0, 10, QSizePolicy::Fixed, \
QSizePolicy::Fixed); m_writeButton->setVisible(false);
m_clearButton->setVisible(false);
- m_cancelButton->setVisible(false);
- ui->writeButton->setVisible(false);
- ui->clearButton->setVisible(false);
- ui->cancelButton->setVisible(true);
+ m_cancelButton->setVisible(true);
// Expose the progress bar state to the OS
m_ExtProgressBar.InitProgressBar(maxValue);
@@ -427,9 +423,6 @@ void MainDialog::hideWritingProgress()
m_writeButton->setVisible(true);
m_clearButton->setVisible(true);
m_cancelButton->setVisible(false);
- ui->writeButton->setVisible(true);
- ui->clearButton->setVisible(true);
- ui->cancelButton->setVisible(false);
// Send a signal that progressbar is no longer present
m_ExtProgressBar.DestroyProgressBar();
diff --git a/imagewriter/maindialog.ui b/imagewriter/maindialog.ui
index da4574c..29cce5a 100644
--- a/imagewriter/maindialog.ui
+++ b/imagewriter/maindialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>550</width>
- <height>204</height>
+ <width>538</width>
+ <height>196</height>
</rect>
</property>
<property name="sizePolicy">
@@ -201,72 +201,6 @@
</property>
</spacer>
</item>
- <item>
- <widget class="QPushButton" name="clearButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="toolTip">
- <string>Delete partitions and make all space available for storing \
data</string>
- </property>
- <property name="text">
- <string>Clea&r</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="writeButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>&Write</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="cancelButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>&Cancel</string>
- </property>
- </widget>
- </item>
</layout>
</item>
<item>
@@ -295,63 +229,31 @@
<slot>openImageFile()</slot>
<hints>
<hint type="sourcelabel">
- <x>700</x>
- <y>76</y>
+ <x>678</x>
+ <y>68</y>
</hint>
<hint type="destinationlabel">
- <x>467</x>
+ <x>425</x>
<y>7</y>
</hint>
</hints>
</connection>
<connection>
- <sender>writeButton</sender>
- <signal>clicked()</signal>
- <receiver>MainDialog</receiver>
- <slot>writeImageToDevice()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>619</x>
- <y>137</y>
- </hint>
- <hint type="destinationlabel">
- <x>507</x>
- <y>13</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>deviceRefreshButton</sender>
<signal>clicked()</signal>
<receiver>MainDialog</receiver>
<slot>scheduleEnumFlashDevices()</slot>
<hints>
<hint type="sourcelabel">
- <x>685</x>
- <y>92</y>
+ <x>678</x>
+ <y>108</y>
</hint>
<hint type="destinationlabel">
- <x>542</x>
+ <x>425</x>
<y>18</y>
</hint>
</hints>
</connection>
- <connection>
- <sender>clearButton</sender>
- <signal>clicked()</signal>
- <receiver>MainDialog</receiver>
- <slot>clearDevice()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>321</x>
- <y>133</y>
- </hint>
- <hint type="destinationlabel">
- <x>274</x>
- <y>77</y>
- </hint>
- </hints>
- </connection>
</connections>
<slots>
<slot>openImageFile()</slot>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic