mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 02:54:46 -04:00
Format code using clang-format
This commit is contained in:
@ -10,18 +10,18 @@
|
||||
#include "yacreader_titled_toolbar.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
YACReaderSideBar::YACReaderSideBar(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Minimum);
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
|
||||
|
||||
settings = new QSettings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
|
||||
settings = new QSettings(YACReader::getSettingsPath() + "/YACReaderLibrary.ini", QSettings::IniFormat); //TODO unificar la creación del fichero de config con el servidor
|
||||
settings->beginGroup("libraryConfig");
|
||||
|
||||
//widgets
|
||||
//widgets
|
||||
foldersView = new YACReaderFoldersView;
|
||||
readingListsView = new YACReaderReadingListsView;
|
||||
selectedLibrary = new YACReaderLibraryListWidget;
|
||||
selectedLibrary = new YACReaderLibraryListWidget;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
librariesTitle = new YACReaderTitledToolBar(tr("Libraries"));
|
||||
@ -45,41 +45,41 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
|
||||
splitter->setStyleSheet("QSplitter::handle:vertical { height: 26px; background-color: transparent;}");
|
||||
#endif
|
||||
|
||||
selectedLibrary->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
selectedLibrary->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||
selectedLibrary->setFocusPolicy(Qt::NoFocus);
|
||||
selectedLibrary->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
selectedLibrary->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
selectedLibrary->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
//layout
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
//layout
|
||||
QVBoxLayout *l = new QVBoxLayout;
|
||||
|
||||
l->setContentsMargins(0,0,0,0);
|
||||
l->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
//LIBRARIES-------------------------------------------------------
|
||||
#ifndef Q_OS_MAC
|
||||
l->addSpacing(5);
|
||||
l->addSpacing(5);
|
||||
#endif
|
||||
|
||||
l->addWidget(librariesTitle);
|
||||
l->addWidget(librariesTitle);
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
l->addSpacing(4);
|
||||
l->addSpacing(4);
|
||||
l->addWidget(new YACReaderSideBarSeparator(this));
|
||||
l->addSpacing(3);
|
||||
l->addSpacing(3);
|
||||
#endif
|
||||
|
||||
l->addWidget(selectedLibrary);
|
||||
l->addWidget(selectedLibrary);
|
||||
#ifndef Q_OS_MAC
|
||||
l->addSpacing(11);
|
||||
#else
|
||||
l->addSpacing(6);
|
||||
l->addSpacing(6);
|
||||
#endif
|
||||
|
||||
//END LIBRARIES---------------------------------------------------
|
||||
|
||||
//FOLDERS---------------------------------------------------------
|
||||
QWidget * foldersContainer = new QWidget(this);
|
||||
QVBoxLayout * foldersLayout = new QVBoxLayout;
|
||||
foldersLayout->setContentsMargins(0,0,0,0);
|
||||
QWidget *foldersContainer = new QWidget(this);
|
||||
QVBoxLayout *foldersLayout = new QVBoxLayout;
|
||||
foldersLayout->setContentsMargins(0, 0, 0, 0);
|
||||
foldersLayout->setSpacing(0);
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
@ -110,8 +110,8 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
|
||||
//READING LISTS----------------------------------------------------
|
||||
splitter->addWidget(readingListsView);
|
||||
|
||||
QVBoxLayout * readingListsHeaderLayout = new QVBoxLayout;
|
||||
readingListsHeaderLayout->setContentsMargins(0,0,0,0);
|
||||
QVBoxLayout *readingListsHeaderLayout = new QVBoxLayout;
|
||||
readingListsHeaderLayout->setContentsMargins(0, 0, 0, 0);
|
||||
readingListsHeaderLayout->setSpacing(0);
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
@ -134,7 +134,7 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
|
||||
|
||||
//readingListsLayout->addWidget(readingListsView);
|
||||
readingListsHeaderLayout->addStretch();
|
||||
QSplitterHandle * handle = splitter->handle(1);
|
||||
QSplitterHandle *handle = splitter->handle(1);
|
||||
//handle->setCursor(QCursor(Qt::ArrowCursor));
|
||||
handle->setLayout(readingListsHeaderLayout);
|
||||
//END READING LISTS------------------------------------------------
|
||||
@ -142,35 +142,32 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
|
||||
l->addWidget(splitter);
|
||||
l->setSpacing(0);
|
||||
|
||||
setLayout(l);
|
||||
setLayout(l);
|
||||
|
||||
if(settings->contains(SIDEBAR_SPLITTER_STATUS))
|
||||
if (settings->contains(SIDEBAR_SPLITTER_STATUS))
|
||||
splitter->restoreState(settings->value(SIDEBAR_SPLITTER_STATUS).toByteArray());
|
||||
}
|
||||
|
||||
|
||||
void YACReaderSideBar::paintEvent(QPaintEvent * event)
|
||||
void YACReaderSideBar::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(event)
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QPainter painter(this);
|
||||
QPainter painter(this);
|
||||
|
||||
painter.fillRect(0,0,width(),height(),QColor("#F1F1F1"));
|
||||
painter.fillRect(0, 0, width(), height(), QColor("#F1F1F1"));
|
||||
#else
|
||||
QPainter painter(this);
|
||||
QPainter painter(this);
|
||||
|
||||
painter.fillRect(0,0,width(),height(),QColor("#454545"));
|
||||
//QWidget::paintEvent(event);
|
||||
painter.fillRect(0, 0, width(), height(), QColor("#454545"));
|
||||
//QWidget::paintEvent(event);
|
||||
#endif
|
||||
|
||||
|
||||
//QPixmap shadow(":/images/side_bar/shadow.png");
|
||||
//painter.drawPixmap(width()-shadow.width(),0,shadow.width(),height(),shadow);
|
||||
|
||||
//QPixmap shadow(":/images/side_bar/shadow.png");
|
||||
//painter.drawPixmap(width()-shadow.width(),0,shadow.width(),height(),shadow);
|
||||
|
||||
// painter.setRenderHint(QPainter::Antialiasing);
|
||||
// painter.drawLine(rect().topLeft(), rect().bottomRight());
|
||||
// painter.setRenderHint(QPainter::Antialiasing);
|
||||
// painter.drawLine(rect().topLeft(), rect().bottomRight());
|
||||
|
||||
//QWidget::paintEvent(event);
|
||||
}
|
||||
@ -184,20 +181,20 @@ void YACReaderSideBar::closeEvent(QCloseEvent *event)
|
||||
|
||||
QSize YACReaderSideBar::sizeHint() const
|
||||
{
|
||||
return QSize(275,200);
|
||||
return QSize(275, 200);
|
||||
}
|
||||
|
||||
YACReaderSideBarSeparator::YACReaderSideBarSeparator(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setFixedHeight(1);
|
||||
}
|
||||
|
||||
void YACReaderSideBarSeparator::paintEvent(QPaintEvent * event)
|
||||
void YACReaderSideBarSeparator::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
Q_UNUSED(event)
|
||||
|
||||
QPainter painter(this);
|
||||
QPainter painter(this);
|
||||
|
||||
painter.fillRect(5,0,width()-10,height(),QColor("#575757"));
|
||||
painter.fillRect(5, 0, width() - 10, height(), QColor("#575757"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user