Merge pull request #382 from YACReader/mac_ui_build_flag

Replace Q_OS_MAC with with a custom define to controll mac vs windows/linux ui
This commit is contained in:
Luis Ángel San Martín 2023-05-31 10:44:26 +02:00 committed by GitHub
commit 147c882431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 141 additions and 99 deletions

View File

@ -472,7 +472,7 @@ QAction *MainWindowViewer::addActionWithShortcut(const QString &text, const QStr
void MainWindowViewer::createToolBars()
{
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
comicToolBar = new YACReaderMacOSXToolbar(this);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
comicToolBar->setIconSize(QSize(18, 18));
@ -481,12 +481,12 @@ void MainWindowViewer::createToolBars()
comicToolBar = addToolBar(tr("&File"));
#endif
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
comicToolBar->setStyleSheet("QToolBar{border:none;}");
comicToolBar->setIconSize(QSize(18, 18));
#endif
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
comicToolBar->addAction(actionWithCustomIcon(QIcon(addExtensionToIconPathInToolbar(":/images/viewer_toolbar/open")), openAction));
comicToolBar->addAction(actionWithCustomIcon(QIcon(addExtensionToIconPathInToolbar(":/images/viewer_toolbar/openFolder")), openFolderAction));
#else
@ -564,7 +564,7 @@ void MainWindowViewer::createToolBars()
comicToolBar->addAction(actionWithCustomIcon(QIcon(addExtensionToIconPathInToolbar(":/images/viewer_toolbar/flow")), showFlowAction));
comicToolBar->addAction(actionWithCustomIcon(QIcon(addExtensionToIconPathInToolbar(":/images/viewer_toolbar/info")), showInfoAction));
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
comicToolBar->addStretch();
#else
comicToolBar->addWidget(new YACReaderToolBarStretch());
@ -574,7 +574,7 @@ void MainWindowViewer::createToolBars()
comicToolBar->addAction(actionWithCustomIcon(QIcon(addExtensionToIconPathInToolbar(":/images/viewer_toolbar/options")), optionsAction));
comicToolBar->addAction(actionWithCustomIcon(QIcon(addExtensionToIconPathInToolbar(":/images/viewer_toolbar/help")), helpAboutAction));
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
comicToolBar->setMovable(false);
#endif
@ -1061,7 +1061,7 @@ void MainWindowViewer::toggleToolBars()
toolbars ? hideToolBars() : showToolBars();
Configuration::getConfiguration().setShowToolbars(toolbars);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
comicToolBar->setMovable(false);
#endif
}
@ -1289,7 +1289,7 @@ void MainWindowViewer::toggleFitToWidthSlider()
{
int y;
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
y = 0;
#else
y = this->comicToolBar->frameSize().height();

View File

@ -8,12 +8,13 @@
#include <QCloseEvent>
#include <QSettings>
#ifdef Q_OS_MAC
#include "yacreader_global.h"
#ifdef Y_MAC_UI
#include "yacreader_macosx_toolbar.h"
#endif
#include "comic_db.h"
#include "yacreader_global.h"
class Comic;
class Viewer;
@ -102,7 +103,7 @@ private:
EditShortcutsDialog *editShortcutsDialog;
//! ToolBars
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
YACReaderMacOSXToolbar *comicToolBar;
#else
QToolBar *comicToolBar;

View File

@ -28,7 +28,7 @@ NotificationsLabelWidget::NotificationsLabelWidget(QWidget *parent)
textLabel->setFixedSize(200, 120);
// TODO check if the effects still be broken in OSX yet
// TODO check if the effects are still broken in OSX
#ifndef Q_OS_MAC
this->setGraphicsEffect(effect);
#endif

View File

@ -952,7 +952,7 @@ void Viewer::configureContent(QString msg)
void Viewer::hideCursor()
{
#ifdef Q_OS_MAC
#ifdef Q_OS_MAC // TODO_Y_MAC_UI isn't BlankCursor supported in macos?
setCursor(QCursor(QBitmap(1, 1), QBitmap(1, 1)));
#else
setCursor(Qt::BlankCursor);

View File

@ -1,5 +1,7 @@
#include "classic_comics_view.h"
#include "yacreader_global.h"
#include "QStackedWidget"
#include "comic_flow_widget.h"
@ -78,7 +80,7 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
layout->setContentsMargins(0, 0, 0, 0);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
sVertical->setCollapsible(1, false);
#endif

View File

@ -8,12 +8,12 @@
#include <QSizePolicy>
#include <QPainter>
#include "yacreader_global_gui.h"
#include "yacreader_global.h"
ComicsViewTransition::ComicsViewTransition(QWidget *parent)
: QWidget(parent)
{
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
setStyleSheet("QWidget {background:#FFFFFF}");
#else
setStyleSheet("QWidget {background:#2A2A2A}");
@ -24,7 +24,7 @@ void ComicsViewTransition::paintEvent(QPaintEvent *)
{
QPainter painter(this);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
painter.fillRect(0, 0, width(), height(), QColor("#FFFFFF"));
#else
painter.fillRect(0, 0, width(), height(), QColor("#2A2A2A"));

View File

@ -5,13 +5,15 @@
#include "folder.h"
#include "db_helper.h"
#include "qnaturalsorting.h"
#include "yacreader_global.h"
#include "yacreader_global_gui.h"
#include <QtGui>
#include <algorithm>
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
#include <QFileIconProvider>
QIcon finishedFolderIcon;
void drawMacOSXFinishedFolderIcon()
@ -134,7 +136,7 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
}
if (role == Qt::DecorationRole) {
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
if (item->data(FolderModel::Finished).toBool()) {
if (finishedFolderIcon.isNull()) {
drawMacOSXFinishedFolderIcon();

View File

@ -136,7 +136,7 @@ QIcon ReadingListItem::getIcon() const
if (parent->getId() == 0)
return list; // top level list
else
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
return QFileIconProvider().icon(QFileIconProvider::Folder);
#else
return folder; // sublist

View File

@ -1,9 +1,11 @@
#include "empty_container_info.h"
#include "yacreader_global.h"
EmptyContainerInfo::EmptyContainerInfo(QWidget *parent)
: QWidget(parent), iconLabel(new QLabel()), titleLabel(new QLabel())
{
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
backgroundColor = "#FFFFFF";
titleLabel->setStyleSheet("QLabel {color:#888888; font-size:24px;font-family:Arial;font-weight:bold;}");
#else

View File

@ -1,5 +1,7 @@
#include "empty_folder_widget.h"
#include "yacreader_global.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QListView>
@ -77,7 +79,7 @@ EmptyFolderWidget::EmptyFolderWidget(QWidget *parent)
foldersView = new QListView();
foldersView->setAttribute(Qt::WA_MacShowFocusRect, false);
foldersView->setItemDelegate(new ListviewDelegate);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
foldersView->setStyleSheet("QListView {background-color:transparent; border: none; color:#959595; outline:0; font-size: 18px; show-decoration-selected: 0; margin:0}"
"QListView::item:selected {background-color: #EFEFEF; color:#CCCCCC;}"
"QListView::item:hover {background-color:#F4F4F8; color:#757575; }"

View File

@ -2,6 +2,7 @@
#include "folder_model.h"
#include "grid_comics_view.h"
#include "yacreader_global.h"
#include "yacreader_global_gui.h"
#include "yacreader_tool_bar_stretch.h"
@ -77,7 +78,7 @@ FolderContentView::FolderContentView(QAction *toogleRecentVisibilityAction, QWid
QQmlContext *ctxt = view->rootContext();
LibraryUITheme theme;
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
theme = Light;
#else
theme = Dark;

View File

@ -30,7 +30,7 @@ GridComicsView::GridComicsView(QWidget *parent)
QQmlContext *ctxt = view->rootContext();
LibraryUITheme theme;
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
theme = Light;
#else
theme = Dark;
@ -44,6 +44,7 @@ GridComicsView::GridComicsView(QWidget *parent)
ctxt->setContextProperty("borderColor", "#DBDBDB");
ctxt->setContextProperty("titleColor", "#121212");
ctxt->setContextProperty("textColor", "#636363");
ctxt->setContextProperty("showDropShadow", QVariant(false));
// fonts settings
ctxt->setContextProperty("fontSize", 11);
ctxt->setContextProperty("fontFamily", QApplication::font().family());
@ -66,15 +67,17 @@ GridComicsView::GridComicsView(QWidget *parent)
ctxt->setContextProperty("readTickUncheckedColor", "#DEDEDE");
ctxt->setContextProperty("readTickCheckedColor", "#E84852");
ctxt->setContextProperty("currentComicBackgroundColor", "#88FFFFFF");
} else {
ctxt->setContextProperty("backgroundColor", "#2A2A2A");
ctxt->setContextProperty("cellColor", "#212121");
ctxt->setContextProperty("selectedColor", "#121212");
ctxt->setContextProperty("selectedBorderColor", "#121212");
ctxt->setContextProperty("selectedBorderColor", "#FFCC00");
ctxt->setContextProperty("borderColor", "#121212");
ctxt->setContextProperty("titleColor", "#FFFFFF");
ctxt->setContextProperty("textColor", "#A8A8A8");
ctxt->setContextProperty("dropShadow", QVariant(false));
ctxt->setContextProperty("showDropShadow", QVariant(true));
// fonts settings
int fontSize = QApplication::font().pointSize();
if (fontSize == -1)
@ -100,14 +103,10 @@ GridComicsView::GridComicsView(QWidget *parent)
ctxt->setContextProperty("readTickUncheckedColor", "#1C1C1C");
ctxt->setContextProperty("readTickCheckedColor", "#E84852");
ctxt->setContextProperty("currentComicBackgroundColor", "#88000000");
}
#ifdef Q_OS_MAC
#else
#endif
ctxt->setContextProperty("backgroundImage", QUrl());
ctxt->setContextProperty("backgroundBlurOpacity", 0.0);
ctxt->setContextProperty("backgroundBlurRadius", 0.0);
@ -284,7 +283,7 @@ void GridComicsView::updateBackgroundConfig()
ctxt->setContextProperty("backgroundBlurVisible", QVariant(false));
}
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
ctxt->setContextProperty("cellColor", useBackgroundImage ? "#99FFFFFF" : "#FFFFFF");
ctxt->setContextProperty("selectedColor", "#FFFFFF");
#else

View File

@ -1,5 +1,7 @@
#include "info_comics_view.h"
#include "yacreader_global.h"
#include <QtQuick>
#include <QQuickWidget>
@ -21,7 +23,7 @@ InfoComicsView::InfoComicsView(QWidget *parent)
QQmlContext *ctxt = view->rootContext();
LibraryUITheme theme;
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
theme = Light;
#else
theme = Dark;
@ -44,6 +46,8 @@ InfoComicsView::InfoComicsView(QWidget *parent)
ctxt->setContextProperty("readTickUncheckedColor", "#DEDEDE");
ctxt->setContextProperty("readTickCheckedColor", "#E84852");
ctxt->setContextProperty("showDropShadow", QVariant(false));
} else {
ctxt->setContextProperty("infoBackgroundColor", "#2E2E2E");
ctxt->setContextProperty("topShadow", "info-top-shadow.png");
@ -61,6 +65,8 @@ InfoComicsView::InfoComicsView(QWidget *parent)
ctxt->setContextProperty("readTickUncheckedColor", "#1C1C1C");
ctxt->setContextProperty("readTickCheckedColor", "#E84852");
ctxt->setContextProperty("showDropShadow", QVariant(true));
}
ctxt->setContextProperty("backgroundImage", QUrl());

View File

@ -1,5 +1,6 @@
#include "library_window.h"
#include "folder_item.h"
#include "yacreader_global.h"
#include <QHBoxLayout>
#include <QSplitter>
@ -20,8 +21,8 @@
#include <thread>
#include <future>
#include "folder_item.h"
#include "data_base_management.h"
#include "yacreader_global.h"
#include "no_libraries_widget.h"
#include "import_widget.h"
@ -226,7 +227,7 @@ void LibraryWindow::doLayout()
{
// LAYOUT ELEMENTS------------------------------------------------------------
auto sHorizontal = new QSplitter(Qt::Horizontal); // spliter principal
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
sHorizontal->setStyleSheet("QSplitter::handle{image:none;background-color:#B8B8B8;} QSplitter::handle:vertical {height:1px;}");
#else
sHorizontal->setStyleSheet("QSplitter::handle:vertical {height:4px;}");
@ -237,7 +238,7 @@ void LibraryWindow::doLayout()
editInfoToolBar = new QToolBar();
editInfoToolBar->setStyleSheet("QToolBar {border: none;}");
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
libraryToolBar = new YACReaderMacOSXToolbar(this);
#else
libraryToolBar = new YACReaderMainToolBar(this);
@ -245,7 +246,7 @@ void LibraryWindow::doLayout()
// FOLDERS FILTER-------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
// in MacOSX the searchEdit is created using the toolbar wrapper
searchEdit = new YACReaderSearchLineEdit();
#endif
@ -286,7 +287,7 @@ void LibraryWindow::doLayout()
contentViewsManager = new YACReaderContentViewsManager(settings, this);
sHorizontal->addWidget(sideBar);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
QVBoxLayout *rightLayout = new QVBoxLayout;
rightLayout->addWidget(libraryToolBar);
rightLayout->addWidget(contentViewsManager->containerWidget());
@ -321,7 +322,7 @@ void LibraryWindow::doLayout()
connect(noLibrariesWidget, &NoLibrariesWidget::addExistingLibrary, this, &LibraryWindow::showAddLibrary);
// collapsible disabled in macosx (only temporaly)
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
sHorizontal->setCollapsible(0, false);
#endif
}
@ -445,7 +446,7 @@ void LibraryWindow::setUpShortcutsManagement()
<< showHideMarksAction
<< toogleShowRecentIndicatorAction
#ifndef Q_OS_MAC
<< toggleFullScreenAction
<< toggleFullScreenAction // Think about what to do in macos if the default theme is used
#endif
<< toggleComicsViewAction);
@ -974,7 +975,7 @@ void LibraryWindow::disableAllActions()
void LibraryWindow::createToolBars()
{
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
// libraryToolBar->setIconSize(QSize(16,16)); //TODO make icon size dynamic
libraryToolBar->addAction(backAction);
@ -1010,7 +1011,9 @@ void LibraryWindow::createToolBars()
libraryToolBar->serverButton->setDefaultAction(serverConfigAction);
libraryToolBar->helpButton->setDefaultAction(helpAboutAction);
libraryToolBar->toggleComicsViewButton->setDefaultAction(toggleComicsViewAction);
#ifndef Q_OS_MAC
libraryToolBar->fullscreenButton->setDefaultAction(toggleFullScreenAction);
#endif
libraryToolBar->setSearchWidget(searchEdit);
#endif
@ -1096,7 +1099,7 @@ void LibraryWindow::createMenus()
selectedLibrary->addAction(importLibraryAction);
// MacOSX app menus
#ifdef Q_OS_MACX
#ifdef Q_OS_MAC
QMenuBar *menu = this->menuBar();
// about / preferences
// TODO
@ -1279,7 +1282,7 @@ void LibraryWindow::createConnections()
connect(optionsDialog, &YACReaderOptionsDialog::editShortcuts, editShortcutsDialog, &QWidget::show);
// Search filter
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
connect(searchEdit, &YACReaderMacOSXSearchLineEdit::filterChanged, this, &LibraryWindow::setSearchFilter);
#else
connect(searchEdit, &YACReaderSearchLineEdit::filterChanged, this, &LibraryWindow::setSearchFilter);
@ -2092,7 +2095,7 @@ void LibraryWindow::onAddComicsToLabel()
void LibraryWindow::setToolbarTitle(const QModelIndex &modelIndex)
{
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
if (!modelIndex.isValid())
libraryToolBar->setCurrentFolderName(selectedLibrary->currentText());
else
@ -2361,7 +2364,7 @@ void LibraryWindow::rename(QString newName) // TODO replace
selectedLibrary->renameCurrentLibrary(newName);
libraries.save();
renameLibraryDialog->close();
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
if (!foldersModelProxy->mapToSource(foldersView->currentIndex()).isValid())
libraryToolBar->setCurrentFolderName(selectedLibrary->currentText());
#endif
@ -2506,7 +2509,7 @@ void LibraryWindow::toNormal()
else
showNormal();
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
auto timer = new QTimer();
timer->setSingleShot(true);
timer->start();
@ -2826,7 +2829,7 @@ void LibraryWindow::showNoLibrariesWidget()
void LibraryWindow::showRootWidget()
{
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
libraryToolBar->setDisabled(false);
#endif
searchEdit->setEnabled(true);
@ -2837,7 +2840,7 @@ void LibraryWindow::showImportingWidget()
{
disableAllActions();
importWidget->clear();
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
libraryToolBar->setDisabled(true);
#endif
searchEdit->setDisabled(true);

View File

@ -6,6 +6,7 @@
#include <QModelIndex>
#include <QFileInfo>
#include "yacreader_global.h"
#include "yacreader_global_gui.h"
#include "yacreader_libraries.h"
@ -20,7 +21,7 @@
#include <future>
#include <memory>
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
#include "yacreader_macosx_toolbar.h"
#endif
@ -123,7 +124,7 @@ public:
QSize slideSizeW;
QSize slideSizeF;
// search filter
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
YACReaderMacOSXSearchLineEdit *searchEdit;
#else
YACReaderSearchLineEdit *searchEdit;
@ -249,7 +250,7 @@ public:
QAction *addToMenuAction;
QAction *addToFavoritesAction;
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
YACReaderMacOSXToolbar *libraryToolBar;
#else
YACReaderMainToolBar *libraryToolBar;

View File

@ -1,5 +1,7 @@
#include "no_search_results_widget.h"
#include "yacreader_global.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QPainter>
@ -7,7 +9,7 @@
NoSearchResultsWidget::NoSearchResultsWidget(QWidget *parent)
: QWidget(parent)
{
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
backgroundColor = "#FFFFFF";
#else
backgroundColor = "#2A2A2A";
@ -22,7 +24,7 @@ NoSearchResultsWidget::NoSearchResultsWidget(QWidget *parent)
titleLabel = new QLabel("No results");
titleLabel->setAlignment(Qt::AlignCenter);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
titleLabel->setStyleSheet("QLabel {color:#888888; font-size:24px;font-family:Arial;font-weight:bold;}");
#else
titleLabel->setStyleSheet("QLabel {color:#CCCCCC; font-size:24px;font-family:Arial;font-weight:bold;}");

View File

@ -126,7 +126,7 @@ Rectangle {
samples: 17
color: "#BB000000"
source: coverElement
visible: (Qt.platform.os === "osx") ? false : true;
visible: showDropShadow;
}
Image {

View File

@ -133,7 +133,7 @@ Rectangle {
//samples: 17
color: "#BB000000"
source: coverElement
visible: (Qt.platform.os === "osx") ? false : true;
visible: showDropShadow;
}
Image {

View File

@ -73,7 +73,7 @@ SplitView {
samples: 17
color: "#FF000000"
source: realCell
visible: (Qt.platform.os === "osx") ? false : true;
visible: showDropShadow;
}
Rectangle {
@ -134,7 +134,7 @@ SplitView {
rightMargin : commonBorder ? -commonBorderWidth : -rBorderwidth
}
border.color: (Qt.platform.os === "osx") ? selectedBorderColor : "#ffcc00"
border.color: selectedBorderColor
border.width: 3
opacity: (dummyValue || !dummyValue) && comicsSelectionHelper.isSelectedIndex(index) ? 1 : 0
@ -432,7 +432,7 @@ SplitView {
height: showCurrentComic ? 270 : 20
Rectangle {
color: (Qt.platform.os === "osx") ? "#88FFFFFF" : "#88000000"
color: currentComicBackgroundColor
id: currentComicVisualView
@ -468,7 +468,7 @@ SplitView {
samples: 17
color: "#FF000000"
source: currentCoverElement
visible: (Qt.platform.os === "osx") ? false : true;
visible: showDropShadow;
}
ColumnLayout
@ -678,7 +678,7 @@ SplitView {
samples: 17
color: "#AA000000"
source: readButton
visible: ((Qt.platform.os === "osx") ? false : true) && !readButton.pressed
visible: showDropShadow && !readButton.pressed
}
}
}

View File

@ -76,7 +76,7 @@ SplitView {
//samples: 17
color: "#FF000000"
source: realCell
visible: (Qt.platform.os === "osx") ? false : true;
visible: showDropShadow;
}
Rectangle {
@ -137,7 +137,7 @@ SplitView {
rightMargin : commonBorder ? -commonBorderWidth : -rBorderwidth
}
border.color: (Qt.platform.os === "osx") ? selectedBorderColor : "#ffcc00"
border.color: selectedBorderColor
border.width: 3
opacity: (dummyValue || !dummyValue) && comicsSelectionHelper.isSelectedIndex(index) ? 1 : 0
@ -435,7 +435,7 @@ SplitView {
height: showCurrentComic ? 270 : 20
Rectangle {
color: (Qt.platform.os === "osx") ? "#88FFFFFF" : "#88000000"
color: currentComicBackgroundColor
id: currentComicVisualView
@ -472,7 +472,7 @@ SplitView {
//samples: 17
color: "#FF000000"
source: currentCoverElement
visible: (Qt.platform.os === "osx") ? false : true;
visible: showDropShadow;
}
ColumnLayout
@ -686,7 +686,7 @@ SplitView {
//samples: 17
color: "#AA000000"
source: readButton
visible: ((Qt.platform.os === "osx") ? false : true) && !readButton.pressed
visible: showDropShadow && !readButton.pressed
}
}
}

View File

@ -1,5 +1,7 @@
#include "yacreader_content_views_manager.h"
#include "yacreader_global.h"
#include "library_window.h"
#include "classic_comics_view.h"
@ -212,7 +214,7 @@ void YACReaderContentViewsManager::_toggleComicsView()
QIcon icoViewsButton;
icoViewsButton.addFile(addExtensionToIconPath(":/images/main_toolbar/info"), QSize(), QIcon::Normal);
libraryWindow->toggleComicsViewAction->setIcon(icoViewsButton);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
libraryWindow->libraryToolBar->updateViewSelectorIcon(icoViewsButton);
#endif
if (gridComicsView == nullptr)
@ -229,7 +231,7 @@ void YACReaderContentViewsManager::_toggleComicsView()
QIcon icoViewsButton;
icoViewsButton.addFile(addExtensionToIconPath(":/images/main_toolbar/flow"), QSize(), QIcon::Normal);
libraryWindow->toggleComicsViewAction->setIcon(icoViewsButton);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
libraryWindow->libraryToolBar->updateViewSelectorIcon(icoViewsButton);
#endif
if (infoComicsView == nullptr)
@ -245,7 +247,7 @@ void YACReaderContentViewsManager::_toggleComicsView()
QIcon icoViewsButton;
icoViewsButton.addFile(addExtensionToIconPath(":/images/main_toolbar/grid"), QSize(), QIcon::Normal);
libraryWindow->toggleComicsViewAction->setIcon(icoViewsButton);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
libraryWindow->libraryToolBar->updateViewSelectorIcon(icoViewsButton);
#endif
if (classicComicsView == nullptr)

View File

@ -1,5 +1,7 @@
#include "yacreader_folders_view.h"
#include "yacreader_global.h"
#include "folder_item.h"
#include "folder_model.h"
@ -80,7 +82,7 @@ void YACReaderFoldersViewItemDeletegate::paint(QPainter *painter, const QStyleOp
{
if (!index.data(FolderModel::CompletedRole).toBool()) {
painter->save();
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
painter->setBrush(QBrush(QColor(85, 95, 127)));
#else
painter->setBrush(QBrush(QColor(237, 197, 24)));
@ -103,7 +105,7 @@ void YACReaderFoldersViewItemDeletegate::paint(QPainter *painter, const QStyleOp
if (now - added < daysInSeconds || now - updated < daysInSeconds) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
painter->setBrush(QBrush(QColor(85, 95, 127)));
#else
painter->setBrush(QBrush(QColor(237, 197, 24)));

View File

@ -71,7 +71,7 @@ QString YACReader::labelColorToRGBString(LabelColors color)
case YPink:
return "#FF9FDD";
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
case YWhite:
return "#E3E3E3";
#else

View File

@ -19,6 +19,10 @@
#define MAX_LIBRARIES_WARNING_NUM 10
#ifdef Q_OS_MAC
#define Y_MAC_UI
#endif
namespace YACReader {
enum YACReaderIPCMessages {

View File

@ -57,7 +57,7 @@ QList<qulonglong> YACReader::mimeDataToComicsIds(const QMimeData *data)
QString YACReader::addExtensionToIconPath(const QString &path)
{
#ifdef YACREADER_LIBRARY
#ifdef Q_OS_MAC
#ifdef Q_OS_MAC // TODO_Y_MAC_UI
return path + ".png";
#else
return path + ".svg";

View File

@ -1,5 +1,6 @@
#include "yacreader_library_item_widget.h"
#include "yacreader_global.h"
#include "yacreader_global_gui.h"
#include <QHBoxLayout>
@ -56,7 +57,7 @@ YACReaderLibraryItemWidget::YACReaderLibraryItemWidget(QString n /*ame*/, QStrin
mainLayout->addWidget(down);*/
setLayout(mainLayout);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
QString styleSheet = "background-color:transparent; color:#DDDFDF;";
setStyleSheet(styleSheet);
#endif
@ -117,7 +118,7 @@ bool YACReaderLibraryItemWidget::eventFilter(QObject *object, QEvent *event){
void YACReaderLibraryItemWidget::deselect()
{
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
QString styleSheet = "background-color:transparent;";
setStyleSheet(styleSheet);
#else
@ -137,7 +138,7 @@ void YACReaderLibraryItemWidget::deselect()
void YACReaderLibraryItemWidget::select()
{
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
// QString styleSheet ="color: white; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6BAFE4, stop: 1 #3984D2); border-top: 2px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5EA3DF, stop: 1 #73B8EA); border-left:none;border-right:none;border-bottom:1px solid #3577C2;";
QString styleSheet = "color: white; background-color:#91c4f4; border-bottom:1px solid #91c4f4;";
#else

View File

@ -1,4 +1,6 @@
#include "yacreader_search_line_edit.h"
#include "yacreader_global.h"
#include "yacreader_global_gui.h"
#include <QToolButton>
@ -13,7 +15,7 @@ YACReaderSearchLineEdit::YACReaderSearchLineEdit(QWidget *parent)
clearButton = new QToolButton(this);
searchLabel = new QLabel(this);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
QPixmap clearIcon;
QPixmap searchIcon;
@ -41,7 +43,7 @@ YACReaderSearchLineEdit::YACReaderSearchLineEdit(QWidget *parent)
clearButton->setIcon(QIcon(clearIcon));
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
clearButton->setIconSize(QSize(14, 14));
#else
clearButton->setIconSize(QSize(12, 12));
@ -53,7 +55,7 @@ YACReaderSearchLineEdit::YACReaderSearchLineEdit(QWidget *parent)
connect(clearButton, &QAbstractButton::clicked, this, &QLineEdit::clear);
connect(this, &QLineEdit::textChanged, this, &YACReaderSearchLineEdit::updateCloseButton);
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
setStyleSheet(QString("QLineEdit {border-top:1px solid #9F9F9F; border-bottom:1px solid #ACACAC; border-right:1px solid #ACACAC; border-left:1px solid #ACACAC; border-radius: 4px; background-color:#EEEEEE; padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-bottom: 1px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6).arg(clearButton->sizeHint().width() + frameWidth + 2));
#else
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));
@ -62,7 +64,7 @@ YACReaderSearchLineEdit::YACReaderSearchLineEdit(QWidget *parent)
setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
setMaximumWidth(212);
setFixedHeight(26);
#else
@ -90,7 +92,7 @@ const QString YACReaderSearchLineEdit::text()
void YACReaderSearchLineEdit::resizeEvent(QResizeEvent *)
{
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
QSize sz = clearButton->sizeHint();
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
clearButton->move(rect().right() - frameWidth - sz.width(),

View File

@ -8,6 +8,8 @@
#include "yacreader_library_list_widget.h"
#include "yacreader_search_line_edit.h"
#include "yacreader_titled_toolbar.h"
#include "yacreader_global.h"
#include "yacreader_global_gui.h"
YACReaderSideBar::YACReaderSideBar(QWidget *parent)
@ -23,7 +25,7 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
readingListsView = new YACReaderReadingListsView;
selectedLibrary = new YACReaderLibraryListWidget;
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
librariesTitle = new YACReaderTitledToolBar(tr("Libraries"));
foldersTitle = new YACReaderTitledToolBar(tr("Folders"));
readingListsTitle = new YACReaderTitledToolBar(tr("Reading Lists"));
@ -36,7 +38,7 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
splitter = new QSplitter(this);
splitter->setOrientation(Qt::Vertical);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
splitter->setStyleSheet("QSplitter::handle { "
" image: none; background-color = black; "
" }"
@ -55,20 +57,20 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
l->setContentsMargins(0, 0, 0, 0);
// LIBRARIES-------------------------------------------------------
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
l->addSpacing(5);
#endif
l->addWidget(librariesTitle);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
l->addSpacing(4);
l->addWidget(new YACReaderSideBarSeparator(this));
l->addSpacing(3);
#endif
l->addWidget(selectedLibrary);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
l->addSpacing(11);
#else
l->addSpacing(6);
@ -82,7 +84,7 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
foldersLayout->setContentsMargins(0, 0, 0, 0);
foldersLayout->setSpacing(0);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
// foldersLayout->addSpacing(6);
// foldersLayout->addSpacing(5);
@ -94,7 +96,7 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
foldersLayout->addWidget(foldersTitle);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
foldersLayout->addSpacing(4);
foldersLayout->addWidget(new YACReaderSideBarSeparator(this));
foldersLayout->addSpacing(4);
@ -114,7 +116,7 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
readingListsHeaderLayout->setContentsMargins(0, 0, 0, 0);
readingListsHeaderLayout->setSpacing(0);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
// readingListsHeaderLayout->addSpacing(6);
// readingListsHeaderLayout->addSpacing(5);
@ -126,7 +128,7 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
readingListsHeaderLayout->addWidget(readingListsTitle);
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
readingListsHeaderLayout->addSpacing(4);
readingListsHeaderLayout->addWidget(new YACReaderSideBarSeparator(this));
readingListsHeaderLayout->addSpacing(4);
@ -152,7 +154,7 @@ void YACReaderSideBar::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
QPainter painter(this);
painter.fillRect(0, 0, width(), height(), QColor("#F1F1F1"));

View File

@ -1,5 +1,8 @@
#include "yacreader_table_view.h"
#include "yacreader_global.h"
#include "yacreader_global_gui.h"
#include <QHeaderView>
#include <QResizeEvent>
#include <QPropertyAnimation>
@ -13,7 +16,6 @@
#include "QsLog.h"
#include "comic_item.h"
#include "yacreader_global_gui.h"
YACReaderTableView::YACReaderTableView(QWidget *parent)
: QTableView(parent), showDelete(false), editing(false), myeditor(0)
@ -24,7 +26,7 @@ YACReaderTableView::YACReaderTableView(QWidget *parent)
"QTableCornerButton::section {background-color:#F5F5F5; border:none; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4);}"
"QTableView::item {outline: 0px; border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE; padding-bottom:1px; color:#252626;}"
"QTableView {border-top:1px solid #B8B8B8;border-bottom:none;border-left:1px solid #B8B8B8;border-right:none;}"
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
"QTableView {border-top:1px solid #B8B8B8;border-bottom:none;border-left:none;border-right:none;}"
"QTableView::item:selected {outline: 0px; border-bottom: 1px solid #3875D7;border-top: 1px solid #3875D7; padding-bottom:1px; background-color: #3875D7; color: #FFFFFF; }"

View File

@ -1,5 +1,7 @@
#include "yacreader_titled_toolbar.h"
#include "yacreader_global.h"
#include <QAction>
#include <QHBoxLayout>
#include <QLabel>
@ -40,7 +42,7 @@ void DropShadowLabel::paintEvent(QPaintEvent *event)
QPainter painter(this);
painter.setFont(font());
#ifndef Q_OS_MAC
#ifndef Y_MAC_UI
drawTextEffect(&painter, QPoint(contentsMargins().left(), 1));
#endif
drawText(&painter, QPoint(contentsMargins().left(), 0));
@ -68,7 +70,7 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString &title, QWidget *pa
nameLabel = new DropShadowLabel(this);
nameLabel->setText(title);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
nameLabel->setColor(QColor("#808080"));
// nameLabel->setDropShadowColor(QColor("#F9FAFB"));
@ -94,7 +96,7 @@ void YACReaderTitledToolBar::addAction(QAction *action)
QHBoxLayout *mainLayout = dynamic_cast<QHBoxLayout *>(layout());
// fix for QToolButton and retina support in OSX
#ifdef Q_OS_MAC
#ifdef Q_OS_MAC // TODO_Y_MAC_UI
QPushButton *pb = new QPushButton(this);
pb->setCursor(QCursor(Qt::ArrowCursor));
pb->setIcon(action->icon());
@ -128,7 +130,7 @@ void YACReaderTitledToolBar::addSepartor()
QWidget *w = new QWidget(this);
w->setFixedSize(1, 14);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
w->setStyleSheet("QWidget {background-color:#AFAFAF;}");
#else
w->setStyleSheet("QWidget {background-color:#6F6F6F;}");

View File

@ -1,5 +1,7 @@
#include "yacreader_treeview.h"
#include "yacreader_global.h"
YACReaderTreeView::YACReaderTreeView(QWidget *parent)
: QTreeView(parent), clicking(false)
{
@ -18,7 +20,7 @@ YACReaderTreeView::YACReaderTreeView(QWidget *parent)
setSelectionBehavior(QAbstractItemView::SelectRows);
setAttribute(Qt::WA_MacShowFocusRect, false);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
setStyleSheet("QTreeView {background-color:transparent; border: none;}"
"QTreeView::item:selected {background-color:#91c4f4; border-top: 1px solid #91c4f4; border-left:none;border-right:none;border-bottom:1px solid #91c4f4;}"

View File

@ -1,5 +1,7 @@
#include "edit_shortcuts_dialog.h"
#include "yacreader_global.h"
#include "actions_groups_model.h"
#include "actions_shortcuts_model.h"
#include "edit_shortcut_item_delegate.h"
@ -61,7 +63,7 @@ EditShortcutsDialog::EditShortcutsDialog(QWidget *parent)
connect(actionsGroupsListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &EditShortcutsDialog::loadShortcuts); // clicked(QModelIndex) doesn't work :S
connect(actionsModel, &ActionsShortcutsModel::conflict, this, &EditShortcutsDialog::processConflict);
#ifdef Q_OS_MAC
#ifdef Y_MAC_UI
setFixedSize(760, 500);
#else
setFixedSize(804, 500); // extra width for modifiers