Commit 646008f1 authored by Jan Möbius's avatar Jan Möbius

Prepare to change icons for view modes

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7334 383ad7c9-94d9-4d36-a494-682f7c89f535
parent d8d81d58
......@@ -196,7 +196,18 @@ void Core::setupOptions() {
emit log(LOGERR,tr("Unable to create config dir ~/.OpenFlipper"));
return;
}
}
// Create a local directory to cache icons
QDir iconCacheDir = configDir;
// Create a personal Icon cache dir to save for example user added icons
if ( ! iconCacheDir.exists("Icons") ){
configDir.mkdir("Icons");
emit log(LOGOUT,tr("Creating Icon Cache Dir ~/.OpenFlipper/Icons"));
}
OpenFlipper::Options::configDir(configDir);
// Remember the main application directory (assumed to be one above executable Path)
......
......@@ -226,20 +226,39 @@ void viewModeWidget::slotModeContextMenu ( const QPoint & _pos ){
QMenu menu(0);
menu.addAction(tr("Remove Mode"), this, SLOT ( slotRemoveMode() ));
menu.addAction(tr("Copy Mode"), this, SLOT ( slotCopyMode() ));
menu.addAction(tr("Change Icon"), this, SLOT ( slotSetIcon() ));
//check if mode is custom e.g. that it can be removed
for (int i=0; i < modes_.size(); i++)
if (modes_[i]->name == viewModeList->currentItem()->text()){
menu.actions()[0]->setEnabled(modes_[i]->custom);
menu.actions()[2]->setEnabled(modes_[i]->custom);
break;
}
menu.addAction(tr("Copy Mode"), this, SLOT ( slotCopyMode() ));
menu.exec(viewModeList->mapToGlobal( _pos) );
}
}
void viewModeWidget::slotSetIcon() {
// Get the correct mode
int id = -1;
for (int i=0; i < modes_.size(); i++)
if (modes_[i]->name == viewModeList->currentItem()->text()){
id = i;
break;
}
if ( id == -1) {
std::cerr << "Unable to find Mode viewModeWidget::slotSetIcon()" << std::endl;
return;
}
std::cerr << "Todo : implement change icon" << std::endl;
}
// =======================================================================================================
// ToolBox and ToolBar Lists update functions
// =======================================================================================================
......
......@@ -87,6 +87,8 @@ class viewModeWidget : public QDialog, public Ui::viewMode
* This slot creates an new empty view mode
*/
void slotAddMode();
// ============================================
......@@ -97,6 +99,12 @@ class viewModeWidget : public QDialog, public Ui::viewMode
* This slot shows the used toolbar Context Menu
*/
void slotModeContextMenu ( const QPoint & _pos );
/** \brief Context menu slot to change the icon for a view mode
*
* This slot asks the user to change the icon of the given view mode
*/
void slotSetIcon();
// ============================================
// ToolBox and ToolBar Lists update functions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment