diff options
author | Arno <am@disconnect.de> | 2012-09-08 11:38:09 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-09-08 11:38:09 +0200 |
commit | c90f920ebc2dd3386d4f84df3ad25480fbaf616b (patch) | |
tree | 8c86019127587816564ce11249343cd7c980f921 /shemov.cpp | |
parent | 2edb6f9b4d70b85b9209d75d1baa7a16e3b8d279 (diff) | |
download | SheMov-c90f920ebc2dd3386d4f84df3ad25480fbaf616b.tar.gz SheMov-c90f920ebc2dd3386d4f84df3ad25480fbaf616b.tar.bz2 SheMov-c90f920ebc2dd3386d4f84df3ad25480fbaf616b.zip |
Implement copy file from PictureViewer2
Add an action to PictureViewer2 for copying the current pic to another
directory.
When I tried to add the QAction to the context menu, I realized that I
chose the variable names picView and picViewer in shemov.cpp very
poorly. Took some time to sift though it. Eventually I shifted some code
around to make it more readable. While at it I replaced the individual
separators with createSeparator(). Other than adding the Copy To action
no functional changes.
Diffstat (limited to 'shemov.cpp')
-rw-r--r-- | shemov.cpp | 142 |
1 files changed, 76 insertions, 66 deletions
@@ -596,72 +596,82 @@ void SheMov::createActions(){ mPlaySelectedArchiveFilesA = new QAction(tr("Play selected...."), this); connect(mPlaySelectedArchiveFilesA, SIGNAL(triggered()), mATree->filesWidget(), SLOT(playSelected())); - //picture widget - // delete + edit - mPWDeletePicFromA = new QAction(QIcon(":/huge_balls_pierced.png"), tr("Delete..."), this); - mPicWidget->picView()->addAction(mPWDeletePicFromA); - connect(mPWDeletePicFromA, SIGNAL(triggered()), mPicWidget->picView(), SLOT(deletePics())); - mPWEditPicMappingsA = new QAction(QIcon(":/squirting_nipple.png"), tr("Edit mappings..."), this); - mPicWidget->picView()->addAction(mPWEditPicMappingsA); - connect(mPWEditPicMappingsA, SIGNAL(triggered()), mPicWidget->picView(), SIGNAL(editPicsMappings())); - QAction *pvSep1 = new QAction(this); - pvSep1->setSeparator(true); - mPicWidget->picView()->addAction(pvSep1); - - // viewer actions - PictureViewer2 *picViewer = SmGlobals::instance()->pictureViewer(); - mPVToggleA = new QAction(QIcon(":/dick_in_cage.png"), tr("Show/Hide Picture Viewer"), this); - mPVToggleA->setCheckable(true); - mPVToggleA->setData(PictureViewer2::HideAction); - connect(mPVToggleA, SIGNAL(toggled(bool)), picViewer, SLOT(setVisible(bool))); - mPVToggleA->setChecked(false); - mPicWidget->picView()->addAction(mPVToggleA); - picViewer->addAction(mPVToggleA); - - //add or replace pictures: pictureviewer - QSignalMapper *PVAddMapper = new QSignalMapper(this); - mPVAddA = new QAction(QIcon(":/used_tampon.png"), tr("Add selected"), this); - connect(mPVAddA, SIGNAL(triggered()), PVAddMapper, SLOT(map())); - PVAddMapper->setMapping(mPVAddA, false); - mPicWidget->picView()->addAction(mPVAddA); - mPVReplaceA = new QAction(QIcon(":/clean_tampon.png"), tr("Replace with selected"), this); - connect(mPVReplaceA, SIGNAL(triggered()), PVAddMapper, SLOT(map())); - PVAddMapper->setMapping(mPVReplaceA, true); - mPicWidget->picView()->addAction(mPVReplaceA); - connect(PVAddMapper, SIGNAL(mapped(int)), mPicWidget->picView(), SLOT(setPVData(int))); - - //select all from current, see tabChanged(int) - mPVSelectAllA = new QAction(QIcon(":/blue_syringe.png"), tr("Select all pics"), this); - picViewer->addAction(mPVSelectAllA); - - //slide - QAction *pvSep2 = new QAction(this); - pvSep2->setSeparator(true); - mPicWidget->picView()->addAction(pvSep2); - mPVSlideA = new QAction(QIcon(":/chastity_belt_with_cuffs.png"), tr("Slide"), this); - mPVSlideA->setCheckable(true); - mPVSlideA->setData(PictureViewer2::SlideAction); - connect(mPVSlideA, SIGNAL(toggled(bool)), picViewer, SLOT(slide(bool))); - connect(mPVSlideA, SIGNAL(toggled(bool)), this, SLOT(setSlide(bool))); - QAction *pv2Sep1 = new QAction(this); - pv2Sep1->setSeparator(true); - picViewer->addAction(pv2Sep1); - picViewer->addAction(mPVSlideA); - - //shuffle - 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()), picViewer, SLOT(shuffle())); - picViewer->addAction(mPVShuffleA); - - // refresh - mPWRefreshA = new QAction(QIcon(":/huge_bra.png"), tr("Refresh"), this); - mPicWidget->picView()->addAction(mPWRefreshA); - connect(mPWRefreshA, SIGNAL(triggered()), mPicWidget->picView(), SLOT(refresh())); - mPicWidget->setPicViewerAction(mPVToggleA); - picViewer->initActions(); + /* very unfortunate naming of variables: + * picViewer: the actual PictureViewer2 window + * picView: the picture files TreeView + * First: the Treeview -> picView */ + + // Delete... + Edit Mappings... + mPWDeletePicFromA = new QAction(QIcon(":/huge_balls_pierced.png"), tr("Delete..."), this); + mPicWidget->picView()->addAction(mPWDeletePicFromA); + connect(mPWDeletePicFromA, SIGNAL(triggered()), mPicWidget->picView(), SLOT(deletePics())); + mPWEditPicMappingsA = new QAction(QIcon(":/squirting_nipple.png"), tr("Edit mappings..."), this); + mPicWidget->picView()->addAction(mPWEditPicMappingsA); + connect(mPWEditPicMappingsA, SIGNAL(triggered()), mPicWidget->picView(), SIGNAL(editPicsMappings())); + mPicWidget->picView()->addAction(createSeparator()); + + // Show/Hide Picture Viewer + PictureViewer2 *picViewer = SmGlobals::instance()->pictureViewer(); + mPVToggleA = new QAction(QIcon(":/dick_in_cage.png"), tr("Show/Hide Picture Viewer"), this); + mPVToggleA->setCheckable(true); + mPVToggleA->setData(PictureViewer2::HideAction); + connect(mPVToggleA, SIGNAL(toggled(bool)), picViewer, SLOT(setVisible(bool))); + mPVToggleA->setChecked(false); + mPicWidget->picView()->addAction(mPVToggleA); + + // Add selected + Replace with selected + QSignalMapper *PVAddMapper = new QSignalMapper(this); + mPVAddA = new QAction(QIcon(":/used_tampon.png"), tr("Add selected"), this); + connect(mPVAddA, SIGNAL(triggered()), PVAddMapper, SLOT(map())); + PVAddMapper->setMapping(mPVAddA, false); + mPicWidget->picView()->addAction(mPVAddA); + mPVReplaceA = new QAction(QIcon(":/clean_tampon.png"), tr("Replace with selected"), this); + connect(mPVReplaceA, SIGNAL(triggered()), PVAddMapper, SLOT(map())); + PVAddMapper->setMapping(mPVReplaceA, true); + mPicWidget->picView()->addAction(mPVReplaceA); + connect(PVAddMapper, SIGNAL(mapped(int)), mPicWidget->picView(), SLOT(setPVData(int))); + + // Refresh + mPicWidget->picView()->addAction(createSeparator()); + mPWRefreshA = new QAction(QIcon(":/huge_bra.png"), tr("Refresh"), this); + mPicWidget->picView()->addAction(mPWRefreshA); + connect(mPWRefreshA, SIGNAL(triggered()), mPicWidget->picView(), SLOT(refresh())); + mPicWidget->setPicViewerAction(mPVToggleA); + + /* Now the context menu for the actual Viewer + * picViewer -> PictureViewer2 */ + + // Show/Hide Picture Viewer + picViewer->addAction(mPVToggleA); + + // Select all pics + mPVSelectAllA = new QAction(QIcon(":/blue_syringe.png"), tr("Select all pics"), this); + picViewer->addAction(mPVSelectAllA); + + // Slide + mPVSlideA = new QAction(QIcon(":/chastity_belt_with_cuffs.png"), tr("Slide"), this); + mPVSlideA->setCheckable(true); + mPVSlideA->setData(PictureViewer2::SlideAction); + connect(mPVSlideA, SIGNAL(toggled(bool)), picViewer, SLOT(slide(bool))); + connect(mPVSlideA, SIGNAL(toggled(bool)), this, SLOT(setSlide(bool))); + picViewer->addAction(createSeparator()); + picViewer->addAction(mPVSlideA); + + // Shuffle + mPVShuffleA = new QAction(QIcon(":/bizarre_amputee.png"), tr("Shuffle"), this); + connect(mPVShuffleA, SIGNAL(triggered()), picViewer, SLOT(shuffle())); + picViewer->addAction(mPVShuffleA); + picViewer->addAction(createSeparator()); + + // Copy to... + mPVCopyToA = new QAction(tr("Copy to..."), this); + connect(mPVCopyToA, SIGNAL(triggered()), picViewer, SLOT(copyCurrent())); + picViewer->addAction(mPVCopyToA); + + // assign actions to PictureViewer2 members, so they can be toggled from within + picViewer->initActions(); + + /* picView(er) END Actions! */ //don't add actions with checkable(true) unless you know what you're doing! mPicActionGroup = new QActionGroup(this); |