mirror of
https://github.com/YACReader/yacreader
synced 2025-07-25 08:25:03 -04:00
removed some ugly defines
This commit is contained in:
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#define NUM_BOOKMARKS 250
|
|
||||||
|
|
||||||
Bookmarks::Bookmarks()
|
Bookmarks::Bookmarks()
|
||||||
:lastPageIndex(0)
|
:lastPageIndex(0)
|
||||||
@ -138,8 +137,8 @@ void BookmarksList::save()
|
|||||||
QFile f(QCoreApplication::applicationDirPath()+"/bookmarks.yacr");
|
QFile f(QCoreApplication::applicationDirPath()+"/bookmarks.yacr");
|
||||||
f.open(QIODevice::WriteOnly);
|
f.open(QIODevice::WriteOnly);
|
||||||
QDataStream dataS(&f);
|
QDataStream dataS(&f);
|
||||||
if(list.count()>NUM_BOOKMARKS)
|
if(list.count()>numMaxBookmarks)
|
||||||
deleteOldest(list.count()-NUM_BOOKMARKS);
|
deleteOldest(list.count()-numMaxBookmarks);
|
||||||
dataS << list;
|
dataS << list;
|
||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
BookmarksList(){}
|
BookmarksList():numMaxBookmarks(400){}
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
void add(const QString & comicID, const Bookmark & b);
|
void add(const QString & comicID, const Bookmark & b);
|
||||||
@ -39,6 +39,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
QMap<QString,Bookmark> list;
|
QMap<QString,Bookmark> list;
|
||||||
void deleteOldest(int num);
|
void deleteOldest(int num);
|
||||||
|
private:
|
||||||
|
int numMaxBookmarks;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
#include "compressed_archive.h"
|
#include "compressed_archive.h"
|
||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
|
|
||||||
|
QStringList Comic::extensions = QStringList() << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp";
|
||||||
|
QStringList Comic::literalExtensions = QStringList() << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp";
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
Comic::Comic()
|
Comic::Comic()
|
||||||
:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false)
|
:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false)
|
||||||
@ -241,8 +244,7 @@ bool FileComic::load(const QString & path, const ComicDB & comic)
|
|||||||
|
|
||||||
QList<QString> FileComic::filter(const QList<QString> & src)
|
QList<QString> FileComic::filter(const QList<QString> & src)
|
||||||
{
|
{
|
||||||
QList<QString> extensions;
|
QList<QString> extensions = getSupportedImageLiteralFormats();
|
||||||
extensions EXTENSIONS_LITERAL;
|
|
||||||
QList<QString> filtered;
|
QList<QString> filtered;
|
||||||
bool fileAccepted = false;
|
bool fileAccepted = false;
|
||||||
|
|
||||||
@ -493,9 +495,8 @@ bool FolderComic::load(const QString & path, int atPage )
|
|||||||
void FolderComic::process()
|
void FolderComic::process()
|
||||||
{
|
{
|
||||||
QDir d(_path);
|
QDir d(_path);
|
||||||
QStringList l;
|
|
||||||
l EXTENSIONS;
|
d.setNameFilters(getSupportedImageFormats());
|
||||||
d.setNameFilters(l);
|
|
||||||
d.setFilter(QDir::Files|QDir::NoDotAndDotDot);
|
d.setFilter(QDir::Files|QDir::NoDotAndDotDot);
|
||||||
//d.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
//d.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
||||||
QFileInfoList list = d.entryInfoList();
|
QFileInfoList list = d.entryInfoList();
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
#include "poppler-qt4.h"
|
#include "poppler-qt4.h"
|
||||||
|
|
||||||
class ComicDB;
|
class ComicDB;
|
||||||
#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp"
|
//#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp" Comic::getSupportedImageFormats()
|
||||||
#define EXTENSIONS_LITERAL << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp"
|
//#define EXTENSIONS_LITERAL << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp" //Comic::getSupportedImageLiteralFormats()
|
||||||
class Comic : public QObject
|
class Comic : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -36,6 +36,9 @@ class ComicDB;
|
|||||||
int _firstPage;
|
int _firstPage;
|
||||||
|
|
||||||
bool _isPDF;
|
bool _isPDF;
|
||||||
|
|
||||||
|
static QStringList extensions;
|
||||||
|
static QStringList literalExtensions;
|
||||||
public:
|
public:
|
||||||
Bookmarks * bm;
|
Bookmarks * bm;
|
||||||
|
|
||||||
@ -63,6 +66,9 @@ class ComicDB;
|
|||||||
QByteArray getRawPage(int page);
|
QByteArray getRawPage(int page);
|
||||||
bool pageIsLoaded(int page);
|
bool pageIsLoaded(int page);
|
||||||
|
|
||||||
|
inline static QStringList getSupportedImageFormats() { return extensions;};
|
||||||
|
inline static QStringList getSupportedImageLiteralFormats() { return literalExtensions;};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadFinished();
|
void loadFinished();
|
||||||
void setBookmark();
|
void setBookmark();
|
||||||
|
@ -673,7 +673,7 @@ void MainWindowViewer::openFolderFromPath(QString pathDir, QString atFileName)
|
|||||||
|
|
||||||
QDir d(pathDir);
|
QDir d(pathDir);
|
||||||
d.setFilter(QDir::Files|QDir::NoDotAndDotDot);
|
d.setFilter(QDir::Files|QDir::NoDotAndDotDot);
|
||||||
d.setNameFilters(QStringList() EXTENSIONS);
|
d.setNameFilters(Comic::getSupportedImageFormats());
|
||||||
d.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
d.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
||||||
QStringList list = d.entryList();
|
QStringList list = d.entryList();
|
||||||
|
|
||||||
@ -1016,8 +1016,7 @@ void MainWindowViewer::dropEvent(QDropEvent *event)
|
|||||||
info.setFile( fName ); // information about file
|
info.setFile( fName ); // information about file
|
||||||
if (info.isFile())
|
if (info.isFile())
|
||||||
{
|
{
|
||||||
QStringList imageSuffixs;
|
QStringList imageSuffixs = Comic::getSupportedImageLiteralFormats();
|
||||||
imageSuffixs EXTENSIONS_LITERAL;
|
|
||||||
if(imageSuffixs.contains("."+info.suffix())) //image dropped
|
if(imageSuffixs.contains("."+info.suffix())) //image dropped
|
||||||
openFolderFromPath(info.absoluteDir().absolutePath(),info.fileName());
|
openFolderFromPath(info.absoluteDir().absolutePath(),info.fileName());
|
||||||
else
|
else
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
|
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
#define NL 2
|
|
||||||
#define NR 2
|
|
||||||
|
|
||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
#include "yacreader_global.h"
|
#include "yacreader_global.h"
|
||||||
|
|
||||||
@ -480,7 +477,7 @@ void DoublePageRender::run()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
Render::Render()
|
Render::Render()
|
||||||
:currentIndex(0),doublePage(false),comic(0),loadedComic(false),imageRotation(0),numLeftPages(NL),numRightPages(NR)
|
:currentIndex(0),doublePage(false),comic(0),loadedComic(false),imageRotation(0),numLeftPages(2),numRightPages(2)
|
||||||
{
|
{
|
||||||
int size = numLeftPages+numRightPages+1;
|
int size = numLeftPages+numRightPages+1;
|
||||||
currentPageBufferedIndex = numLeftPages;
|
currentPageBufferedIndex = numLeftPages;
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
#include "notifications_label_widget.h"
|
#include "notifications_label_widget.h"
|
||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#define STEPS 22
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Viewer::Viewer(QWidget * parent)
|
Viewer::Viewer(QWidget * parent)
|
||||||
@ -28,8 +26,8 @@ doublePage(false),
|
|||||||
wheelStop(false),
|
wheelStop(false),
|
||||||
direction(1),
|
direction(1),
|
||||||
restoreMagnifyingGlass(false),
|
restoreMagnifyingGlass(false),
|
||||||
drag(false)
|
drag(false),
|
||||||
|
numScrollSteps(22)
|
||||||
{
|
{
|
||||||
translator = new YACReaderTranslator(this);
|
translator = new YACReaderTranslator(this);
|
||||||
translator->hide();
|
translator->hide();
|
||||||
@ -362,12 +360,12 @@ void Viewer::keyPressEvent(QKeyEvent *event)
|
|||||||
switch (event->key())
|
switch (event->key())
|
||||||
{
|
{
|
||||||
case Qt::Key_Space:
|
case Qt::Key_Space:
|
||||||
posByStep = height()/STEPS;
|
posByStep = height()/numScrollSteps;
|
||||||
nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80));
|
nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80));
|
||||||
scrollDown();
|
scrollDown();
|
||||||
break;
|
break;
|
||||||
case Qt::Key_B:
|
case Qt::Key_B:
|
||||||
posByStep = height()/STEPS;
|
posByStep = height()/numScrollSteps;
|
||||||
nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80));
|
nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80));
|
||||||
scrollUp();
|
scrollUp();
|
||||||
break;
|
break;
|
||||||
|
@ -112,6 +112,7 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
|
|||||||
QTimer * hideCursorTimer;
|
QTimer * hideCursorTimer;
|
||||||
int direction;
|
int direction;
|
||||||
bool drag;
|
bool drag;
|
||||||
|
int numScrollSteps;
|
||||||
|
|
||||||
//!Widgets
|
//!Widgets
|
||||||
QLabel *content;
|
QLabel *content;
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
#include "tableitem.h"
|
||||||
|
|
||||||
YACReaderTableView::YACReaderTableView(QWidget *parent) :
|
YACReaderTableView::YACReaderTableView(QWidget *parent) :
|
||||||
QTableView(parent),showDelete(false),editing(false),myeditor(0)
|
QTableView(parent),showDelete(false),editing(false),myeditor(0)
|
||||||
{
|
{
|
||||||
@ -165,7 +167,7 @@ void YACReaderTableView::resizeEvent(QResizeEvent * event)
|
|||||||
|
|
||||||
QTableView::resizeEvent(event);
|
QTableView::resizeEvent(event);
|
||||||
}
|
}
|
||||||
#include "tableitem.h"
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
//YACReaderRatingDelegate-------------------------------------------------------
|
//YACReaderRatingDelegate-------------------------------------------------------
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user