aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/desktop-plugins
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-10-13 11:53:38 -0400
committerKen Moore <moorekou@gmail.com>2015-10-13 11:53:38 -0400
commit9aa35401ade8779dddd63dd8726c2755a751d047 (patch)
treec4a68a474d5628416cefac36d77762c808b7d6e0 /lumina-desktop/desktop-plugins
parentRe-enable the option to go to an eternally-mounted device directory (Looks li... (diff)
downloadlumina-9aa35401ade8779dddd63dd8726c2755a751d047.tar.gz
lumina-9aa35401ade8779dddd63dd8726c2755a751d047.tar.bz2
lumina-9aa35401ade8779dddd63dd8726c2755a751d047.zip
A bit more cleanup of the new desktop icons:
1) Adjust the font outlines quite a bit more - now it properly respects the theme settings and adjusts appropriately. 2) Add options to re-size all the desktop icons at the same time (use 16 pixel increments) 3) Adjust the default desktop icon size (use a 64x64 icon be default). 4) Ensure that the applauncher re-scales the icon as necessary to ensure it is the proper size.
Diffstat (limited to 'lumina-desktop/desktop-plugins')
-rw-r--r--lumina-desktop/desktop-plugins/LDPlugin.cpp3
-rw-r--r--lumina-desktop/desktop-plugins/LDPlugin.h2
-rw-r--r--lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp8
-rw-r--r--lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h14
4 files changed, 21 insertions, 6 deletions
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.cpp b/lumina-desktop/desktop-plugins/LDPlugin.cpp
index c6d2e320..0fec17c6 100644
--- a/lumina-desktop/desktop-plugins/LDPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/LDPlugin.cpp
@@ -36,6 +36,9 @@ void LDPlugin::setupMenu(){
menu->addAction( LXDG::findIcon("transform-move",""), tr("Start Moving Item"), this, SLOT(slotStartMove()) );
menu->addAction( LXDG::findIcon("transform-scale",""), tr("Start Resizing Item"), this, SLOT(slotStartResize()) );
menu->addSeparator();
+ menu->addAction( LXDG::findIcon("zoom-in",""), tr("Increase Desktop Icon Sizes"), this, SIGNAL(IncreaseIconSize()) );
+ menu->addAction( LXDG::findIcon("zoom-out",""), tr("Decrease Desktop Icon Sizes"), this, SIGNAL(DecreaseIconSize()) );
+ menu->addSeparator();
menu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove Item"), this, SLOT(slotRemovePlugin()) );
}
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.h b/lumina-desktop/desktop-plugins/LDPlugin.h
index f9e5a12b..521a89f4 100644
--- a/lumina-desktop/desktop-plugins/LDPlugin.h
+++ b/lumina-desktop/desktop-plugins/LDPlugin.h
@@ -106,6 +106,8 @@ signals:
void StartMoving(QString); //ID of plugin
void StartResizing(QString); //ID of plugin
void RemovePlugin(QString); //ID of plugin
+ void IncreaseIconSize(); // only used for desktop icons
+ void DecreaseIconSize(); // only used for desktop icons
private slots:
void slotStartMove(){
diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
index cf7f84d4..f2fd2206 100644
--- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
@@ -34,7 +34,7 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par
//QSize sz(qRound(1.1*icosize), icosize+qRound(2.7*button->fontMetrics().height()) );
//button->setFixedSize(sz); //make sure to adjust the button on first show.
this->setInitialSize(120, 100); //give the container a bit of a buffer
- QTimer::singleShot(100,this, SLOT(loadButton()) );
+ QTimer::singleShot(200,this, SLOT(loadButton()) );
}
void AppLauncherPlugin::Cleanup(){
@@ -89,6 +89,12 @@ void AppLauncherPlugin::loadButton(){
}
//Now adjust the visible text as necessary based on font/grid sizing
button->setToolTip(txt);
+ //Double check that the visual icon size matches the requested size - otherwise upscale the icon
+ if(button->icon().actualSize(button->iconSize()) != button->iconSize()){
+ QIcon ico = button->icon();
+ ico.addPixmap( ico.pixmap(button->iconSize()).scaled(button->iconSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation) );
+ button->setIcon(ico);
+ }
//int icosize = this->readSetting("iconsize",64).toInt();
//int bwid = qRound(1.1*icosize);
//this->setFixedSize(bwid, icosize+qRound(2.5*button->fontMetrics().height()) ); //make sure to adjust the button on first show.
diff --git a/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h b/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
index 7a0f28cf..7c8c012d 100644
--- a/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
+++ b/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
@@ -27,7 +27,6 @@ public:
//This button needs slightly different font settings - do this in the constructor so that other widgets can take it into account.
QFont font = this->font();
font.setStyleStrategy(QFont::PreferAntialias); //Always set the font strategy (just in case it starts working down the road)
- font.setWeight(70); //need a slightly heavier weight due to outlining later
this->setFont(font);
}
~OutlineToolButton(){}
@@ -45,8 +44,10 @@ protected:
QStylePainter p(this);
QStyleOptionToolButton opt;
initStyleOption(&opt);
+ opt.font = this->property("font").value<QFont>(); //This ensures that the stylesheet values are incorporated
opt.font.setStyleStrategy(QFont::PreferAntialias); //Always set the font strategy (just in case it starts working down the road)
- opt.font.setWeight(65); //need a slightly heavier weight due to outlining later
+ opt.font.setKerning(true);
+ opt.fontMetrics = QFontMetrics(opt.font);
opt.text.clear(); //Don't paint the text yet - just the background/icon
p.drawComplexControl(QStyle::CC_ToolButton, opt); //This does all the normal QToolButton stuff - just not text
//Now get the text rectangle for the widget
@@ -55,9 +56,12 @@ protected:
QColor textC = opt.palette.text().color().toHsl(); //need the lightness value in a moment
QColor outC = textC;
//qDebug() << "Font Color Values:" << textC << textC.lightness() << textC.lightnessF();
- if(textC.lightnessF() > 0.5){ outC.setHsl(textC.hue(), textC.hslSaturation(), 0, 80); }
- else{outC.setHsl(textC.hue(), textC.hslSaturation(), 255, 80); }
+ if(textC.lightnessF() > 0.5){ outC.setHsl(textC.hue(), textC.hslSaturation(), 0, 110); }
+ else{outC.setHsl(textC.hue(), textC.hslSaturation(), 255, 110); }
//qDebug() << "Outline Color Values:" << outC;
+ //Now get the size of the outline border (need to scale for high-res monitors)
+ qreal OWidth = opt.fontMetrics.width("o")/3.0;
+ //qDebug() << "Outline Width:" << OWidth;
//Now generate a QPainterPath for the text
QPainterPath path;
QStringList txt = this->text().split("\n"); //need each line independently, the newline actually gets painted otherwise
@@ -67,7 +71,7 @@ protected:
path.setFillRule(Qt::WindingFill);
//Now paint the text
p.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); //need antialiasing for this to work well (sub-pixel painting)
- p.strokePath(path, QPen(QBrush(outC),1.8, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin) ); //This will be the outline - 1pixel thick, semi-transparent
+ p.strokePath(path, QPen(QBrush(outC),OWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin) ); //This will be the outline - 1pixel thick, semi-transparent
p.fillPath(path, QBrush(textC)); //this will be the inside/text color
}
bgstack15