diff options
| author | Arno <arno@disconnect.de> | 2018-04-03 09:11:25 +0200 | 
|---|---|---|
| committer | Arno <arno@disconnect.de> | 2018-04-03 09:11:25 +0200 | 
| commit | 0d2eb533f18dbd2330f5bd48b6a154a3c87b84d2 (patch) | |
| tree | 6f471c93aabda83662934f30218cb658f9e30efa /shemov.cpp | |
| parent | bac6fe431150bb5706fe0fb349e753b8fe08c12e (diff) | |
| download | SheMov-0d2eb533f18dbd2330f5bd48b6a154a3c87b84d2.tar.gz SheMov-0d2eb533f18dbd2330f5bd48b6a154a3c87b84d2.tar.bz2 SheMov-0d2eb533f18dbd2330f5bd48b6a154a3c87b84d2.zip | |
Add a menu with global actions to SmGlobals
Use it in the toolbar for FSWidge and hide the menuBar.
Change Helper::icon to accept different foreground colors and wether to
draw the ellipse.
Diffstat (limited to 'shemov.cpp')
| -rw-r--r-- | shemov.cpp | 88 | 
1 files changed, 56 insertions, 32 deletions
| @@ -50,6 +50,56 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla      qApp->processEvents();  	(void) SmGlobals::instance(); +    mAnalyzeActorsA = new QAction(tr("Actors..."), this); +    connect(mAnalyzeActorsA, &QAction::triggered, this, &SheMov::analyzeActors); +    mAnalyzeGenresA = new QAction(tr("Genres..."), this); +    connect(mAnalyzeGenresA, &QAction::triggered, this, &SheMov::analyzeGenres); +    mAnalyzeSeriesA = new QAction(tr("Series..."), this); +    connect(mAnalyzeSeriesA, &QAction::triggered, this, &SheMov::analyzeSeries); +    mAnalyzePartsA = new QAction(tr("Series Parts..."), this); +    connect(mAnalyzePartsA, &QAction::triggered, this, &SheMov::analyzeParts); +    mConsistencyA = new QAction(tr("Check consisteny..."), this); +    connect(mConsistencyA, &QAction::triggered, this, &SheMov::checkConsistency); +    /*mSearchDialogA = new QAction(tr("Search..."), this); +    mSearchDialogA->setShortcut(tr("CTRL+f")); +    connect(mSearchDialogA, &QAction::triggered, mSearchDialog, &SearchDialog::show);*/ +    mQuitA = new QAction(tr("Quit"), this); +    mQuitA->setShortcut(tr("CTRL+q")); +    connect(mQuitA, &QAction::triggered, qApp, &QApplication::closeAllWindows); +    mConfigA = new QAction(QIcon(":/chastity_belt.png"), tr("Configure..."), this); +    connect(mConfigA, &QAction::triggered, this, &SheMov::configure); +    QString aboutLabel = QString(tr("About %1...")).arg(qApp->applicationName()); +    mAboutShemovA = new QAction(aboutLabel, this); +    connect(mAboutShemovA, &QAction::triggered, this, &SheMov::aboutShemov); +    mAboutQtA = new QAction(tr("About Qt..."), this); +    connect(mAboutQtA, &QAction::triggered, qApp, &QApplication::aboutQt); +    mStatisticsA = new QAction(tr("Some statistics..."), this); +    connect(mStatisticsA, &QAction::triggered, this, &SheMov::showStatistics); + +    //global menu +    QAction *globalMenuA = new QAction(Helper::icon(QColor(0, 0, 0, 0), Qt::black, QChar(0x26A4), true, false), tr("Global"), this); +    QMenu *globalMenu = new QMenu; +    globalMenu->addAction(mConsistencyA); +    globalMenu->addSeparator(); +    QMenu *analyzeMenu = new QMenu; +    analyzeMenu->addAction(mAnalyzeActorsA); +    analyzeMenu->addAction(mAnalyzeGenresA); +    analyzeMenu->addAction(mAnalyzePartsA); +    analyzeMenu->addAction(mAnalyzeSeriesA); +    QAction *analyzeMenuA = new QAction(tr("Analyze"), this); +    analyzeMenuA->setMenu(analyzeMenu); +    globalMenu->addAction(analyzeMenuA); +    globalMenu->addSeparator(); +    globalMenu->addAction(mConfigA); +    globalMenu->addAction(mStatisticsA); +    globalMenu->addSeparator(); +    globalMenu->addAction(mAboutQtA); +    globalMenu->addAction(mAboutShemovA); +    globalMenu->addSeparator(); +    globalMenu->addAction(mQuitA); +    globalMenuA->setMenu(globalMenu); +    SmGlobals::instance()->setGlobalAction(globalMenuA); +  	//FileSystemWidget + TabWidget      splash.showMessage(tr("Constructing Filemanager..."), Qt::AlignHCenter, Qt::yellow);      qApp->processEvents(); @@ -170,6 +220,11 @@ void SheMov::configure(){  }  void SheMov::tabChanged(int newTab){ +    if(newTab == FileManager){ +        menuBar()->setVisible(false); +    }else{ +        menuBar()->setVisible(true); +    }      mEditPicMenuA->setVisible(newTab == Pictures);      mViewPicMenuA->setVisible(newTab == Pictures);      mArchiveViewMenuA->setVisible(newTab == Movies); @@ -322,27 +377,6 @@ void SheMov::createStatusbar(){  }  void SheMov::createActions(){ -	mConsistencyA = new QAction(tr("Check consisteny..."), this); -    connect(mConsistencyA, &QAction::triggered, this, &SheMov::checkConsistency); -    mSearchDialogA = new QAction(tr("Search..."), this); -    mSearchDialogA->setShortcut(tr("CTRL+f")); -    connect(mSearchDialogA, &QAction::triggered, mSearchDialog, &SearchDialog::show); - -    //connnect -	mQuitA = new QAction(tr("Quit"), this); -	mQuitA->setShortcut(tr("CTRL+q")); -    connect(mQuitA, &QAction::triggered, qApp, &QApplication::closeAllWindows); -	mConfigA = new QAction(QIcon(":/chastity_belt.png"), tr("Configure..."), this); -    connect(mConfigA, &QAction::triggered, this, &SheMov::configure); - -	//Help menu -	QString aboutLabel = QString(tr("About %1...")).arg(qApp->applicationName()); -	mAboutShemovA = new QAction(aboutLabel, this); -    connect(mAboutShemovA, &QAction::triggered, this, &SheMov::aboutShemov); -	mAboutQtA = new QAction(tr("About Qt..."), this); -    connect(mAboutQtA, &QAction::triggered, qApp, &QApplication::aboutQt); -	mStatisticsA = new QAction(tr("Some statistics..."), this); -    connect(mStatisticsA, &QAction::triggered, this, &SheMov::showStatistics);      //headers      mPicsTreeHeaderGroup = new QActionGroup(this); @@ -550,17 +584,7 @@ void SheMov::createActions(){      // db analyzer dialogs      // analyze actors -    mAnalyzeActorsA = new QAction(tr("Actors..."), this); -    connect(mAnalyzeActorsA, &QAction::triggered, this, &SheMov::analyzeActors); -    // analyze genres -    mAnalyzeGenresA = new QAction(tr("Genres..."), this); -    connect(mAnalyzeGenresA, &QAction::triggered, this, &SheMov::analyzeGenres); -    // analyze series -    mAnalyzeSeriesA = new QAction(tr("Series..."), this); -    connect(mAnalyzeSeriesA, &QAction::triggered, this, &SheMov::analyzeSeries); -    // anaylze series parts -    mAnalyzePartsA = new QAction(tr("Series Parts..."), this); -    connect(mAnalyzePartsA, &QAction::triggered, this, &SheMov::analyzeParts); +      //don't add actions with checkable(true) unless you know what you're doing!      mPicActionGroup = new QActionGroup(this); | 
