summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <codeminister@publicstatic.de>2014-01-22 16:07:07 (GMT)
committerGregor Mi <codeminister@publicstatic.de>2014-01-22 16:07:07 (GMT)
commit31050787b5ae8edf0677c6c32701f8743d39c239 (patch)
tree7b75a6215844cfff220c00b6bed93b08a08eb26e
parent8b1a074524cdbfe01d1b8551b4d6e7b529462671 (diff)
Fix in SaveLocation. ShowImageDialog: use QDialog instead of KDialog.
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/SaveLocation.ui39
-rw-r--r--src/TODO5
-rw-r--r--src/skanlite.cpp39
-rw-r--r--src/skanlite.h8
5 files changed, 73 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c36b35f..745d764 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,7 +36,7 @@ find_package(KF5 ${KF5_VERSION} REQUIRED
PrintUtils # FIXME KF5 why is this needed?
DocTools # yields kdoctools_create_handbook
Sane # will find KF5Sane
- KDE4Support # FIXME KF5 remove
+ KDE4Support # FIXME KF5 remove later
)
ecm_setup_version(
diff --git a/src/SaveLocation.ui b/src/SaveLocation.ui
index 966ead2..c6ece35 100644
--- a/src/SaveLocation.ui
+++ b/src/SaveLocation.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SaveLocation</class>
- <widget class="QWidget" name="SaveLocation">
+ <widget class="QDialog" name="SaveLocation">
<property name="geometry">
<rect>
<x>0</x>
@@ -133,7 +133,7 @@
</widget>
</item>
<item row="6" column="0" colspan="2">
- <widget class="QDialogButtonBox" name="dialogButtonBox">
+ <widget class="QDialogButtonBox" name="u_dialogButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -177,5 +177,38 @@
</layout>
</widget>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>u_dialogButtonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>SaveLocation</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>200</x>
+ <y>152</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>200</x>
+ <y>86</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>u_dialogButtonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>SaveLocation</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>200</x>
+ <y>152</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>200</x>
+ <y>86</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
diff --git a/src/TODO b/src/TODO
index 1caa1a7..5d944dc 100644
--- a/src/TODO
+++ b/src/TODO
@@ -1,5 +1,9 @@
2014-01-21 Porting from KDE4 to 5
=================================
+Changes in 1.1.0 (from 1.0.0)
+-----------------------------
+* Save Image Dialog: "Close" button is now called "Discard" because it discards the currently scanned image
+
Major issues
------------
* Scan button: crash after scan
@@ -13,6 +17,7 @@ Minor issues
* Main dialog: Help button does not show help (is this a KF5 issue?)
* Main dialog: Help and Close button do not have icons but they had before (is this a KF5 theme issue?)
* Settings dialog: Ok, Cancel button has no icons (is this a KF5 theme issue?)
+* Show image dialog: Save button has no image (is this a KF5 theme issue?)
before 2014
===========
diff --git a/src/skanlite.cpp b/src/skanlite.cpp
index fad4338..f471890 100644
--- a/src/skanlite.cpp
+++ b/src/skanlite.cpp
@@ -177,19 +177,32 @@ Skanlite::Skanlite(const QString& device, QWidget* parent)
m_deviceName = device;
}
- // prepare the Show Image Dialog
- /* FIXME KF5
- *
- m_showImgDialog = new KDialog(this);
- m_showImgDialog->setButtons(KDialog::User1 | KDialog::Close);
- m_showImgDialog->setButtonText(KDialog::User1, i18n("Save"));
- m_showImgDialog->setButtonIcon(KDialog::User1, QIcon::fromTheme("document-save"));
- m_showImgDialog->setDefaultButton(KDialog::User1);
- m_showImgDialog->resize(640, 480);
- m_showImgDialog->setMainWidget(&m_imageViewer);
- connect(m_showImgDialog, SIGNAL(user1Clicked()), this, SLOT(saveImage()));
+ // prepare the Show Image Dialog
+ {
+ /* FIXME KF5
+ *
+ m_showImgDialog->setButtonIcon(KDialog::User1, QIcon::fromTheme("document-save")); // still needed?
+ m_showImgDialog->setDefaultButton(KDialog::User1); // still needed?
+ connect(m_showImgDialog, SIGNAL(user1Clicked()), this, SLOT(saveImage()));
+ */
+ m_showImgDialog = new QDialog(this);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout(m_showImgDialog);
+
+ QDialogButtonBox* dlgBtnBoxBottom = new QDialogButtonBox(m_showImgDialog);
+ // "Close" (now Discard) and "User1"=Save
+ dlgBtnBoxBottom->setStandardButtons(QDialogButtonBox::Discard | QDialogButtonBox::Save);
+
+ mainLayout->addWidget(&m_imageViewer);
+ mainLayout->addWidget(dlgBtnBoxBottom);
+
+ m_showImgDialog->resize(640, 480);
+ connect(dlgBtnBoxBottom, SIGNAL(accepted()), this, SLOT(saveImage()));
+ connect(dlgBtnBoxBottom, SIGNAL(accepted()), m_showImgDialog, SLOT(accept()));
+ connect(dlgBtnBoxBottom->button(QDialogButtonBox::Discard),
+ SIGNAL(clicked()), m_showImgDialog, SLOT(reject()));
+ }
- */
// save the default sane options for later use
m_ksanew->getOptVals(m_defaultScanOpts);
@@ -346,6 +359,8 @@ void Skanlite::imageReady(QByteArray &data, int w, int h, int bpl, int f)
//************************************************************
void Skanlite::saveImage()
{
+ qDebug() << "saveImage()";
+
// ask the first time if we are in "ask on first" mode
if ((m_settingsUi.saveModeCB->currentIndex() == SaveModeAskFirst) && m_firstImage) {
if (m_saveLocation->exec() != QFileDialog::Accepted) return;
diff --git a/src/skanlite.h b/src/skanlite.h
index 4940fa5..873184d 100644
--- a/src/skanlite.h
+++ b/src/skanlite.h
@@ -79,11 +79,11 @@ class Skanlite : public QDialog
private:
KAboutData* m_aboutData;
- KSaneWidget *m_ksanew;
+ KSaneWidget *m_ksanew = nullptr;
Ui::SkanliteSettings m_settingsUi;
- QDialog *m_settingsDialog;
- QDialog *m_showImgDialog;
- SaveLocation *m_saveLocation;
+ QDialog *m_settingsDialog = nullptr;
+ QDialog *m_showImgDialog = nullptr;
+ SaveLocation *m_saveLocation = nullptr;
QString m_deviceName;
QMap<QString,QString> m_defaultScanOpts;
QImage m_img;