summaryrefslogtreecommitdiff
path: root/tools/designer/src
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-08-10 17:15:03 +0200
committerJens Bache-Wiig <jbache@trolltech.com>2009-08-10 17:39:20 +0200
commit13a31fe82845f8b1f4d86919080d3b2a87c4d061 (patch)
tree6ec3b5c3bc0811abca5fc84d1aa094be30d4e8c4 /tools/designer/src
parent35ef002453cbe9841e23a7d33064a51dbe99fb06 (diff)
downloadqt4-tools-13a31fe82845f8b1f4d86919080d3b2a87c4d061.tar.gz
Introducing icon theme support
Added some static functions to QIcon to support desktop themes based on the freedesktop spec. It is not intended to replace KIcon and the intention is to use it when available to share icon cache between applications. Applications currently using icon themes are Assistant, Designer and the textedit demo. Reviewed-by: ogoffart
Diffstat (limited to 'tools/designer/src')
-rw-r--r--tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp5
-rw-r--r--tools/designer/src/components/formeditor/formwindowmanager.cpp22
-rw-r--r--tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp3
-rw-r--r--tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp4
-rw-r--r--tools/designer/src/designer/qdesigner_actions.cpp7
-rw-r--r--tools/designer/src/lib/shared/actioneditor.cpp18
-rw-r--r--tools/designer/src/lib/shared/qtresourceview.cpp10
7 files changed, 52 insertions, 17 deletions
diff --git a/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp b/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
index ff0c3c688e..cf838a2480 100644
--- a/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
+++ b/tools/designer/src/components/buddyeditor/buddyeditor_plugin.cpp
@@ -72,8 +72,9 @@ void BuddyEditorPlugin::initialize(QDesignerFormEditorInterface *core)
m_action = new QAction(tr("Edit Buddies"), this);
m_action->setObjectName(QLatin1String("__qt_edit_buddies_action"));
- m_action->setIcon(QIcon(core->resourceLocation() + QLatin1String("/buddytool.png")));
- m_action->setIcon(QIcon(core->resourceLocation() + QLatin1String("/buddytool.png")));
+ QIcon buddyIcon = QIcon::fromTheme("designer-edit-buddy",
+ QIcon(core->resourceLocation() + QLatin1String("/buddytool.png")));
+ m_action->setIcon(buddyIcon);
m_action->setEnabled(false);
setParent(core);
diff --git a/tools/designer/src/components/formeditor/formwindowmanager.cpp b/tools/designer/src/components/formeditor/formwindowmanager.cpp
index 993bae9055..a2a0a40535 100644
--- a/tools/designer/src/components/formeditor/formwindowmanager.cpp
+++ b/tools/designer/src/components/formeditor/formwindowmanager.cpp
@@ -443,7 +443,8 @@ void FormWindowManager::setupActions()
m_actionVerticalLayout->setEnabled(false);
connect(m_actionVerticalLayout, SIGNAL(triggered()), this, SLOT(createLayout()));
- QAction *actionFormLayout = new QAction(createIconSet(QLatin1String("editform.png")), tr("Lay Out in a &Form Layout"), this);
+ QIcon formIcon = QIcon::fromTheme("designer-form-layout", createIconSet(QLatin1String("editform.png")));
+ QAction *actionFormLayout = new QAction(formIcon, tr("Lay Out in a &Form Layout"), this);
actionFormLayout->setObjectName(QLatin1String("__qt_form_layout_action"));
actionFormLayout->setShortcut(Qt::CTRL + Qt::Key_6);
actionFormLayout->setStatusTip(tr("Lays out the selected widgets in a form layout"));
@@ -510,15 +511,30 @@ void FormWindowManager::setupActions()
m_actionUndo = m_undoGroup->createUndoAction(this);
m_actionUndo->setEnabled(false);
- m_actionUndo->setIcon(createIconSet(QLatin1String("undo.png")));
+
+ m_actionUndo->setIcon(QIcon::fromTheme("edit-undo", createIconSet(QLatin1String("undo.png"))));
m_actionRedo = m_undoGroup->createRedoAction(this);
m_actionRedo->setEnabled(false);
- m_actionRedo->setIcon(createIconSet(QLatin1String("redo.png")));
+ m_actionRedo->setIcon(QIcon::fromTheme("edit-redo", createIconSet(QLatin1String("redo.png"))));
m_actionShowFormWindowSettingsDialog = new QAction(tr("Form &Settings..."), this);
m_actionShowFormWindowSettingsDialog->setObjectName(QLatin1String("__qt_form_settings_action"));
connect(m_actionShowFormWindowSettingsDialog, SIGNAL(triggered()), this, SLOT(slotActionShowFormWindowSettingsDialog()));
m_actionShowFormWindowSettingsDialog->setEnabled(false);
+
+
+ m_actionCopy->setIcon(QIcon::fromTheme("edit-copy", m_actionCopy->icon()));
+ m_actionCut->setIcon(QIcon::fromTheme("edit-cut", m_actionCut->icon()));
+ m_actionPaste->setIcon(QIcon::fromTheme("edit-paste", m_actionPaste->icon()));
+
+ // These do not currently exist, but will allow theme authors to fill in the gaps
+ m_actionBreakLayout->setIcon(QIcon::fromTheme("designer-break-layout", m_actionBreakLayout->icon()));
+ m_actionGridLayout->setIcon(QIcon::fromTheme("designer-grid-layout", m_actionGridLayout->icon()));
+ m_actionHorizontalLayout->setIcon(QIcon::fromTheme("designer-horizontal-layout", m_actionHorizontalLayout->icon()));
+ m_actionVerticalLayout->setIcon(QIcon::fromTheme("designer-vertical-layout", m_actionVerticalLayout->icon()));
+ m_actionSplitHorizontal->setIcon(QIcon::fromTheme("designer-split-horizontal", m_actionSplitHorizontal->icon()));
+ m_actionSplitVertical->setIcon(QIcon::fromTheme("designer-split-vertical", m_actionSplitVertical->icon()));
+ m_actionAdjustSize->setIcon(QIcon::fromTheme("designer-adjust-size", m_actionAdjustSize->icon()));
}
void FormWindowManager::slotActionCutActivated()
diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
index e664ae7cfb..a1130410fc 100644
--- a/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
+++ b/tools/designer/src/components/signalsloteditor/signalsloteditor_plugin.cpp
@@ -72,7 +72,8 @@ void SignalSlotEditorPlugin::initialize(QDesignerFormEditorInterface *core)
m_action = new QAction(tr("Edit Signals/Slots"), this);
m_action->setObjectName(QLatin1String("__qt_edit_signals_slots_action"));
m_action->setShortcut(tr("F4"));
- QIcon icon(QIcon(core->resourceLocation() + QLatin1String("/signalslottool.png")));
+ QIcon icon = QIcon::fromTheme("designer-edit-signals",
+ QIcon(core->resourceLocation() + QLatin1String("/signalslottool.png")));
m_action->setIcon(icon);
m_action->setEnabled(false);
diff --git a/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp b/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
index 9b051c9b95..ddddd083f3 100644
--- a/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
+++ b/tools/designer/src/components/tabordereditor/tabordereditor_plugin.cpp
@@ -72,7 +72,9 @@ void TabOrderEditorPlugin::initialize(QDesignerFormEditorInterface *core)
m_action = new QAction(tr("Edit Tab Order"), this);
m_action->setObjectName(QLatin1String("_qt_edit_tab_order_action"));
- m_action->setIcon(QIcon(core->resourceLocation() + QLatin1String("/tabordertool.png")));
+ QIcon icon = QIcon::fromTheme("designer-edit-tabs",
+ QIcon(core->resourceLocation() + QLatin1String("/tabordertool.png")));
+ m_action->setIcon(icon);
m_action->setEnabled(false);
setParent(core);
diff --git a/tools/designer/src/designer/qdesigner_actions.cpp b/tools/designer/src/designer/qdesigner_actions.cpp
index c671386f8a..567a13ea92 100644
--- a/tools/designer/src/designer/qdesigner_actions.cpp
+++ b/tools/designer/src/designer/qdesigner_actions.cpp
@@ -200,6 +200,10 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
#endif
m_previewManager(0)
{
+ m_newFormAction->setIcon(QIcon::fromTheme("document-new", m_newFormAction->icon()));
+ m_openFormAction->setIcon(QIcon::fromTheme("document-open", m_openFormAction->icon()));
+ m_saveFormAction->setIcon(QIcon::fromTheme("document-save", m_saveFormAction->icon()));
+
Q_ASSERT(m_core != 0);
qdesigner_internal::QDesignerFormWindowManager *ifwm = qobject_cast<qdesigner_internal::QDesignerFormWindowManager *>(m_core->formWindowManager());
Q_ASSERT(ifwm);
@@ -323,7 +327,8 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench)
shortcuts.append(QKeySequence(Qt::Key_Escape));
#endif
m_editWidgetsAction->setShortcuts(shortcuts);
- m_editWidgetsAction->setIcon(QIcon(m_core->resourceLocation() + QLatin1String("/widgettool.png")));
+ QIcon fallback(m_core->resourceLocation() + QLatin1String("/widgettool.png"));
+ m_editWidgetsAction->setIcon(QIcon::fromTheme("designer-edit-widget", fallback));
connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(editWidgetsSlot()));
m_editWidgetsAction->setChecked(true);
m_editWidgetsAction->setEnabled(false);
diff --git a/tools/designer/src/lib/shared/actioneditor.cpp b/tools/designer/src/lib/shared/actioneditor.cpp
index 1a236d6bd6..a931b8aafc 100644
--- a/tools/designer/src/lib/shared/actioneditor.cpp
+++ b/tools/designer/src/lib/shared/actioneditor.cpp
@@ -147,7 +147,8 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
toolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
l->addWidget(toolbar);
// edit actions
- m_actionNew->setIcon(createIconSet(QLatin1String("filenew.png")));
+ QIcon documentNewIcon = QIcon::fromTheme("document-new", createIconSet(QLatin1String("filenew.png")));
+ m_actionNew->setIcon(documentNewIcon);
m_actionNew->setEnabled(false);
connect(m_actionNew, SIGNAL(triggered()), this, SLOT(slotNewAction()));
toolbar->addAction(m_actionNew);
@@ -156,15 +157,18 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
m_actionCut->setEnabled(false);
connect(m_actionCut, SIGNAL(triggered()), this, SLOT(slotCut()));
- m_actionCut->setIcon(createIconSet(QLatin1String("editcut.png")));
+ QIcon editCutIcon = QIcon::fromTheme("edit-cut", createIconSet(QLatin1String("editcut.png")));
+ m_actionCut->setIcon(editCutIcon);
m_actionCopy->setEnabled(false);
connect(m_actionCopy, SIGNAL(triggered()), this, SLOT(slotCopy()));
- m_actionCopy->setIcon(createIconSet(QLatin1String("editcopy.png")));
+ QIcon editCopyIcon = QIcon::fromTheme("edit-copy", createIconSet(QLatin1String("editcopy.png")));
+ m_actionCopy->setIcon(editCopyIcon);
toolbar->addAction(m_actionCopy);
connect(m_actionPaste, SIGNAL(triggered()), this, SLOT(slotPaste()));
- m_actionPaste->setIcon(createIconSet(QLatin1String("editpaste.png")));
+ QIcon editPasteIcon = QIcon::fromTheme("edit-paste", createIconSet(QLatin1String("editpaste.png")));
+ m_actionPaste->setIcon(editPasteIcon);
toolbar->addAction(m_actionPaste);
m_actionEdit->setEnabled(false);
@@ -172,7 +176,8 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
connect(m_actionNavigateToSlot, SIGNAL(triggered()), this, SLOT(navigateToSlotCurrentAction()));
- m_actionDelete->setIcon(createIconSet(QLatin1String("editdelete.png")));
+ QIcon editDeleteIcon = QIcon::fromTheme("edit-delete", createIconSet(QLatin1String("editdelete.png")));
+ m_actionDelete->setIcon(editDeleteIcon);
m_actionDelete->setEnabled(false);
connect(m_actionDelete, SIGNAL(triggered()), this, SLOT(slotDelete()));
toolbar->addAction(m_actionDelete);
@@ -243,7 +248,8 @@ QToolButton *ActionEditor::createConfigureMenuButton(const QString &t, QMenu **p
{
QToolButton *configureButton = new QToolButton;
QAction *configureAction = new QAction(t, configureButton);
- configureAction->setIcon(createIconSet(QLatin1String("configure.png")));
+ QIcon configureIcon = QIcon::fromTheme("document-properties", createIconSet(QLatin1String("configure.png")));
+ configureAction->setIcon(configureIcon);
QMenu *configureMenu = new QMenu;
configureAction->setMenu(configureMenu);
configureButton->setDefaultAction(configureAction);
diff --git a/tools/designer/src/lib/shared/qtresourceview.cpp b/tools/designer/src/lib/shared/qtresourceview.cpp
index 40be3e60e2..f55f7ae7b0 100644
--- a/tools/designer/src/lib/shared/qtresourceview.cpp
+++ b/tools/designer/src/lib/shared/qtresourceview.cpp
@@ -582,17 +582,21 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
{
d_ptr->q_ptr = this;
- d_ptr->m_editResourcesAction = new QAction(qdesigner_internal::createIconSet(QLatin1String("edit.png")), tr("Edit Resources..."), this);
+ QIcon editIcon = QIcon::fromTheme("document-properties", qdesigner_internal::createIconSet(QLatin1String("edit.png")));
+ d_ptr->m_editResourcesAction = new QAction(editIcon, tr("Edit Resources..."), this);
d_ptr->m_toolBar->addAction(d_ptr->m_editResourcesAction);
connect(d_ptr->m_editResourcesAction, SIGNAL(triggered()), this, SLOT(slotEditResources()));
d_ptr->m_editResourcesAction->setEnabled(false);
- d_ptr->m_reloadResourcesAction = new QAction(qdesigner_internal::createIconSet(QLatin1String("reload.png")), tr("Reload"), this);
+ QIcon refreshIcon = QIcon::fromTheme("view-refresh", qdesigner_internal::createIconSet(QLatin1String("reload.png")));
+ d_ptr->m_reloadResourcesAction = new QAction(refreshIcon, tr("Reload"), this);
+
d_ptr->m_toolBar->addAction(d_ptr->m_reloadResourcesAction);
connect(d_ptr->m_reloadResourcesAction, SIGNAL(triggered()), this, SLOT(slotReloadResources()));
d_ptr->m_reloadResourcesAction->setEnabled(false);
- d_ptr->m_copyResourcePathAction = new QAction(qdesigner_internal::createIconSet(QLatin1String("editcopy.png")), tr("Copy Path"), this);
+ QIcon copyIcon = QIcon::fromTheme("edit-copy", qdesigner_internal::createIconSet(QLatin1String("editcopy.png")));
+ d_ptr->m_copyResourcePathAction = new QAction(copyIcon, tr("Copy Path"), this);
connect(d_ptr->m_copyResourcePathAction, SIGNAL(triggered()), this, SLOT(slotCopyResourcePath()));
d_ptr->m_copyResourcePathAction->setEnabled(false);