+ issue #0002053: Support of themes

This commit is contained in:
wmayer 2015-07-12 22:54:56 +02:00
parent b52ab25322
commit f7644fc9f3
9 changed files with 86 additions and 13 deletions

View File

@ -289,7 +289,7 @@ PyObject* Application::sOpen(PyObject * /*self*/, PyObject *args,PyObject * /*kw
else if (ext == QLatin1String("py") || ext == QLatin1String("fcmacro") ||
ext == QLatin1String("fcscript")) {
PythonEditor* editor = new PythonEditor();
editor->setWindowIcon(Gui::BitmapFactory().pixmap("applications-python"));
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
edit->open(fileName);
edit->resize(400, 300);
@ -360,7 +360,7 @@ PyObject* Application::sInsert(PyObject * /*self*/, PyObject *args,PyObject * /*
else if (ext == QLatin1String("py") || ext == QLatin1String("fcmacro") ||
ext == QLatin1String("fcscript")) {
PythonEditor* editor = new PythonEditor();
editor->setWindowIcon(Gui::BitmapFactory().pixmap("applications-python"));
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
edit->open(fileName);
edit->resize(400, 300);

View File

@ -182,7 +182,7 @@ void DlgMacroExecuteImp::on_createButton_clicked()
}
file.close();
PythonEditor* editor = new PythonEditor();
editor->setWindowIcon(Gui::BitmapFactory().pixmap("applications-python"));
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
edit->open(fi.absoluteFilePath());
edit->setWindowTitle(QString::fromAscii("%1[*]").arg(fn));

View File

@ -4,9 +4,9 @@ Comment=Default FreeCAD icon theme
Inherits=Default
# Directory list
Directories=.
Directories=scalable
[.]
[scalable]
Size=48
MinSize=8
MaxSize=512

View File

@ -115,6 +115,79 @@
<file>DrawStyleShaded.svg</file>
<file>DrawStyleWireFrame.svg</file>
<file>user.svg</file>
</qresource>
<!-- Alternative directory names for icons that should be loaded from a theme -->
<!-- See also http://permalink.gmane.org/gmane.comp.lib.qt.general/26374 -->
<qresource prefix="/icons/FreeCAD-default">
<file>index.theme</file>
</qresource>
<qresource prefix="/icons/FreeCAD-default/scalable">
<file>list-remove.svg</file>
<file>list-add.svg</file>
<file>media-playback-start.svg</file>
<file>media-record.svg</file>
<file>media-playback-stop.svg</file>
<file>utilities-terminal.svg</file>
<file>Std_ViewScreenShot.svg</file>
<file>breakpoint.svg</file>
<file>debug-marker.svg</file>
<file>debug-start.svg</file>
<file>debug-stop.svg</file>
<file>document-new.svg</file>
<file>document-open.svg</file>
<file>document-save.svg</file>
<file>document-save-as.svg</file>
<file>document-print.svg</file>
<file>document-print-preview.svg</file>
<file>document-properties.svg</file>
<file>application-exit.svg</file>
<file>edit-copy.svg</file>
<file>edit-cut.svg</file>
<file>edit-delete.svg</file>
<file>edit-paste.svg</file>
<file>edit-select-all.svg</file>
<file>edit-select-box.svg</file>
<file>edit-redo.svg</file>
<file>edit-undo.svg</file>
<file>edit-edit.svg</file>
<file>help-browser.svg</file>
<file>preferences-system.svg</file>
<file>window-new.svg</file>
<file>camera-photo.svg</file>
<file>applications-accessories.svg</file>
<file>applications-python.svg</file>
<file>accessories-text-editor.svg</file>
<file>accessories-calculator.svg</file>
<file>internet-web-browser.svg</file>
<file>view-select.svg</file>
<file>view-unselectable.svg</file>
<file>view-refresh.svg</file>
<file>view-fullscreen.svg</file>
<file>view-axometric.svg</file>
<file>view-isometric.svg</file>
<file>view-perspective.svg</file>
<file>view-bottom.svg</file>
<file>view-front.svg</file>
<file>view-left.svg</file>
<file>view-rear.svg</file>
<file>view-right.svg</file>
<file>view-top.svg</file>
<file>zoom-all.svg</file>
<file>zoom-border.svg</file>
<file>zoom-fit-best.svg</file>
<file>zoom-in.svg</file>
<file>zoom-out.svg</file>
<file>zoom-selection.svg</file>
<file>view-rotate-left.svg</file>
<file>view-rotate-right.svg</file>
<file>view-measurement.svg</file>
<file>Part_Measure_Clear_All.svg</file>
<file>Part_Measure_Toggle_All.svg</file>
<file>DrawStyleAsIs.svg</file>
<file>DrawStyleFlatLines.svg</file>
<file>DrawStylePoints.svg</file>
<file>DrawStyleShaded.svg</file>
<file>DrawStyleWireFrame.svg</file>
<file>user.svg</file>
</qresource>
</RCC>

View File

@ -370,7 +370,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WFlags f)
// Python console
PythonConsole* pcPython = new PythonConsole(this);
pcPython->setWordWrapMode(QTextOption::NoWrap);
pcPython->setWindowIcon(Gui::BitmapFactory().pixmap("applications-python"));
pcPython->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
pcPython->setObjectName
(QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Python console")));
pDockMgr->registerDockWindow("Std_PythonView", pcPython);

View File

@ -534,7 +534,7 @@ void PythonDebugger::showDebugMarker(const QString& fn, int line)
if (!edit) {
PythonEditor* editor = new PythonEditor();
editor->setWindowIcon(Gui::BitmapFactory().pixmap("applications-python"));
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
edit = new PythonEditorView(editor, getMainWindow());
edit->open(fn);
edit->resize(400, 300);

View File

@ -55,8 +55,8 @@ struct PythonEditorP
PythonDebugger* debugger;
PythonEditorP()
: debugLine(-1),
breakpoint(QLatin1String(":/icons/breakpoint.png")),
debugMarker(QLatin1String(":/icons/debug-marker.png"))
breakpoint(BitmapFactory().iconFromTheme("breakpoint").pixmap(16,16)),
debugMarker(BitmapFactory().iconFromTheme("debug-marker").pixmap(16,16))
{
debugger = Application::Instance->macroManager()->debugger();
}

View File

@ -75,7 +75,7 @@ ReportView::ReportView( QWidget* parent )
tabPython = new PythonConsole();
tabPython->setWordWrapMode(QTextOption::NoWrap);
tabPython->setWindowTitle(trUtf8("Python console"));
tabPython->setWindowIcon(BitmapFactory().pixmap("applications-python"));
tabPython->setWindowIcon(BitmapFactory().iconFromTheme("applications-python"));
int python = tabWidget->addTab(tabPython, tabPython->windowTitle());
tabWidget->setTabIcon(python, tabPython->windowIcon());
tabWidget->setCurrentIndex(0);

View File

@ -254,10 +254,10 @@ void SelectionView::onItemContextMenu(const QPoint& point)
return;
QMenu menu;
QAction *selectAction = menu.addAction(tr("Select only"),this,SLOT(select()));
selectAction->setIcon(QIcon(QString::fromAscii(":/icons/view-select.svg")));
selectAction->setIcon(QIcon::fromTheme(QString::fromAscii("view-select")));
selectAction->setToolTip(tr("Selects only this object"));
QAction *deselectAction = menu.addAction(tr("Deselect"),this,SLOT(deselect()));
deselectAction->setIcon(QIcon(QString::fromAscii(":/icons/view-unselectable.svg")));
deselectAction->setIcon(QIcon::fromTheme(QString::fromAscii("view-unselectable")));
deselectAction->setToolTip(tr("Deselects this object"));
QAction *zoomAction = menu.addAction(tr("Zoom fit"),this,SLOT(zoom()));
zoomAction->setIcon(QIcon::fromTheme(QString::fromAscii("zoom-fit-best")));
@ -265,7 +265,7 @@ void SelectionView::onItemContextMenu(const QPoint& point)
QAction *gotoAction = menu.addAction(tr("Go to selection"),this,SLOT(treeSelect()));
gotoAction->setToolTip(tr("Selects and locates this object in the tree view"));
QAction *toPythonAction = menu.addAction(tr("To python console"),this,SLOT(toPython()));
toPythonAction->setIcon(QIcon(QString::fromAscii(":/icons/applications-python.svg")));
toPythonAction->setIcon(QIcon::fromTheme(QString::fromAscii("applications-python")));
toPythonAction->setToolTip(tr("Reveals this object and its subelements in the python console."));
menu.exec(selectionView->mapToGlobal(point));
}