Update files format with clang-format

This commit is contained in:
Luis Ángel San Martín 2019-06-01 18:44:35 +02:00 committed by Luis Ángel San Martín
parent 732ea7ecac
commit f945c6c5ca
23 changed files with 104 additions and 114 deletions

View File

@ -7,7 +7,7 @@ class ComicsViewTransition : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ComicsViewTransition(const QString& backgroundColor, QWidget *parent = nullptr); explicit ComicsViewTransition(const QString &backgroundColor, QWidget *parent = nullptr);
QSize sizeHint(); QSize sizeHint();
protected: protected:

View File

@ -162,8 +162,7 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
} }
return QVariant(finishedFolderIcon); return QVariant(finishedFolderIcon);
} } else {
else {
return QVariant(QFileIconProvider().icon(QFileIconProvider::Folder)); return QVariant(QFileIconProvider().icon(QFileIconProvider::Folder));
} }
} else { } else {

View File

@ -129,7 +129,7 @@ QIcon ReadingListItem::getIcon() const
if (parent->getId() == 0) if (parent->getId() == 0)
return YACReader::noHighlightedIcon(":/images/lists/list.png"); //top level list return YACReader::noHighlightedIcon(":/images/lists/list.png"); //top level list
else { else {
if(Theme::currentTheme().useNativeFolderIcons) if (Theme::currentTheme().useNativeFolderIcons)
return QFileIconProvider().icon(QFileIconProvider::Folder); return QFileIconProvider().icon(QFileIconProvider::Folder);
else else
return YACReader::noHighlightedIcon(":/images/sidebar/folder.png"); //sublist return YACReader::noHighlightedIcon(":/images/sidebar/folder.png"); //sublist

View File

@ -3,7 +3,7 @@
#include "theme.h" #include "theme.h"
EmptyContainerInfo::EmptyContainerInfo(QWidget *parent) EmptyContainerInfo::EmptyContainerInfo(QWidget *parent)
: QWidget(parent), iconLabel(new QLabel()), titleLabel(new QLabel()) : QWidget(parent), iconLabel(new QLabel()), titleLabel(new QLabel())
{ {
auto theme = Theme::currentTheme(); auto theme = Theme::currentTheme();

View File

@ -12,7 +12,7 @@
#include "theme.h" #include "theme.h"
void testListView(QListView * l) void testListView(QListView *l)
{ {
QStringListModel *slm = new QStringListModel(QStringList() << "Lorem ipsum" QStringListModel *slm = new QStringListModel(QStringList() << "Lorem ipsum"
<< "Hailer skualer" << "Hailer skualer"
@ -84,7 +84,7 @@ EmptyFolderWidget::EmptyFolderWidget(QWidget *parent)
foldersView->setStyleSheet(theme.emptyFolderWidgetStyle); foldersView->setStyleSheet(theme.emptyFolderWidgetStyle);
foldersView->setSizePolicy(QSizePolicy ::Expanding, QSizePolicy ::Expanding ); foldersView->setSizePolicy(QSizePolicy ::Expanding, QSizePolicy ::Expanding);
layout->addSpacing(12); layout->addSpacing(12);
layout->addWidget(foldersView, 1); layout->addWidget(foldersView, 1);

View File

@ -101,8 +101,7 @@ LibraryWindow::LibraryWindow()
if (libraries.isEmpty()) { if (libraries.isEmpty()) {
showNoLibrariesWidget(); showNoLibrariesWidget();
} } else {
else {
showRootWidget(); showRootWidget();
selectedLibrary->setCurrentIndex(0); selectedLibrary->setCurrentIndex(0);
} }
@ -115,7 +114,7 @@ void LibraryWindow::setupUI()
libraryCreator = new LibraryCreator(); libraryCreator = new LibraryCreator();
packageManager = new PackageManager(); packageManager = new PackageManager();
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"); settings->beginGroup("libraryConfig");
historyController = new YACReaderHistoryController(this); historyController = new YACReaderHistoryController(this);
@ -169,7 +168,7 @@ void LibraryWindow::setupUI()
void LibraryWindow::doLayout() void LibraryWindow::doLayout()
{ {
//LAYOUT ELEMENTS------------------------------------------------------------ //LAYOUT ELEMENTS------------------------------------------------------------
auto sHorizontal = new QSplitter(Qt::Horizontal); //spliter principal auto sHorizontal = new QSplitter(Qt::Horizontal); //spliter principal
sHorizontal->setStyleSheet(theme.mainWindowHorizontalSpliterStyle); sHorizontal->setStyleSheet(theme.mainWindowHorizontalSpliterStyle);
@ -263,7 +262,7 @@ void LibraryWindow::doLayout()
//collapsible disabled in macosx (only temporaly) //collapsible disabled in macosx (only temporaly)
if (theme.isMacosNative) { if (theme.isMacosNative) {
sHorizontal->setCollapsible(0,false); sHorizontal->setCollapsible(0, false);
} }
} }
@ -735,7 +734,7 @@ void LibraryWindow::disableAllActions()
void LibraryWindow::createToolBars() void LibraryWindow::createToolBars()
{ {
editInfoToolBar->setIconSize(QSize(18,18)); editInfoToolBar->setIconSize(QSize(18, 18));
editInfoToolBar->addAction(openComicAction); editInfoToolBar->addAction(openComicAction);
editInfoToolBar->addSeparator(); editInfoToolBar->addSeparator();
editInfoToolBar->addAction(editSelectedComicsAction); editInfoToolBar->addAction(editSelectedComicsAction);
@ -938,8 +937,8 @@ void LibraryWindow::createConnections()
connect(libraryToolBar->toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); connect(libraryToolBar->toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
} }
connect(libraryToolBar->toggleComicsViewAction,SIGNAL(triggered()),comicsViewsManager,SLOT(toggleComicsView())); connect(libraryToolBar->toggleComicsViewAction, SIGNAL(triggered()), comicsViewsManager, SLOT(toggleComicsView()));
connect(libraryToolBar->optionsAction, SIGNAL(triggered()),optionsDialog,SLOT(show())); connect(libraryToolBar->optionsAction, SIGNAL(triggered()), optionsDialog, SLOT(show()));
#ifdef SERVER_RELEASE #ifdef SERVER_RELEASE
connect(libraryToolBar->serverConfigAction, SIGNAL(triggered()), serverConfigDialog, SLOT(show())); connect(libraryToolBar->serverConfigAction, SIGNAL(triggered()), serverConfigDialog, SLOT(show()));
#endif #endif
@ -1085,24 +1084,21 @@ void LibraryWindow::loadLibrary(const QString &name)
setRootIndex(); setRootIndex();
libraryToolBar->searchEdit->clear(); libraryToolBar->searchEdit->clear();
} } else if (comparation > 0) {
else if(comparation > 0) { int ret = QMessageBox::question(this, tr("Download new version"), tr("This library was created with a newer version of YACReaderLibrary. Download the new version now?"), QMessageBox::Yes, QMessageBox::No);
int ret = QMessageBox::question(this,tr("Download new version"),tr("This library was created with a newer version of YACReaderLibrary. Download the new version now?"),QMessageBox::Yes,QMessageBox::No); if (ret == QMessageBox::Yes)
if(ret == QMessageBox::Yes)
QDesktopServices::openUrl(QUrl("http://www.yacreader.com")); QDesktopServices::openUrl(QUrl("http://www.yacreader.com"));
comicsViewsManager->comicsView->setModel(nullptr); comicsViewsManager->comicsView->setModel(nullptr);
foldersView->setModel(nullptr); foldersView->setModel(nullptr);
listsView->setModel(nullptr); listsView->setModel(nullptr);
disableAllActions();//TODO comprobar que se deben deshabilitar disableAllActions(); //TODO comprobar que se deben deshabilitar
//será possible renombrar y borrar estas bibliotecas //será possible renombrar y borrar estas bibliotecas
renameLibraryAction->setEnabled(true); renameLibraryAction->setEnabled(true);
removeLibraryAction->setEnabled(true); removeLibraryAction->setEnabled(true);
} }
} } else {
else {
comicsViewsManager->comicsView->setModel(nullptr); comicsViewsManager->comicsView->setModel(nullptr);
foldersView->setModel(nullptr); foldersView->setModel(nullptr);
listsView->setModel(nullptr); listsView->setModel(nullptr);
@ -1610,12 +1606,11 @@ void LibraryWindow::checkEmptyFolder()
{ {
if (comicsModel->rowCount() > 0 && !importedCovers) { if (comicsModel->rowCount() > 0 && !importedCovers) {
disableComicsActions(false); disableComicsActions(false);
} } else {
else {
disableComicsActions(true); disableComicsActions(true);
if (libraryToolBar->toggleFullScreenAction != nullptr) { if (libraryToolBar->toggleFullScreenAction != nullptr) {
if(comicsModel->rowCount() > 0) if (comicsModel->rowCount() > 0)
libraryToolBar->toggleFullScreenAction->setEnabled(true); libraryToolBar->toggleFullScreenAction->setEnabled(true);
} }
@ -1699,7 +1694,7 @@ void LibraryWindow::create(QString source, QString dest, QString name)
{ {
QLOG_INFO() << QString("About to create a library from '%1' to '%2' with name '%3'").arg(source).arg(dest).arg(name); QLOG_INFO() << QString("About to create a library from '%1' to '%2' with name '%3'").arg(source).arg(dest).arg(name);
libraryCreator->createLibrary(source,dest); libraryCreator->createLibrary(source, dest);
libraryCreator->start(); libraryCreator->start();
_lastAdded = name; _lastAdded = name;
_sourceLastAdded = source; _sourceLastAdded = source;
@ -1836,7 +1831,7 @@ void LibraryWindow::rename(QString newName) //TODO replace
QString currentLibrary = selectedLibrary->currentText(); QString currentLibrary = selectedLibrary->currentText();
if (newName != currentLibrary) { if (newName != currentLibrary) {
if (!libraries.contains(newName)) { if (!libraries.contains(newName)) {
libraries.rename(currentLibrary,newName); libraries.rename(currentLibrary, newName);
//selectedLibrary->removeItem(selectedLibrary->currentIndex()); //selectedLibrary->removeItem(selectedLibrary->currentIndex());
//libraries.addLibrary(newName,path); //libraries.addLibrary(newName,path);
selectedLibrary->renameCurrentLibrary(newName); selectedLibrary->renameCurrentLibrary(newName);
@ -1844,15 +1839,13 @@ void LibraryWindow::rename(QString newName) //TODO replace
renameLibraryDialog->close(); renameLibraryDialog->close();
if (!theme.isMacosNative) { if (!theme.isMacosNative) {
if(!foldersModelProxy->mapToSource(foldersView->currentIndex()).isValid()) if (!foldersModelProxy->mapToSource(foldersView->currentIndex()).isValid())
libraryToolBar->setTitle(selectedLibrary->currentText()); libraryToolBar->setTitle(selectedLibrary->currentText());
} }
} } else {
else {
libraryAlreadyExists(newName); libraryAlreadyExists(newName);
} }
} } else
else
renameLibraryDialog->close(); renameLibraryDialog->close();
//selectedLibrary->setCurrentIndex(selectedLibrary->findText(newName)); //selectedLibrary->setCurrentIndex(selectedLibrary->findText(newName));
} }

View File

@ -90,26 +90,26 @@ class LibraryWindow : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
YACReaderSideBar * sideBar; YACReaderSideBar *sideBar;
CreateLibraryDialog * createLibraryDialog; CreateLibraryDialog *createLibraryDialog;
ExportLibraryDialog * exportLibraryDialog; ExportLibraryDialog *exportLibraryDialog;
ImportLibraryDialog * importLibraryDialog; ImportLibraryDialog *importLibraryDialog;
ExportComicsInfoDialog * exportComicsInfoDialog; ExportComicsInfoDialog *exportComicsInfoDialog;
ImportComicsInfoDialog * importComicsInfoDialog; ImportComicsInfoDialog *importComicsInfoDialog;
AddLibraryDialog * addLibraryDialog; AddLibraryDialog *addLibraryDialog;
LibraryCreator * libraryCreator; LibraryCreator *libraryCreator;
HelpAboutDialog * had; HelpAboutDialog *had;
RenameLibraryDialog * renameLibraryDialog; RenameLibraryDialog *renameLibraryDialog;
PropertiesDialog * propertiesDialog; PropertiesDialog *propertiesDialog;
ComicVineDialog * comicVineDialog; ComicVineDialog *comicVineDialog;
EditShortcutsDialog * editShortcutsDialog; EditShortcutsDialog *editShortcutsDialog;
//YACReaderSocialDialog * socialDialog; //YACReaderSocialDialog * socialDialog;
bool fullscreen; bool fullscreen;
bool importedCovers; //if true, the library is read only (not updates,open comic or properties) bool importedCovers; //if true, the library is read only (not updates,open comic or properties)
bool fromMaximized; bool fromMaximized;
PackageManager * packageManager; PackageManager *packageManager;
QSize slideSizeW; QSize slideSizeW;
QSize slideSizeF; QSize slideSizeF;
@ -148,15 +148,15 @@ public:
QAction *exportLibraryAction; QAction *exportLibraryAction;
QAction *importLibraryAction; QAction *importLibraryAction;
QAction * updateLibraryAction; QAction *updateLibraryAction;
QAction * removeLibraryAction; QAction *removeLibraryAction;
QAction * renameLibraryAction; QAction *renameLibraryAction;
//QAction * socialAction; //QAction * socialAction;
//tree actions //tree actions
QAction * addFolderAction; QAction *addFolderAction;
QAction * deleteFolderAction; QAction *deleteFolderAction;
//-- //--
QAction *setRootIndexAction; QAction *setRootIndexAction;
QAction *expandAllNodesAction; QAction *expandAllNodesAction;

View File

@ -13,11 +13,11 @@ class OptionsDialog : public YACReaderOptionsDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
OptionsDialog(QWidget * parent = nullptr); OptionsDialog(QWidget *parent = nullptr);
public slots: public slots:
void editApiKey(); void editApiKey();
void restoreOptions(QSettings * settings) override; void restoreOptions(QSettings *settings) override;
private slots: private slots:
void useBackgroundImageCheckClicked(bool checked); void useBackgroundImageCheckClicked(bool checked);

View File

@ -2,5 +2,4 @@
Theme::Theme() Theme::Theme()
{ {
} }

View File

@ -10,7 +10,8 @@ class Theme
public: public:
Theme(); Theme();
static Theme currentTheme() { static Theme currentTheme()
{
Theme t; Theme t;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@ -121,11 +122,11 @@ public:
t.mainWindowHorizontalSpliterStyle = "QSplitter::handle{image:none;background-color:#B8B8B8;} QSplitter::handle:vertical {height:1px;}"; t.mainWindowHorizontalSpliterStyle = "QSplitter::handle{image:none;background-color:#B8B8B8;} QSplitter::handle:vertical {height:1px;}";
} else { } else {
t.isMacosNative = false; t.isMacosNative = false;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
t.useNativeFullScreen = true; t.useNativeFullScreen = true;
#else #else
t.useNativeFullScreen = false; t.useNativeFullScreen = false;
#endif #endif
t.disableClassicViewCollapsing = false; t.disableClassicViewCollapsing = false;
@ -162,7 +163,7 @@ public:
// //
t.sidebarBackgroundColor = "#454545"; t.sidebarBackgroundColor = "#454545";
t.sidebarSplitterStyle = "QSplitter::handle:vertical { height: 39px; background-color: transparent;}";/*"QSplitter::handle { " t.sidebarSplitterStyle = "QSplitter::handle:vertical { height: 39px; background-color: transparent;}"; /*"QSplitter::handle { "
" image: none; background-color = black; " " image: none; background-color = black; "
" }" " }"
"QSplitter::handle:vertical { height: 39px;}"*/ "QSplitter::handle:vertical { height: 39px;}"*/
@ -234,7 +235,7 @@ public:
"QTableView {border-top:1px solid #B8B8B8;border-bottom:none;border-left:1px solid #B8B8B8;border-right:none;}" "QTableView {border-top:1px solid #B8B8B8;border-bottom:none;border-left:1px solid #B8B8B8;border-right:none;}"
"QTableView::item:selected {outline: 0px; border-bottom: 1px solid #D4D4D4;border-top: 1px solid #D4D4D4; padding-bottom:1px; background-color: #D4D4D4; }" "QTableView::item:selected {outline: 0px; border-bottom: 1px solid #D4D4D4;border-top: 1px solid #D4D4D4; padding-bottom:1px; background-color: #D4D4D4; }"
"QHeaderView::section:horizontal {background-color:#F5F5F5; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4); border-left:none; border-top:none; padding:4px; color:#313232;}" "QHeaderView::section:horizontal {background-color:#F5F5F5; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4); border-left:none; border-top:none; padding:4px; color:#313232;}"
"QHeaderView::section:vertical {border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE;}"; "QHeaderView::section:vertical {border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE;}";
t.mainWindowHorizontalSpliterStyle = "QSplitter::handle:vertical {height:4px;}"; t.mainWindowHorizontalSpliterStyle = "QSplitter::handle:vertical {height:4px;}";
@ -243,19 +244,20 @@ public:
return t; return t;
} }
void configureComicsGridView(QQmlContext *ctxt) { void configureComicsGridView(QQmlContext *ctxt)
ctxt->setContextProperty("backgroundColor", gridComicsViewBackgroundColor ); {
ctxt->setContextProperty("backgroundColor", gridComicsViewBackgroundColor);
ctxt->setContextProperty("cellColor", gridComicsViewCellColor); ctxt->setContextProperty("cellColor", gridComicsViewCellColor);
ctxt->setContextProperty("selectedColor", gridComicsViewSelectedColor); ctxt->setContextProperty("selectedColor", gridComicsViewSelectedColor);
ctxt->setContextProperty("selectedBorderColor", gridComicsViewSelectedBorderColor); ctxt->setContextProperty("selectedBorderColor", gridComicsViewSelectedBorderColor);
ctxt->setContextProperty("borderColor", gridComicsViewBorderColor); ctxt->setContextProperty("borderColor", gridComicsViewBorderColor);
ctxt->setContextProperty("titleColor", gridComicsViewTitleColor); ctxt->setContextProperty("titleColor", gridComicsViewTitleColor);
ctxt->setContextProperty("textColor", gridComicsViewTextColor); ctxt->setContextProperty("textColor", gridComicsViewTextColor);
ctxt->setContextProperty("useDropShadows",useDropShadows); ctxt->setContextProperty("useDropShadows", useDropShadows);
//fonts settings //fonts settings
if (gridComicsViewFontSize < 1) { if (gridComicsViewFontSize < 1) {
int fontSize = QApplication::font().pointSize(); int fontSize = QApplication::font().pointSize();
if(fontSize == -1) if (fontSize == -1)
fontSize = QApplication::font().pixelSize(); fontSize = QApplication::font().pixelSize();
ctxt->setContextProperty("fontSize", fontSize); ctxt->setContextProperty("fontSize", fontSize);
@ -269,7 +271,8 @@ public:
ctxt->setContextProperty("currentComicBackgroundColor", gridComicsViewCurrentComicBackground); ctxt->setContextProperty("currentComicBackgroundColor", gridComicsViewCurrentComicBackground);
} }
void configureInfoView(QQmlContext *ctxt) { void configureInfoView(QQmlContext *ctxt)
{
ctxt->setContextProperty("infoBackgroundColor", infoViewInfoBackgroundColor); ctxt->setContextProperty("infoBackgroundColor", infoViewInfoBackgroundColor);
ctxt->setContextProperty("topShadow", infoViewTopShadow); ctxt->setContextProperty("topShadow", infoViewTopShadow);
ctxt->setContextProperty("infoShadow", infoViewInfoShadow); ctxt->setContextProperty("infoShadow", infoViewInfoShadow);
@ -287,7 +290,7 @@ public:
ctxt->setContextProperty("readTickUncheckedColor", infoViewReadTickUncheckedColor); ctxt->setContextProperty("readTickUncheckedColor", infoViewReadTickUncheckedColor);
ctxt->setContextProperty("readTickCheckedColor", infoViewReadTickCheckedColor); ctxt->setContextProperty("readTickCheckedColor", infoViewReadTickCheckedColor);
ctxt->setContextProperty("useDropShadows",useDropShadows); ctxt->setContextProperty("useDropShadows", useDropShadows);
} }
bool isMacosNative; bool isMacosNative;

View File

@ -173,9 +173,8 @@ void YACReaderComicsViewsManager::switchToComicsView(ComicsView *from, ComicsVie
//load content into current view //load content into current view
libraryWindow->loadCoversFromCurrentModel(); libraryWindow->loadCoversFromCurrentModel();
if (!libraryWindow->libraryToolBar->searchEdit->text().isEmpty()) if (!libraryWindow->libraryToolBar->searchEdit->text().isEmpty()) {
{ comicsView->enableFilterMode(true);
comicsView->enableFilterMode(true);
} }
} }
@ -210,7 +209,7 @@ void YACReaderComicsViewsManager::_toggleComicsView()
libraryWindow->libraryToolBar->updateViewSelectorIcon(icoViewsButton); libraryWindow->libraryToolBar->updateViewSelectorIcon(icoViewsButton);
if (infoComicsView == nullptr) if (infoComicsView == nullptr)
infoComicsView = new InfoComicsView(); infoComicsView = new InfoComicsView();
switchToComicsView(gridComicsView, infoComicsView); switchToComicsView(gridComicsView, infoComicsView);
comicsViewStatus = Info; comicsViewStatus = Info;
@ -224,7 +223,7 @@ void YACReaderComicsViewsManager::_toggleComicsView()
libraryWindow->libraryToolBar->toggleComicsViewAction->setIcon(icoViewsButton); libraryWindow->libraryToolBar->toggleComicsViewAction->setIcon(icoViewsButton);
libraryWindow->libraryToolBar->updateViewSelectorIcon(icoViewsButton); libraryWindow->libraryToolBar->updateViewSelectorIcon(icoViewsButton);
if(classicComicsView == nullptr) if (classicComicsView == nullptr)
classicComicsView = new ClassicComicsView(theme.disableClassicViewCollapsing); classicComicsView = new ClassicComicsView(theme.disableClassicViewCollapsing);
switchToComicsView(infoComicsView, classicComicsView); switchToComicsView(infoComicsView, classicComicsView);

View File

@ -2,7 +2,7 @@
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
YACReaderLibrarySearchEdit::YACReaderLibrarySearchEdit(YACReaderMacOSXSearchLineEdit *searchEdit) YACReaderLibrarySearchEdit::YACReaderLibrarySearchEdit(YACReaderMacOSXSearchLineEdit *searchEdit)
:macosSearchEdit(searchEdit), defaultSearchEdit(nullptr) : macosSearchEdit(searchEdit), defaultSearchEdit(nullptr)
{ {
connect(searchEdit, connect(searchEdit,
&YACReaderMacOSXSearchLineEdit::filterChanged, &YACReaderMacOSXSearchLineEdit::filterChanged,
@ -12,7 +12,7 @@ YACReaderLibrarySearchEdit::YACReaderLibrarySearchEdit(YACReaderMacOSXSearchLine
#endif #endif
YACReaderLibrarySearchEdit::YACReaderLibrarySearchEdit(YACReaderSearchLineEdit *searchEdit) YACReaderLibrarySearchEdit::YACReaderLibrarySearchEdit(YACReaderSearchLineEdit *searchEdit)
:defaultSearchEdit(searchEdit) : defaultSearchEdit(searchEdit)
{ {
connect(searchEdit, connect(searchEdit,
&YACReaderSearchLineEdit::filterChanged, &YACReaderSearchLineEdit::filterChanged,
@ -25,9 +25,9 @@ void YACReaderLibrarySearchEdit::clear()
if (defaultSearchEdit != nullptr) { if (defaultSearchEdit != nullptr) {
defaultSearchEdit->clear(); defaultSearchEdit->clear();
} else { } else {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
macosSearchEdit->clear(); macosSearchEdit->clear();
#endif #endif
} }
} }
@ -36,9 +36,9 @@ void YACReaderLibrarySearchEdit::clearText()
if (defaultSearchEdit != nullptr) { if (defaultSearchEdit != nullptr) {
defaultSearchEdit->clearText(); defaultSearchEdit->clearText();
} else { } else {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
macosSearchEdit->clearText(); macosSearchEdit->clearText();
#endif #endif
} }
} }
@ -47,9 +47,9 @@ void YACReaderLibrarySearchEdit::setDisabled(bool disabled)
if (defaultSearchEdit != nullptr) { if (defaultSearchEdit != nullptr) {
defaultSearchEdit->setDisabled(disabled); defaultSearchEdit->setDisabled(disabled);
} else { } else {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
macosSearchEdit->setDisabled(disabled); macosSearchEdit->setDisabled(disabled);
#endif #endif
} }
} }
@ -58,9 +58,9 @@ void YACReaderLibrarySearchEdit::setEnabled(bool enabled)
if (defaultSearchEdit != nullptr) { if (defaultSearchEdit != nullptr) {
defaultSearchEdit->setEnabled(enabled); defaultSearchEdit->setEnabled(enabled);
} else { } else {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
macosSearchEdit->setEnabled(enabled); macosSearchEdit->setEnabled(enabled);
#endif #endif
} }
} }
@ -69,9 +69,9 @@ QString YACReaderLibrarySearchEdit::text()
if (defaultSearchEdit != nullptr) { if (defaultSearchEdit != nullptr) {
return defaultSearchEdit->text(); return defaultSearchEdit->text();
} else { } else {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
return macosSearchEdit->text(); return macosSearchEdit->text();
#endif #endif
} }
return ""; return "";

View File

@ -11,9 +11,9 @@
#include "yacreader_macosx_toolbar.h" #include "yacreader_macosx_toolbar.h"
#endif #endif
class YACReaderLibrarySearchEdit: public QObject class YACReaderLibrarySearchEdit : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
YACReaderLibrarySearchEdit(YACReaderMacOSXSearchLineEdit *searchEdit); YACReaderLibrarySearchEdit(YACReaderMacOSXSearchLineEdit *searchEdit);

View File

@ -7,11 +7,11 @@
using namespace YACReader; using namespace YACReader;
YACReaderLibraryToolbar::YACReaderLibraryToolbar(QMainWindow *mainWindow, bool isMacosNative, bool useNativeFullScreen, QSettings *settings) YACReaderLibraryToolbar::YACReaderLibraryToolbar(QMainWindow *mainWindow, bool isMacosNative, bool useNativeFullScreen, QSettings *settings)
:QObject(mainWindow), mainWindow(mainWindow), isMacosNative(isMacosNative), useNativeFullScreen(useNativeFullScreen), settings(settings) : QObject(mainWindow), mainWindow(mainWindow), isMacosNative(isMacosNative), useNativeFullScreen(useNativeFullScreen), settings(settings)
{ {
backAction = new QAction(mainWindow); backAction = new QAction(mainWindow);
QIcon icoBackButton; QIcon icoBackButton;
icoBackButton.addFile(":/images/main_toolbar/back.svg",QSize(), QIcon::Normal); icoBackButton.addFile(":/images/main_toolbar/back.svg", QSize(), QIcon::Normal);
//icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back_disabled.svg"), QIcon::Disabled); //icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back_disabled.svg"), QIcon::Disabled);
backAction->setData(BACK_ACTION_YL); backAction->setData(BACK_ACTION_YL);
backAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(BACK_ACTION_YL)); backAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(BACK_ACTION_YL));
@ -42,13 +42,13 @@ YACReaderLibraryToolbar::YACReaderLibraryToolbar(QMainWindow *mainWindow, bool i
icoServerButton.addFile(":/images/main_toolbar/server.svg", QSize(), QIcon::Normal); icoServerButton.addFile(":/images/main_toolbar/server.svg", QSize(), QIcon::Normal);
serverConfigAction->setIcon(icoServerButton); serverConfigAction->setIcon(icoServerButton);
toggleComicsViewAction = new QAction(tr("Change between comics views"),mainWindow); toggleComicsViewAction = new QAction(tr("Change between comics views"), mainWindow);
toggleComicsViewAction->setToolTip(tr("Change between comics views")); toggleComicsViewAction->setToolTip(tr("Change between comics views"));
QIcon icoViewsButton; QIcon icoViewsButton;
if(!settings->contains(COMICS_VIEW_STATUS) || settings->value(COMICS_VIEW_STATUS) == Flow) if (!settings->contains(COMICS_VIEW_STATUS) || settings->value(COMICS_VIEW_STATUS) == Flow)
icoViewsButton.addFile(":/images/main_toolbar/grid.svg", QSize(), QIcon::Normal); icoViewsButton.addFile(":/images/main_toolbar/grid.svg", QSize(), QIcon::Normal);
else if(settings->value(COMICS_VIEW_STATUS) == Grid) else if (settings->value(COMICS_VIEW_STATUS) == Grid)
icoViewsButton.addFile(":/images/main_toolbar/info.svg", QSize(), QIcon::Normal); icoViewsButton.addFile(":/images/main_toolbar/info.svg", QSize(), QIcon::Normal);
else else
icoViewsButton.addFile(":/images/main_toolbar/flow.svg", QSize(), QIcon::Normal); icoViewsButton.addFile(":/images/main_toolbar/flow.svg", QSize(), QIcon::Normal);
@ -62,11 +62,11 @@ YACReaderLibraryToolbar::YACReaderLibraryToolbar(QMainWindow *mainWindow, bool i
helpAboutAction->setData(HELP_ABOUT_ACTION_YL); helpAboutAction->setData(HELP_ABOUT_ACTION_YL);
helpAboutAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(HELP_ABOUT_ACTION_YL)); helpAboutAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(HELP_ABOUT_ACTION_YL));
QIcon icoHelpButton; QIcon icoHelpButton;
icoHelpButton.addFile(":/images/main_toolbar/help.svg",QSize(), QIcon::Normal); icoHelpButton.addFile(":/images/main_toolbar/help.svg", QSize(), QIcon::Normal);
helpAboutAction->setIcon(icoHelpButton); helpAboutAction->setIcon(icoHelpButton);
if (!useNativeFullScreen) { if (!useNativeFullScreen) {
toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"),mainWindow); toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"), mainWindow);
toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off")); toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off"));
toggleFullScreenAction->setData(TOGGLE_FULL_SCREEN_ACTION_YL); toggleFullScreenAction->setData(TOGGLE_FULL_SCREEN_ACTION_YL);
toggleFullScreenAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_FULL_SCREEN_ACTION_YL)); toggleFullScreenAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_FULL_SCREEN_ACTION_YL));

View File

@ -10,23 +10,23 @@
#include "yacreader_library_search_edit.h" #include "yacreader_library_search_edit.h"
class YACReaderLibraryToolbar: public QObject class YACReaderLibraryToolbar : public QObject
{ {
public: public:
YACReaderLibraryToolbar(QMainWindow *mainWindow, bool isMacosNative, bool useNativeFullScreen, QSettings *settings); YACReaderLibraryToolbar(QMainWindow *mainWindow, bool isMacosNative, bool useNativeFullScreen, QSettings *settings);
QWidget * widget() { return defaultToolbar; } QWidget *widget() { return defaultToolbar; }
QAction * backAction; QAction *backAction;
QAction * forwardAction; QAction *forwardAction;
QAction * optionsAction; QAction *optionsAction;
QAction * serverConfigAction; QAction *serverConfigAction;
QAction * toggleComicsViewAction; QAction *toggleComicsViewAction;
QAction * helpAboutAction; QAction *helpAboutAction;
QAction * toggleFullScreenAction = nullptr; QAction *toggleFullScreenAction = nullptr;
YACReaderLibrarySearchEdit *searchEdit; YACReaderLibrarySearchEdit *searchEdit;
public slots: public slots:
@ -43,15 +43,13 @@ private:
QMainWindow *mainWindow; QMainWindow *mainWindow;
bool isMacosNative; bool isMacosNative;
bool useNativeFullScreen; bool useNativeFullScreen;
QSettings * settings; QSettings *settings;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
YACReaderMacOSXToolbar *macosxToolbar = nullptr; YACReaderMacOSXToolbar *macosxToolbar = nullptr;
#endif #endif
YACReaderMainToolBar *defaultToolbar = nullptr; YACReaderMainToolBar *defaultToolbar = nullptr;
}; };
#endif // YACREADER_LIBRARY_TOOLBAR_H #endif // YACREADER_LIBRARY_TOOLBAR_H

View File

@ -132,7 +132,7 @@ void YACReaderMainToolBar::addWideDivider()
mainLayout->addSpacing(3); mainLayout->addSpacing(3);
} }
void YACReaderMainToolBar::setTitle(const QString & name) void YACReaderMainToolBar::setTitle(const QString &name)
{ {
currentFolder->setText(name); currentFolder->setText(name);
currentFolderName = name; currentFolderName = name;

View File

@ -24,7 +24,7 @@ signals:
public slots: public slots:
void select(); void select();
void deselect(); void deselect();
void setName(const QString & name); void setName(const QString &name);
private: private:
QLabel *icon; QLabel *icon;

View File

@ -29,7 +29,7 @@ YACReaderSearchLineEdit::YACReaderSearchLineEdit(QWidget *parent)
clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
clearButton->hide(); clearButton->hide();
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&))); connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(updateCloseButton(const QString &)));
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
setStyleSheet(QString("QLineEdit {color: #ABABAB; border:none; border-radius: 4px; background-color:#404040; padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-right: 9px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6 + 5).arg(clearButton->sizeHint().width() + frameWidth + 2)); setStyleSheet(QString("QLineEdit {color: #ABABAB; border:none; border-radius: 4px; background-color:#404040; padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-right: 9px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6 + 5).arg(clearButton->sizeHint().width() + frameWidth + 2));

View File

@ -60,7 +60,7 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
l->addSpacing(3); l->addSpacing(3);
} }
l->addWidget(selectedLibrary); l->addWidget(selectedLibrary);
if (!theme.isMacosNative) { if (!theme.isMacosNative) {
l->addSpacing(11); l->addSpacing(11);

View File

@ -41,7 +41,7 @@ public slots:
protected: protected:
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *);
void closeEvent ( QCloseEvent * event ); void closeEvent(QCloseEvent *event);
QSettings *settings; QSettings *settings;
QSplitter *splitter; QSplitter *splitter;
Theme theme = Theme::currentTheme(); Theme theme = Theme::currentTheme();

View File

@ -88,7 +88,7 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString &title, QWidget *pa
void YACReaderTitledToolBar::addAction(QAction *action) void YACReaderTitledToolBar::addAction(QAction *action)
{ {
auto mainLayout = dynamic_cast<QHBoxLayout *>(layout()); auto mainLayout = dynamic_cast<QHBoxLayout *>(layout());
auto tb = new QToolButton(this); auto tb = new QToolButton(this);
tb->setCursor(QCursor(Qt::ArrowCursor)); tb->setCursor(QCursor(Qt::ArrowCursor));

View File

@ -25,7 +25,7 @@ private:
QColor dropShadowColor; QColor dropShadowColor;
QColor textColor; QColor textColor;
void drawText(QPainter *painter, QPoint offset); void drawText(QPainter *painter, QPoint offset);
void drawTextEffect(QPainter* painter, QPoint offset); void drawTextEffect(QPainter *painter, QPoint offset);
Theme theme = Theme::currentTheme(); Theme theme = Theme::currentTheme();
}; };
@ -44,7 +44,7 @@ public slots:
void addSepartor(); void addSepartor();
private: private:
DropShadowLabel * nameLabel; DropShadowLabel *nameLabel;
Theme theme = Theme::currentTheme(); Theme theme = Theme::currentTheme();
}; };

View File

@ -2,7 +2,6 @@
#include "theme.h" #include "theme.h"
YACReaderTreeView::YACReaderTreeView(QWidget *parent) YACReaderTreeView::YACReaderTreeView(QWidget *parent)
: QTreeView(parent) : QTreeView(parent)
{ {