[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [digikam] utilities/assistants/printcreator: separate layout and caption settings on different page
From: Gilles Caulier <null () kde ! org>
Date: 2017-07-03 21:35:22
Message-ID: E1dS906-0002mI-Fo () code ! kde ! org
[Download RAW message or body]
Git commit e69a8e98abb6ecce75433a1fa5a2ba3d9d88d492 by Gilles Caulier.
Committed on 03/07/2017 at 21:32.
Pushed by cgilles into branch 'master'.
separate layout and caption settings on different page to not have a very large \
wizard on screen
M +4 -2 utilities/assistants/printcreator/CMakeLists.txt
A +269 -0 utilities/assistants/printcreator/ui/advprintcaptionpage.ui
M +3 -270 utilities/assistants/printcreator/ui/advprintphotopage.ui
A +121 -0 utilities/assistants/printcreator/wizard/advprintcaptionpage.cpp \
[License: GPL (v2+)] A +61 -0 \
utilities/assistants/printcreator/wizard/advprintcaptionpage.h [License: GPL \
(v2+)] M +0 -23 utilities/assistants/printcreator/wizard/advprintphotopage.cpp
M +90 -66 utilities/assistants/printcreator/wizard/advprintwizard.cpp
M +3 -3 utilities/assistants/printcreator/wizard/advprintwizard.h
https://commits.kde.org/digikam/e69a8e98abb6ecce75433a1fa5a2ba3d9d88d492
diff --git a/utilities/assistants/printcreator/CMakeLists.txt \
b/utilities/assistants/printcreator/CMakeLists.txt index 49ac2d0fa3..75f19c1a9e \
100644
--- a/utilities/assistants/printcreator/CMakeLists.txt
+++ b/utilities/assistants/printcreator/CMakeLists.txt
@@ -24,12 +24,13 @@ set(libprintcreator_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/tools/templateicon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tools/advprintlayouttree.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tools/advprintphoto.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintcropframe.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintintropage.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintphotopage.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintcaptionpage.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintcroppage.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintcustomdlg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintoptionspage.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintintropage.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintcropframe.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintimagesconfig.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wizard/advprintwizard.cpp
)
@@ -37,6 +38,7 @@ set(libprintcreator_SRCS
ki18n_wrap_ui(libprintcreator_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/ui/advprintphotopage.ui
${CMAKE_CURRENT_SOURCE_DIR}/ui/advprintcroppage.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/ui/advprintcaptionpage.ui
${CMAKE_CURRENT_SOURCE_DIR}/ui/advprintcustomlayout.ui
${CMAKE_CURRENT_SOURCE_DIR}/ui/advprintoptionspage.ui
)
diff --git a/utilities/assistants/printcreator/ui/advprintcaptionpage.ui \
b/utilities/assistants/printcreator/ui/advprintcaptionpage.ui new file mode 100644
index 0000000000..206cf8d69f
--- /dev/null
+++ b/utilities/assistants/printcreator/ui/advprintcaptionpage.ui
@@ -0,0 +1,269 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AdvPrintCaptionPage</class>
+ <widget class="QWidget" name="AdvPrintCaptionPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>920</width>
+ <height>487</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_12">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Captions Type:</string>
+ </property>
+ <property name="buddy">
+ <cstring>m_captions</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="m_captions">
+ <item>
+ <property name="text">
+ <string>No captions</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Image file names</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Exif date-time</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Comments</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Free</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLineEdit" name="m_FreeCaptionFormat">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>400</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="m_free_label1">
+ <property name="text">
+ <string>"%f" : file name
+"%t" : camera exposure time
+"%c" : item comment
+"%i" : ISO sensibility from camera
+"%d" : date and time from camera
+</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="m_free_label2">
+ <property name="text">
+ <string>"%r" : camera sensor resolution
+"%a" : camera aperture
+"%l" : focal length from camera
+"\n" : new line</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Color:</string>
+ </property>
+ <property name="buddy">
+ <cstring>m_font_color</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Digikam::DColorSelector" name="m_font_color"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <widget class="QLabel" name="textLabel1_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Size:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ <property name="buddy">
+ <cstring>m_font_size</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="m_font_size">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum">
+ <number>2</number>
+ </property>
+ <property name="maximum">
+ <number>8</number>
+ </property>
+ <property name="singleStep">
+ <number>2</number>
+ </property>
+ <property name="pageStep">
+ <number>2</number>
+ </property>
+ <property name="value">
+ <number>4</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Family:</string>
+ </property>
+ <property name="buddy">
+ <cstring>m_font_name</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QFontComboBox" name="m_font_name"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QCheckBox" name="m_sameCaption">
+ <property name="text">
+ <string>Same to all</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="m_setDefault">
+ <property name="text">
+ <string>Use these settings as default</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>Digikam::DColorSelector</class>
+ <extends>QPushButton</extends>
+ <header>dcolorselector.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/utilities/assistants/printcreator/ui/advprintphotopage.ui \
b/utilities/assistants/printcreator/ui/advprintphotopage.ui index \
ee8b9251fe..6d95fa7003 100644
--- a/utilities/assistants/printcreator/ui/advprintphotopage.ui
+++ b/utilities/assistants/printcreator/ui/advprintphotopage.ui
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AdvPrintPhotoPage</class>
- <widget class="QWidget" name="PhotoPage">
+ <widget class="QWidget" name="AdvPrintPhotoPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>821</width>
- <height>560</height>
+ <width>954</width>
+ <height>740</height>
</rect>
</property>
<property name="sizePolicy">
@@ -412,275 +412,8 @@
</item>
</layout>
</item>
- <item row="1" column="0">
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string/>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_12">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_9">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Captions:</string>
- </property>
- <property name="buddy">
- <cstring>m_captions</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="m_captions">
- <item>
- <property name="text">
- <string>No captions</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Image file names</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Exif date-time</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Comments</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Free</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QLineEdit" name="m_FreeCaptionFormat">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="minimumSize">
- <size>
- <width>400</width>
- <height>0</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="m_free_label">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>%f filename, %t exposure time, %c comment, %i ISO, %d \
date-time, %r resolution, %a aperture, %l focal length, \n \
newline</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_8">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QCheckBox" name="m_sameCaption">
- <property name="text">
- <string>Same to all</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="m_setDefault">
- <property name="text">
- <string>Use as default</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Family:</string>
- </property>
- <property name="buddy">
- <cstring>m_font_name</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QFontComboBox" name="m_font_name"/>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_6">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Color:</string>
- </property>
- <property name="buddy">
- <cstring>m_font_color</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Digikam::DColorSelector" name="m_font_color">
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <item>
- <widget class="QLabel" name="textLabel1_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Size:</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- <property name="buddy">
- <cstring>m_font_size</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="m_font_size">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimum">
- <number>2</number>
- </property>
- <property name="maximum">
- <number>8</number>
- </property>
- <property name="singleStep">
- <number>2</number>
- </property>
- <property name="pageStep">
- <number>2</number>
- </property>
- <property name="value">
- <number>4</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_10">
- <item>
- <spacer name="verticalSpacer_5">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>13</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="0">
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>813</width>
- <height>5</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>Digikam::DColorSelector</class>
- <extends>QPushButton</extends>
- <header>dcolorselector.h</header>
- </customwidget>
- </customwidgets>
<tabstops>
<tabstop>ListPhotoSizes</tabstop>
<tabstop>BtnPreviewPageDown</tabstop>
diff --git a/utilities/assistants/printcreator/wizard/advprintcaptionpage.cpp \
b/utilities/assistants/printcreator/wizard/advprintcaptionpage.cpp new file mode \
100644 index 0000000000..3b2b4ac170
--- /dev/null
+++ b/utilities/assistants/printcreator/wizard/advprintcaptionpage.cpp
@@ -0,0 +1,121 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2017-05-25
+ * Description : a tool to print images
+ *
+ * Copyright (C) 2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#include "advprintcaptionpage.h"
+
+// Qt includes
+
+#include <QIcon>
+#include <QPrinter>
+#include <QPrinterInfo>
+#include <QWidget>
+#include <QApplication>
+#include <QStyle>
+
+// KDE includes
+
+#include <klocalizedstring.h>
+
+// Local includes
+
+#include "digikam_debug.h"
+#include "advprintwizard.h"
+
+namespace Digikam
+{
+
+class AdvPrintCaptionPage::Private
+{
+public:
+
+ template <class Ui_Class>
+
+ class WizardUI : public QWidget, public Ui_Class
+ {
+ public:
+
+ WizardUI(QWidget* const parent)
+ : QWidget(parent)
+ {
+ this->setupUi(this);
+ }
+ };
+
+ typedef WizardUI<Ui_AdvPrintCaptionPage> CaptionUI;
+
+public:
+
+ Private(QWidget* const parent)
+ {
+ captionUi = new CaptionUI(parent);
+ }
+
+ CaptionUI* captionUi;
+};
+
+AdvPrintCaptionPage::AdvPrintCaptionPage(QWizard* const wizard, const QString& \
title) + : DWizardPage(wizard, title),
+ d(new Private(this))
+{
+ connect(d->captionUi->m_captions, SIGNAL(activated(QString)),
+ wizard, SLOT(slotCaptionChanged(QString)));
+
+ connect(d->captionUi->m_FreeCaptionFormat , SIGNAL(editingFinished()),
+ wizard, SLOT(slotInfoPageUpdateCaptions()));
+
+ connect(d->captionUi->m_sameCaption , SIGNAL(stateChanged(int)),
+ wizard, SLOT(slotInfoPageUpdateCaptions()));
+
+ connect(d->captionUi->m_font_name , SIGNAL(currentFontChanged(QFont)),
+ wizard, SLOT(slotInfoPageUpdateCaptions()));
+
+ connect(d->captionUi->m_font_size , SIGNAL(valueChanged(int)),
+ wizard, SLOT(slotInfoPageUpdateCaptions()));
+
+ connect(d->captionUi->m_font_color , SIGNAL(signalColorSelected(QColor)),
+ wizard, SLOT(slotInfoPageUpdateCaptions()));
+
+ connect(d->captionUi->m_setDefault , SIGNAL(clicked()),
+ wizard, SLOT(slotSaveCaptionSettings()));
+
+ // -----------------------------------
+
+ setPageWidget(d->captionUi);
+ setLeftBottomPix(QIcon::fromTheme(QLatin1String("image-stack")));
+}
+
+AdvPrintCaptionPage::~AdvPrintCaptionPage()
+{
+ delete d;
+}
+
+Ui_AdvPrintCaptionPage* AdvPrintCaptionPage::ui() const
+{
+ return d->captionUi;
+}
+
+void AdvPrintCaptionPage::updateUi()
+{
+ d->captionUi->update();
+}
+
+} // namespace Digikam
diff --git a/utilities/assistants/printcreator/wizard/advprintcaptionpage.h \
b/utilities/assistants/printcreator/wizard/advprintcaptionpage.h new file mode 100644
index 0000000000..2c91587903
--- /dev/null
+++ b/utilities/assistants/printcreator/wizard/advprintcaptionpage.h
@@ -0,0 +1,61 @@
+/* ============================================================
+ *
+ * This file is a part of digiKam project
+ * http://www.digikam.org
+ *
+ * Date : 2017-05-25
+ * Description : a tool to print images
+ *
+ * Copyright (C) 2017 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ============================================================ */
+
+#ifndef ADV_PRINT_CAPTION_PAGE_H
+#define ADV_PRINT_CAPTION_PAGE_H
+
+// Qt includes
+
+#include <QString>
+#include <QPrinter>
+#include <QList>
+#include <QUrl>
+
+// Local includes
+
+#include "dwizardpage.h"
+#include "ui_advprintcaptionpage.h"
+
+namespace Digikam
+{
+
+class AdvPrintCaptionPage : public DWizardPage
+{
+ Q_OBJECT
+
+public:
+
+ explicit AdvPrintCaptionPage(QWizard* const wizard, const QString& title);
+ ~AdvPrintCaptionPage();
+
+ Ui_AdvPrintCaptionPage* ui() const;
+ void updateUi();
+
+private:
+
+ class Private;
+ Private* const d;
+};
+
+} // namespace Digikam
+
+#endif // ADV_PRINT_CAPTION_PAGE_H
diff --git a/utilities/assistants/printcreator/wizard/advprintphotopage.cpp \
b/utilities/assistants/printcreator/wizard/advprintphotopage.cpp index \
2f90c7c1b7..8f9f993e9c 100644
--- a/utilities/assistants/printcreator/wizard/advprintphotopage.cpp
+++ b/utilities/assistants/printcreator/wizard/advprintphotopage.cpp
@@ -100,29 +100,6 @@ AdvPrintPhotoPage::AdvPrintPhotoPage(QWizard* const wizard, \
const QString& title connect(d->photoUi->m_printer_choice, \
SIGNAL(activated(QString)), this, SLOT(slotOutputChanged(QString)));
- // -----------------
-
- connect(d->photoUi->m_captions, SIGNAL(activated(QString)),
- wizard, SLOT(slotCaptionChanged(QString)));
-
- connect(d->photoUi->m_FreeCaptionFormat , SIGNAL(editingFinished()),
- wizard, SLOT(slotInfoPageUpdateCaptions()));
-
- connect(d->photoUi->m_sameCaption , SIGNAL(stateChanged(int)),
- wizard, SLOT(slotInfoPageUpdateCaptions()));
-
- connect(d->photoUi->m_font_name , SIGNAL(currentFontChanged(QFont)),
- wizard, SLOT(slotInfoPageUpdateCaptions()));
-
- connect(d->photoUi->m_font_size , SIGNAL(valueChanged(int)),
- wizard, SLOT(slotInfoPageUpdateCaptions()));
-
- connect(d->photoUi->m_font_color , SIGNAL(signalColorSelected(QColor)),
- wizard, SLOT(slotInfoPageUpdateCaptions()));
-
- connect(d->photoUi->m_setDefault , SIGNAL(clicked()),
- wizard, SLOT(slotSaveCaptionSettings()));
-
connect(d->photoUi->BtnPreviewPageUp, SIGNAL(clicked()),
wizard, SLOT(slotBtnPreviewPageUpClicked()));
diff --git a/utilities/assistants/printcreator/wizard/advprintwizard.cpp \
b/utilities/assistants/printcreator/wizard/advprintwizard.cpp index \
6afc53810a..5317f34e29 100644
--- a/utilities/assistants/printcreator/wizard/advprintwizard.cpp
+++ b/utilities/assistants/printcreator/wizard/advprintwizard.cpp
@@ -65,6 +65,7 @@
#include "advprintcustomdlg.h"
#include "advprintintropage.h"
#include "advprintphotopage.h"
+#include "advprintcaptionpage.h"
#include "advprintcroppage.h"
#include "digikam_debug.h"
#include "templateicon.h"
@@ -75,6 +76,7 @@ namespace Digikam
{
const char* const PHOTO_PAGE_NAME = I18N_NOOP("Select page layout");
+const char* const CAPTION_PAGE_NAME = I18N_NOOP("Caption Settings");
const char* const CROP_PAGE_NAME = I18N_NOOP("Crop photos");
const char* const CUSTOM_PAGE_LAYOUT_NAME = I18N_NOOP("Custom");
@@ -87,6 +89,7 @@ public:
{
introPage = 0;
photoPage = 0;
+ captionPage = 0;
cropPage = 0;
infopageCurrentPhoto = 0;
currentPreviewPage = 0;
@@ -100,6 +103,7 @@ public:
AdvPrintIntroPage* introPage;
AdvPrintPhotoPage* photoPage;
+ AdvPrintCaptionPage* captionPage;
AdvPrintCropPage* cropPage;
// Page Size in mm
@@ -125,10 +129,11 @@ AdvPrintWizard::AdvPrintWizard(QWidget* const parent, \
DInfoInterface* const ifac {
setWindowTitle(i18n("Print Creator"));
- d->iface = iface;
- d->introPage = new AdvPrintIntroPage(this, i18n("Welcome to Print Creator"));
- d->photoPage = new AdvPrintPhotoPage(this, i18n(PHOTO_PAGE_NAME));
- d->cropPage = new AdvPrintCropPage(this, i18n(CROP_PAGE_NAME));
+ d->iface = iface;
+ d->introPage = new AdvPrintIntroPage(this, i18n("Welcome to Print Creator"));
+ d->photoPage = new AdvPrintPhotoPage(this, i18n(PHOTO_PAGE_NAME));
+ d->captionPage = new AdvPrintCaptionPage(this, i18n(CAPTION_PAGE_NAME));
+ d->cropPage = new AdvPrintCropPage(this, i18n(CROP_PAGE_NAME));
// -----------------------------------
@@ -1145,32 +1150,32 @@ void AdvPrintWizard::manageBtnPreviewPage()
}
}
-void AdvPrintWizard::infopage_setCaptionButtons()
+void AdvPrintWizard::setCaptionButtons()
{
if (d->photos.size())
{
AdvPrintPhoto* const pPhoto = d->photos.at(d->infopageCurrentPhoto);
- if (pPhoto && !d->photoPage->ui()->m_sameCaption->isChecked())
+ if (pPhoto && !d->captionPage->ui()->m_sameCaption->isChecked())
{
- infopage_blockCaptionButtons();
+ blockCaptionButtons();
if (pPhoto->m_pAdvPrintCaptionInfo)
{
- d->photoPage->ui()->m_font_color->setColor(pPhoto->m_pAdvPrintCaptionInfo->m_caption_color);
- d->photoPage->ui()->m_font_size->setValue(pPhoto->m_pAdvPrintCaptionInfo->m_caption_size);
- d->photoPage->ui()->m_font_name->setCurrentFont(pPhoto->m_pAdvPrintCaptionInfo->m_caption_font);
- d->photoPage->ui()->m_captions->setCurrentIndex(int(pPhoto->m_pAdvPrintCaptionInfo->m_caption_type));
- d->photoPage->ui()->m_FreeCaptionFormat->setText(pPhoto->m_pAdvPrintCaptionInfo->m_caption_text);
- enableCaptionGroup(d->photoPage->ui()->m_captions->currentText());
+ d->captionPage->ui()->m_font_color->setColor(pPhoto->m_pAdvPrintCaptionInfo->m_caption_color);
+ d->captionPage->ui()->m_font_size->setValue(pPhoto->m_pAdvPrintCaptionInfo->m_caption_size);
+ d->captionPage->ui()->m_font_name->setCurrentFont(pPhoto->m_pAdvPrintCaptionInfo->m_caption_font);
+ d->captionPage->ui()->m_captions->setCurrentIndex(int(pPhoto->m_pAdvPrintCaptionInfo->m_caption_type));
+ d->captionPage->ui()->m_FreeCaptionFormat->setText(pPhoto->m_pAdvPrintCaptionInfo->m_caption_text);
+ enableCaptionGroup(d->captionPage->ui()->m_captions->currentText());
}
else
{
- infopage_readCaptionSettings();
- slotCaptionChanged(d->photoPage->ui()->m_captions->currentText());
+ readCaptionSettings();
+ slotCaptionChanged(d->captionPage->ui()->m_captions->currentText());
}
- infopage_blockCaptionButtons(false);
+ blockCaptionButtons(false);
}
}
}
@@ -1296,9 +1301,9 @@ void AdvPrintWizard::slotXMLLoadElement(QXmlStreamReader& \
xmlReader)
if (xmlReader.name() == QLatin1String("pa_caption"))
{
- d->photoPage->ui()->m_sameCaption->blockSignals(true);
- d->photoPage->ui()->m_sameCaption->setCheckState( Qt::Unchecked );
- d->photoPage->ui()->m_sameCaption->blockSignals(false);
+ d->captionPage->ui()->m_sameCaption->blockSignals(true);
+ d->captionPage->ui()->m_sameCaption->setCheckState( Qt::Unchecked );
+ d->captionPage->ui()->m_sameCaption->blockSignals(false);
//useless this item has been added now
if (pPhoto->m_pAdvPrintCaptionInfo)
@@ -1350,7 +1355,7 @@ void AdvPrintWizard::slotXMLLoadElement(QXmlStreamReader& \
xmlReader)
pPhoto->m_pAdvPrintCaptionInfo->m_caption_text = \
attr.toString(); }
- infopage_setCaptionButtons();
+ setCaptionButtons();
}
}
}
@@ -1400,7 +1405,7 @@ void AdvPrintWizard::slotImageSelected(QTreeWidgetItem* item)
qCDebug(DIGIKAM_GENERAL_LOG) << " current row now is " << itemIndex;
d->infopageCurrentPhoto = itemIndex;
- infopage_setCaptionButtons();
+ setCaptionButtons();
}
void AdvPrintWizard::slotDecreaseCopies()
@@ -1638,16 +1643,24 @@ void AdvPrintWizard::slotPageChanged(int curr)
d->photoPage->ui()->ListPhotoSizes->setCurrentRow(0);
}
- // update captions only the first time to avoid missing old changes when
- // back to this page
- if (!before)
- slotInfoPageUpdateCaptions();
-
// reset preview page number
d->currentPreviewPage = 0;
// create our photo sizes list
previewPhotos();
}
+ else if (current->title() == i18n(CAPTION_PAGE_NAME))
+ {
+ // readSettings only the first time
+
+ if (!before)
+ readSettings(current->title());
+
+ // update captions only the first time to avoid missing old changes when
+ // back to this page
+
+ if (!before)
+ slotInfoPageUpdateCaptions();
+ }
else if (current->title() == i18n(CROP_PAGE_NAME))
{
readSettings(current->title());
@@ -1675,12 +1688,12 @@ void AdvPrintWizard::updateCaption(AdvPrintPhoto* pPhoto)
if (pPhoto)
{
if (!pPhoto->m_pAdvPrintCaptionInfo &&
- d->photoPage->ui()->m_captions->currentIndex() != \
AdvPrintCaptionInfo::NoCaptions) + \
d->captionPage->ui()->m_captions->currentIndex() != AdvPrintCaptionInfo::NoCaptions) \
{ pPhoto->m_pAdvPrintCaptionInfo = new AdvPrintCaptionInfo();
}
else if (pPhoto->m_pAdvPrintCaptionInfo &&
- d->photoPage->ui()->m_captions->currentIndex() == \
AdvPrintCaptionInfo::NoCaptions) + \
d->captionPage->ui()->m_captions->currentIndex() == AdvPrintCaptionInfo::NoCaptions) \
{ delete pPhoto->m_pAdvPrintCaptionInfo;
pPhoto->m_pAdvPrintCaptionInfo = NULL;
@@ -1688,11 +1701,11 @@ void AdvPrintWizard::updateCaption(AdvPrintPhoto* pPhoto)
if (pPhoto->m_pAdvPrintCaptionInfo)
{
- pPhoto->m_pAdvPrintCaptionInfo->m_caption_color = \
d->photoPage->ui()->m_font_color->color();
- pPhoto->m_pAdvPrintCaptionInfo->m_caption_size = \
d->photoPage->ui()->m_font_size->value();
- pPhoto->m_pAdvPrintCaptionInfo->m_caption_font = \
d->photoPage->ui()->m_font_name->currentFont();
- pPhoto->m_pAdvPrintCaptionInfo->m_caption_type = \
(AdvPrintCaptionInfo::AvailableCaptions)d->photoPage->ui()->m_captions->currentIndex();
- pPhoto->m_pAdvPrintCaptionInfo->m_caption_text = \
d->photoPage->ui()->m_FreeCaptionFormat->text(); + \
pPhoto->m_pAdvPrintCaptionInfo->m_caption_color = \
d->captionPage->ui()->m_font_color->color(); + \
pPhoto->m_pAdvPrintCaptionInfo->m_caption_size = \
d->captionPage->ui()->m_font_size->value(); + \
pPhoto->m_pAdvPrintCaptionInfo->m_caption_font = \
d->captionPage->ui()->m_font_name->currentFont(); + \
pPhoto->m_pAdvPrintCaptionInfo->m_caption_type = \
(AdvPrintCaptionInfo::AvailableCaptions)d->captionPage->ui()->m_captions->currentIndex();
+ pPhoto->m_pAdvPrintCaptionInfo->m_caption_text = \
d->captionPage->ui()->m_FreeCaptionFormat->text(); }
}
}
@@ -1701,7 +1714,7 @@ void AdvPrintWizard::slotInfoPageUpdateCaptions()
{
if (d->photos.size())
{
- if (d->photoPage->ui()->m_sameCaption->isChecked())
+ if (d->captionPage->ui()->m_sameCaption->isChecked())
{
QList<AdvPrintPhoto*>::iterator it;
@@ -1740,25 +1753,28 @@ void AdvPrintWizard::enableCaptionGroup(const QString& text)
if (text == i18n("No captions"))
{
fontSettingsEnabled = false;
- d->photoPage->ui()->m_FreeCaptionFormat->setEnabled(false);
- d->photoPage->ui()->m_free_label->setEnabled(false);
+ d->captionPage->ui()->m_FreeCaptionFormat->setEnabled(false);
+ d->captionPage->ui()->m_free_label1->setEnabled(false);
+ d->captionPage->ui()->m_free_label2->setEnabled(false);
}
else if (text == i18n("Free"))
{
fontSettingsEnabled = true;
- d->photoPage->ui()->m_FreeCaptionFormat->setEnabled(true);
- d->photoPage->ui()->m_free_label->setEnabled(true);
+ d->captionPage->ui()->m_FreeCaptionFormat->setEnabled(true);
+ d->captionPage->ui()->m_free_label1->setEnabled(true);
+ d->captionPage->ui()->m_free_label2->setEnabled(true);
}
else
{
fontSettingsEnabled = true;
- d->photoPage->ui()->m_FreeCaptionFormat->setEnabled(false);
- d->photoPage->ui()->m_free_label->setEnabled(false);
+ d->captionPage->ui()->m_FreeCaptionFormat->setEnabled(false);
+ d->captionPage->ui()->m_free_label1->setEnabled(false);
+ d->captionPage->ui()->m_free_label2->setEnabled(false);
}
- d->photoPage->ui()->m_font_name->setEnabled(fontSettingsEnabled);
- d->photoPage->ui()->m_font_size->setEnabled(fontSettingsEnabled);
- d->photoPage->ui()->m_font_color->setEnabled(fontSettingsEnabled);
+ d->captionPage->ui()->m_font_name->setEnabled(fontSettingsEnabled);
+ d->captionPage->ui()->m_font_size->setEnabled(fontSettingsEnabled);
+ d->captionPage->ui()->m_font_color->setEnabled(fontSettingsEnabled);
}
void AdvPrintWizard::slotCaptionChanged(const QString& text)
@@ -2089,6 +2105,10 @@ void AdvPrintWizard::saveSettings(const QString& pageName)
group.writeEntry(QLatin1String("IconSize"),
d->photoPage->ui()->ListPhotoSizes->iconSize());
}
+ else if (pageName == i18n(CAPTION_PAGE_NAME))
+ {
+ // Nothing to do
+ }
else if (pageName == i18n(CROP_PAGE_NAME))
{
if (d->photoPage->ui()->m_printer_choice->currentText() == i18n("Print to \
JPG")) @@ -2100,27 +2120,27 @@ void AdvPrintWizard::saveSettings(const QString& \
pageName) }
}
-void AdvPrintWizard::infopage_readCaptionSettings()
+void AdvPrintWizard::readCaptionSettings()
{
KConfig config;
KConfigGroup group = config.group(QLatin1String("PrintCreator"));
// image captions
- d->photoPage->ui()->m_captions->setCurrentIndex(group.readEntry(QLatin1String("Captions"), \
0)); + d->captionPage->ui()->m_captions->setCurrentIndex(group.readEntry(QLatin1String("Captions"), \
0)); // caption color
QColor defColor(Qt::yellow);
QColor color = group.readEntry(QLatin1String("CaptionColor"), defColor);
- d->photoPage->ui()->m_font_color->setColor(color);
+ d->captionPage->ui()->m_font_color->setColor(color);
// caption font
QFont defFont(QLatin1String("Sans Serif"));
QFont font = group.readEntry(QLatin1String("CaptionFont"), defFont);
- d->photoPage->ui()->m_font_name->setCurrentFont(font.family());
+ d->captionPage->ui()->m_font_name->setCurrentFont(font.family());
// caption size
int fontSize = group.readEntry(QLatin1String("CaptionSize"), 4);
- d->photoPage->ui()->m_font_size->setValue(fontSize);
+ d->captionPage->ui()->m_font_size->setValue(fontSize);
// free caption
QString captionTxt = group.readEntry(QLatin1String("FreeCaption"));
- d->photoPage->ui()->m_FreeCaptionFormat->setText(captionTxt);
+ d->captionPage->ui()->m_FreeCaptionFormat->setText(captionTxt);
}
void AdvPrintWizard::readSettings(const QString& pageName)
@@ -2149,14 +2169,17 @@ void AdvPrintWizard::readSettings(const QString& pageName)
// photo size
d->savedPhotoSize = group.readEntry("PhotoSize");
- //caption
initPhotoSizes(d->photoPage->printer()->paperSize(QPrinter::Millimeter));
- infopage_readCaptionSettings();
+ }
+ else if (pageName == i18n(CAPTION_PAGE_NAME))
+ {
+ //caption
+ readCaptionSettings();
bool same_to_all = group.readEntry("SameCaptionToAll", 0) == 1;
- d->photoPage->ui()->m_sameCaption->setChecked(same_to_all);
+ d->captionPage->ui()->m_sameCaption->setChecked(same_to_all);
//enable right caption stuff
- slotCaptionChanged(d->photoPage->ui()->m_captions->currentText());
+ slotCaptionChanged(d->captionPage->ui()->m_captions->currentText());
}
else if (pageName == i18n(CROP_PAGE_NAME))
{
@@ -2569,14 +2592,15 @@ void AdvPrintWizard::slotPagesetupclicked()
previewPhotos();
}
-void AdvPrintWizard::infopage_blockCaptionButtons(bool block)
+void AdvPrintWizard::blockCaptionButtons(bool block)
{
- d->photoPage->ui()->m_captions->blockSignals(block);
- d->photoPage->ui()->m_free_label->blockSignals(block);
- d->photoPage->ui()->m_sameCaption->blockSignals(block);
- d->photoPage->ui()->m_font_name->blockSignals(block);
- d->photoPage->ui()->m_font_size->blockSignals(block);
- d->photoPage->ui()->m_font_color->blockSignals(block);
+ d->captionPage->ui()->m_captions->blockSignals(block);
+ d->captionPage->ui()->m_free_label1->blockSignals(block);
+ d->captionPage->ui()->m_free_label2->blockSignals(block);
+ d->captionPage->ui()->m_sameCaption->blockSignals(block);
+ d->captionPage->ui()->m_font_name->blockSignals(block);
+ d->captionPage->ui()->m_font_size->blockSignals(block);
+ d->captionPage->ui()->m_font_color->blockSignals(block);
}
void AdvPrintWizard::slotSaveCaptionSettings()
@@ -2585,17 +2609,17 @@ void AdvPrintWizard::slotSaveCaptionSettings()
KConfig config;
KConfigGroup group = config.group(QLatin1String("PrintCreator"));
// image captions
- group.writeEntry(QLatin1String("Captions"), \
d->photoPage->ui()->m_captions->currentIndex()); + \
group.writeEntry(QLatin1String("Captions"), \
d->captionPage->ui()->m_captions->currentIndex()); // caption color
- group.writeEntry(QLatin1String("CaptionColor"), \
d->photoPage->ui()->m_font_color->color()); + \
group.writeEntry(QLatin1String("CaptionColor"), \
d->captionPage->ui()->m_font_color->color()); // caption font
- group.writeEntry(QLatin1String("CaptionFont"), \
QFont(d->photoPage->ui()->m_font_name->currentFont())); + \
group.writeEntry(QLatin1String("CaptionFont"), \
QFont(d->captionPage->ui()->m_font_name->currentFont())); // caption size
- group.writeEntry(QLatin1String("CaptionSize"), \
d->photoPage->ui()->m_font_size->value()); + \
group.writeEntry(QLatin1String("CaptionSize"), \
d->captionPage->ui()->m_font_size->value()); // free caption
- group.writeEntry(QLatin1String("FreeCaption"), \
d->photoPage->ui()->m_FreeCaptionFormat->text()); + \
group.writeEntry(QLatin1String("FreeCaption"), \
d->captionPage->ui()->m_FreeCaptionFormat->text()); // same to all
- group.writeEntry(QLatin1String("SameCaptionToAll"), \
(d->photoPage->ui()->m_sameCaption->isChecked() ? 1 : 0)); + \
group.writeEntry(QLatin1String("SameCaptionToAll"), \
(d->captionPage->ui()->m_sameCaption->isChecked() ? 1 : 0)); }
} // namespace Digikam
diff --git a/utilities/assistants/printcreator/wizard/advprintwizard.h \
b/utilities/assistants/printcreator/wizard/advprintwizard.h index \
f2e7a58a2a..bbaac54426 100644
--- a/utilities/assistants/printcreator/wizard/advprintwizard.h
+++ b/utilities/assistants/printcreator/wizard/advprintwizard.h
@@ -109,9 +109,9 @@ private:
void initPhotoSizes(const QSizeF& pageSize);
void previewPhotos();
- void infopage_blockCaptionButtons(bool block=true);
- void infopage_setCaptionButtons();
- void infopage_readCaptionSettings();
+ void blockCaptionButtons(bool block=true);
+ void setCaptionButtons();
+ void readCaptionSettings();
/// To parse template file with 'fn' as filename, and 'pageSize' in mm.
void parseTemplateFile( const QString& fn, const QSizeF& pageSize );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic