diff options
author | Arno <am@disconnect.de> | 2012-03-17 12:36:16 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-03-17 12:36:16 +0100 |
commit | 0cdf34c82044a27f1abfe8bd8dce213efa173da8 (patch) | |
tree | e39a52910339c075c23d251585b44d2a6dc24ac4 | |
parent | c2cd7f21e9a2e5d0219bb674e3b40378c35b3038 (diff) | |
download | SheMov-0cdf34c82044a27f1abfe8bd8dce213efa173da8.tar.gz SheMov-0cdf34c82044a27f1abfe8bd8dce213efa173da8.tar.bz2 SheMov-0cdf34c82044a27f1abfe8bd8dce213efa173da8.zip |
Randomize selection for pictureviewer
std::random_shuffle available files in PictureViewer2. Add action to
View menu and reuse an icon.
-rw-r--r-- | pictureviewer2.cpp | 4 | ||||
-rw-r--r-- | pictureviewer2.h | 1 | ||||
-rw-r--r-- | shemov.cpp | 7 | ||||
-rw-r--r-- | shemov.h | 1 |
4 files changed, 13 insertions, 0 deletions
diff --git a/pictureviewer2.cpp b/pictureviewer2.cpp index 88522e0..7a75be1 100644 --- a/pictureviewer2.cpp +++ b/pictureviewer2.cpp @@ -114,6 +114,10 @@ void PictureViewer2::readSettings(){ mBgColor = t.value<QColor>(); } +void PictureViewer2::shuffle(){ + std::random_shuffle(mFiles.begin(), mFiles.end()); +} + void PictureViewer2::wheelEvent(QWheelEvent *event){ int steps = event->delta() / 8 / 15; if(steps < 0){ diff --git a/pictureviewer2.h b/pictureviewer2.h index 77328e8..3aba527 100644 --- a/pictureviewer2.h +++ b/pictureviewer2.h @@ -37,6 +37,7 @@ class PictureViewer2 : public QGraphicsView { void previous(); void slide(); void readSettings(); + void shuffle(); protected: virtual void wheelEvent(QWheelEvent *event); @@ -645,10 +645,16 @@ void SheMov::createActions(){ mPVSlideA->setCheckable(true); connect(mPVSlideA, SIGNAL(triggered()), mPicWidget->picView()->PV(), SLOT(slide())); mPicWidget->picView()->addAction(mPVSlideA); + QAction *pv2Sep1 = new QAction(this); + pv2Sep1->setSeparator(true); + mPicWidget->picView()->PV()->addAction(pv2Sep1); mPicWidget->picView()->PV()->addAction(mPVSlideA); QAction *pvSep3 = new QAction(this); pvSep3->setSeparator(true); mPicWidget->picView()->addAction(pvSep3); + mPVShuffleA = new QAction(QIcon(":/bizarre_amputee.png"), tr("Shuffle"), this); + connect(mPVShuffleA, SIGNAL(triggered()), mPicWidget->picView()->PV(), SLOT(shuffle())); + mPicWidget->picView()->PV()->addAction(mPVShuffleA); // refresh mPWRefreshA = new QAction(QIcon(":/huge_bra.png"), tr("Refresh"), this); @@ -783,6 +789,7 @@ void SheMov::createMenus(){ mPicViewMenu->addAction(mPVAddA); mPicViewMenu->addAction(mPVReplaceA); mPicViewMenu->addSeparator(); + mPicViewMenu->addAction(mPVShuffleA); mPicViewMenu->addAction(mPWRefreshA); mViewPicMenuA = menuBar()->addMenu(mPicViewMenu); @@ -177,6 +177,7 @@ class SheMov : public QMainWindow { QAction *mPVReplaceA; QAction *mPVSelectAllA; QAction *mPVSlideA; + QAction *mPVShuffleA; QActionGroup *mPicActionGroup; //EndActions |