Skip to content

Commit

Permalink
Merge branch 'scalable_editor' into 'master'
Browse files Browse the repository at this point in the history
Treat editor icons as scalable

See merge request OpenMW/openmw!4042
  • Loading branch information
psi29a committed Apr 23, 2024
2 parents 9662586 + 1bb48bc commit 02cdeb6
Show file tree
Hide file tree
Showing 28 changed files with 669 additions and 75 deletions.
18 changes: 18 additions & 0 deletions CI/before_script.msvc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,16 @@ add_qt_image_dlls() {
QT_IMAGEFORMATS[$CONFIG]="${QT_IMAGEFORMATS[$CONFIG]} $@"
}

declare -A QT_ICONENGINES
QT_ICONENGINES["Release"]=""
QT_ICONENGINES["Debug"]=""
QT_ICONENGINES["RelWithDebInfo"]=""
add_qt_icon_dlls() {
local CONFIG=$1
shift
QT_ICONENGINES[$CONFIG]="${QT_ICONENGINES[$CONFIG]} $@"
}

if [ -z $PLATFORM ]; then
PLATFORM="$(uname -m)"
fi
Expand Down Expand Up @@ -942,6 +952,7 @@ printf "Qt ${QT_VER}... "

add_qt_platform_dlls $CONFIGURATION "$(pwd)/plugins/platforms/qwindows${DLLSUFFIX}.dll"
add_qt_image_dlls $CONFIGURATION "$(pwd)/plugins/imageformats/qsvg${DLLSUFFIX}.dll"
add_qt_icon_dlls $CONFIGURATION "$(pwd)/plugins/iconengines/qsvgicon${DLLSUFFIX}.dll"
done
echo Done.
}
Expand Down Expand Up @@ -1143,6 +1154,13 @@ fi
cp "$DLL" "${DLL_PREFIX}imageformats"
done
echo
echo "- Qt Icon Engine DLLs..."
mkdir -p ${DLL_PREFIX}iconengines
for DLL in ${QT_ICONENGINES[$CONFIGURATION]}; do
echo " $(basename $DLL)"
cp "$DLL" "${DLL_PREFIX}iconengines"
done
echo
done
#fi

Expand Down
20 changes: 14 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -825,20 +825,28 @@ if (OPENMW_OSX_DEPLOYMENT AND APPLE)
get_filename_component(QT_QMACSTYLE_PLUGIN_NAME "${QT_QMACSTYLE_PLUGIN_PATH}" NAME)
configure_file("${QT_QMACSTYLE_PLUGIN_PATH}" "${APP_BUNDLE_DIR}/Contents/PlugIns/${QT_QMACSTYLE_PLUGIN_GROUP}/${QT_QMACSTYLE_PLUGIN_NAME}" COPYONLY)

get_property(QT_QSVG_PLUGIN_PATH TARGET Qt${QT_VERSION_MAJOR}::QSvgPlugin PROPERTY LOCATION_RELEASE)
get_filename_component(QT_QSVG_PLUGIN_DIR "${QT_QSVG_PLUGIN_PATH}" DIRECTORY)
get_filename_component(QT_QSVG_PLUGIN_GROUP "${QT_QSVG_PLUGIN_DIR}" NAME)
get_filename_component(QT_QSVG_PLUGIN_NAME "${QT_QSVG_PLUGIN_PATH}" NAME)
configure_file("${QT_QSVG_PLUGIN_PATH}" "${APP_BUNDLE_DIR}/Contents/PlugIns/${QT_QSVG_PLUGIN_GROUP}/${QT_QSVG_PLUGIN_NAME}" COPYONLY)

get_property(QT_QSVG_ICON_PLUGIN_PATH TARGET Qt${QT_VERSION_MAJOR}::QSvgIconPlugin PROPERTY LOCATION_RELEASE)
get_filename_component(QT_QSVG_ICON_PLUGIN_DIR "${QT_QSVG_ICON_PLUGIN_PATH}" DIRECTORY)
get_filename_component(QT_QSVG_ICON_PLUGIN_GROUP "${QT_QSVG_ICON_PLUGIN_DIR}" NAME)
get_filename_component(QT_QSVG_ICON_PLUGIN_NAME "${QT_QSVG_ICON_PLUGIN_PATH}" NAME)
configure_file("${QT_QSVG_ICON_PLUGIN_PATH}" "${APP_BUNDLE_DIR}/Contents/PlugIns/${QT_QSVG_ICON_PLUGIN_GROUP}/${QT_QSVG_ICON_PLUGIN_NAME}" COPYONLY)

configure_file("${OpenMW_SOURCE_DIR}/files/mac/qt.conf" "${APP_BUNDLE_DIR}/Contents/Resources/qt.conf" COPYONLY)

if (BUILD_OPENCS)
get_property(OPENCS_BUNDLE_NAME_TMP TARGET openmw-cs PROPERTY OUTPUT_NAME)
set(OPENCS_BUNDLE_NAME "${OPENCS_BUNDLE_NAME_TMP}.app")
configure_file("${QT_COCOA_PLUGIN_PATH}" "${OPENCS_BUNDLE_NAME}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY)
configure_file("${QT_QMACSTYLE_PLUGIN_PATH}" "${OPENCS_BUNDLE_NAME}/Contents/PlugIns/${QT_QMACSTYLE_PLUGIN_GROUP}/${QT_QMACSTYLE_PLUGIN_NAME}" COPYONLY)
configure_file("${OpenMW_SOURCE_DIR}/files/mac/qt.conf" "${OPENCS_BUNDLE_NAME}/Contents/Resources/qt.conf" COPYONLY)

get_property(QT_QSVG_PLUGIN_PATH TARGET Qt${QT_VERSION_MAJOR}::QSvgPlugin PROPERTY LOCATION_RELEASE)
get_filename_component(QT_QSVG_PLUGIN_DIR "${QT_QSVG_PLUGIN_PATH}" DIRECTORY)
get_filename_component(QT_QSVG_PLUGIN_GROUP "${QT_QSVG_PLUGIN_DIR}" NAME)
get_filename_component(QT_QSVG_PLUGIN_NAME "${QT_QSVG_PLUGIN_PATH}" NAME)
configure_file("${QT_QSVG_PLUGIN_PATH}" "${OPENCS_BUNDLE_NAME}/Contents/PlugIns/${QT_QSVG_PLUGIN_GROUP}/${QT_QSVG_PLUGIN_NAME}" COPYONLY)
configure_file("${QT_QSVG_ICON_PLUGIN_PATH}" "${OPENCS_BUNDLE_NAME}/Contents/PlugIns/${QT_QSVG_ICON_PLUGIN_GROUP}/${QT_QSVG_ICON_PLUGIN_NAME}" COPYONLY)
configure_file("${OpenMW_SOURCE_DIR}/files/mac/qt.conf" "${OPENCS_BUNDLE_NAME}/Contents/Resources/qt.conf" COPYONLY)
endif ()

install(DIRECTORY "${APP_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS DESTINATION "." COMPONENT Runtime)
Expand Down
2 changes: 1 addition & 1 deletion apps/launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ target_link_libraries(openmw-launcher
components_qt
)

target_link_libraries(openmw-launcher Qt::Widgets Qt::Core)
target_link_libraries(openmw-launcher Qt::Widgets Qt::Core Qt::Svg)

if (BUILD_WITH_CODE_COVERAGE)
target_compile_options(openmw-launcher PRIVATE --coverage)
Expand Down
8 changes: 4 additions & 4 deletions apps/opencs/view/doc/startup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <QScreen>
#include <QVBoxLayout>

QPushButton* CSVDoc::StartupDialogue::addButton(const QString& label, const QIcon& icon)
QPushButton* CSVDoc::StartupDialogue::addButton(const QString& label, const QString& icon)
{
int column = mColumn--;

Expand Down Expand Up @@ -39,13 +39,13 @@ QWidget* CSVDoc::StartupDialogue::createButtons()
mLayout = new QGridLayout(widget);

/// \todo add icons
QPushButton* loadDocument = addButton("Edit A Content File", QIcon(":startup/edit-content"));
QPushButton* loadDocument = addButton("Edit A Content File", ":startup/edit-content");
connect(loadDocument, &QPushButton::clicked, this, &StartupDialogue::loadDocument);

QPushButton* createAddon = addButton("Create A New Addon", QIcon(":startup/create-addon"));
QPushButton* createAddon = addButton("Create A New Addon", ":startup/create-addon");
connect(createAddon, &QPushButton::clicked, this, &StartupDialogue::createAddon);

QPushButton* createGame = addButton("Create A New Game", QIcon(":startup/create-game"));
QPushButton* createGame = addButton("Create A New Game", ":startup/create-game");
connect(createGame, &QPushButton::clicked, this, &StartupDialogue::createGame);

for (int i = 0; i < 3; ++i)
Expand Down
2 changes: 1 addition & 1 deletion apps/opencs/view/doc/startup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace CSVDoc
int mColumn;
QGridLayout* mLayout;

QPushButton* addButton(const QString& label, const QIcon& icon);
QPushButton* addButton(const QString& label, const QString& icon);

QWidget* createButtons();

Expand Down
2 changes: 1 addition & 1 deletion apps/opencs/view/render/instancemovemode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class QWidget;

CSVRender::InstanceMoveMode::InstanceMoveMode(QWidget* parent)
: ModeButton(QIcon(QPixmap(":scenetoolbar/transform-move")),
: ModeButton(QIcon(":scenetoolbar/transform-move"),
"Move selected instances"
"<ul><li>Use {scene-edit-primary} to move instances around freely</li>"
"<li>Use {scene-edit-secondary} to move instances around within the grid</li>"
Expand Down
2 changes: 1 addition & 1 deletion apps/opencs/view/widget/scenetoolmode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void CSVWidget::SceneToolMode::showPanel(const QPoint& position)

void CSVWidget::SceneToolMode::addButton(const std::string& icon, const std::string& id, const QString& tooltip)
{
ModeButton* button = new ModeButton(QIcon(QPixmap(icon.c_str())), tooltip, mPanel);
ModeButton* button = new ModeButton(QIcon(icon.c_str()), tooltip, mPanel);
addButton(button, id);
}

Expand Down
16 changes: 8 additions & 8 deletions apps/opencs/view/widget/scenetoolshapebrush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ CSVWidget::ShapeBrushWindow::ShapeBrushWindow(CSMDoc::Document& document, QWidge
: QFrame(parent, Qt::Popup)
, mDocument(document)
{
mButtonPoint = new QPushButton(QIcon(QPixmap(":scenetoolbar/brush-point")), "", this);
mButtonSquare = new QPushButton(QIcon(QPixmap(":scenetoolbar/brush-square")), "", this);
mButtonCircle = new QPushButton(QIcon(QPixmap(":scenetoolbar/brush-circle")), "", this);
mButtonCustom = new QPushButton(QIcon(QPixmap(":scenetoolbar/brush-custom")), "", this);
mButtonPoint = new QPushButton(QIcon(":scenetoolbar/brush-point"), "", this);
mButtonSquare = new QPushButton(QIcon(":scenetoolbar/brush-square"), "", this);
mButtonCircle = new QPushButton(QIcon(":scenetoolbar/brush-circle"), "", this);
mButtonCustom = new QPushButton(QIcon(":scenetoolbar/brush-custom"), "", this);

mSizeSliders = new ShapeBrushSizeControls("Brush size", this);

Expand Down Expand Up @@ -201,25 +201,25 @@ void CSVWidget::SceneToolShapeBrush::setButtonIcon(CSVWidget::BrushShape brushSh
{
case BrushShape_Point:

setIcon(QIcon(QPixmap(":scenetoolbar/brush-point")));
setIcon(QIcon(":scenetoolbar/brush-point"));
tooltip += mShapeBrushWindow->toolTipPoint;
break;

case BrushShape_Square:

setIcon(QIcon(QPixmap(":scenetoolbar/brush-square")));
setIcon(QIcon(":scenetoolbar/brush-square"));
tooltip += mShapeBrushWindow->toolTipSquare;
break;

case BrushShape_Circle:

setIcon(QIcon(QPixmap(":scenetoolbar/brush-circle")));
setIcon(QIcon(":scenetoolbar/brush-circle"));
tooltip += mShapeBrushWindow->toolTipCircle;
break;

case BrushShape_Custom:

setIcon(QIcon(QPixmap(":scenetoolbar/brush-custom")));
setIcon(QIcon(":scenetoolbar/brush-custom"));
tooltip += mShapeBrushWindow->toolTipCustom;
break;
}
Expand Down
16 changes: 8 additions & 8 deletions apps/opencs/view/widget/scenetooltexturebrush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ CSVWidget::TextureBrushWindow::TextureBrushWindow(CSMDoc::Document& document, QW
mSelectedBrush = new QLabel(QString::fromStdString(mBrushTextureLabel));
}

mButtonPoint = new QPushButton(QIcon(QPixmap(":scenetoolbar/brush-point")), "", this);
mButtonSquare = new QPushButton(QIcon(QPixmap(":scenetoolbar/brush-square")), "", this);
mButtonCircle = new QPushButton(QIcon(QPixmap(":scenetoolbar/brush-circle")), "", this);
mButtonCustom = new QPushButton(QIcon(QPixmap(":scenetoolbar/brush-custom")), "", this);
mButtonPoint = new QPushButton(QIcon(":scenetoolbar/brush-point"), "", this);
mButtonSquare = new QPushButton(QIcon(":scenetoolbar/brush-square"), "", this);
mButtonCircle = new QPushButton(QIcon(":scenetoolbar/brush-circle"), "", this);
mButtonCustom = new QPushButton(QIcon(":scenetoolbar/brush-custom"), "", this);

mSizeSliders = new BrushSizeControls("Brush size", this);

Expand Down Expand Up @@ -282,25 +282,25 @@ void CSVWidget::SceneToolTextureBrush::setButtonIcon(CSVWidget::BrushShape brush
{
case BrushShape_Point:

setIcon(QIcon(QPixmap(":scenetoolbar/brush-point")));
setIcon(QIcon(":scenetoolbar/brush-point"));
tooltip += mTextureBrushWindow->toolTipPoint;
break;

case BrushShape_Square:

setIcon(QIcon(QPixmap(":scenetoolbar/brush-square")));
setIcon(QIcon(":scenetoolbar/brush-square"));
tooltip += mTextureBrushWindow->toolTipSquare;
break;

case BrushShape_Circle:

setIcon(QIcon(QPixmap(":scenetoolbar/brush-circle")));
setIcon(QIcon(":scenetoolbar/brush-circle"));
tooltip += mTextureBrushWindow->toolTipCircle;
break;

case BrushShape_Custom:

setIcon(QIcon(QPixmap(":scenetoolbar/brush-custom")));
setIcon(QIcon(":scenetoolbar/brush-custom"));
tooltip += mTextureBrushWindow->toolTipCustom;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/opencs/view/widget/scenetooltoggle2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void CSVWidget::SceneToolToggle2::addButton(
stream << mSingleIcon << id;

PushButton* button = new PushButton(
QIcon(QPixmap(stream.str().c_str())), PushButton::Type_Toggle, tooltip.isEmpty() ? name : tooltip, mPanel);
QIcon(stream.str().c_str()), PushButton::Type_Toggle, tooltip.isEmpty() ? name : tooltip, mPanel);

button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
button->setIconSize(QSize(mIconSize, mIconSize));
Expand Down
2 changes: 1 addition & 1 deletion apps/opencs/view/world/dragrecordtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void CSVWorld::DragRecordTable::startDragFromTable(const CSVWorld::DragRecordTab
mime->setIndexAtDragStart(index);
QDrag* drag = new QDrag(this);
drag->setMimeData(mime);
drag->setPixmap(QString::fromUtf8(mime->getIcon().c_str()));
drag->setPixmap(QIcon(mime->getIcon().c_str()).pixmap(QSize(16, 16)));
drag->exec(Qt::CopyAction);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/wizard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ target_link_libraries(openmw-wizard
components_qt
)

target_link_libraries(openmw-wizard Qt::Widgets Qt::Core)
target_link_libraries(openmw-wizard Qt::Widgets Qt::Core Qt::Svg)

if (OPENMW_USE_UNSHIELD)
target_link_libraries(openmw-wizard ${LIBUNSHIELD_LIBRARIES})
Expand Down
2 changes: 1 addition & 1 deletion components/contentselector/view/contentselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ContentSelectorView::ContentSelector::~ContentSelector() = default;

void ContentSelectorView::ContentSelector::buildContentModel(bool showOMWScripts)
{
QIcon warningIcon(ui->addonView->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(16, 15)));
QIcon warningIcon(ui->addonView->style()->standardIcon(QStyle::SP_MessageBoxWarning));
mContentModel = new ContentSelectorModel::ContentModel(this, warningIcon, showOMWScripts);
}

Expand Down
Loading

0 comments on commit 02cdeb6

Please sign in to comment.