Commit 81f80ac3 authored by Tobias Koenig's avatar Tobias Koenig Committed by Albert Astals Cid
Browse files

Implement drawing quick selection tool for presentation mode

REVIEW: 124687
parent 8b603c17
......@@ -81,6 +81,7 @@ add_subdirectory( ui )
add_subdirectory( shell )
add_subdirectory( generators )
add_subdirectory( autotests )
add_subdirectory( conf/autotests )
add_subdirectory(doc)
......@@ -227,9 +228,7 @@ install(FILES core/okularGenerator.desktop DESTINATION ${KDE_INSTALL_KSERVICETYP
# okularpart
set(okularpart_SRCS
part.cpp
extensions.cpp
set(okularpart_conf_SRCS
conf/preferencesdialog.cpp
conf/dlgaccessibility.cpp
conf/dlgdebug.cpp
......@@ -238,7 +237,17 @@ set(okularpart_SRCS
conf/dlgannotations.cpp
conf/dlgperformance.cpp
conf/dlgpresentation.cpp
conf/editannottooldialog.cpp
conf/editdrawingtooldialog.cpp
conf/widgetannottools.cpp
conf/widgetconfigurationtoolsbase.cpp
conf/widgetdrawingtools.cpp
)
set(okularpart_SRCS
${okularpart_conf_SRCS}
part.cpp
extensions.cpp
ui/embeddedfilesdialog.cpp
ui/annotwindow.cpp
ui/annotationmodel.cpp
......@@ -249,6 +258,7 @@ set(okularpart_SRCS
ui/annotationwidgets.cpp
ui/bookmarklist.cpp
ui/debug_ui.cpp
ui/drawingtoolselectaction.cpp
ui/fileprinterpreview.cpp
ui/findbar.cpp
ui/formwidgets.cpp
......@@ -294,8 +304,6 @@ ki18n_wrap_ui(okularpart_SRCS
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
#qt5_add_dbus_interfaces(okularpart_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.kde.KSpeech.xml)
add_library(okularpart MODULE ${okularpart_SRCS})
generate_export_header(okularpart BASE_NAME okularpart)
......
macro(add_conf_unittest _source)
set(_test ${_source} ../editdrawingtooldialog.cpp)
get_filename_component(_name ${_source} NAME_WE)
add_executable( ${_name} ${_test} )
add_test( ${_name} ${_name} )
ecm_mark_as_test(okular-conf-${_name})
target_link_libraries( ${_name}
Qt5::Test
Qt5::Widgets
Qt5::Xml
KF5::I18n
KF5::Completion
KF5::WidgetsAddons
)
endmacro ()
add_conf_unittest(editdrawingtooldialogtest.cpp)
/***************************************************************************
* Copyright (C) 2015 by Laurent Montel <montel@kde.org> *
* *
* 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 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "editdrawingtooldialogtest.h"
#include "../editdrawingtooldialog.h"
#include <KColorButton>
#include <KLineEdit>
#include <QDialogButtonBox>
#include <QSpinBox>
#include <QTest>
EditDrawingToolDialogTest::EditDrawingToolDialogTest(QObject *parent)
: QObject(parent)
{
}
EditDrawingToolDialogTest::~EditDrawingToolDialogTest()
{
}
void EditDrawingToolDialogTest::shouldHaveDefaultValues()
{
EditDrawingToolDialog dlg;
const QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
QVERIFY(buttonBox);
const KLineEdit *name = dlg.findChild<KLineEdit *>(QStringLiteral("name"));
QVERIFY(name);
const KColorButton *colorButton = dlg.findChild<KColorButton *>(QStringLiteral("colorbutton"));
QVERIFY(colorButton);
const QSpinBox *opacity = dlg.findChild<QSpinBox *>(QStringLiteral("opacity"));
QVERIFY(opacity);
QVERIFY(name->text().isEmpty());
}
QTEST_MAIN(EditDrawingToolDialogTest)
/***************************************************************************
* Copyright (C) 2015 by Laurent Montel <montel@kde.org> *
* *
* 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 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef EDITDRAWINGTOOLDIALOGTEST_H
#define EDITDRAWINGTOOLDIALOGTEST_H
#include <QObject>
class EditDrawingToolDialogTest : public QObject
{
Q_OBJECT
public:
explicit EditDrawingToolDialogTest(QObject *parent = Q_NULLPTR);
~EditDrawingToolDialogTest();
private Q_SLOTS:
void shouldHaveDefaultValues();
};
#endif // EDITDRAWINGTOOLDIALOGTEST_H
......@@ -10,10 +10,11 @@
#include "dlgpresentation.h"
#include "ui_dlgpresentationbase.h"
#include "widgetdrawingtools.h"
#include <qapplication.h>
#include <qdesktopwidget.h>
#include <KConfigDialogManager>
#include <KLocalizedString>
#include "settings.h"
......@@ -24,6 +25,12 @@ DlgPresentation::DlgPresentation( QWidget * parent )
m_dlg = new Ui_DlgPresentationBase();
m_dlg->setupUi( this );
WidgetDrawingTools * kcfg_DrawingTools = new WidgetDrawingTools( m_dlg->annotationToolsGroupBox );
m_dlg->verticalLayout_4->addWidget( kcfg_DrawingTools );
kcfg_DrawingTools->setObjectName( "kcfg_DrawingTools" );
KConfigDialogManager::changedMap()->insert( "WidgetDrawingTools", SIGNAL(changed()) );
QStringList choices;
choices.append( i18nc( "@label:listbox The current screen, for the presentation mode", "Current Screen" ) );
choices.append( i18nc( "@label:listbox The default screen for the presentation mode", "Default Screen" ) );
......
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgPresentationBase</class>
<widget class="QWidget" name="DlgPresentationBase" >
<property name="geometry" >
<widget class="QWidget" name="DlgPresentationBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>446</height>
<height>525</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<property name="margin" >
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Navigation</string>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin" >
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin" >
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="kcfg_SlidesAdvance" >
<property name="text" >
<widget class="QCheckBox" name="kcfg_SlidesAdvance">
<property name="text">
<string>Advance every:</string>
</property>
</widget>
</item>
<item>
<widget class="KPluralHandlingSpinBox" name="kcfg_SlidesAdvanceTime" >
<property name="enabled" >
<widget class="KPluralHandlingSpinBox" name="kcfg_SlidesAdvanceTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="value" >
<property name="value">
<number>5</number>
</property>
</widget>
......@@ -53,8 +81,8 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="kcfg_SlidesLoop" >
<property name="text" >
<widget class="QCheckBox" name="kcfg_SlidesLoop">
<property name="text">
<string>Loop after last page</string>
</property>
</widget>
......@@ -63,63 +91,50 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Appearance</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_3" >
<item row="0" column="0" >
<widget class="QLabel" name="textLabel3" >
<property name="text" >
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="textLabel3">
<property name="text">
<string>Background color:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="KColorButton" name="kcfg_SlidesBackgroundColor" />
<item row="0" column="1">
<widget class="KColorButton" name="kcfg_SlidesBackgroundColor"/>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Pencil color:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KColorButton" name="kcfg_SlidesPencilColor" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="textLabel2">
<property name="text">
<string>Mouse cursor:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QComboBox" name="kcfg_SlidesCursor" >
<item row="1" column="1">
<widget class="QComboBox" name="kcfg_SlidesCursor">
<item>
<property name="text" >
<property name="text">
<string>Hidden After Delay</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Always Visible</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Always Hidden</string>
</property>
</item>
......@@ -128,15 +143,15 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="kcfg_SlidesShowProgress" >
<property name="text" >
<widget class="QCheckBox" name="kcfg_SlidesShowProgress">
<property name="text">
<string>Show &amp;progress indicator</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_SlidesShowSummary" >
<property name="text" >
<widget class="QCheckBox" name="kcfg_SlidesShowSummary">
<property name="text">
<string>Show s&amp;ummary page</string>
</property>
</widget>
......@@ -145,121 +160,121 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="kcfg_SlidesTransitionsEnabled" >
<property name="title" >
<widget class="QGroupBox" name="kcfg_SlidesTransitionsEnabled">
<property name="title">
<string>Enable transitions</string>
</property>
<property name="checkable" >
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="textLabel1" >
<property name="text" >
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Default transition:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="kcfg_SlidesTransition" >
<item row="0" column="1">
<widget class="QComboBox" name="kcfg_SlidesTransition">
<item>
<property name="text" >
<property name="text">
<string>Blinds Vertical</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Blinds Horizontal</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Box In</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Box Out</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Dissolve</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Fade</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Glitter Down</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Glitter Right</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Glitter Right-Down</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Random Transition</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Replace</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Split Horizontal In</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Split Horizontal Out</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Split Vertical In</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Split Vertical Out</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Wipe Down</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Wipe Right</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Wipe Left</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Wipe Up</string>
</property>
</item>
......@@ -269,46 +284,38 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Placement</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Screen:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="screenCombo" />
<item row="0" column="1">
<widget class="QComboBox" name="screenCombo"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
<widget class="QGroupBox" name="annotationToolsGroupBox">
<property name="title">
<string>Drawing Tool Configuration</string>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>4</height>
</size>
</property>
</spacer>
<layout class="QVBoxLayout" name="verticalLayout_4"/>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidgets>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
......@@ -328,11 +335,11 @@
<receiver>kcfg_SlidesAdvanceTime</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>88</x>
<y>43</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>280</x>
<y>49</y>
</hint>
......
#include "editannottooldialog.h"
#include <kcolorbutton.h>
#include <kcombobox.h>
#include <klocalizedstring.h>
#include <klineedit.h>
#include <QApplication>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGroupBox>
#include <QLabel>
#include <QListWidget>