Custom/thin scrollbars for context view.

This commit is contained in:
craig.p.drummond
2014-10-07 18:47:56 +00:00
committed by craig.p.drummond
parent 4c85d7cbaa
commit e2226777d9
5 changed files with 30 additions and 1 deletions

View File

@@ -83,6 +83,7 @@
57. If MPD supports https, then there is no need to convert SoundCould URLs.
58. If playlist is loaded and replaces playqueue, then start playback of first
track.
59. Custom/thin scrollbars for context view.
1.4.2
-----

View File

@@ -31,6 +31,7 @@
#include "support/action.h"
#include "widgets/icons.h"
#include "support/localize.h"
#include "support/touchproxystyle.h"
#include <QLabel>
#include <QScrollBar>
#include <QImage>
@@ -44,6 +45,7 @@
#include <QMenu>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QTimer>
// Uncomment this #define to have header labels an images centered. Thsi is disabled, as the image
// centering only works if there is some text larger than 1 line to be displayed underneath :-(
@@ -135,6 +137,10 @@ View::View(QWidget *parent, const QStringList &views)
cancelJobAction->setEnabled(false);
connect(cancelJobAction, SIGNAL(triggered()), SLOT(abort()));
text=texts.at(0);
if (!Utils::touchFriendly()) {
QTimer::singleShot(0, this, SLOT(initStyle()));
}
}
View::~View()
@@ -287,3 +293,16 @@ void View::setHtml(const QString &h, int index)
void View::abort()
{
}
void View::initStyle()
{
if (GtkStyle::isActive() && GtkStyle::thinScrollbars()) {
// Already have thin style scrollbars...
return;
}
TouchProxyStyle *tps=new TouchProxyStyle(0, false, true);
foreach (TextBrowser *t, texts) {
t->verticalScrollBar()->setStyle(tps);
t->horizontalScrollBar()->setStyle(tps);
}
}

View File

@@ -77,6 +77,9 @@ Q_SIGNALS:
protected Q_SLOTS:
virtual void abort();
private Q_SLOTS:
void initStyle();
protected:
Song currentSong;
QString stdHeader;

View File

@@ -251,6 +251,12 @@ static WindowManager *wm=0;
static QProxyStyle *proxyStyle=0;
static bool symbolicIcons=false;
static QColor symbolicIconColor(0, 0, 0);
static bool thinSbar=false;
bool GtkStyle::thinScrollbars()
{
return thinSbar;
}
void GtkStyle::applyTheme(QWidget *widget)
{
@@ -259,7 +265,6 @@ void GtkStyle::applyTheme(QWidget *widget)
#else
if (widget && isActive()) {
QString theme=GtkStyle::themeName().toLower();
bool thinSbar=false;
bool touchStyleSpin=false;
int modViewFrame=0;
QMap<QString, QString> css;

View File

@@ -39,6 +39,7 @@ namespace GtkStyle
extern QString iconTheme();
extern void setThemeName(const QString &n);
extern void setIconTheme(const QString &n);
extern bool thinScrollbars();
extern void applyTheme(QWidget *widget);
extern void registerWidget(QWidget *widget);
extern bool useSymbolicIcons();