Merged luisangelsm/yacreader into default

This commit is contained in:
Felix Kauselmann
2015-08-27 10:34:33 +02:00
parent 23c33cef61
commit 14fed7aba0
95 changed files with 350 additions and 177 deletions

View File

@ -16,16 +16,32 @@ YACReaderLibraryItemWidget::YACReaderLibraryItemWidget(QString n/*ame*/, QString
QPixmap iconPixmap(":/images/sidebar/libraryIcon.png");
icon = new QLabel(this);
icon->setPixmap(iconPixmap);
icon->setPixmap(iconPixmap);
nameLabel = new QLabel(name,this);
options = new QToolButton(this);
options = new QToolButton(this);
#ifdef Q_OS_MAC
//TODO fix this crazy hack for having a propper retina icon for the options
//this hack has been perpetrated using Qt 5.5.0
QString sourceOptionsImage;
if(devicePixelRatio()>1)
sourceOptionsImage = ":/images/sidebar/libraryOptions@2x.png";
else
sourceOptionsImage = ":/images/sidebar/libraryOptions.png";
QPixmap iconOptionsPixmap(sourceOptionsImage);
iconOptionsPixmap.setDevicePixelRatio(devicePixelRatio());
QLabel * helperLabel = new QLabel(options);
helperLabel->move(4,2);
helperLabel->setFixedSize(14,14);
helperLabel->setPixmap(iconOptionsPixmap);
#else
options->setIcon(QIcon(":/images/sidebar/libraryOptions.png"));
#endif
options->setHidden(true);
options->setFixedWidth(18);
options->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum);
options->setStyleSheet("QToolButton {border:none;}");
options->setFixedWidth(18);
options->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum);
options->setStyleSheet("QToolButton {border:none;}");
connect(options,SIGNAL(clicked()),this,SIGNAL(showOptions()));
/*up = new QToolButton(this);
up->setIcon(QIcon(":/images/libraryUp.png"));

View File

@ -23,9 +23,15 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
readingListsView = new YACReaderReadingListsView;
selectedLibrary = new YACReaderLibraryListWidget;
librariesTitle = new YACReaderTitledToolBar(tr("LIBRARIES"));
foldersTitle = new YACReaderTitledToolBar(tr("FOLDERS"));
#ifdef Q_OS_MAC
librariesTitle = new YACReaderTitledToolBar(tr("Libraries"));
foldersTitle = new YACReaderTitledToolBar(tr("Folders"));
readingListsTitle = new YACReaderTitledToolBar(tr("Reading Lists"));
#else
librariesTitle = new YACReaderTitledToolBar(tr("LIBRARIES"));
foldersTitle = new YACReaderTitledToolBar(tr("FOLDERS"));
readingListsTitle = new YACReaderTitledToolBar(tr("READING LISTS"));
#endif
splitter = new QSplitter(this);
splitter->setOrientation(Qt::Vertical);
@ -150,7 +156,7 @@ void YACReaderSideBar::paintEvent(QPaintEvent * event)
#ifdef Q_OS_MAC
QPainter painter(this);
painter.fillRect(0,0,width(),height(),QColor("#FFFFFF"));
painter.fillRect(0,0,width(),height(),QColor("#F1F1F1"));
#else
QPainter painter(this);

View File

@ -158,7 +158,7 @@ void YACReaderTableView::performDrag()
QLOG_DEBUG() << "performDrag";
QDrag *drag = new QDrag(this);
drag->setMimeData(model()->mimeData(selectionModel()->selectedRows()));
drag->setPixmap(QPixmap(":/images/openInYACReader.png")); //TODO add better image
drag->setPixmap(QPixmap(":/images/comics_view_toolbar/openInYACReader.png")); //TODO add better image
/*Qt::DropAction dropAction =*/ drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
}

View File

@ -1,12 +1,12 @@
#include "yacreader_titled_toolbar.h"
#include <QAction>
#include <QHBoxLayout>
#include <QLabel>
#include <QPixmap>
#include <QToolButton>
#include <QGraphicsDropShadowEffect>
#include <QPainter>
#include <QPixmap>
#include <QPushButton>
#include <QToolButton>
DropShadowLabel::DropShadowLabel(QWidget* parent) :
@ -40,8 +40,9 @@ void DropShadowLabel::paintEvent(QPaintEvent *event)
QPainter painter(this);
painter.setFont(font());
//TODO find where is the '3' comming from?
#ifndef Q_OS_MAC
drawTextEffect(&painter, QPoint(contentsMargins().left(), 1));
#endif
drawText(&painter, QPoint(contentsMargins().left(), 0));
}
@ -71,8 +72,8 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString & title, QWidget *p
nameLabel->setText(title);
#ifdef Q_OS_MAC
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
nameLabel->setColor(QColor("#707E8C"));
nameLabel->setDropShadowColor(QColor("#F9FAFB"));
nameLabel->setColor(QColor("#808080"));
//nameLabel->setDropShadowColor(QColor("#F9FAFB"));
#else
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
nameLabel->setColor(QColor("#BDBFBF"));
@ -95,14 +96,26 @@ void YACReaderTitledToolBar::addAction(QAction * action)
{
QHBoxLayout * mainLayout = dynamic_cast<QHBoxLayout *>(layout());
QToolButton * tb = new QToolButton(this);
//fix for QToolButton and retina support in OSX
#ifdef Q_OS_MAC
QPushButton * pb = new QPushButton(this);
pb->setCursor(QCursor(Qt::ArrowCursor));
pb->setIcon(action->icon());
pb->addAction(action);
connect(pb, SIGNAL(clicked(bool)), action, SIGNAL(triggered(bool)));
mainLayout->addWidget(pb);
#else
QToolButton * tb = new QToolButton(this);
tb->setCursor(QCursor(Qt::ArrowCursor));
tb->setDefaultAction(action);
tb->setIconSize(QSize(16,16));
tb->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
//tb->setStyleSheet("QToolButton:hover {background-color:#C5C5C5;}");
mainLayout->addWidget(tb);
mainLayout->addWidget(tb);
#endif
}
void YACReaderTitledToolBar::addSpacing(int spacing)