summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-07-19 17:37:04 +0200
committerArno <arno@disconnect.de>2018-07-19 17:37:04 +0200
commit3e8bac71c414a5b9f7c80bc9a6b0fb6a760519f6 (patch)
treee5e9690068fa392087f14bf49c6bcc1efdf2975b
parent14b6a59fb5315eab8262c7419a3a324b037b99ba (diff)
downloadSheMov-3e8bac71c414a5b9f7c80bc9a6b0fb6a760519f6.tar.gz
SheMov-3e8bac71c414a5b9f7c80bc9a6b0fb6a760519f6.tar.bz2
SheMov-3e8bac71c414a5b9f7c80bc9a6b0fb6a760519f6.zip
Create file for MappingTreeView
Single it out to a separate file to make editing easier.
-rw-r--r--mappingtreeview.cpp38
-rw-r--r--mappingtreeview.h32
-rw-r--r--mappingtreewidget.cpp25
-rw-r--r--mappingtreewidget.h15
-rw-r--r--newpicsdialog.cpp1
-rw-r--r--shemov.pro6
6 files changed, 76 insertions, 41 deletions
diff --git a/mappingtreeview.cpp b/mappingtreeview.cpp
new file mode 100644
index 0000000..b1aab32
--- /dev/null
+++ b/mappingtreeview.cpp
@@ -0,0 +1,38 @@
+/*
+ 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 <QMenu>
+#include <QContextMenuEvent>
+
+#include "mappingtreeview.h"
+
+
+MappingTreeView::MappingTreeView(QWidget *parent) : SmTreeView(parent) {}
+
+void MappingTreeView::contextMenuEvent(QContextMenuEvent *e){
+ QMenu ctxMenu(this);
+ ctxMenu.addActions(actions());
+ ctxMenu.exec(e->globalPos());
+}
+
+void MappingTreeView::keyPressEvent(QKeyEvent *e){
+ if(e->key() == Qt::Key_Right && (e->modifiers() & Qt::ControlModifier)){
+ clearFocus();
+ emit shiftFocus();
+ return;
+ }
+ if(e->key() == Qt::Key_Return && (e->modifiers() & Qt::ControlModifier)){
+ emit acceptPics();
+ }
+ if(e->key() == Qt::Key_Right){
+ emit addMapping();
+ }
+ if(e->key() == Qt::Key_Delete){
+ emit clearMappings();
+ }
+ SmTreeView::keyPressEvent(e);
+}
diff --git a/mappingtreeview.h b/mappingtreeview.h
new file mode 100644
index 0000000..22abaa6
--- /dev/null
+++ b/mappingtreeview.h
@@ -0,0 +1,32 @@
+/*
+ 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 MAPPINGTREEVIEW_H
+#define MAPPINGTREEVIEW_H
+
+#include <QWidget>
+
+#include <smtreeview.h>
+
+class MappingTreeView : public SmTreeView {
+ Q_OBJECT
+ public:
+ MappingTreeView(QWidget *parent = 0);
+
+ signals:
+ void addMapping();
+ void removeMapping();
+ void clearMappings();
+ void shiftFocus();
+ void acceptPics();
+
+ protected:
+ virtual void contextMenuEvent(QContextMenuEvent *e);
+ virtual void keyPressEvent(QKeyEvent *e);
+};
+
+#endif // MAPPINGTREEVIEW_H
diff --git a/mappingtreewidget.cpp b/mappingtreewidget.cpp
index 8477b0e..cbd24b1 100644
--- a/mappingtreewidget.cpp
+++ b/mappingtreewidget.cpp
@@ -25,6 +25,7 @@
#include "mappingtreewidget.h"
#include "mappingtreemodel.h"
+#include "mappingtreeview.h"
#include "smglobals.h"
MappingTreeWidget::MappingTreeWidget(QWidget *parent) : QWidget(parent){
@@ -326,31 +327,7 @@ const QModelIndex MappingTreeWidget::selected() const{
}
-MappingTreeView::MappingTreeView(QWidget *parent) : SmTreeView(parent) {}
-void MappingTreeView::contextMenuEvent(QContextMenuEvent *e){
- QMenu ctxMenu(this);
- ctxMenu.addActions(actions());
- ctxMenu.exec(e->globalPos());
-}
-
-void MappingTreeView::keyPressEvent(QKeyEvent *e){
- if(e->key() == Qt::Key_Right && (e->modifiers() & Qt::ControlModifier)){
- clearFocus();
- emit shiftFocus();
- return;
- }
- if(e->key() == Qt::Key_Return && (e->modifiers() & Qt::ControlModifier)){
- emit acceptPics();
- }
- if(e->key() == Qt::Key_Right){
- emit addMapping();
- }
- if(e->key() == Qt::Key_Delete){
- emit clearMappings();
- }
- SmTreeView::keyPressEvent(e);
-}
MappingTreeResultView::MappingTreeResultView(QWidget *parent) : SmTreeView(parent) {
setAlternatingRowColors(true);
diff --git a/mappingtreewidget.h b/mappingtreewidget.h
index baf9fb1..d5c431f 100644
--- a/mappingtreewidget.h
+++ b/mappingtreewidget.h
@@ -75,22 +75,7 @@ class MappingTreeWidget : public QWidget {
QAction *mEditChildA;
};
-class MappingTreeView : public SmTreeView {
- Q_OBJECT
- public:
- MappingTreeView(QWidget *parent = 0);
-
- signals:
- void addMapping();
- void removeMapping();
- void clearMappings();
- void shiftFocus();
- void acceptPics();
- protected:
- virtual void contextMenuEvent(QContextMenuEvent *e);
- virtual void keyPressEvent(QKeyEvent *e);
-};
class MappingTreeResultView : public SmTreeView {
Q_OBJECT
diff --git a/newpicsdialog.cpp b/newpicsdialog.cpp
index 2d58a18..f5e5697 100644
--- a/newpicsdialog.cpp
+++ b/newpicsdialog.cpp
@@ -25,6 +25,7 @@
#include "helper.h"
#include "mappingtreewidget.h"
#include "mappingtreemodel.h"
+#include "mappingtreeview.h"
#include "delegates.h"
#include "smglobals.h"
diff --git a/shemov.pro b/shemov.pro
index 075b300..95f4cc2 100644
--- a/shemov.pro
+++ b/shemov.pro
@@ -49,7 +49,8 @@ SOURCES = main.cpp \
moviepropertiesdialog.cpp \
sminputdialog.cpp \
editfiledialog.cpp \
- picturelistview.cpp
+ picturelistview.cpp \
+ mappingtreeview.cpp
HEADERS = \
shemov.h \
helper.h \
@@ -93,7 +94,8 @@ HEADERS = \
moviepropertiesdialog.h \
sminputdialog.h \
editfiledialog.h \
- picturelistview.h
+ picturelistview.h \
+ mappingtreeview.h
LIBS += -lmagic -lXfixes -lX11 -lMagick++-6.Q16HDRI
INCLUDEPATH += /usr/include/ImageMagick-6/
RESOURCES = shemov.qrc