improved handling of the dark theme. Needed since Ubuntu is not coherently dealing with it.
This commit is contained in:
@@ -86,11 +86,7 @@ using namespace std;
|
|||||||
PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
|
PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
|
||||||
: QMainWindow( parent, f )
|
: QMainWindow( parent, f )
|
||||||
{
|
{
|
||||||
QString str = QIcon::themeName();
|
getTheme();
|
||||||
if (str.contains("dark", Qt::CaseInsensitive))
|
|
||||||
fDarkTheme = true;
|
|
||||||
else
|
|
||||||
fDarkTheme = false;
|
|
||||||
|
|
||||||
// reads and manages the conents of the xml-startup (musredit_startup.xml) file
|
// reads and manages the conents of the xml-startup (musredit_startup.xml) file
|
||||||
fAdmin = new PAdmin();
|
fAdmin = new PAdmin();
|
||||||
@@ -194,8 +190,13 @@ void PTextEdit::setupFileActions()
|
|||||||
a->setShortcut( tr("Ctrl+N") );
|
a->setShortcut( tr("Ctrl+N") );
|
||||||
a->setStatusTip( tr("Create a new msr-file") );
|
a->setStatusTip( tr("Create a new msr-file") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/document-new-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&New..." ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/document-open-dark.svg");
|
iconName = QString(":/icons/document-open-dark.svg");
|
||||||
@@ -205,8 +206,13 @@ void PTextEdit::setupFileActions()
|
|||||||
a->setShortcut( tr("Ctrl+O") );
|
a->setShortcut( tr("Ctrl+O") );
|
||||||
a->setStatusTip( tr("Opens a msr-file") );
|
a->setStatusTip( tr("Opens a msr-file") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/document-open-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Open..." ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( fileOpen() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
fRecentFilesMenu = menu->addMenu( tr("Recent Files") );
|
fRecentFilesMenu = menu->addMenu( tr("Recent Files") );
|
||||||
for (int i=0; i<MAX_RECENT_FILES; i++) {
|
for (int i=0; i<MAX_RECENT_FILES; i++) {
|
||||||
@@ -225,8 +231,13 @@ void PTextEdit::setupFileActions()
|
|||||||
a->setShortcut( tr("F5") );
|
a->setShortcut( tr("F5") );
|
||||||
a->setStatusTip( tr("Reload msr-file") );
|
a->setStatusTip( tr("Reload msr-file") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileReload() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( fileReload() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/view-refresh-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "Reload..." ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( fileReload() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
a = new QAction( tr( "Open Prefs..." ), this);
|
a = new QAction( tr( "Open Prefs..." ), this);
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileOpenPrefs() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( fileOpenPrefs() ) );
|
||||||
@@ -242,8 +253,13 @@ void PTextEdit::setupFileActions()
|
|||||||
a->setShortcut( tr("Ctrl+S") );
|
a->setShortcut( tr("Ctrl+S") );
|
||||||
a->setStatusTip( tr("Save msr-file") );
|
a->setStatusTip( tr("Save msr-file") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/document-save-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Save..." ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( fileSave() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
a = new QAction( tr( "Save &As..." ), this );
|
a = new QAction( tr( "Save &As..." ), this );
|
||||||
a->setStatusTip( tr("Save msr-file As") );
|
a->setStatusTip( tr("Save msr-file As") );
|
||||||
@@ -264,8 +280,13 @@ void PTextEdit::setupFileActions()
|
|||||||
a->setShortcut( tr("Ctrl+P") );
|
a->setShortcut( tr("Ctrl+P") );
|
||||||
a->setStatusTip( tr("Print msr-file") );
|
a->setStatusTip( tr("Print msr-file") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/document-print-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Print..." ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( filePrint() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
@@ -318,8 +339,13 @@ void PTextEdit::setupEditActions()
|
|||||||
a->setShortcut( tr("Ctrl+Z") );
|
a->setShortcut( tr("Ctrl+Z") );
|
||||||
a->setStatusTip( tr("Edit Undo") );
|
a->setStatusTip( tr("Edit Undo") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/edit-undo-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Undo" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( editUndo() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/edit-redo-dark.svg");
|
iconName = QString(":/icons/edit-redo-dark.svg");
|
||||||
@@ -329,8 +355,14 @@ void PTextEdit::setupEditActions()
|
|||||||
a->setShortcut( tr("Ctrl+Y") );
|
a->setShortcut( tr("Ctrl+Y") );
|
||||||
a->setStatusTip( tr("Edit Redo") );
|
a->setStatusTip( tr("Edit Redo") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/edit-redo-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Redo" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( editRedo() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
a = new QAction( tr( "Select &All" ), this );
|
a = new QAction( tr( "Select &All" ), this );
|
||||||
@@ -350,8 +382,13 @@ void PTextEdit::setupEditActions()
|
|||||||
a->setShortcut( tr("Ctrl+C") );
|
a->setShortcut( tr("Ctrl+C") );
|
||||||
a->setStatusTip( tr("Edit Copy") );
|
a->setStatusTip( tr("Edit Copy") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/edit-copy-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Copy" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( editCopy() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/edit-cut-dark.svg");
|
iconName = QString(":/icons/edit-cut-dark.svg");
|
||||||
@@ -361,8 +398,13 @@ void PTextEdit::setupEditActions()
|
|||||||
a->setShortcut( tr("Ctrl+X") );
|
a->setShortcut( tr("Ctrl+X") );
|
||||||
a->setStatusTip( tr("Edit Cut") );
|
a->setStatusTip( tr("Edit Cut") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/edit-cut-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "Cu&t" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( editCut() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/edit-paste-dark.svg");
|
iconName = QString(":/icons/edit-paste-dark.svg");
|
||||||
@@ -372,8 +414,13 @@ void PTextEdit::setupEditActions()
|
|||||||
a->setShortcut( tr("Ctrl+V") );
|
a->setShortcut( tr("Ctrl+V") );
|
||||||
a->setStatusTip( tr("Edit Paste") );
|
a->setStatusTip( tr("Edit Paste") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/edit-paste-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Paste" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( editPaste() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
tb->addSeparator();
|
tb->addSeparator();
|
||||||
@@ -386,8 +433,13 @@ void PTextEdit::setupEditActions()
|
|||||||
a->setShortcut( tr("Ctrl+F") );
|
a->setShortcut( tr("Ctrl+F") );
|
||||||
a->setStatusTip( tr("Edit Find") );
|
a->setStatusTip( tr("Edit Find") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( editFind() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( editFind() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/edit-find-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Find" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( editFind() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/go-next-use-dark.svg");
|
iconName = QString(":/icons/go-next-use-dark.svg");
|
||||||
@@ -397,8 +449,13 @@ void PTextEdit::setupEditActions()
|
|||||||
a->setShortcut( tr("F3") );
|
a->setShortcut( tr("F3") );
|
||||||
a->setStatusTip( tr("Edit Find Next") );
|
a->setStatusTip( tr("Edit Find Next") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( editFindNext() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( editFindNext() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/go-next-use-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "Find &Next" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( editFindNext() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/go-previous-use-dark.svg");
|
iconName = QString(":/icons/go-previous-use-dark.svg");
|
||||||
@@ -408,8 +465,13 @@ void PTextEdit::setupEditActions()
|
|||||||
a->setShortcut( tr("Shift+F4") );
|
a->setShortcut( tr("Shift+F4") );
|
||||||
a->setStatusTip( tr("Edit Find Previous") );
|
a->setStatusTip( tr("Edit Find Previous") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( editFindPrevious() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( editFindPrevious() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/go-previous-use-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "Find Pre&vious" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( editFindPrevious() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
a = new QAction( tr( "Replace..." ), this );
|
a = new QAction( tr( "Replace..." ), this );
|
||||||
a->setShortcut( tr("Ctrl+R") );
|
a->setShortcut( tr("Ctrl+R") );
|
||||||
@@ -565,8 +627,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a->setShortcut( tr("Alt+W") );
|
a->setShortcut( tr("Alt+W") );
|
||||||
a->setStatusTip( tr("Call musrWiz which helps to create msr-files") );
|
a->setStatusTip( tr("Call musrWiz which helps to create msr-files") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrWiz() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrWiz() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrWiz-32x32.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "musr&Wiz" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrWiz() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
tb->addSeparator();
|
tb->addSeparator();
|
||||||
@@ -579,8 +646,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a->setShortcut( tr("Alt+C") );
|
a->setShortcut( tr("Alt+C") );
|
||||||
a->setStatusTip( tr("Calculate Chi Square (Log Max Likelihood)") );
|
a->setStatusTip( tr("Calculate Chi Square (Log Max Likelihood)") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrCalcChisq() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrCalcChisq() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrchisq-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "Calculate &Chisq" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrCalcChisq() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/musrfit-dark.svg");
|
iconName = QString(":/icons/musrfit-dark.svg");
|
||||||
@@ -590,8 +662,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a->setShortcut( tr("Alt+F") );
|
a->setShortcut( tr("Alt+F") );
|
||||||
a->setStatusTip( tr("Fit") );
|
a->setStatusTip( tr("Fit") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrFit() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrFit() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrfit-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Fit" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrFit() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/musrswap-dark.svg");
|
iconName = QString(":/icons/musrswap-dark.svg");
|
||||||
@@ -601,8 +678,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a->setShortcut( tr("Alt+S") );
|
a->setShortcut( tr("Alt+S") );
|
||||||
a->setStatusTip( tr("Swap msr-file <-> mlog-file") );
|
a->setStatusTip( tr("Swap msr-file <-> mlog-file") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrSwapMsrMlog() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrSwapMsrMlog() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrswap-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Swap Msr <-> Mlog" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrSwapMsrMlog() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/musrStep-32x32-dark.svg");
|
iconName = QString(":/icons/musrStep-32x32-dark.svg");
|
||||||
@@ -612,8 +694,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a->setShortcut( tr("Alt+P") );
|
a->setShortcut( tr("Alt+P") );
|
||||||
a->setStatusTip( tr("Set Steps") );
|
a->setStatusTip( tr("Set Steps") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrSetSteps() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrSetSteps() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrStep-32x32.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "Set Ste&ps" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrSetSteps() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/msr2data-dark.svg");
|
iconName = QString(":/icons/msr2data-dark.svg");
|
||||||
@@ -623,8 +710,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a->setShortcut( tr("Alt+M") );
|
a->setShortcut( tr("Alt+M") );
|
||||||
a->setStatusTip( tr("Start msr2data interface") );
|
a->setStatusTip( tr("Start msr2data interface") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrMsr2Data() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrMsr2Data() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/msr2data-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Msr2Data" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrMsr2Data() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
tb->addSeparator();
|
tb->addSeparator();
|
||||||
@@ -637,8 +729,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a->setShortcut( tr("Alt+V") );
|
a->setShortcut( tr("Alt+V") );
|
||||||
a->setStatusTip( tr("Start musrview") );
|
a->setStatusTip( tr("Start musrview") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrView() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrView() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrview-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&View" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrView() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/musrt0-dark.svg");
|
iconName = QString(":/icons/musrt0-dark.svg");
|
||||||
@@ -647,8 +744,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
fMusrT0Action = new QAction( QIcon( QPixmap(iconName) ), tr( "&T0" ), this );
|
fMusrT0Action = new QAction( QIcon( QPixmap(iconName) ), tr( "&T0" ), this );
|
||||||
fMusrT0Action->setStatusTip( tr("Start musrt0") );
|
fMusrT0Action->setStatusTip( tr("Start musrt0") );
|
||||||
connect( fMusrT0Action, SIGNAL( triggered() ), this, SLOT( musrT0() ) );
|
connect( fMusrT0Action, SIGNAL( triggered() ), this, SLOT( musrT0() ) );
|
||||||
tb->addAction(fMusrT0Action);
|
|
||||||
menu->addAction(fMusrT0Action);
|
menu->addAction(fMusrT0Action);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrt0-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&T0" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrT0() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
fMusrT0Action->setEnabled(fAdmin->getEnableMusrT0Flag());
|
fMusrT0Action->setEnabled(fAdmin->getEnableMusrT0Flag());
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
@@ -658,8 +760,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a = new QAction( QIcon( QPixmap(iconName) ), tr( "Raw Fourier" ), this );
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "Raw Fourier" ), this );
|
||||||
a->setStatusTip( tr("Start musrFT") );
|
a->setStatusTip( tr("Start musrFT") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrFT() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrFT() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrFT-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "Raw Fourier" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrFT() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
if (fDarkTheme)
|
if (fDarkTheme)
|
||||||
iconName = QString(":/icons/musrprefs-dark.svg");
|
iconName = QString(":/icons/musrprefs-dark.svg");
|
||||||
@@ -668,8 +775,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Preferences" ), this );
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Preferences" ), this );
|
||||||
a->setStatusTip( tr("Show Preferences") );
|
a->setStatusTip( tr("Show Preferences") );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( musrPrefs() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrPrefs() ) );
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrprefs-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Preferences" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrPrefs() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
tb->addSeparator();
|
tb->addSeparator();
|
||||||
@@ -681,8 +793,13 @@ void PTextEdit::setupMusrActions()
|
|||||||
a = new QAction( QIcon( QPixmap(iconName)), tr( "&Dump Header"), this);
|
a = new QAction( QIcon( QPixmap(iconName)), tr( "&Dump Header"), this);
|
||||||
a->setStatusTip( tr("Dumps muSR File Header Information") );
|
a->setStatusTip( tr("Dumps muSR File Header Information") );
|
||||||
connect( a, SIGNAL(triggered()), this, SLOT(musrDump()));
|
connect( a, SIGNAL(triggered()), this, SLOT(musrDump()));
|
||||||
tb->addAction(a);
|
|
||||||
menu->addAction(a);
|
menu->addAction(a);
|
||||||
|
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
|
||||||
|
iconName = QString(":/icons/musrdump-plain.svg");
|
||||||
|
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&Dump Header" ), this );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( musrDump() ) );
|
||||||
|
}
|
||||||
|
tb->addAction(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@@ -2881,6 +2998,27 @@ void PTextEdit::setFileSystemWatcherActive()
|
|||||||
fFileSystemWatcherActive = true;
|
fFileSystemWatcherActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief PTextEdit::getTheme
|
||||||
|
*/
|
||||||
|
void PTextEdit::getTheme()
|
||||||
|
{
|
||||||
|
fDarkTheme = false; // true if theme is dark
|
||||||
|
fDarkToolBarIcon = false; // needed for ubuntu dark since there the menu icons are dark, however the toolbar icons are plain!
|
||||||
|
|
||||||
|
QString str = QIcon::themeName();
|
||||||
|
|
||||||
|
if (str.contains("dark", Qt::CaseInsensitive)) {
|
||||||
|
fDarkTheme = true;
|
||||||
|
if (str.contains("ubuntu", Qt::CaseInsensitive)) {
|
||||||
|
fDarkToolBarIcon = false;
|
||||||
|
} else {
|
||||||
|
fDarkToolBarIcon = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>fill the recent file list in the menu.
|
* <p>fill the recent file list in the menu.
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool fDarkTheme;
|
bool fDarkTheme;
|
||||||
|
bool fDarkToolBarIcon;
|
||||||
PAdmin *fAdmin; ///< pointer to the xml-startup file informations. Needed for different purposes like default working- and executable directories etc.
|
PAdmin *fAdmin; ///< pointer to the xml-startup file informations. Needed for different purposes like default working- and executable directories etc.
|
||||||
QFileSystemWatcher *fFileSystemWatcher; ///< checks if msr-files are changing on the disk while being open in musredit.
|
QFileSystemWatcher *fFileSystemWatcher; ///< checks if msr-files are changing on the disk while being open in musredit.
|
||||||
bool fFileSystemWatcherActive; ///< flag to enable/disable the file system watcher
|
bool fFileSystemWatcherActive; ///< flag to enable/disable the file system watcher
|
||||||
@@ -181,6 +182,7 @@ private:
|
|||||||
QMenu *fRecentFilesMenu; ///< recent file menu
|
QMenu *fRecentFilesMenu; ///< recent file menu
|
||||||
QAction *fRecentFilesAction[MAX_RECENT_FILES]; ///< array of the recent file actions
|
QAction *fRecentFilesAction[MAX_RECENT_FILES]; ///< array of the recent file actions
|
||||||
|
|
||||||
|
void getTheme();
|
||||||
void fillRecentFiles();
|
void fillRecentFiles();
|
||||||
QStringList getRunList(QString runListStr, bool &ok);
|
QStringList getRunList(QString runListStr, bool &ok);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user