kwin: convert kwinoptions button pixmaps to PNG

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-20 22:09:03 +03:00
parent 65b6788324
commit fb58f737d6
6 changed files with 43 additions and 66 deletions

View file

@ -13,13 +13,29 @@ set(kcm_kwinoptions_PART_SRCS
kde4_add_plugin(kcm_kwinoptions ${kcm_kwinoptions_PART_SRCS})
target_link_libraries(kcm_kwinoptions ${KDE4_KDEUI_LIBS})
install(TARGETS kcm_kwinoptions DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} )
install(
TARGETS kcm_kwinoptions
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
)
########### install files ###############
install( FILES kwinoptions.desktop kwinactions.desktop kwinadvanced.desktop
install(
FILES
kwinoptions.desktop
kwinactions.desktop
kwinadvanced.desktop
kwinfocus.desktop kwinmoving.desktop
DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
)
install(
FILES
buttons/max1.png
buttons/max2.png
buttons/max3.png
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwin/kcm_kwinoptions/buttons
)
kde4_install_icons(${KDE4_ICON_INSTALL_DIR})

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

View file

@ -20,25 +20,25 @@
#include "mouse.h"
#include <QLabel>
#include <KComboBox>
#include <QLayout>
#include <QSizePolicy>
#include <QBitmap>
#include <QGroupBox>
#include <QPixmap>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QFormLayout>
#include <QtDBus/QtDBus>
#include <kconfig.h>
#include <kdialog.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include <kiconeffect.h>
#include <kcolorscheme.h>
#include <kstandarddirs.h>
#include <kseparator.h>
#include <QtDBus/QtDBus>
#include <kcombobox.h>
#include <X11/X.h>
#include <X11/Xlib.h>
@ -68,64 +68,25 @@ QPixmap maxButtonPixmaps[3];
void createMaxButtonPixmaps()
{
char const * maxButtonXpms[][3 + 13] = {
{
0, 0, 0,
"...............",
".......#.......",
"......###......",
".....#####.....",
"..#....#....#..",
".##....#....##.",
"###############",
".##....#....##.",
"..#....#....#..",
".....#####.....",
"......###......",
".......#.......",
"..............."
},
{
0, 0, 0,
"...............",
".......#.......",
"......###......",
".....#####.....",
".......#.......",
".......#.......",
".......#.......",
".......#.......",
".......#.......",
".....#####.....",
"......###......",
".......#.......",
"..............."
},
{
0, 0, 0,
"...............",
"...............",
"...............",
"...............",
"..#.........#..",
".##.........##.",
"###############",
".##.........##.",
"..#.........#..",
"...............",
"...............",
"...............",
"..............."
},
static const char* imagefilepaths[] = {
"kwin/kcm_kwinoptions/buttons/max1.png",
"kwin/kcm_kwinoptions/buttons/max2.png",
"kwin/kcm_kwinoptions/buttons/max3.png",
};
QByteArray baseColor(". c " + KColorScheme(QPalette::Active, KColorScheme::View).background().color().name().toAscii());
QByteArray textColor("# c " + KColorScheme(QPalette::Active, KColorScheme::View).foreground().color().name().toAscii());
for (int t = 0; t < 3; ++t) {
maxButtonXpms[t][0] = "15 13 2 1";
maxButtonXpms[t][1] = baseColor.constData();
maxButtonXpms[t][2] = textColor.constData();
maxButtonPixmaps[t] = QPixmap(maxButtonXpms[t]);
const QString imagefilepath = KGlobal::dirs()->findResource("data", imagefilepaths[t]);
if (imagefilepath.isEmpty()) {
kWarning() << "No button image for" << imagefilepaths[t];
continue;
}
QImage image(imagefilepath);
KIconEffect::toMonochrome(
image,
KColorScheme(QPalette::Active, KColorScheme::View).foreground().color(),
KColorScheme(QPalette::Active, KColorScheme::View).background().color(),
float(1.0)
);
maxButtonPixmaps[t] = QPixmap::fromImage(image);
maxButtonPixmaps[t].setMask(maxButtonPixmaps[t].createHeuristicMask());
}
}