diff options
author | Arno <arno@disconnect.de> | 2016-03-29 08:38:12 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2016-03-29 08:38:12 +0200 |
commit | bc11672a2bc4140f67476b79fc6b427f4a5cc4ec (patch) | |
tree | 61d93dff324e7c31175e7ead5e6376399ad32add | |
parent | 2844e586208fed423cbb81f269add2370231b780 (diff) | |
download | SheMov-bc11672a2bc4140f67476b79fc6b427f4a5cc4ec.tar.gz SheMov-bc11672a2bc4140f67476b79fc6b427f4a5cc4ec.tar.bz2 SheMov-bc11672a2bc4140f67476b79fc6b427f4a5cc4ec.zip |
Design slide dialog
Does nothing yet, just the dialog...
-rw-r--r-- | pictureviewer2.cpp | 102 | ||||
-rw-r--r-- | pictureviewer2.h | 38 | ||||
-rw-r--r-- | shemov.cpp | 13 | ||||
-rw-r--r-- | shemov.h | 3 |
4 files changed, 153 insertions, 3 deletions
diff --git a/pictureviewer2.cpp b/pictureviewer2.cpp index 189cf80..ead82ea 100644 --- a/pictureviewer2.cpp +++ b/pictureviewer2.cpp @@ -32,12 +32,22 @@ #include <QFile> #include <QTemporaryFile> #include <QMessageBox> +#include <QCheckBox> +#include <QRadioButton> +#include <QGroupBox> +#include <QSpinBox> +#include <QPushButton> +#include <QVBoxLayout> +#include <QHBoxLayout> +#include <QLabel> +#include <QGridLayout> #include "pictureviewer2.h" #include "picfilesmodel.h" #include "pictureswidget.h" #include "smglobals.h" #include "mappingtreemodel.h" +#include "mappingtreewidget.h" #include "smtreeitem.h" #include "configurationdialog.h" #include "newpicsdialog.h" @@ -483,6 +493,11 @@ void PictureViewer2::doControl(QGraphicsItem *item){ } } +void PictureViewer2::doSlide(){ + PictureViewerSlideDlg dlg(this); + dlg.exec(); +} + void PictureViewer2::wheelEvent(QWheelEvent *event){ int steps = event->delta() / 8 / 15; if(steps < 0){ @@ -888,6 +903,93 @@ QString PictureViewer2::constructWindowTitle() const { return retval; } +PictureViewerSlideDlg::PictureViewerSlideDlg(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){ + mResultCountTempl = QString(tr("Sliding over %1 pics")); + QGroupBox *slideGb = new QGroupBox(tr("Slide")); + mSlideAll = new QRadioButton(tr("Slide all")); + connect(mSlideAll, SIGNAL(toggled(bool)), this, SLOT(slideAllToggled(bool))); + mRecent = new QRadioButton(tr("Slide recent")); + connect(mRecent, SIGNAL(toggled(bool)), this, SLOT(recentToggled(bool))); + mSelection = new QRadioButton(tr("Slide selection")); + connect(mSelection, SIGNAL(toggled(bool)), this, SLOT(slideSelectionToggled(bool))); + mNoSlide = new QRadioButton(tr("Stop slide")); + connect(mNoSlide, SIGNAL(toggled(bool)), this, SLOT(noSlideToggled(bool))); + QVBoxLayout *slideL = new QVBoxLayout; + slideL->addWidget(mSlideAll); + slideL->addWidget(mRecent); + slideL->addWidget(mSelection); + slideL->addWidget(mNoSlide); + slideGb->setLayout(slideL); + QGroupBox *miscGb = new QGroupBox(tr("Misc.")); + mResultCount = new QLabel(mResultCountTempl.arg("0")); + mRecentDays = new QSpinBox; + mRecentDays->setMinimum(1); + mRecentDays->setPrefix(tr("Slide last ")); + mRecentDays->setSuffix(tr(" days")); + mShuffle = new QCheckBox(tr("Shuffle")); + QVBoxLayout *miscL = new QVBoxLayout; + miscL->addWidget(mResultCount); + miscL->addWidget(mRecentDays); + miscL->addWidget(mShuffle); + miscGb->setLayout(miscL); + mMappingEditWidget = new MappingEditWidget; + QGroupBox *selectionGb = new QGroupBox(tr("Selection")); + QVBoxLayout *selectionL = new QVBoxLayout; + selectionL->addWidget(mMappingEditWidget); + selectionGb->setLayout(selectionL); + mOk = new QPushButton(tr("Ok")); + connect(mOk, SIGNAL(clicked()), this, SLOT(accept())); + mCancel = new QPushButton(tr("Cancel")); + connect(mCancel, SIGNAL(clicked()), this, SLOT(reject())); + mCalcResultCount = new QPushButton(tr("Calc...")); + QHBoxLayout *buttonL = new QHBoxLayout; + buttonL->addWidget(mCalcResultCount); + buttonL->addStretch(); + buttonL->addWidget(mOk); + buttonL->addWidget(mCancel); + + QGridLayout *mainL = new QGridLayout; + mainL->addWidget(slideGb, 0, 0); + mainL->addWidget(miscGb, 0, 1); + mainL->addWidget(selectionGb, 1, 0, 1, 2); + mainL->addLayout(buttonL, 2, 0, 1, 2); + setLayout(mainL); + + mNoSlide->setChecked(true); +} + +void PictureViewerSlideDlg::slideAllToggled(bool checked){ + if(checked){ + mRecentDays->setEnabled(false); + mMappingEditWidget->setEnabled(false); + mSlideResult = SlideAll; + } +} + +void PictureViewerSlideDlg::slideSelectionToggled(bool checked){ + if(checked){ + mRecentDays->setEnabled(false); + mMappingEditWidget->setEnabled(true); + mSlideResult = SlideSelection; + } +} + +void PictureViewerSlideDlg::recentToggled(bool checked){ + if(checked){ + mRecentDays->setEnabled(true); + mMappingEditWidget->setEnabled(false); + mSlideResult = SlideRecent; + } +} + +void PictureViewerSlideDlg::noSlideToggled(bool checked){ + if(checked){ + mRecentDays->setEnabled(false); + mMappingEditWidget->setEnabled(false); + mSlideResult = NoSlide; + } +} + PictureViewer2Item::PictureViewer2Item(const PicData &data, const int numSelected, const QSize &picSize, QGraphicsItem *parent) : QGraphicsItem(parent), mDoc(0){ QStringList textList; //prevent QStaticText from wrapping filesnames with spaces diff --git a/pictureviewer2.h b/pictureviewer2.h index f0c5e71..730296f 100644 --- a/pictureviewer2.h +++ b/pictureviewer2.h @@ -13,6 +13,7 @@ #include <QVariant> #include <QGraphicsItem> #include <QStaticText> +#include <QDialog> class PictureViewerGraphicsScene; class BoundingRectItem; @@ -29,6 +30,12 @@ class SmTreeItem; class MappingTreeModel; class PicFilesModel; class NewPicsDialog; +class QRadioButton; +class QCheckBox; +class QLabel; +class QPushButton; +class QSpinBox; +class MappingEditWidget; typedef QList<QVariant> PicData; typedef QList<QList<QVariant> > PicDataList; @@ -36,7 +43,7 @@ typedef QList<QList<QVariant> > PicDataList; class PictureViewer2 : public QGraphicsView { Q_OBJECT public: - enum AssocActions { HideAction, MarkAction, DeleteAction }; + enum AssocActions { HideAction, MarkAction, DeleteAction, SlideAction }; explicit PictureViewer2(QWidget *parent = 0); void addFiles(const PicDataList &files, bool clear = true); void addFiles(const QString &dir, bool clear = true); @@ -76,6 +83,7 @@ class PictureViewer2 : public QGraphicsView { void markCurrent(); void clearMarks(); void doControl(QGraphicsItem *item); + void doSlide(); protected: virtual void wheelEvent(QWheelEvent *event); @@ -149,6 +157,34 @@ class PictureViewer2 : public QGraphicsView { QString mArchiveDir; }; +class PictureViewerSlideDlg : public QDialog { + Q_OBJECT + public: + enum SlideResult { SlideAll, SlideRecent, SlideSelection, NoSlide }; + explicit PictureViewerSlideDlg(QWidget *parent = 0, Qt::WindowFlags f = 0); + + private slots: + void slideAllToggled(bool checked); + void recentToggled(bool checked); + void slideSelectionToggled(bool checked); + void noSlideToggled(bool checked); + + private: + QRadioButton *mSlideAll; + QRadioButton *mRecent; + QRadioButton *mSelection; + QRadioButton *mNoSlide; + QCheckBox *mShuffle; + QLabel *mResultCount; + QSpinBox *mRecentDays; + QPushButton *mOk; + QPushButton *mCancel; + QPushButton *mCalcResultCount; + QString mResultCountTempl; + MappingEditWidget *mMappingEditWidget; + int mSlideResult; +}; + class PictureViewer2Item : public QGraphicsItem { public: explicit PictureViewer2Item(const PicData &data, const int numSelected, const QSize &picSize = QSize(), QGraphicsItem *parent = 0); @@ -511,8 +511,15 @@ void SheMov::createActions(){ connect(mPWEditPicMappingsA, SIGNAL(triggered()), mPicWidget->picView(), SIGNAL(editPicsMappings())); mPicWidget->picView()->addAction(createSeparator()); - // Show/Hide Picture Viewer + // Show slide dialog PictureViewer2 *picViewer = SmGlobals::instance()->pictureViewer(); + mPVSlideDlgA = new QAction(QIcon(":/hourglass_figure.png"), tr("Show slide dialog..."), this); + mPVSlideDlgA->setData(PictureViewer2::SlideAction); + mPicWidget->picView()->addAction(mPVSlideDlgA); + connect(mPVSlideDlgA, SIGNAL(triggered()), picViewer, SLOT(doSlide())); + mPicWidget->picView()->addAction(createSeparator()); + + // Show/Hide Picture Viewer mPVToggleA = new QAction(QIcon(":/dick_in_cage.png"), tr("Show/Hide Picture Viewer"), this); mPVToggleA->setCheckable(true); mPVToggleA->setData(PictureViewer2::HideAction); @@ -542,6 +549,10 @@ void SheMov::createActions(){ /* Now the context menu for the actual Viewer * picViewer -> PictureViewer2 */ + // Slide Dialog + picViewer->addAction(mPVSlideDlgA); + picViewer->addAction(createSeparator()); + // Show/Hide Picture Viewer picViewer->addAction(mPVToggleA); @@ -138,8 +138,9 @@ class SheMov : public QMainWindow { QAction *mPVCopyToA; QAction *mPVShowNPDialogA; QAction *mPVAddToNPA; + QAction *mPVSlideDlgA; QActionGroup *mPicActionGroup; - //EndActions + //EndActions //ArchiveView actions QAction *mArchiveViewRenameA; |