mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Move functions
This commit is contained in:
parent
c8f8c5661f
commit
8f1c63fcf0
@ -36,37 +36,6 @@
|
||||
#include <QDate>
|
||||
#include <QMenuBar>
|
||||
|
||||
// TODO there are no SVG assets in macos yet
|
||||
// we need two sets of icons, one for the toolbar and one for the context menu because of this bug (QTBUG-96553): https://bugreports.qt.io/browse/QTBUG-96553
|
||||
|
||||
QString addExtensionToIconPath(const QString &path)
|
||||
{
|
||||
|
||||
return path + ".svg";
|
||||
}
|
||||
|
||||
QString addExtensionToIconPathInToolbar(const QString &path)
|
||||
{
|
||||
return path + "_18x18.svg";
|
||||
}
|
||||
|
||||
QAction *actionWithCustomIcon(const QIcon &icon, QAction *action)
|
||||
{
|
||||
auto a = new QAction(icon, action->text());
|
||||
|
||||
a->setEnabled(action->isEnabled());
|
||||
a->setCheckable(action->isCheckable());
|
||||
|
||||
a->setChecked(action->isChecked());
|
||||
|
||||
QObject::connect(a, &QAction::triggered, action, &QAction::triggered);
|
||||
QObject::connect(action, &QAction::enabledChanged, a, &QAction::setEnabled);
|
||||
QObject::connect(a, &QAction::toggled, action, &QAction::setChecked);
|
||||
QObject::connect(action, &QAction::toggled, a, &QAction::setChecked);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
MainWindowViewer::MainWindowViewer()
|
||||
: QMainWindow(), fullscreen(false), toolbars(true), currentDirectory("."), currentDirectoryImgDest("."), isClient(false)
|
||||
{
|
||||
|
@ -49,3 +49,41 @@ QList<qulonglong> YACReader::mimeDataToComicsIds(const QMimeData *data)
|
||||
in >> comicIds; // deserialize the list of indentifiers
|
||||
return comicIds;
|
||||
}
|
||||
|
||||
// TODO some SVG assets are missing in macos (WIP)
|
||||
// we need two sets of icons, one for the toolbar and one for the context menu because of this bug (QTBUG-96553): https://bugreports.qt.io/browse/QTBUG-96553
|
||||
|
||||
QString YACReader::addExtensionToIconPath(const QString &path)
|
||||
{
|
||||
#ifdef YACREADER_LIBRARY
|
||||
#ifdef Q_OS_MAC
|
||||
return path + ".png";
|
||||
#else
|
||||
return path + ".svg";
|
||||
#endif
|
||||
#else
|
||||
return path + ".svg";
|
||||
#endif
|
||||
}
|
||||
|
||||
QString YACReader::addExtensionToIconPathInToolbar(const QString &path)
|
||||
{
|
||||
return path + "_18x18.svg";
|
||||
}
|
||||
|
||||
QAction *YACReader::actionWithCustomIcon(const QIcon &icon, QAction *action)
|
||||
{
|
||||
auto a = new QAction(icon, action->text());
|
||||
|
||||
a->setEnabled(action->isEnabled());
|
||||
a->setCheckable(action->isCheckable());
|
||||
|
||||
a->setChecked(action->isChecked());
|
||||
|
||||
QObject::connect(a, &QAction::triggered, action, &QAction::triggered);
|
||||
QObject::connect(action, &QAction::enabledChanged, a, &QAction::setEnabled);
|
||||
QObject::connect(a, &QAction::toggled, action, &QAction::setChecked);
|
||||
QObject::connect(action, &QAction::toggled, a, &QAction::setChecked);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
@ -110,6 +110,9 @@ QAction *createSeparator();
|
||||
QIcon noHighlightedIcon(const QString &path);
|
||||
void colorize(QImage &img, QColor &col);
|
||||
QList<qulonglong> mimeDataToComicsIds(const QMimeData *data);
|
||||
QString addExtensionToIconPath(const QString &path);
|
||||
QString addExtensionToIconPathInToolbar(const QString &path);
|
||||
QAction *actionWithCustomIcon(const QIcon &icon, QAction *action);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user