Skip to content

Commit

Permalink
Misc icon fixes
Browse files Browse the repository at this point in the history
Remove the legacy icon loader, replace most png icons with svg.

Ref: #91
  • Loading branch information
rodlie committed May 5, 2024
1 parent 1316350 commit bed7905
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 267 deletions.
2 changes: 0 additions & 2 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ set(
effectsloader.cpp
eimporters.cpp
evfileio.cpp
iconloader.cpp
renderhandler.cpp
GUI/BoxesList/boxsinglewidget.cpp
GUI/BoxesList/boxscrollwidget.cpp
Expand Down Expand Up @@ -228,7 +227,6 @@ set(
GUI/ColorWidgets/colorpickingwidget.h
effectsloader.h
eimporters.h
iconloader.h
renderhandler.h
GUI/BoxesList/boxsinglewidget.h
GUI/BoxesList/boxscrollwidget.h
Expand Down
41 changes: 21 additions & 20 deletions src/app/GUI/BoxesList/boxsinglewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,27 +558,28 @@ void BoxSingleWidget::setTargetAbstraction(SWT_Abstraction *abs) {
updateFillTypeBoxVisible();
}

void BoxSingleWidget::loadStaticPixmaps() {
if(sStaticPixmapsLoaded) return;
void BoxSingleWidget::loadStaticPixmaps()
{
if (sStaticPixmapsLoaded) { return; }
const auto iconsDir = eSettings::sIconsDir();
VISIBLE_PIXMAP = new QPixmap(iconsDir + "/visible_v2.png");
INVISIBLE_PIXMAP = new QPixmap(iconsDir + "/hidden_v2.png");
BOX_CHILDREN_VISIBLE = new QPixmap(iconsDir + "/childrenVisible_v2.png");
BOX_CHILDREN_HIDDEN = new QPixmap(iconsDir + "/childrenHidden_v2.png");
ANIMATOR_CHILDREN_VISIBLE = new QPixmap(iconsDir + "/childrenVisibleSmall_v2.png");
ANIMATOR_CHILDREN_HIDDEN = new QPixmap(iconsDir + "/childrenHiddenSmall_v2.png");
LOCKED_PIXMAP = new QPixmap(iconsDir + "/locked_v2.png");
UNLOCKED_PIXMAP = new QPixmap(iconsDir + "/unlocked_v2.png");
MUTED_PIXMAP = new QPixmap(iconsDir + "/muted.png");
UNMUTED_PIXMAP = new QPixmap(iconsDir + "/unmuted.png");
ANIMATOR_RECORDING = new QPixmap(iconsDir + "/recording.png");
ANIMATOR_NOT_RECORDING = new QPixmap(iconsDir + "/notRecording.png");
ANIMATOR_DESCENDANT_RECORDING = new QPixmap(iconsDir + "/childRecording.png");
C_PIXMAP = new QPixmap(iconsDir + "/c.png");
G_PIXMAP = new QPixmap(iconsDir + "/g.png");
CG_PIXMAP = new QPixmap(iconsDir + "/cg.png");
GRAPH_PROPERTY = new QPixmap(iconsDir + "/graphProperty.png");
PROMOTE_TO_LAYER_PIXMAP = new QPixmap(iconsDir + "/promoteToLayer_v2.png");
VISIBLE_PIXMAP = new QPixmap(":/icons/visible_v2.svg");
INVISIBLE_PIXMAP = new QPixmap(":/icons/hidden_v2.svg");
BOX_CHILDREN_VISIBLE = new QPixmap(":/icons/childrenVisible_v2.svg");
BOX_CHILDREN_HIDDEN = new QPixmap(":/icons/childrenHidden_v2.svg");
ANIMATOR_CHILDREN_VISIBLE = new QPixmap(":/icons/childrenVisibleSmall_v2.svg");
ANIMATOR_CHILDREN_HIDDEN = new QPixmap(":/icons/childrenHiddenSmall_v2.svg");
LOCKED_PIXMAP = new QPixmap(":/icons/locked_v2.svg");
UNLOCKED_PIXMAP = new QPixmap(":/icons/unlocked_v2.svg");
MUTED_PIXMAP = new QPixmap(":/icons/muted.svg");
UNMUTED_PIXMAP = new QPixmap(":/icons/unmuted.svg");
ANIMATOR_RECORDING = new QPixmap(":/icons/recording.svg");
ANIMATOR_NOT_RECORDING = new QPixmap(":/icons/notRecording.svg");
ANIMATOR_DESCENDANT_RECORDING = new QPixmap(":/icons/childRecording.svg");
C_PIXMAP = new QPixmap(":/icons/c.svg");
G_PIXMAP = new QPixmap(":/icons/g.svg");
CG_PIXMAP = new QPixmap(":/icons/cg.svg");
GRAPH_PROPERTY = new QPixmap(":/icons/noInterpolation/graphProperty.png"); // TODO svg
PROMOTE_TO_LAYER_PIXMAP = new QPixmap(":/icons/promoteToLayer_v2.svg");
sStaticPixmapsLoaded = true;
}

Expand Down
42 changes: 20 additions & 22 deletions src/app/GUI/fillstrokesettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,17 @@ FillStrokeSettingsWidget::FillStrokeSettingsWidget(Document &document,
connect(&mDocument, &Document::selectedPaintSettingsChanged,
this, &FillStrokeSettingsWidget::updateCurrentSettings);

const auto iconsDir = eSettings::sIconsDir(); // remove when new icons have been added

// main buttons
mFillTargetButton = new QPushButton(QIcon(iconsDir + "/properties_fill.png"),
tr("Fill"), this);
mStrokeTargetButton = new QPushButton(QIcon(iconsDir + "/properties_stroke_paint.png"),
tr("Stroke"), this);
mFillNoneButton = new QPushButton(QIcon(iconsDir + "/fill_none.png"),
tr("None"), this);
mFillFlatButton = new QPushButton(QIcon(iconsDir + "/fill_flat.png"),
tr("Flat"), this);
mFillGradientButton = new QPushButton(QIcon(iconsDir + "/fill_gradient.png"),
tr("Gradient"), this);
mFillTargetButton = new QPushButton(QIcon(":/icons/noInterpolation/properties_fill.png"),
tr("Fill"), this); // TODO: svg
mStrokeTargetButton = new QPushButton(QIcon(":/icons/noInterpolation/properties_stroke_paint.png"),
tr("Stroke"), this); // TODO svg
mFillNoneButton = new QPushButton(QIcon(":/icons/fill_none.svg").pixmap(10, 10),
tr("None"), this); // use 10x10 workaround until everything is svg
mFillFlatButton = new QPushButton(QIcon(":/icons/noInterpolation/fill_flat.png"),
tr("Flat"), this); // TODO: svg
mFillGradientButton = new QPushButton(QIcon(":/icons/noInterpolation/fill_gradient.png"),
tr("Gradient"), this); // TODO: svg

mFillTargetButton->setCheckable(true);
mFillNoneButton->setCheckable(true);
Expand Down Expand Up @@ -155,11 +153,11 @@ FillStrokeSettingsWidget::FillStrokeSettingsWidget(Document &document,
mJoinStyleWidget->setContentsMargins(0, 0, 0, 0);
mJoinStyleLayout->setMargin(0);

mBevelJoinStyleButton = new QPushButton(QIcon(iconsDir + "/joinBevel.png"),
mBevelJoinStyleButton = new QPushButton(QIcon(":/icons/joinBevel.svg"),
QString(), this);
mMiterJointStyleButton = new QPushButton(QIcon(iconsDir + "/joinMiter.png"),
mMiterJointStyleButton = new QPushButton(QIcon(":/icons/joinMiter.svg"),
QString(), this);
mRoundJoinStyleButton = new QPushButton(QIcon(iconsDir + "/joinRound.png"),
mRoundJoinStyleButton = new QPushButton(QIcon(":/icons/joinRound.svg"),
QString(), this);

mBevelJoinStyleButton->setToolTip(tr("Bevel"));
Expand Down Expand Up @@ -194,11 +192,11 @@ FillStrokeSettingsWidget::FillStrokeSettingsWidget(Document &document,
mCapStyleWidget->setContentsMargins(0, 0, 0, 0);
mCapStyleLayout->setMargin(0);

mFlatCapStyleButton = new QPushButton(QIcon(iconsDir + "/capFlat.png"),
mFlatCapStyleButton = new QPushButton(QIcon(":/icons/capFlat.svg"),
QString(), this);
mSquareCapStyleButton = new QPushButton(QIcon(iconsDir + "/capSquare.png"),
mSquareCapStyleButton = new QPushButton(QIcon(":/icons/capSquare.svg"),
QString(), this);
mRoundCapStyleButton = new QPushButton(QIcon(iconsDir + "/capRound.png"),
mRoundCapStyleButton = new QPushButton(QIcon(":/icons/capRound.svg"),
QString(), this);

mFlatCapStyleButton->setToolTip(tr("Flat"));
Expand Down Expand Up @@ -236,10 +234,10 @@ FillStrokeSettingsWidget::FillStrokeSettingsWidget(Document &document,
mGradientTypeWidget->setContentsMargins(0, 0, 0, 0);
mGradientTypeLayout->setMargin(0);

mLinearGradientButton = new QPushButton(QIcon(iconsDir + "/fill_gradient.png"),
tr("Linear"), this);
mRadialGradientButton = new QPushButton(QIcon(iconsDir + "/fill_gradient_radial.png"),
tr("Radial"), this);
mLinearGradientButton = new QPushButton(QIcon(":/icons/noInterpolation/fill_gradient.png"),
tr("Linear"), this); // TODO svg
mRadialGradientButton = new QPushButton(QIcon(":/icons/noInterpolation/fill_gradient_radial.png"),
tr("Radial"), this); // TODO svg

mLinearGradientButton->setCheckable(true);
mRadialGradientButton->setCheckable(true);
Expand Down
2 changes: 1 addition & 1 deletion src/app/GUI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ MainWindow::MainWindow(Document& document,
stylesheet.close();
}

BoxSingleWidget::loadStaticPixmaps(); // TODO: remove when everything is QIcon
BoxSingleWidget::loadStaticPixmaps();

mDocument.setPath("");

Expand Down
170 changes: 0 additions & 170 deletions src/app/iconloader.cpp

This file was deleted.

38 changes: 0 additions & 38 deletions src/app/iconloader.h

This file was deleted.

9 changes: 0 additions & 9 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "memoryhandler.h"
#include "ShaderEffects/shadereffectprogram.h"
#include "videoencoder.h"
#include "iconloader.h"
#include "appsupport.h"

#ifdef Q_OS_WIN
Expand Down Expand Up @@ -217,14 +216,6 @@ int main(int argc, char *argv[])

eFilterSettings filterSettings;

// remove when we have moved over to QIcon:
QDir(eSettings::sSettingsDir()).mkpath(eSettings::sIconsDir());

// remove when we have moved over to QIcon:
eSizesUI::button.add([](const int size) {
IconLoader::generateAll(eSizesUI::widget, size);
});

eWidgetsImpl widImpl;
ImportHandler importHandler;

Expand Down
7 changes: 2 additions & 5 deletions src/ui/widgets/bookmarkedwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ BookmarkedWidget::BookmarkedWidget(const bool vertical,
mDownArrow->setFixedHeight(dimension);
}

const auto iconDir = eSettings::sIconsDir();
const auto downArr = iconDir + "/down-arrow.png";
const auto upArr = iconDir + "/up-arrow.png";
mUpArrow->setIcon(QIcon(upArr));
mDownArrow->setIcon(QIcon(downArr));
mUpArrow->setIcon(QIcon::fromTheme("uparrow"));
mDownArrow->setIcon(QIcon::fromTheme("downarrow"));

connect(mUpArrow, &QPushButton::pressed, this, [this]() {
if(mFirstViewed == 0) return;
Expand Down

0 comments on commit bed7905

Please sign in to comment.