Replace Q_OS_MAC with Q_OS_MACOS

This commit is contained in:
Luis Ángel San Martín 2023-06-04 20:55:11 +02:00
parent 072f73b986
commit 68ece533e1
27 changed files with 67 additions and 67 deletions

View File

@ -84,7 +84,7 @@ BookmarksDialog::BookmarksDialog(QWidget *parent)
l->addWidget(new QLabel("<font color=\"#FFFFFF\">" + tr("Click on any image to go to the bookmark") + "</font>"), 0, Qt::AlignCenter); l->addWidget(new QLabel("<font color=\"#FFFFFF\">" + tr("Click on any image to go to the bookmark") + "</font>"), 0, Qt::AlignCenter);
l->addLayout(layout); l->addLayout(layout);
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
l->addLayout(buttons); l->addLayout(buttons);
#endif #endif

View File

@ -21,7 +21,7 @@ using namespace QsLogging;
#define new DEBUG_NEW #define new DEBUG_NEW
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
#include <QEvent> #include <QEvent>
#include <QFileOpenEvent> #include <QFileOpenEvent>
class YACReaderApplication : public QApplication class YACReaderApplication : public QApplication
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
YACReaderApplication app(argc, argv); YACReaderApplication app(argc, argv);
#else #else
QApplication app(argc, argv); QApplication app(argc, argv);
@ -178,7 +178,7 @@ int main(int argc, char *argv[])
logger.addDestination(std::move(fileDestination)); logger.addDestination(std::move(fileDestination));
QTranslator translator; QTranslator translator;
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
translator.load(QLocale(), "yacreader", "_", QString(DATADIR) + "/yacreader/languages"); translator.load(QLocale(), "yacreader", "_", QString(DATADIR) + "/yacreader/languages");
#else #else
translator.load(QLocale(), "yacreader", "_", "languages"); translator.load(QLocale(), "yacreader", "_", "languages");
@ -202,7 +202,7 @@ int main(int argc, char *argv[])
mwv->openComicFromPath(arglist.at(0)); mwv->openComicFromPath(arglist.at(0));
} }
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
app.setWindow(mwv); app.setWindow(mwv);
#endif #endif
mwv->show(); mwv->show();

View File

@ -187,7 +187,7 @@ void MainWindowViewer::createActions()
openAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_ACTION_Y)); openAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(OPEN_ACTION_Y));
connect(openAction, &QAction::triggered, this, QOverload<>::of(&MainWindowViewer::open)); connect(openAction, &QAction::triggered, this, QOverload<>::of(&MainWindowViewer::open));
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
newInstanceAction = new QAction(tr("New instance"), this); newInstanceAction = new QAction(tr("New instance"), this);
newInstanceAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEW_INSTANCE_ACTION_Y)); newInstanceAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(NEW_INSTANCE_ACTION_Y));
connect(newInstanceAction, &QAction::triggered, connect(newInstanceAction, &QAction::triggered,
@ -624,7 +624,7 @@ void MainWindowViewer::createToolBars()
viewer->setContextMenuPolicy(Qt::ActionsContextMenu); viewer->setContextMenuPolicy(Qt::ActionsContextMenu);
// MacOSX app menus // MacOSX app menus
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
auto menuBar = this->menuBar(); auto menuBar = this->menuBar();
// about / preferences // about / preferences
// TODO // TODO
@ -939,7 +939,7 @@ void MainWindowViewer::saveImage()
void MainWindowViewer::enableActions() void MainWindowViewer::enableActions()
{ {
setActionsEnabled(true); setActionsEnabled(true);
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
activateWindow(); activateWindow();
raise(); raise();
#endif #endif
@ -1158,7 +1158,7 @@ void MainWindowViewer::setUpShortcutsManagement()
<< toggleFullScreenAction << toggleFullScreenAction
<< toggleToolbarsAction << toggleToolbarsAction
<< showEditShortcutsAction << showEditShortcutsAction
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
<< newInstanceAction << newInstanceAction
#endif #endif
); );

View File

@ -111,7 +111,7 @@ private:
//! Actions //! Actions
QAction *openAction; QAction *openAction;
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QAction *newInstanceAction; // needed in macos QAction *newInstanceAction; // needed in macos
#endif #endif
QAction *openFolderAction; QAction *openFolderAction;

View File

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

View File

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

View File

@ -26,7 +26,7 @@ void InitialComicInfoExtractor::extract()
} }
#ifndef NO_PDF #ifndef NO_PDF
if (fi.suffix().compare("pdf", Qt::CaseInsensitive) == 0) { if (fi.suffix().compare("pdf", Qt::CaseInsensitive) == 0) {
#if defined Q_OS_MAC && defined USE_PDFKIT #if defined Q_OS_MACOS && defined USE_PDFKIT
auto pdfComic = std::make_unique<MacOSXPDFComic>(); auto pdfComic = std::make_unique<MacOSXPDFComic>();
if (!pdfComic->openComic(_fileSource)) { if (!pdfComic->openComic(_fileSource)) {
return; return;
@ -57,7 +57,7 @@ void InitialComicInfoExtractor::extract()
#endif #endif
_numPages = pdfComic->numPages(); _numPages = pdfComic->numPages();
if (_numPages >= _coverPage) { if (_numPages >= _coverPage) {
#if defined Q_OS_MAC || defined USE_PDFIUM #if defined Q_OS_MACOS || defined USE_PDFIUM
QImage p = pdfComic->getPage(_coverPage - 1); // TODO check if the page is valid QImage p = pdfComic->getPage(_coverPage - 1); // TODO check if the page is valid
#else #else
QImage p = pdfComic->page(_coverPage - 1)->renderToImage(72, 72); QImage p = pdfComic->page(_coverPage - 1)->renderToImage(72, 72);

View File

@ -18,7 +18,7 @@ bool YACReader::openComic(const ComicDB &comic,
labelParam = QString("--readingListId=%1").arg(source.sourceId); labelParam = QString("--readingListId=%1").arg(source.sourceId);
} }
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOSOS
QStringList possiblePaths { QDir::cleanPath(QCoreApplication::applicationDirPath() + "/../../../") }; QStringList possiblePaths { QDir::cleanPath(QCoreApplication::applicationDirPath() + "/../../../") };
possiblePaths += QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation); possiblePaths += QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
@ -38,7 +38,7 @@ bool YACReader::openComic(const ComicDB &comic,
yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath() + "/YACReader.exe"), parameters); yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath() + "/YACReader.exe"), parameters);
#endif #endif
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
QStringList parameters { path, QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId), labelParam }; QStringList parameters { path, QString("--comicId=%1").arg(comic.id), QString("--libraryId=%1").arg(libraryId), labelParam };
yacreaderFound = QProcess::startDetached(QStringLiteral("YACReader"), parameters); yacreaderFound = QProcess::startDetached(QStringLiteral("YACReader"), parameters);
#endif #endif

View File

@ -110,7 +110,7 @@ void LibraryCreator::run()
stopRunning = false; stopRunning = false;
#if !defined use_unarr && !defined use_libarchive #if !defined use_unarr && !defined use_libarchive
// check for 7z lib // check for 7z lib
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
QLibrary *sevenzLib = new QLibrary(QString(LIBDIR) + "/p7zip/7z.so"); QLibrary *sevenzLib = new QLibrary(QString(LIBDIR) + "/p7zip/7z.so");
#else #else
QLibrary *sevenzLib = new QLibrary(QCoreApplication::applicationDirPath() + "/utils/7z"); QLibrary *sevenzLib = new QLibrary(QCoreApplication::applicationDirPath() + "/utils/7z");
@ -255,7 +255,7 @@ void LibraryCreator::create(QDir dir)
return; return;
QFileInfo fileInfo = list.at(i); QFileInfo fileInfo = list.at(i);
QString fileName = fileInfo.fileName(); QString fileName = fileInfo.fileName();
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QStringList src = _source.split("/"); QStringList src = _source.split("/");
QString filePath = fileInfo.absoluteFilePath(); QString filePath = fileInfo.absoluteFilePath();
QStringList fp = filePath.split("/"); QStringList fp = filePath.split("/");
@ -410,7 +410,7 @@ void LibraryCreator::update(QDir dirS)
QFileInfo fileInfoS = listS.at(i); QFileInfo fileInfoS = listS.at(i);
if (fileInfoS.isDir()) // create folder if (fileInfoS.isDir()) // create folder
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QStringList src = _source.split("/"); QStringList src = _source.split("/");
QString filePath = fileInfoS.absoluteFilePath(); QString filePath = fileInfoS.absoluteFilePath();
QStringList fp = filePath.split("/"); QStringList fp = filePath.split("/");
@ -426,7 +426,7 @@ void LibraryCreator::update(QDir dirS)
_currentPathFolders.pop_back(); _currentPathFolders.pop_back();
} else // create comic } else // create comic
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QStringList src = _source.split("/"); QStringList src = _source.split("/");
QString filePath = fileInfoS.absoluteFilePath(); QString filePath = fileInfoS.absoluteFilePath();
QStringList fp = filePath.split("/"); QStringList fp = filePath.split("/");
@ -463,7 +463,7 @@ void LibraryCreator::update(QDir dirS)
if (nameS != "/.yacreaderlibrary") { if (nameS != "/.yacreaderlibrary") {
// QLOG_WARN() << "dir source < dest" << nameS << nameD; // QLOG_WARN() << "dir source < dest" << nameS << nameD;
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QStringList src = _source.split("/"); QStringList src = _source.split("/");
QString filePath = fileInfoS.absoluteFilePath(); QString filePath = fileInfoS.absoluteFilePath();
QStringList fp = filePath.split("/"); QStringList fp = filePath.split("/");
@ -494,7 +494,7 @@ void LibraryCreator::update(QDir dirS)
if (nameS != "/.yacreaderlibrary") // skip .yacreaderlibrary folder if (nameS != "/.yacreaderlibrary") // skip .yacreaderlibrary folder
{ {
// QLOG_WARN() << "one of them(or both) is a file" << nameS << nameD; // QLOG_WARN() << "one of them(or both) is a file" << nameS << nameD;
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QStringList src = _source.split("/"); QStringList src = _source.split("/");
QString filePath = fileInfoS.absoluteFilePath(); QString filePath = fileInfoS.absoluteFilePath();
QStringList fp = filePath.split("/"); QStringList fp = filePath.split("/");
@ -520,7 +520,7 @@ void LibraryCreator::update(QDir dirS)
int comparation = QString::localeAwareCompare(nameS, nameD); int comparation = QString::localeAwareCompare(nameS, nameD);
if (comparation < 0) // create new thumbnail if (comparation < 0) // create new thumbnail
{ {
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QStringList src = _source.split("/"); QStringList src = _source.split("/");
QString filePath = fileInfoS.absoluteFilePath(); QString filePath = fileInfoS.absoluteFilePath();
QStringList fp = filePath.split("/"); QStringList fp = filePath.split("/");
@ -547,7 +547,7 @@ void LibraryCreator::update(QDir dirS)
// copy metadata to avoid loosing it if the imported comics doesn't have it. // copy metadata to avoid loosing it if the imported comics doesn't have it.
// DBHelper::removeFromDB(fileInfoD, _database); // DBHelper::removeFromDB(fileInfoD, _database);
// #ifdef Q_OS_MAC // #ifdef Q_OS_MACOS
// QStringList src = _source.split("/"); // QStringList src = _source.split("/");
// QString filePath = fileInfoS.absoluteFilePath(); // QString filePath = fileInfoS.absoluteFilePath();
// QStringList fp = filePath.split("/"); // QStringList fp = filePath.split("/");

View File

@ -447,7 +447,7 @@ void LibraryWindow::setUpShortcutsManagement()
tmpList = QList<QAction *>() tmpList = QList<QAction *>()
<< showHideMarksAction << showHideMarksAction
<< toogleShowRecentIndicatorAction << toogleShowRecentIndicatorAction
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
<< toggleFullScreenAction // Think about what to do in macos if the default theme is used << toggleFullScreenAction // Think about what to do in macos if the default theme is used
#endif #endif
<< toggleComicsViewAction); << toggleComicsViewAction);
@ -623,7 +623,7 @@ void LibraryWindow::createActions()
toogleShowRecentIndicatorAction->setIcon(QIcon(":/images/comics_view_toolbar/showRecentIndicator.svg")); toogleShowRecentIndicatorAction->setIcon(QIcon(":/images/comics_view_toolbar/showRecentIndicator.svg"));
toogleShowRecentIndicatorAction->setChecked(settings->value(DISPLAY_RECENTLY_INDICATOR, true).toBool()); toogleShowRecentIndicatorAction->setChecked(settings->value(DISPLAY_RECENTLY_INDICATOR, true).toBool());
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"), this); toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"), this);
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);
@ -896,7 +896,7 @@ void LibraryWindow::createActions()
this->addAction(setFolderAsYonkomaAction); this->addAction(setFolderAsYonkomaAction);
this->addAction(deleteMetadataAction); this->addAction(deleteMetadataAction);
this->addAction(rescanXMLFromCurrentFolderAction); this->addAction(rescanXMLFromCurrentFolderAction);
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
this->addAction(toggleFullScreenAction); this->addAction(toggleFullScreenAction);
#endif #endif
@ -906,7 +906,7 @@ void LibraryWindow::createActions()
void LibraryWindow::disableComicsActions(bool disabled) void LibraryWindow::disableComicsActions(bool disabled)
{ {
// if there aren't comics, no fullscreen option will be available // if there aren't comics, no fullscreen option will be available
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
toggleFullScreenAction->setDisabled(disabled); toggleFullScreenAction->setDisabled(disabled);
#endif #endif
// edit toolbar // edit toolbar
@ -1013,7 +1013,7 @@ void LibraryWindow::createToolBars()
libraryToolBar->serverButton->setDefaultAction(serverConfigAction); libraryToolBar->serverButton->setDefaultAction(serverConfigAction);
libraryToolBar->helpButton->setDefaultAction(helpAboutAction); libraryToolBar->helpButton->setDefaultAction(helpAboutAction);
libraryToolBar->toggleComicsViewButton->setDefaultAction(toggleComicsViewAction); libraryToolBar->toggleComicsViewButton->setDefaultAction(toggleComicsViewAction);
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
libraryToolBar->fullscreenButton->setDefaultAction(toggleFullScreenAction); libraryToolBar->fullscreenButton->setDefaultAction(toggleFullScreenAction);
#endif #endif
libraryToolBar->setSearchWidget(searchEdit); libraryToolBar->setSearchWidget(searchEdit);
@ -1101,7 +1101,7 @@ void LibraryWindow::createMenus()
selectedLibrary->addAction(importLibraryAction); selectedLibrary->addAction(importLibraryAction);
// MacOSX app menus // MacOSX app menus
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QMenuBar *menu = this->menuBar(); QMenuBar *menu = this->menuBar();
// about / preferences // about / preferences
// TODO // TODO
@ -1272,7 +1272,7 @@ void LibraryWindow::createConnections()
connect(setRootIndexAction, &QAction::triggered, this, &LibraryWindow::setRootIndex); connect(setRootIndexAction, &QAction::triggered, this, &LibraryWindow::setRootIndex);
connect(expandAllNodesAction, &QAction::triggered, foldersView, &QTreeView::expandAll); connect(expandAllNodesAction, &QAction::triggered, foldersView, &QTreeView::expandAll);
connect(colapseAllNodesAction, &QAction::triggered, foldersView, &QTreeView::collapseAll); connect(colapseAllNodesAction, &QAction::triggered, foldersView, &QTreeView::collapseAll);
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
connect(toggleFullScreenAction, &QAction::triggered, this, &LibraryWindow::toggleFullScreen); connect(toggleFullScreenAction, &QAction::triggered, this, &LibraryWindow::toggleFullScreen);
#endif #endif
connect(toggleComicsViewAction, &QAction::triggered, contentViewsManager, &YACReaderContentViewsManager::toggleComicsView); connect(toggleComicsViewAction, &QAction::triggered, contentViewsManager, &YACReaderContentViewsManager::toggleComicsView);
@ -1447,7 +1447,7 @@ void LibraryWindow::loadLibrary(const QString &name)
rescanLibraryForXMLInfoAction->setDisabled(true); rescanLibraryForXMLInfoAction->setDisabled(true);
disableComicsActions(true); disableComicsActions(true);
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
toggleFullScreenAction->setEnabled(true); toggleFullScreenAction->setEnabled(true);
#endif #endif
@ -1886,7 +1886,7 @@ void LibraryWindow::showComicsViewContextMenu(const QPoint &point)
QMenu subMenu; QMenu subMenu;
setupAddToSubmenu(subMenu); setupAddToSubmenu(subMenu);
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
menu.addSeparator(); menu.addSeparator();
menu.addAction(toggleFullScreenAction); menu.addAction(toggleFullScreenAction);
#endif #endif
@ -2155,7 +2155,7 @@ void LibraryWindow::checkEmptyFolder()
disableComicsActions(false); disableComicsActions(false);
} else { } else {
disableComicsActions(true); disableComicsActions(true);
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
if (comicsModel->rowCount() > 0) if (comicsModel->rowCount() > 0)
toggleFullScreenAction->setEnabled(true); toggleFullScreenAction->setEnabled(true);
#endif #endif
@ -2685,12 +2685,12 @@ void LibraryWindow::openContainingFolderComic()
{ {
QModelIndex modelIndex = contentViewsManager->comicsView->currentIndex(); QModelIndex modelIndex = contentViewsManager->comicsView->currentIndex();
QFileInfo file(QDir::cleanPath(currentPath() + comicsModel->getComicPath(modelIndex))); QFileInfo file(QDir::cleanPath(currentPath() + comicsModel->getComicPath(modelIndex)));
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
QString path = file.absolutePath(); QString path = file.absolutePath();
QDesktopServices::openUrl(QUrl("file:///" + path, QUrl::TolerantMode)); QDesktopServices::openUrl(QUrl("file:///" + path, QUrl::TolerantMode));
#endif #endif
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
QString filePath = file.absoluteFilePath(); QString filePath = file.absoluteFilePath();
QStringList args; QStringList args;
args << "-e"; args << "-e";

View File

@ -175,7 +175,7 @@ public:
QAction *removeLibraryAction; QAction *removeLibraryAction;
QAction *helpAboutAction; QAction *helpAboutAction;
QAction *renameLibraryAction; QAction *renameLibraryAction;
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
QAction *toggleFullScreenAction; QAction *toggleFullScreenAction;
#endif #endif
QAction *optionsAction; QAction *optionsAction;

View File

@ -21,7 +21,7 @@
#include "yacreader_libraries.h" #include "yacreader_libraries.h"
#include "exit_check.h" #include "exit_check.h"
#include "opengl_checker.h" #include "opengl_checker.h"
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOSOS
#include "trayhandler.h" #include "trayhandler.h"
#endif #endif
@ -44,7 +44,7 @@ void logSystemAndConfig()
#if !defined use_unarr && !defined use_libarchive #if !defined use_unarr && !defined use_libarchive
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if (QLibrary::isLibrary(QApplication::applicationDirPath() + "/utils/7z.dll")) if (QLibrary::isLibrary(QApplication::applicationDirPath() + "/utils/7z.dll"))
#elif defined Q_OS_UNIX && !defined Q_OS_MAC #elif defined Q_OS_UNIX && !defined Q_OS_MACOS
if (QLibrary::isLibrary(QString(LIBDIR) + "/yacreader/7z.so") | QLibrary::isLibrary(QString(LIBDIR) + "/p7zip/7z.so")) if (QLibrary::isLibrary(QString(LIBDIR) + "/yacreader/7z.so") | QLibrary::isLibrary(QString(LIBDIR) + "/p7zip/7z.so"))
#else #else
if (QLibrary::isLibrary(QApplication::applicationDirPath() + "/utils/7z.so")) if (QLibrary::isLibrary(QApplication::applicationDirPath() + "/utils/7z.so"))
@ -58,7 +58,7 @@ void logSystemAndConfig()
QLOG_INFO() << "using unarr decompression backend"; QLOG_INFO() << "using unarr decompression backend";
#endif // use_unarr #endif // use_unarr
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
if (QFileInfo(QString(BINDIR) + "/qrencode").exists()) if (QFileInfo(QString(BINDIR) + "/qrencode").exists())
#else #else
if (QFileInfo(QApplication::applicationDirPath() + "/utils/qrencode.exe").exists() || QFileInfo("./util/qrencode").exists()) if (QFileInfo(QApplication::applicationDirPath() + "/utils/qrencode.exe").exists() || QFileInfo("./util/qrencode").exists())
@ -169,7 +169,7 @@ int main(int argc, char **argv)
logger.addDestination(std::move(fileDestination)); logger.addDestination(std::move(fileDestination));
QTranslator translator; QTranslator translator;
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
translator.load(QLocale(), "yacreaderlibrary", "_", QString(DATADIR) + "/yacreader/languages"); translator.load(QLocale(), "yacreaderlibrary", "_", QString(DATADIR) + "/yacreader/languages");
#else #else
translator.load(QLocale(), "yacreaderlibrary", "_", "languages"); translator.load(QLocale(), "yacreaderlibrary", "_", "languages");
@ -177,7 +177,7 @@ int main(int argc, char **argv)
app.installTranslator(&translator); app.installTranslator(&translator);
/*QTranslator viewerTranslator; /*QTranslator viewerTranslator;
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
viewerTranslator.load(QString(DATADIR) + "/yacreader/languages/yacreader_" + sufix); viewerTranslator.load(QString(DATADIR) + "/yacreader/languages/yacreader_" + sufix);
#else #else
viewerTranslator.load(QCoreApplication::applicationDirPath() + "/languages/yacreader_" + sufix); viewerTranslator.load(QCoreApplication::applicationDirPath() + "/languages/yacreader_" + sufix);
@ -268,7 +268,7 @@ int main(int argc, char **argv)
if (!settings->value(START_TO_TRAY, false).toBool() || !settings->value(CLOSE_TO_TRAY, false).toBool()) { if (!settings->value(START_TO_TRAY, false).toBool() || !settings->value(CLOSE_TO_TRAY, false).toBool()) {
mw->show(); mw->show();
} }
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOSOS
else { else {
OSXHideDockIcon(); OSXHideDockIcon();
} }

View File

@ -16,7 +16,7 @@ void PackageManager::createPackage(const QString &libraryPath, const QString &de
// TODO: Missing slot for openingError!!! // TODO: Missing slot for openingError!!!
connect(_7z, SIGNAL(error(QProcess::ProcessError)), this, SLOT(openingError(QProcess::ProcessError))); connect(_7z, SIGNAL(error(QProcess::ProcessError)), this, SLOT(openingError(QProcess::ProcessError)));
connect(_7z, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &PackageManager::exported); connect(_7z, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &PackageManager::exported);
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
_7z->start("7z", attributes); // TODO: use 7z.so _7z->start("7z", attributes); // TODO: use 7z.so
#else #else
_7z->start(QCoreApplication::applicationDirPath() + "/utils/7zip", attributes); // TODO: use 7z.dll _7z->start(QCoreApplication::applicationDirPath() + "/utils/7zip", attributes); // TODO: use 7z.dll
@ -33,7 +33,7 @@ void PackageManager::extractPackage(const QString &packagePath, const QString &d
_7z = new QProcess(); _7z = new QProcess();
connect(_7z, SIGNAL(error(QProcess::ProcessError)), this, SLOT(openingError(QProcess::ProcessError))); connect(_7z, SIGNAL(error(QProcess::ProcessError)), this, SLOT(openingError(QProcess::ProcessError)));
connect(_7z, SIGNAL(finished(int, QProcess::ExitStatus)), this, SIGNAL(imported())); connect(_7z, SIGNAL(finished(int, QProcess::ExitStatus)), this, SIGNAL(imported()));
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
_7z->start("7z", attributes); // TODO: use 7z.so _7z->start("7z", attributes); // TODO: use 7z.so
#else #else
_7z->start(QCoreApplication::applicationDirPath() + "/utils/7zip", attributes); // TODO: use 7z.dll _7z->start(QCoreApplication::applicationDirPath() + "/utils/7zip", attributes); // TODO: use 7z.dll

View File

@ -35,7 +35,7 @@ QString Static::getConfigDir()
return configDir; return configDir;
} }
// Search config file // Search config file
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
QString binDir = (QString(DATADIR) + "/yacreader"); QString binDir = (QString(DATADIR) + "/yacreader");
#else #else
QString binDir = QCoreApplication::applicationDirPath(); QString binDir = QCoreApplication::applicationDirPath();

View File

@ -48,7 +48,7 @@ void YACReaderHttpServer::start(quint16 port)
QString baseTemplatePath = QString("./server/templates"); QString baseTemplatePath = QString("./server/templates");
QString templatePath; QString templatePath;
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
templatePath = QFileInfo(QString(DATADIR) + "/yacreader", baseTemplatePath).absoluteFilePath(); templatePath = QFileInfo(QString(DATADIR) + "/yacreader", baseTemplatePath).absoluteFilePath();
#else #else
templatePath = QFileInfo(QCoreApplication::applicationDirPath(), baseTemplatePath).absoluteFilePath(); templatePath = QFileInfo(QCoreApplication::applicationDirPath(), baseTemplatePath).absoluteFilePath();
@ -76,7 +76,7 @@ void YACReaderHttpServer::start(quint16 port)
QString basedocroot = "./server/docroot"; QString basedocroot = "./server/docroot";
QString docroot; QString docroot;
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
QFileInfo configFile(QString(DATADIR) + "/yacreader"); QFileInfo configFile(QString(DATADIR) + "/yacreader");
docroot = QFileInfo(QString(DATADIR) + "/yacreader", basedocroot).absoluteFilePath(); docroot = QFileInfo(QString(DATADIR) + "/yacreader", basedocroot).absoluteFilePath();
#else #else

View File

@ -7,7 +7,7 @@
#include <QtWidgets> #include <QtWidgets>
#include <QMessageBox> #include <QMessageBox>
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOSOS
#include "trayhandler.h" #include "trayhandler.h"
#endif #endif
@ -26,7 +26,7 @@ TrayIconController::TrayIconController(QSettings *settings, LibraryWindow *windo
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
trayIcon.setIcon(QIcon(":/icon.ico")); trayIcon.setIcon(QIcon(":/icon.ico"));
#else #else
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOSOS
auto icon = QIcon(":/macostrayicon.svg"); auto icon = QIcon(":/macostrayicon.svg");
icon.setIsMask(true); icon.setIsMask(true);
trayIcon.setIcon(icon); trayIcon.setIcon(icon);
@ -96,7 +96,7 @@ bool TrayIconController::handleCloseToTrayIcon(QCloseEvent *event)
void TrayIconController::showWindow() void TrayIconController::showWindow()
{ {
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOSOS
OSXShowDockIcon(); OSXShowDockIcon();
window->showNormal(); window->showNormal();
#else #else

View File

@ -46,7 +46,7 @@ void XMLInfoLibraryScanner::run()
{ {
#if !defined use_unarr && !defined use_libarchive #if !defined use_unarr && !defined use_libarchive
// check for 7z lib // check for 7z lib
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
QLibrary *sevenzLib = new QLibrary(QString(LIBDIR) + "/p7zip/7z.so"); QLibrary *sevenzLib = new QLibrary(QString(LIBDIR) + "/p7zip/7z.so");
#else #else
QLibrary *sevenzLib = new QLibrary(QCoreApplication::applicationDirPath() + "/utils/7z"); QLibrary *sevenzLib = new QLibrary(QCoreApplication::applicationDirPath() + "/utils/7z");

View File

@ -68,7 +68,7 @@ YACReaderMainToolBar::YACReaderMainToolBar(QWidget *parent)
mainLayout->addStretch(); mainLayout->addStretch();
mainLayout->addWidget(toggleComicsViewButton, 0, Qt::AlignVCenter); mainLayout->addWidget(toggleComicsViewButton, 0, Qt::AlignVCenter);
#ifndef Q_OS_MAC #ifndef Q_OS_MACOS
addWideDivider(); addWideDivider();
mainLayout->addWidget(fullscreenButton, 0, Qt::AlignVCenter); mainLayout->addWidget(fullscreenButton, 0, Qt::AlignVCenter);
#endif #endif

View File

@ -118,7 +118,7 @@ int main(int argc, char **argv)
QTranslator translator; QTranslator translator;
QString sufix = QLocale::system().name(); QString sufix = QLocale::system().name();
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
translator.load(QString(DATADIR) + "/yacreader/languages/yacreaderlibrary_" + sufix); translator.load(QString(DATADIR) + "/yacreader/languages/yacreaderlibrary_" + sufix);
#else #else
translator.load(QCoreApplication::applicationDirPath() + "/languages/yacreaderlibrary_" + sufix); translator.load(QCoreApplication::applicationDirPath() + "/languages/yacreaderlibrary_" + sufix);
@ -181,7 +181,7 @@ int main(int argc, char **argv)
QTranslator translator; QTranslator translator;
QString sufix = QLocale::system().name(); QString sufix = QLocale::system().name();
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
translator.load(QString(DATADIR) + "/yacreader/languages/yacreaderlibrary_" + sufix); translator.load(QString(DATADIR) + "/yacreader/languages/yacreaderlibrary_" + sufix);
#else #else
translator.load(QCoreApplication::applicationDirPath() + "/languages/yacreaderlibrary_" + sufix); translator.load(QCoreApplication::applicationDirPath() + "/languages/yacreaderlibrary_" + sufix);
@ -189,7 +189,7 @@ int main(int argc, char **argv)
app.installTranslator(&translator); app.installTranslator(&translator);
QTranslator viewerTranslator; QTranslator viewerTranslator;
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
viewerTranslator.load(QString(DATADIR) + "/yacreader/languages/yacreader_" + sufix); viewerTranslator.load(QString(DATADIR) + "/yacreader/languages/yacreader_" + sufix);
#else #else
viewerTranslator.load(QCoreApplication::applicationDirPath() + "/languages/yacreader_" + sufix); viewerTranslator.load(QCoreApplication::applicationDirPath() + "/languages/yacreader_" + sufix);

View File

@ -795,7 +795,7 @@ bool PDFComic::load(const QString &path, const ComicDB &comic)
void PDFComic::process() void PDFComic::process()
{ {
#if defined Q_OS_MAC && defined USE_PDFKIT #if defined Q_OS_MACOS && defined USE_PDFKIT
pdfComic = std::make_unique<MacOSXPDFComic>(); pdfComic = std::make_unique<MacOSXPDFComic>();
if (!pdfComic->openComic(_path)) { if (!pdfComic->openComic(_path)) {
emit errorOpening(); emit errorOpening();
@ -875,7 +875,7 @@ void PDFComic::process()
void PDFComic::renderPage(int page) void PDFComic::renderPage(int page)
{ {
#if defined Q_OS_MAC && defined USE_PDFKIT #if defined Q_OS_MACOS && defined USE_PDFKIT
QImage img = pdfComic->getPage(page); QImage img = pdfComic->getPage(page);
if (!img.isNull()) { if (!img.isNull()) {
#elif defined USE_PDFIUM #elif defined USE_PDFIUM

View File

@ -164,7 +164,7 @@ class PDFComic : public Comic
private: private:
// pdf // pdf
#if defined Q_OS_MAC && defined USE_PDFKIT #if defined Q_OS_MACOS && defined USE_PDFKIT
std::unique_ptr<MacOSXPDFComic> pdfComic; std::unique_ptr<MacOSXPDFComic> pdfComic;
#elif defined USE_PDFIUM #elif defined USE_PDFIUM
std::unique_ptr<PdfiumComic> pdfComic; std::unique_ptr<PdfiumComic> pdfComic;

View File

@ -7,7 +7,7 @@
#include <QMutex> #include <QMutex>
#include <QtGlobal> #include <QtGlobal>
#if defined Q_OS_MAC && defined USE_PDFKIT #if defined Q_OS_MACOS && defined USE_PDFKIT
class MacOSXPDFComic class MacOSXPDFComic
{ {
public: public:
@ -51,5 +51,5 @@ private:
#else #else
#include "poppler-qt5.h" #include "poppler-qt5.h"
#endif // QT_VERSION #endif // QT_VERSION
#endif // Q_OS_MAC #endif // Q_OS_MACOS
#endif // PDF_COMIC_H #endif // PDF_COMIC_H

View File

@ -19,7 +19,7 @@
#define MAX_LIBRARIES_WARNING_NUM 10 #define MAX_LIBRARIES_WARNING_NUM 10
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
#define Y_MAC_UI #define Y_MAC_UI
#endif #endif

View File

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

View File

@ -299,7 +299,7 @@ CompressedArchive::CompressedArchive(const QString &filePath, QObject *parent)
// fix2: rename 7z.so to 7z.dylib // fix2: rename 7z.so to 7z.dylib
if (sevenzLib == 0) { if (sevenzLib == 0) {
#if defined Q_OS_UNIX #if defined Q_OS_UNIX
#if defined Q_OS_MAC #if defined Q_OS_MACOS
rarLib = new QLibrary(QCoreApplication::applicationDirPath() + "/utils/Codecs/Rar"); rarLib = new QLibrary(QCoreApplication::applicationDirPath() + "/utils/Codecs/Rar");
#else #else
// check if a yacreader specific version of p7zip exists on the system // check if a yacreader specific version of p7zip exists on the system
@ -316,7 +316,7 @@ CompressedArchive::CompressedArchive(const QString &filePath, QObject *parent)
return false; return false;
} }
#endif #endif
#if defined Q_OS_UNIX && !defined Q_OS_MAC #if defined Q_OS_UNIX && !defined Q_OS_MACOS
QFileInfo sevenzlibrary(QString(LIBDIR) + "/yacreader/7z.so"); QFileInfo sevenzlibrary(QString(LIBDIR) + "/yacreader/7z.so");
if (sevenzlibrary.exists()) { if (sevenzlibrary.exists()) {
sevenzLib = new QLibrary(sevenzlibrary.absoluteFilePath()); sevenzLib = new QLibrary(sevenzlibrary.absoluteFilePath());

View File

@ -96,7 +96,7 @@ void YACReaderTitledToolBar::addAction(QAction *action)
QHBoxLayout *mainLayout = dynamic_cast<QHBoxLayout *>(layout()); QHBoxLayout *mainLayout = dynamic_cast<QHBoxLayout *>(layout());
// fix for QToolButton and retina support in OSX // fix for QToolButton and retina support in OSX
#ifdef Q_OS_MAC // TODO_Y_MAC_UI #ifdef Q_OS_MACOS // TODO_Y_MAC_UI
QPushButton *pb = new QPushButton(this); QPushButton *pb = new QPushButton(this);
pb->setCursor(QCursor(Qt::ArrowCursor)); pb->setCursor(QCursor(Qt::ArrowCursor));
pb->setIcon(action->icon()); pb->setIcon(action->icon());

View File

@ -75,7 +75,7 @@ void ShortcutsManager::initDefaultShorcuts()
defaultShorcuts.insert(ZOOM_IN_MGLASS_ACTION_Y, Qt::Key_Asterisk); defaultShorcuts.insert(ZOOM_IN_MGLASS_ACTION_Y, Qt::Key_Asterisk);
defaultShorcuts.insert(ZOOM_OUT_MGLASS_ACTION_Y, Qt::Key_Underscore); defaultShorcuts.insert(ZOOM_OUT_MGLASS_ACTION_Y, Qt::Key_Underscore);
#ifdef Q_OS_MAC #ifdef Q_OS_MACOS
defaultShorcuts.insert(NEW_INSTANCE_ACTION_Y, Qt::Key_N); defaultShorcuts.insert(NEW_INSTANCE_ACTION_Y, Qt::Key_N);
#endif #endif