mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
clang-format
This commit is contained in:
@ -14,12 +14,12 @@ BookmarksDialog::BookmarksDialog(QWidget *parent)
|
||||
{
|
||||
setModal(true);
|
||||
|
||||
//animation = new QPropertyAnimation(this,"windowOpacity");
|
||||
//animation->setDuration(150);
|
||||
// animation = new QPropertyAnimation(this,"windowOpacity");
|
||||
// animation->setDuration(150);
|
||||
|
||||
auto layout = new QHBoxLayout();
|
||||
|
||||
//bookmarks
|
||||
// bookmarks
|
||||
auto bookmarksL = new QGridLayout();
|
||||
|
||||
pages.push_back(new QLabel(tr("Lastest Page")));
|
||||
@ -43,7 +43,7 @@ BookmarksDialog::BookmarksDialog(QWidget *parent)
|
||||
QLabel *l = new QLabel();
|
||||
l->setFixedSize(coverSize);
|
||||
l->setScaledContents(false);
|
||||
//l->setPixmap(QPixmap(":/images/notCover.png"));
|
||||
// l->setPixmap(QPixmap(":/images/notCover.png"));
|
||||
l->installEventFilter(this);
|
||||
images.push_back(l);
|
||||
}
|
||||
@ -54,7 +54,7 @@ BookmarksDialog::BookmarksDialog(QWidget *parent)
|
||||
for (int i = 0; i < 3; i++)
|
||||
bookmarksL->addWidget(images.at(i + 1), 1, i, Qt::AlignCenter);
|
||||
|
||||
//last page
|
||||
// last page
|
||||
auto lp = new QGridLayout();
|
||||
lp->addWidget(pages.at(0), 0, 0, Qt::AlignCenter);
|
||||
lp->addWidget(images.at(0), 1, 0, Qt::AlignCenter);
|
||||
@ -161,17 +161,17 @@ void BookmarksDialog::keyPressEvent(QKeyEvent *event)
|
||||
/*
|
||||
void BookmarksDialog::show()
|
||||
{
|
||||
QDialog::show();
|
||||
disconnect(animation,SIGNAL(finished()),this,SLOT(close()));
|
||||
animation->setStartValue(0);
|
||||
animation->setEndValue(1);
|
||||
animation->start();
|
||||
QDialog::show();
|
||||
disconnect(animation,SIGNAL(finished()),this,SLOT(close()));
|
||||
animation->setStartValue(0);
|
||||
animation->setEndValue(1);
|
||||
animation->start();
|
||||
}
|
||||
|
||||
void BookmarksDialog::hide()
|
||||
{
|
||||
connect(animation,SIGNAL(finished()),this,SLOT(close()));
|
||||
animation->setStartValue(1);
|
||||
animation->setEndValue(0);
|
||||
animation->start();
|
||||
connect(animation,SIGNAL(finished()),this,SLOT(close()));
|
||||
animation->setStartValue(1);
|
||||
animation->setEndValue(0);
|
||||
animation->start();
|
||||
}*/
|
||||
|
@ -28,15 +28,15 @@ protected:
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
//QPropertyAnimation * animation;
|
||||
// QPropertyAnimation * animation;
|
||||
|
||||
public:
|
||||
BookmarksDialog(QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void setBookmarks(const Bookmarks &bookmarks);
|
||||
//void show();
|
||||
//void hide();
|
||||
// void show();
|
||||
// void hide();
|
||||
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
|
@ -22,7 +22,7 @@ void Configuration::load(QSettings *settings)
|
||||
{
|
||||
this->settings = settings;
|
||||
|
||||
//TODO set defaults
|
||||
// TODO set defaults
|
||||
if (!settings->contains(PATH))
|
||||
settings->setValue(PATH, ".");
|
||||
if (!settings->contains(GO_TO_FLOW_SIZE))
|
||||
@ -53,7 +53,7 @@ void Configuration::updateOpenRecentList(QString path)
|
||||
QStringList list = openRecentList();
|
||||
list.removeAll(path);
|
||||
list.prepend(path);
|
||||
//TODO: Make list lenght configurable
|
||||
// TODO: Make list lenght configurable
|
||||
while (list.length() > getOpenRecentSize()) {
|
||||
list.removeLast();
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ public:
|
||||
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat(); }
|
||||
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL, zl); }
|
||||
|
||||
//Unified enum based fitmode
|
||||
// Unified enum based fitmode
|
||||
YACReader::FitMode getFitMode() { return static_cast<YACReader::FitMode>(settings->value(FITMODE, YACReader::FitMode::FullPage).toInt()); }
|
||||
void setFitMode(YACReader::FitMode fitMode) { settings->setValue(FITMODE, static_cast<int>(fitMode)); }
|
||||
|
||||
//openRecent
|
||||
// openRecent
|
||||
int getOpenRecentSize() { return settings->value("recentSize", 25).toInt(); }
|
||||
QStringList openRecentList() { return settings->value("recentFiles").toStringList(); }
|
||||
void updateOpenRecentList(QString path);
|
||||
|
@ -90,7 +90,7 @@ void GoToFlow::centerSlide(int slide)
|
||||
flow->setCenterIndex(slide);
|
||||
if (ready) // load images if pages are loaded.
|
||||
{
|
||||
//worker->reset(); //BUG FIXED : image didn't load if worker was working
|
||||
// worker->reset(); //BUG FIXED : image didn't load if worker was working
|
||||
preload();
|
||||
}
|
||||
}
|
||||
@ -129,9 +129,9 @@ void GoToFlow::reset()
|
||||
{
|
||||
updateTimer->stop();
|
||||
/*imagesLoaded.clear();
|
||||
numImagesLoaded = 0;
|
||||
imagesReady.clear();
|
||||
rawImages.clear();*/
|
||||
numImagesLoaded = 0;
|
||||
imagesReady.clear();
|
||||
rawImages.clear();*/
|
||||
ready = false;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ void GoToFlow::setImageReady(int index, const QByteArray &image)
|
||||
void GoToFlow::preload()
|
||||
{
|
||||
if (numImagesLoaded < imagesLoaded.size())
|
||||
updateTimer->start(30); //TODO comprobar rendimiento, antes era 70
|
||||
updateTimer->start(30); // TODO comprobar rendimiento, antes era 70
|
||||
}
|
||||
|
||||
void GoToFlow::updateImageData()
|
||||
@ -162,7 +162,7 @@ void GoToFlow::updateImageData()
|
||||
imagesSetted[idx] = true;
|
||||
numImagesLoaded++;
|
||||
rawImages[idx].clear();
|
||||
; //release memory
|
||||
; // release memory
|
||||
imagesLoaded[idx] = true;
|
||||
}
|
||||
}
|
||||
@ -180,7 +180,7 @@ void GoToFlow::updateImageData()
|
||||
for (int c = 0; c < 2 * COUNT + 1; c++) {
|
||||
int i = indexes[c];
|
||||
if ((i >= 0) && (i < flow->slideCount()))
|
||||
if (!imagesLoaded[i] && imagesReady[i]) //slide(i).isNull())
|
||||
if (!imagesLoaded[i] && imagesReady[i]) // slide(i).isNull())
|
||||
{
|
||||
// schedule thumbnail generation
|
||||
|
||||
@ -223,7 +223,7 @@ void GoToFlow::setFlowRightToLeft(bool b)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//PageLoader
|
||||
// PageLoader
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
PageLoader::PageLoader(QMutex *m)
|
||||
@ -233,8 +233,8 @@ PageLoader::PageLoader(QMutex *m)
|
||||
|
||||
PageLoader::~PageLoader()
|
||||
{
|
||||
//TODO this destructor never runs. If it is ever called, it will hang, because
|
||||
//the implementation is broken due to the absolutely endless loop in run().
|
||||
// TODO this destructor never runs. If it is ever called, it will hang, because
|
||||
// the implementation is broken due to the absolutely endless loop in run().
|
||||
mutex->lock();
|
||||
condition.wakeOne();
|
||||
mutex->unlock();
|
||||
@ -250,7 +250,7 @@ void PageLoader::generate(int index, QSize size, const QByteArray &rImage)
|
||||
{
|
||||
mutex->lock();
|
||||
this->idx = index;
|
||||
//this->img = QImage();
|
||||
// this->img = QImage();
|
||||
this->size = size;
|
||||
this->rawImage = rImage;
|
||||
mutex->unlock();
|
||||
@ -272,7 +272,7 @@ void PageLoader::run()
|
||||
// copy necessary data
|
||||
mutex->lock();
|
||||
this->working = true;
|
||||
//int idx = this->idx;
|
||||
// int idx = this->idx;
|
||||
|
||||
QImage image;
|
||||
image.loadFromData(this->rawImage);
|
||||
|
@ -33,11 +33,11 @@ class GoToFlow : public GoToFlowWidget
|
||||
public:
|
||||
GoToFlow(QWidget *parent = nullptr, FlowType flowType = CoverFlowLike);
|
||||
~GoToFlow() override;
|
||||
bool ready; //comic is ready for read.
|
||||
bool ready; // comic is ready for read.
|
||||
private:
|
||||
YACReaderFlow *flow;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
//Comic * comic;
|
||||
// Comic * comic;
|
||||
QSize imageSize;
|
||||
|
||||
QVector<bool> imagesLoaded;
|
||||
@ -66,7 +66,7 @@ public slots:
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//PageLoader
|
||||
// PageLoader
|
||||
//-----------------------------------------------------------------------------
|
||||
class PageLoader : public QThread
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ private:
|
||||
YACReaderPageFlowGL *flow;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
//Comic * comic;
|
||||
// Comic * comic;
|
||||
QSize imageSize;
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
|
||||
: QStackedWidget(parent)
|
||||
{
|
||||
//elementos interactivos
|
||||
// elementos interactivos
|
||||
auto normal = new QWidget(this); // container widget
|
||||
auto quickNavi = new QWidget(this); // container widget
|
||||
addWidget(normal);
|
||||
@ -44,17 +44,17 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
|
||||
edit->setStyleSheet("QLineEdit {border: 1px solid #77000000; background: #55000000; color: white; padding: 3px 5px 5px 5px; margin: 13px 5px 12px 5px; font-weight:bold}");
|
||||
edit->setFixedSize(54, 50);
|
||||
edit->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
//edit->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
||||
//edit->resize(QSize(54,50));
|
||||
// edit->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
||||
// edit->resize(QSize(54,50));
|
||||
edit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
//edit->setAutoFillBackground(false);
|
||||
// edit->setAutoFillBackground(false);
|
||||
connect(edit, &QLineEdit::returnPressed, this, &GoToFlowToolBar::goTo);
|
||||
|
||||
QString centerButtonCSS = "QPushButton {background-image: url(:/images/imgCenterSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
|
||||
"QPushButton:focus { border: none; outline: none;}"
|
||||
"QPushButton:pressed {background-image: url(:/images/imgCenterSlidePressed.png); width: 100%; height:100%; background-repeat: none; border: none;} ";
|
||||
centerButton = new QPushButton(this);
|
||||
//centerButton->setIcon(QIcon(":/images/center.png"));
|
||||
// centerButton->setIcon(QIcon(":/images/center.png"));
|
||||
centerButton->setStyleSheet(centerButtonCSS);
|
||||
centerButton->setFixedSize(26, 50);
|
||||
centerButton->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);
|
||||
@ -64,7 +64,7 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget *parent)
|
||||
"QPushButton:focus { border: none; outline: none;}"
|
||||
"QPushButton:pressed {background-image: url(:/images/imgGoToSlidePressed.png); width: 100%; height:100%; background-repeat: none; border: none;} ";
|
||||
goToButton = new QPushButton(this);
|
||||
//goToButton->setIcon(QIcon(":/images/goto.png"));
|
||||
// goToButton->setIcon(QIcon(":/images/goto.png"));
|
||||
goToButton->setStyleSheet(goToButtonCSS);
|
||||
goToButton->setFixedSize(32, 50);
|
||||
goToButton->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);
|
||||
|
@ -19,7 +19,7 @@ GoToFlowWidget::GoToFlowWidget(QWidget *parent)
|
||||
|
||||
setLayout(mainLayout);
|
||||
|
||||
//toolBar->installEventFilter(this);
|
||||
// toolBar->installEventFilter(this);
|
||||
}
|
||||
|
||||
GoToFlowWidget::~GoToFlowWidget() { }
|
||||
@ -65,14 +65,14 @@ void GoToFlowWidget::updateSize()
|
||||
|
||||
/*bool GoToFlowWidget::eventFilter(QObject * target, QEvent * event)
|
||||
{
|
||||
if(event->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent * e = static_cast<QKeyEvent *>(event);
|
||||
if(e->key()==Qt::Key_S || e->key() == Qt::Key_Space)
|
||||
{
|
||||
this->keyPressEvent(e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(target,event);
|
||||
if(event->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent * e = static_cast<QKeyEvent *>(event);
|
||||
if(e->key()==Qt::Key_S || e->key() == Qt::Key_Space)
|
||||
{
|
||||
this->keyPressEvent(e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(target,event);
|
||||
}*/
|
||||
|
@ -36,7 +36,7 @@ signals:
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
//bool eventFilter(QObject *, QEvent *);
|
||||
// bool eventFilter(QObject *, QEvent *);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@ void MagnifyingGlass::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
void MagnifyingGlass::updateImage(int x, int y)
|
||||
{
|
||||
//image section augmented
|
||||
// image section augmented
|
||||
int zoomWidth = static_cast<int>(width() * zoomLevel);
|
||||
int zoomHeight = static_cast<int>(height() * zoomLevel);
|
||||
auto p = (Viewer *)parent();
|
||||
@ -52,7 +52,7 @@ void MagnifyingGlass::updateImage(int x, int y)
|
||||
int yOffset = 0;
|
||||
int zw = zoomWidth;
|
||||
int zh = zoomHeight;
|
||||
//int wOffset,hOffset=0;
|
||||
// int wOffset,hOffset=0;
|
||||
bool outImage = false;
|
||||
if (xp < 0) {
|
||||
xOffset = -xp;
|
||||
@ -93,7 +93,7 @@ void MagnifyingGlass::updateImage(int x, int y)
|
||||
int yOffset = 0;
|
||||
int zw = zoomWidth;
|
||||
int zh = zoomHeight;
|
||||
//int wOffset,hOffset=0;
|
||||
// int wOffset,hOffset=0;
|
||||
bool outImage = false;
|
||||
if (xp < 0) {
|
||||
xOffset = -xp;
|
||||
@ -142,28 +142,28 @@ void MagnifyingGlass::updateImage()
|
||||
void MagnifyingGlass::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
switch (event->modifiers()) {
|
||||
//size
|
||||
// size
|
||||
case Qt::NoModifier:
|
||||
if (event->delta() < 0)
|
||||
sizeUp();
|
||||
else
|
||||
sizeDown();
|
||||
break;
|
||||
//size height
|
||||
// size height
|
||||
case Qt::ControlModifier:
|
||||
if (event->delta() < 0)
|
||||
heightUp();
|
||||
else
|
||||
heightDown();
|
||||
break;
|
||||
//size width
|
||||
// size width
|
||||
case Qt::AltModifier:
|
||||
if (event->delta() < 0)
|
||||
widthUp();
|
||||
else
|
||||
widthDown();
|
||||
break;
|
||||
//zoom level
|
||||
// zoom level
|
||||
case Qt::ShiftModifier:
|
||||
if (event->delta() < 0)
|
||||
zoomIn();
|
||||
|
@ -189,7 +189,7 @@ int main(int argc, char *argv[])
|
||||
if (parser.isSet(readingListId)) {
|
||||
source = OpenComicSource { OpenComicSource::ReadingList, parser.value(readingListId).toULongLong() };
|
||||
} else {
|
||||
source = OpenComicSource { OpenComicSource::Folder, 33 }; //Folder is not needed to get the comic information, the comid id points to a unique comic
|
||||
source = OpenComicSource { OpenComicSource::Folder, 33 }; // Folder is not needed to get the comic information, the comid id points to a unique comic
|
||||
}
|
||||
|
||||
mwv->open(arglist.at(0), parser.value(comicId).toULongLong(), parser.value(libraryId).toULongLong(), source);
|
||||
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
|
||||
int ret = app.exec();
|
||||
delete mwv;
|
||||
|
||||
//Configuration::getConfiguration().save();
|
||||
// Configuration::getConfiguration().save();
|
||||
YACReader::exitCheck(ret);
|
||||
#ifdef Q_OS_WIN
|
||||
logger.shutDownLoggerThread();
|
||||
|
@ -40,33 +40,33 @@
|
||||
class MacToolBarSeparator : public QWidget
|
||||
{
|
||||
public:
|
||||
MacToolBarSeparator(QWidget * parent =0)
|
||||
:QWidget(parent)
|
||||
{
|
||||
setFixedWidth(2);
|
||||
}
|
||||
MacToolBarSeparator(QWidget * parent =0)
|
||||
:QWidget(parent)
|
||||
{
|
||||
setFixedWidth(2);
|
||||
}
|
||||
|
||||
void paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter painter(this);
|
||||
void paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter painter(this);
|
||||
|
||||
QLinearGradient lG(0,0,0,height());
|
||||
QLinearGradient lG(0,0,0,height());
|
||||
|
||||
lG.setColorAt(0,QColor(128,128,128,0));
|
||||
lG.setColorAt(0.5,QColor(128,128,128,255));
|
||||
lG.setColorAt(1,QColor(128,128,128,0));
|
||||
lG.setColorAt(0,QColor(128,128,128,0));
|
||||
lG.setColorAt(0.5,QColor(128,128,128,255));
|
||||
lG.setColorAt(1,QColor(128,128,128,0));
|
||||
|
||||
painter.fillRect(0,0,1,height(),lG);
|
||||
painter.fillRect(0,0,1,height(),lG);
|
||||
|
||||
QLinearGradient lG2(1,0,1,height());
|
||||
QLinearGradient lG2(1,0,1,height());
|
||||
|
||||
lG2.setColorAt(0,QColor(220,220,220,0));
|
||||
lG2.setColorAt(0.5,QColor(220,220,220,255));
|
||||
lG2.setColorAt(1,QColor(220,220,220,0));
|
||||
lG2.setColorAt(0,QColor(220,220,220,0));
|
||||
lG2.setColorAt(0.5,QColor(220,220,220,255));
|
||||
lG2.setColorAt(1,QColor(220,220,220,0));
|
||||
|
||||
painter.fillRect(1,0,1,height(),lG2);
|
||||
}
|
||||
painter.fillRect(1,0,1,height(),lG2);
|
||||
}
|
||||
};
|
||||
#endif*/
|
||||
|
||||
@ -91,7 +91,7 @@ MainWindowViewer::~MainWindowViewer()
|
||||
delete viewer;
|
||||
delete had;
|
||||
|
||||
//delete sliderAction;
|
||||
// delete sliderAction;
|
||||
delete openAction;
|
||||
delete openFolderAction;
|
||||
delete openLatestComicAction;
|
||||
@ -136,13 +136,13 @@ void MainWindowViewer::loadConfiguration()
|
||||
|
||||
void MainWindowViewer::setupUI()
|
||||
{
|
||||
//setUnifiedTitleAndToolBarOnMac(true);
|
||||
// setUnifiedTitleAndToolBarOnMac(true);
|
||||
|
||||
viewer = new Viewer(this);
|
||||
connect(viewer, &Viewer::reset, this, &MainWindowViewer::processReset);
|
||||
//detected end of comic
|
||||
// detected end of comic
|
||||
connect(viewer, &Viewer::openNextComic, this, &MainWindowViewer::openNextComic);
|
||||
//detected start of comic
|
||||
// detected start of comic
|
||||
connect(viewer, &Viewer::openPreviousComic, this, &MainWindowViewer::openPreviousComic);
|
||||
|
||||
setCentralWidget(viewer);
|
||||
@ -157,7 +157,7 @@ void MainWindowViewer::setupUI()
|
||||
resize(QSize(width, height));
|
||||
}
|
||||
|
||||
had = new HelpAboutDialog(this); //TODO load data
|
||||
had = new HelpAboutDialog(this); // TODO load data
|
||||
|
||||
had->loadAboutInformation(":/files/about.html");
|
||||
had->loadHelp(":/files/helpYACReader.html");
|
||||
@ -169,7 +169,7 @@ void MainWindowViewer::setupUI()
|
||||
connect(optionsDialog, &OptionsDialog::changedImageOptions, viewer, &Viewer::updatePage);
|
||||
|
||||
optionsDialog->restoreOptions(settings);
|
||||
//shortcutsDialog = new ShortcutsDialog(this);
|
||||
// shortcutsDialog = new ShortcutsDialog(this);
|
||||
editShortcutsDialog = new EditShortcutsDialog(this);
|
||||
connect(optionsDialog, &YACReaderOptionsDialog::editShortcuts, editShortcutsDialog, &QWidget::show);
|
||||
|
||||
@ -184,10 +184,10 @@ void MainWindowViewer::setupUI()
|
||||
|
||||
viewer->setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
//if(Configuration::getConfiguration().getAlwaysOnTop())
|
||||
// if(Configuration::getConfiguration().getAlwaysOnTop())
|
||||
//{
|
||||
// setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
||||
//}
|
||||
// }
|
||||
|
||||
previousWindowFlags = windowFlags();
|
||||
previousPos = pos();
|
||||
@ -249,7 +249,7 @@ void MainWindowViewer::createActions()
|
||||
connect(openLatestComicAction, &QAction::triggered, this, &MainWindowViewer::openLatestComic);
|
||||
|
||||
QAction *recentFileAction = nullptr;
|
||||
//TODO: Replace limit with a configurable value
|
||||
// TODO: Replace limit with a configurable value
|
||||
for (int i = 0; i < Configuration::getConfiguration().getOpenRecentSize(); i++) {
|
||||
recentFileAction = new QAction(this);
|
||||
recentFileAction->setVisible(false);
|
||||
@ -305,10 +305,10 @@ void MainWindowViewer::createActions()
|
||||
|
||||
adjustHeightAction = new QAction(tr("Fit Height"), this);
|
||||
adjustHeightAction->setIcon(QIcon(":/images/viewer_toolbar/toHeight.png"));
|
||||
//adjustWidth->setCheckable(true);
|
||||
// adjustWidth->setCheckable(true);
|
||||
adjustHeightAction->setDisabled(true);
|
||||
adjustHeightAction->setToolTip(tr("Fit image to height"));
|
||||
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
||||
// adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
||||
adjustHeightAction->setData(ADJUST_HEIGHT_ACTION_Y);
|
||||
adjustHeightAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_HEIGHT_ACTION_Y));
|
||||
adjustHeightAction->setCheckable(true);
|
||||
@ -316,10 +316,10 @@ void MainWindowViewer::createActions()
|
||||
|
||||
adjustWidthAction = new QAction(tr("Fit Width"), this);
|
||||
adjustWidthAction->setIcon(QIcon(":/images/viewer_toolbar/toWidth.png"));
|
||||
//adjustWidth->setCheckable(true);
|
||||
// adjustWidth->setCheckable(true);
|
||||
adjustWidthAction->setDisabled(true);
|
||||
adjustWidthAction->setToolTip(tr("Fit image to width"));
|
||||
//adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
||||
// adjustWidth->setIcon(QIcon(":/images/fitWidth.png"));
|
||||
adjustWidthAction->setData(ADJUST_WIDTH_ACTION_Y);
|
||||
adjustWidthAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADJUST_WIDTH_ACTION_Y));
|
||||
adjustWidthAction->setCheckable(true);
|
||||
@ -342,7 +342,7 @@ void MainWindowViewer::createActions()
|
||||
fitToPageAction->setCheckable(true);
|
||||
connect(fitToPageAction, &QAction::triggered, this, &MainWindowViewer::fitToPageSwitch);
|
||||
|
||||
//fit modes have to be exclusive and checkable
|
||||
// fit modes have to be exclusive and checkable
|
||||
auto fitModes = new QActionGroup(this);
|
||||
fitModes->addAction(adjustHeightAction);
|
||||
fitModes->addAction(adjustWidthAction);
|
||||
@ -412,7 +412,7 @@ void MainWindowViewer::createActions()
|
||||
doublePageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_PAGE_ACTION_Y));
|
||||
connect(doublePageAction, &QAction::triggered, viewer, &Viewer::doublePageSwitch);
|
||||
|
||||
//inversed pictures mode
|
||||
// inversed pictures mode
|
||||
doubleMangaPageAction = new QAction(tr("Double page manga mode"), this);
|
||||
doubleMangaPageAction->setToolTip(tr("Reverse reading order in double page mode"));
|
||||
doubleMangaPageAction->setIcon(QIcon(":/images/viewer_toolbar/doubleMangaPage.png"));
|
||||
@ -479,7 +479,7 @@ void MainWindowViewer::createActions()
|
||||
showShorcutsAction->setIcon(QIcon(":/images/viewer_toolbar/shortcuts.png"));
|
||||
showShorcutsAction->setData(SHOW_SHORCUTS_ACTION_Y);
|
||||
showShorcutsAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_SHORCUTS_ACTION_Y));
|
||||
//connect(showShorcutsAction, SIGNAL(triggered()),shortcutsDialog,SLOT(show()));
|
||||
// connect(showShorcutsAction, SIGNAL(triggered()),shortcutsDialog,SLOT(show()));
|
||||
connect(showShorcutsAction, &QAction::triggered, editShortcutsDialog, &QWidget::show);
|
||||
|
||||
showInfoAction = new QAction(tr("Show Info"), this);
|
||||
@ -497,13 +497,13 @@ void MainWindowViewer::createActions()
|
||||
|
||||
showDictionaryAction = new QAction(tr("Show Dictionary"), this);
|
||||
showDictionaryAction->setIcon(QIcon(":/images/viewer_toolbar/translator.png"));
|
||||
//showDictionaryAction->setCheckable(true);
|
||||
// showDictionaryAction->setCheckable(true);
|
||||
showDictionaryAction->setDisabled(true);
|
||||
showDictionaryAction->setData(SHOW_DICTIONARY_ACTION_Y);
|
||||
showDictionaryAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SHOW_DICTIONARY_ACTION_Y));
|
||||
connect(showDictionaryAction, &QAction::triggered, viewer, &Viewer::translatorSwitch);
|
||||
|
||||
//deprecated
|
||||
// deprecated
|
||||
alwaysOnTopAction = new QAction(tr("Always on top"), this);
|
||||
alwaysOnTopAction->setIcon(QIcon(":/images/alwaysOnTop.png"));
|
||||
alwaysOnTopAction->setCheckable(true);
|
||||
@ -535,7 +535,7 @@ void MainWindowViewer::createToolBars()
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
//comicToolBar->setIconSize(QSize(16,16));
|
||||
// comicToolBar->setIconSize(QSize(16,16));
|
||||
#else
|
||||
comicToolBar->setIconSize(QSize(18, 18));
|
||||
comicToolBar->setStyleSheet("QToolBar{border:none;}");
|
||||
@ -617,7 +617,7 @@ void MainWindowViewer::createToolBars()
|
||||
comicToolBar->addAction(showShorcutsAction);
|
||||
comicToolBar->addAction(optionsAction);
|
||||
comicToolBar->addAction(helpAboutAction);
|
||||
//comicToolBar->addAction(closeAction);
|
||||
// comicToolBar->addAction(closeAction);
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
comicToolBar->setMovable(false);
|
||||
@ -668,13 +668,13 @@ void MainWindowViewer::createToolBars()
|
||||
|
||||
viewer->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
//MacOSX app menus
|
||||
// MacOSX app menus
|
||||
#ifdef Q_OS_MAC
|
||||
auto menuBar = this->menuBar();
|
||||
//about / preferences
|
||||
//TODO
|
||||
// about / preferences
|
||||
// TODO
|
||||
|
||||
//file
|
||||
// file
|
||||
auto fileMenu = new QMenu(tr("File"));
|
||||
|
||||
fileMenu->addAction(newInstanceAction);
|
||||
@ -741,14 +741,14 @@ void MainWindowViewer::createToolBars()
|
||||
menuBar->addMenu(windowMenu);
|
||||
menuBar->addMenu(helpMenu);
|
||||
|
||||
//tool bar
|
||||
//QMenu * toolbarMenu = new QMenu(tr("Toolbar"));
|
||||
//toolbarMenu->addAction();
|
||||
//TODO
|
||||
// tool bar
|
||||
// QMenu * toolbarMenu = new QMenu(tr("Toolbar"));
|
||||
// toolbarMenu->addAction();
|
||||
// TODO
|
||||
|
||||
//menu->addMenu(toolbarMenu);
|
||||
// menu->addMenu(toolbarMenu);
|
||||
|
||||
//attach toolbar
|
||||
// attach toolbar
|
||||
|
||||
comicToolBar->attachToWindow(this->windowHandle());
|
||||
|
||||
@ -759,7 +759,7 @@ void MainWindowViewer::refreshRecentFilesActionList()
|
||||
{
|
||||
QStringList recentFilePaths = Configuration::getConfiguration().openRecentList();
|
||||
|
||||
//TODO: Replace limit with something configurable
|
||||
// TODO: Replace limit with something configurable
|
||||
int iteration = (recentFilePaths.size() < Configuration::getConfiguration().getOpenRecentSize())
|
||||
? recentFilePaths.size()
|
||||
: Configuration::getConfiguration().getOpenRecentSize();
|
||||
@ -876,7 +876,7 @@ void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId, Open
|
||||
} else {
|
||||
isClient = false;
|
||||
QMessageBox::information(this, "Connection Error", "Unable to connect to YACReaderLibrary");
|
||||
//error
|
||||
// error
|
||||
}
|
||||
|
||||
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
|
||||
@ -886,11 +886,11 @@ void MainWindowViewer::openComicFromPath(QString pathFile)
|
||||
{
|
||||
doubleMangaPageAction->setChecked(Configuration::getConfiguration().getDoubleMangaPage());
|
||||
openComic(pathFile);
|
||||
isClient = false; //this method is used for direct openings
|
||||
isClient = false; // this method is used for direct openings
|
||||
updatePrevNextActions(!previousComicPath.isEmpty(), !nextComicPath.isEmpty());
|
||||
}
|
||||
|
||||
//isClient shouldn't be modified when a siblinig comic is opened
|
||||
// isClient shouldn't be modified when a siblinig comic is opened
|
||||
void MainWindowViewer::openSiblingComic(QString pathFile)
|
||||
{
|
||||
openComic(pathFile);
|
||||
@ -923,7 +923,7 @@ void MainWindowViewer::openFolder()
|
||||
|
||||
void MainWindowViewer::openFolderFromPath(QString pathDir)
|
||||
{
|
||||
currentDirectory = pathDir; //TODO ??
|
||||
currentDirectory = pathDir; // TODO ??
|
||||
QFileInfo fi(pathDir);
|
||||
getSiblingComics(fi.absolutePath(), fi.fileName());
|
||||
|
||||
@ -938,7 +938,7 @@ void MainWindowViewer::openFolderFromPath(QString pathDir)
|
||||
|
||||
void MainWindowViewer::openFolderFromPath(QString pathDir, QString atFileName)
|
||||
{
|
||||
currentDirectory = pathDir; //TODO ??
|
||||
currentDirectory = pathDir; // TODO ??
|
||||
QFileInfo fi(pathDir);
|
||||
getSiblingComics(fi.absolutePath(), fi.fileName());
|
||||
|
||||
@ -988,7 +988,7 @@ void MainWindowViewer::enableActions()
|
||||
adjustHeightAction->setDisabled(false);
|
||||
adjustWidthAction->setDisabled(false);
|
||||
goToPageAction->setDisabled(false);
|
||||
//alwaysOnTopAction->setDisabled(false);
|
||||
// alwaysOnTopAction->setDisabled(false);
|
||||
leftRotationAction->setDisabled(false);
|
||||
rightRotationAction->setDisabled(false);
|
||||
showMagnifyingGlassAction->setDisabled(false);
|
||||
@ -1001,9 +1001,9 @@ void MainWindowViewer::enableActions()
|
||||
increasePageZoomAction->setDisabled(false);
|
||||
decreasePageZoomAction->setDisabled(false);
|
||||
resetZoomAction->setDisabled(false);
|
||||
//setBookmark->setDisabled(false);
|
||||
// setBookmark->setDisabled(false);
|
||||
showBookmarksAction->setDisabled(false);
|
||||
showInfoAction->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||
showInfoAction->setDisabled(false); // TODO enable goTo and showInfo (or update) when numPages emited
|
||||
showDictionaryAction->setDisabled(false);
|
||||
showFlowAction->setDisabled(false);
|
||||
|
||||
@ -1020,7 +1020,7 @@ void MainWindowViewer::disableActions()
|
||||
adjustHeightAction->setDisabled(true);
|
||||
adjustWidthAction->setDisabled(true);
|
||||
goToPageAction->setDisabled(true);
|
||||
//alwaysOnTopAction->setDisabled(true);
|
||||
// alwaysOnTopAction->setDisabled(true);
|
||||
leftRotationAction->setDisabled(true);
|
||||
rightRotationAction->setDisabled(true);
|
||||
showMagnifyingGlassAction->setDisabled(true);
|
||||
@ -1034,7 +1034,7 @@ void MainWindowViewer::disableActions()
|
||||
resetZoomAction->setDisabled(true);
|
||||
setBookmarkAction->setDisabled(true);
|
||||
showBookmarksAction->setDisabled(true);
|
||||
showInfoAction->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||
showInfoAction->setDisabled(true); // TODO enable goTo and showInfo (or update) when numPages emited
|
||||
openComicOnTheLeftAction->setDisabled(true);
|
||||
openComicOnTheRightAction->setDisabled(true);
|
||||
showDictionaryAction->setDisabled(true);
|
||||
@ -1043,7 +1043,7 @@ void MainWindowViewer::disableActions()
|
||||
|
||||
void MainWindowViewer::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//TODO remove unused keys
|
||||
// TODO remove unused keys
|
||||
int _key = event->key();
|
||||
Qt::KeyboardModifiers modifiers = event->modifiers();
|
||||
|
||||
@ -1083,7 +1083,7 @@ void MainWindowViewer::toggleFullScreen()
|
||||
Configuration::getConfiguration().setFullScreen(fullscreen = !fullscreen);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||
#ifdef Q_OS_WIN // fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||
|
||||
void MainWindowViewer::toFullScreen()
|
||||
{
|
||||
@ -1091,7 +1091,7 @@ void MainWindowViewer::toFullScreen()
|
||||
|
||||
hideToolBars();
|
||||
viewer->hide();
|
||||
viewer->fullscreen = true; //TODO, change by the right use of windowState();
|
||||
viewer->fullscreen = true; // TODO, change by the right use of windowState();
|
||||
|
||||
previousWindowFlags = windowFlags();
|
||||
previousPos = pos();
|
||||
@ -1114,10 +1114,10 @@ void MainWindowViewer::toFullScreen()
|
||||
|
||||
void MainWindowViewer::toNormal()
|
||||
{
|
||||
//show all
|
||||
// show all
|
||||
viewer->hide();
|
||||
viewer->fullscreen = false; //TODO, change by the right use of windowState();
|
||||
//viewer->hideMagnifyingGlass();
|
||||
viewer->fullscreen = false; // TODO, change by the right use of windowState();
|
||||
// viewer->hideMagnifyingGlass();
|
||||
|
||||
setWindowFlags(previousWindowFlags);
|
||||
move(previousPos);
|
||||
@ -1141,7 +1141,7 @@ void MainWindowViewer::toFullScreen()
|
||||
|
||||
hideToolBars();
|
||||
viewer->hide();
|
||||
viewer->fullscreen = true; //TODO, change by the right use of windowState();
|
||||
viewer->fullscreen = true; // TODO, change by the right use of windowState();
|
||||
setWindowState(Qt::WindowFullScreen);
|
||||
viewer->show();
|
||||
if (viewer->magnifyingGlassIsVisible())
|
||||
@ -1150,10 +1150,10 @@ void MainWindowViewer::toFullScreen()
|
||||
|
||||
void MainWindowViewer::toNormal()
|
||||
{
|
||||
//show all
|
||||
// show all
|
||||
viewer->hide();
|
||||
viewer->fullscreen = false; //TODO, change by the right use of windowState();
|
||||
//viewer->hideMagnifyingGlass();
|
||||
viewer->fullscreen = false; // TODO, change by the right use of windowState();
|
||||
// viewer->hideMagnifyingGlass();
|
||||
if (fromMaximized)
|
||||
showMaximized();
|
||||
else
|
||||
@ -1178,7 +1178,7 @@ void MainWindowViewer::toggleToolBars()
|
||||
}
|
||||
void MainWindowViewer::hideToolBars()
|
||||
{
|
||||
//hide all
|
||||
// hide all
|
||||
this->comicToolBar->hide();
|
||||
toolbars = false;
|
||||
}
|
||||
@ -1203,11 +1203,11 @@ void MainWindowViewer::fitToHeight()
|
||||
|
||||
void MainWindowViewer::toggleWidthHeight()
|
||||
{
|
||||
//Only switch to "Fit to height" when we're in "Fit to width"
|
||||
// Only switch to "Fit to height" when we're in "Fit to width"
|
||||
if (Configuration::getConfiguration().getFitMode() == YACReader::FitMode::ToWidth) {
|
||||
adjustHeightAction->trigger();
|
||||
}
|
||||
//Default to "Fit to width" in all other cases
|
||||
// Default to "Fit to width" in all other cases
|
||||
else {
|
||||
adjustWidthAction->trigger();
|
||||
}
|
||||
@ -1246,7 +1246,7 @@ void MainWindowViewer::processReset()
|
||||
|
||||
void MainWindowViewer::setUpShortcutsManagement()
|
||||
{
|
||||
//actions holder
|
||||
// actions holder
|
||||
auto orphanActions = new QObject;
|
||||
|
||||
QList<QAction *> allActions;
|
||||
@ -1262,7 +1262,7 @@ void MainWindowViewer::setUpShortcutsManagement()
|
||||
|
||||
allActions << tmpList;
|
||||
|
||||
//keys without actions (General)
|
||||
// keys without actions (General)
|
||||
QAction *toggleFullScreenAction = new QAction(tr("Toggle fullscreen mode"), orphanActions);
|
||||
toggleFullScreenAction->setData(TOGGLE_FULL_SCREEN_ACTION_Y);
|
||||
toggleFullScreenAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(TOGGLE_FULL_SCREEN_ACTION_Y));
|
||||
@ -1290,7 +1290,7 @@ void MainWindowViewer::setUpShortcutsManagement()
|
||||
|
||||
allActions << tmpList;
|
||||
|
||||
//keys without actions (MGlass)
|
||||
// keys without actions (MGlass)
|
||||
auto sizeUpMglassAction = new QAction(tr("Size up magnifying glass"), orphanActions);
|
||||
sizeUpMglassAction->setData(SIZE_UP_MGLASS_ACTION_Y);
|
||||
sizeUpMglassAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y));
|
||||
@ -1317,7 +1317,7 @@ void MainWindowViewer::setUpShortcutsManagement()
|
||||
|
||||
allActions << tmpList;
|
||||
|
||||
//keys without actions
|
||||
// keys without actions
|
||||
auto toggleFitToScreenAction = new QAction(tr("Toggle between fit to width and fit to height"), orphanActions);
|
||||
toggleFitToScreenAction->setData(CHANGE_FIT_ACTION_Y);
|
||||
toggleFitToScreenAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(CHANGE_FIT_ACTION_Y));
|
||||
@ -1489,7 +1489,7 @@ void MainWindowViewer::openPreviousComic()
|
||||
if (currentIndex == -1)
|
||||
return;
|
||||
if (currentIndex - 1 >= 0 && currentIndex - 1 < siblingComics.count()) {
|
||||
siblingComics[currentIndex] = currentComicDB; //updated
|
||||
siblingComics[currentIndex] = currentComicDB; // updated
|
||||
currentComicDB = siblingComics.at(currentIndex - 1);
|
||||
open(currentDirectory + currentComicDB.path, currentComicDB, siblingComics);
|
||||
}
|
||||
@ -1509,7 +1509,7 @@ void MainWindowViewer::openNextComic()
|
||||
if (currentIndex == -1)
|
||||
return;
|
||||
if (currentIndex + 1 > 0 && currentIndex + 1 < siblingComics.count()) {
|
||||
siblingComics[currentIndex] = currentComicDB; //updated
|
||||
siblingComics[currentIndex] = currentComicDB; // updated
|
||||
currentComicDB = siblingComics.at(currentIndex + 1);
|
||||
open(currentDirectory + currentComicDB.path, currentComicDB, siblingComics);
|
||||
}
|
||||
@ -1567,26 +1567,26 @@ void MainWindowViewer::getSiblingComics(QString path, QString currentComic)
|
||||
QStringList list = d.entryList();
|
||||
std::sort(list.begin(), list.end(), naturalSortLessThanCI);
|
||||
int index = list.indexOf(currentComic);
|
||||
if (index == -1) //comic not found
|
||||
if (index == -1) // comic not found
|
||||
{
|
||||
/*QFile f(QCoreApplication::applicationDirPath()+"/errorLog.txt");
|
||||
if(!f.open(QIODevice::WriteOnly))
|
||||
{
|
||||
QMessageBox::critical(NULL,tr("Saving error log file...."),tr("There was a problem saving YACReader error log file. Please, check if you have enough permissions in the YACReader root folder."));
|
||||
}
|
||||
else
|
||||
{
|
||||
QTextStream txtS(&f);
|
||||
txtS << "METHOD : MainWindowViewer::getSiblingComics" << '\n';
|
||||
txtS << "ERROR : current comic not found in its own path" << '\n';
|
||||
txtS << path << '\n';
|
||||
txtS << currentComic << '\n';
|
||||
txtS << "Comic list count : " + list.count() << '\n';
|
||||
foreach(QString s, list){
|
||||
txtS << s << '\n';
|
||||
}
|
||||
f.close();
|
||||
}*/
|
||||
if(!f.open(QIODevice::WriteOnly))
|
||||
{
|
||||
QMessageBox::critical(NULL,tr("Saving error log file...."),tr("There was a problem saving YACReader error log file. Please, check if you have enough permissions in the YACReader root folder."));
|
||||
}
|
||||
else
|
||||
{
|
||||
QTextStream txtS(&f);
|
||||
txtS << "METHOD : MainWindowViewer::getSiblingComics" << '\n';
|
||||
txtS << "ERROR : current comic not found in its own path" << '\n';
|
||||
txtS << path << '\n';
|
||||
txtS << currentComic << '\n';
|
||||
txtS << "Comic list count : " + list.count() << '\n';
|
||||
foreach(QString s, list){
|
||||
txtS << s << '\n';
|
||||
}
|
||||
f.close();
|
||||
}*/
|
||||
}
|
||||
|
||||
previousComicPath = nextComicPath = "";
|
||||
@ -1615,7 +1615,7 @@ void MainWindowViewer::dropEvent(QDropEvent *event)
|
||||
info.setFile(fName); // information about file
|
||||
if (info.isFile()) {
|
||||
QStringList imageSuffixs = Comic::getSupportedImageLiteralFormats();
|
||||
if (imageSuffixs.contains(info.suffix())) //image dropped
|
||||
if (imageSuffixs.contains(info.suffix())) // image dropped
|
||||
openFolderFromPath(info.absoluteDir().absolutePath(), info.fileName());
|
||||
else
|
||||
openComicFromPath(fName); // if is file, setText
|
||||
@ -1640,7 +1640,7 @@ void MainWindowViewer::dragEnterEvent(QDragEnterEvent *event)
|
||||
void MainWindowViewer::alwaysOnTopSwitch()
|
||||
{
|
||||
if (!Configuration::getConfiguration().getAlwaysOnTop()) {
|
||||
setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); //always on top
|
||||
setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint); // always on top
|
||||
show();
|
||||
} else {
|
||||
setWindowFlags(this->windowFlags() ^ (Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint));
|
||||
|
@ -78,29 +78,29 @@ public slots:
|
||||
void toggleFitToWidthSlider();
|
||||
|
||||
/*void viewComic();
|
||||
void prev();
|
||||
void next();
|
||||
void updatePage();*/
|
||||
void prev();
|
||||
void next();
|
||||
void updatePage();*/
|
||||
|
||||
private:
|
||||
//!State
|
||||
//! State
|
||||
bool fullscreen;
|
||||
bool toolbars;
|
||||
bool alwaysOnTop;
|
||||
bool fromMaximized;
|
||||
|
||||
//QTBUG-41883
|
||||
// QTBUG-41883
|
||||
QSize _size;
|
||||
QPoint _pos;
|
||||
|
||||
QString currentDirectory;
|
||||
QString currentDirectoryImgDest;
|
||||
//!Widgets
|
||||
//! Widgets
|
||||
Viewer *viewer;
|
||||
//GoToDialog * goToDialog;
|
||||
// GoToDialog * goToDialog;
|
||||
OptionsDialog *optionsDialog;
|
||||
HelpAboutDialog *had;
|
||||
//ShortcutsDialog * shortcutsDialog;
|
||||
// ShortcutsDialog * shortcutsDialog;
|
||||
EditShortcutsDialog *editShortcutsDialog;
|
||||
|
||||
//! ToolBars
|
||||
@ -113,7 +113,7 @@ private:
|
||||
//! Actions
|
||||
QAction *openAction;
|
||||
#ifdef Q_OS_MAC
|
||||
QAction *newInstanceAction; //needed in macos
|
||||
QAction *newInstanceAction; // needed in macos
|
||||
#endif
|
||||
QAction *openFolderAction;
|
||||
QAction *openLatestComicAction;
|
||||
@ -166,7 +166,7 @@ private:
|
||||
|
||||
//! Manejadores de evento:
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
//void resizeEvent(QResizeEvent * event);
|
||||
// void resizeEvent(QResizeEvent * event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
@ -180,7 +180,7 @@ private:
|
||||
quint64 libraryId;
|
||||
OpenComicSource source;
|
||||
|
||||
//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||
// fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||
Qt::WindowFlags previousWindowFlags;
|
||||
QPoint previousPos;
|
||||
QSize previousSize;
|
||||
|
@ -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 still be broken in OSX yet
|
||||
#ifndef Q_OS_MAC
|
||||
this->setGraphicsEffect(effect);
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
auto layoutImage = new QGridLayout();
|
||||
|
||||
QGroupBox *slideSizeBox = new QGroupBox(tr("\"Go to flow\" size"));
|
||||
//slideSizeLabel = new QLabel(,this);
|
||||
// slideSizeLabel = new QLabel(,this);
|
||||
slideSize = new QSlider(this);
|
||||
slideSize->setMinimum(125);
|
||||
slideSize->setMaximum(350);
|
||||
@ -66,33 +66,33 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
connect(colorDialog, &QColorDialog::colorSelected, this, &OptionsDialog::updateColor);
|
||||
|
||||
QGroupBox *colorBox = new QGroupBox(tr("Background color"));
|
||||
//backgroundColor->setMinimumWidth(100);
|
||||
// backgroundColor->setMinimumWidth(100);
|
||||
colorSelection->addWidget(backgroundColor);
|
||||
colorSelection->addWidget(selectBackgroundColorButton = new QPushButton(tr("Choose")));
|
||||
colorSelection->setStretchFactor(backgroundColor, 1);
|
||||
colorSelection->setStretchFactor(selectBackgroundColorButton, 0);
|
||||
//colorSelection->addStretch();
|
||||
// colorSelection->addStretch();
|
||||
connect(selectBackgroundColorButton, &QAbstractButton::clicked, colorDialog, &QWidget::show);
|
||||
colorBox->setLayout(colorSelection);
|
||||
|
||||
brightnessS = new YACReaderSpinSliderWidget(this, true);
|
||||
brightnessS->setRange(0, 100);
|
||||
//brightnessS->setText(tr("Brightness"));
|
||||
// brightnessS->setText(tr("Brightness"));
|
||||
brightnessS->setTracking(false);
|
||||
connect(brightnessS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::brightnessChanged);
|
||||
|
||||
contrastS = new YACReaderSpinSliderWidget(this, true);
|
||||
contrastS->setRange(0, 250);
|
||||
//contrastS->setText(tr("Contrast"));
|
||||
// contrastS->setText(tr("Contrast"));
|
||||
contrastS->setTracking(false);
|
||||
connect(contrastS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::contrastChanged);
|
||||
|
||||
gammaS = new YACReaderSpinSliderWidget(this, true);
|
||||
gammaS->setRange(0, 250);
|
||||
//gammaS->setText(tr("Gamma"));
|
||||
// gammaS->setText(tr("Gamma"));
|
||||
gammaS->setTracking(false);
|
||||
connect(gammaS, &YACReaderSpinSliderWidget::valueChanged, this, &OptionsDialog::gammaChanged);
|
||||
//connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
|
||||
// connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
|
||||
|
||||
quickNavi = new QCheckBox(tr("Quick Navigation Mode"));
|
||||
disableShowOnMouseOver = new QCheckBox(tr("Disable mouse over activation"));
|
||||
@ -105,7 +105,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
|
||||
layoutGeneral->addWidget(pathBox);
|
||||
layoutGeneral->addWidget(slideSizeBox);
|
||||
//layoutGeneral->addWidget(fitBox);
|
||||
// layoutGeneral->addWidget(fitBox);
|
||||
layoutGeneral->addWidget(colorBox);
|
||||
layoutGeneral->addWidget(shortcutsBox);
|
||||
layoutGeneral->addStretch();
|
||||
@ -174,12 +174,12 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
//disable vSyncCheck
|
||||
// disable vSyncCheck
|
||||
#ifndef NO_OPENGL
|
||||
gl->vSyncCheck->hide();
|
||||
#endif
|
||||
//restoreOptions(); //load options
|
||||
//resize(400,0);
|
||||
// restoreOptions(); //load options
|
||||
// resize(400,0);
|
||||
setModal(true);
|
||||
setWindowTitle(tr("Options"));
|
||||
|
||||
@ -209,7 +209,7 @@ void OptionsDialog::saveOptions()
|
||||
settings->setValue(PATH, pathEdit->text());
|
||||
|
||||
settings->setValue(BACKGROUND_COLOR, colorDialog->currentColor());
|
||||
//settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
|
||||
// settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
|
||||
settings->setValue(QUICK_NAVI_MODE, quickNavi->isChecked());
|
||||
settings->setValue(DISABLE_MOUSE_OVER_GOTO_FLOW, disableShowOnMouseOver->isChecked());
|
||||
|
||||
@ -239,7 +239,7 @@ void OptionsDialog::restoreOptions(QSettings *settings)
|
||||
pathEdit->setText(settings->value(PATH).toString());
|
||||
|
||||
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
||||
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
// fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
|
||||
quickNavi->setChecked(settings->value(QUICK_NAVI_MODE).toBool());
|
||||
disableShowOnMouseOver->setChecked(settings->value(DISABLE_MOUSE_OVER_GOTO_FLOW).toBool());
|
||||
@ -270,7 +270,7 @@ void OptionsDialog::brightnessChanged(int value)
|
||||
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
|
||||
settings.setValue(BRIGHTNESS, value);
|
||||
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
|
||||
//emit(changedImageOptions());
|
||||
// emit(changedImageOptions());
|
||||
}
|
||||
|
||||
void OptionsDialog::contrastChanged(int value)
|
||||
@ -278,7 +278,7 @@ void OptionsDialog::contrastChanged(int value)
|
||||
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
|
||||
settings.setValue(CONTRAST, value);
|
||||
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
|
||||
///emit(changedImageOptions());
|
||||
/// emit(changedImageOptions());
|
||||
}
|
||||
|
||||
void OptionsDialog::gammaChanged(int value)
|
||||
@ -286,7 +286,7 @@ void OptionsDialog::gammaChanged(int value)
|
||||
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
|
||||
settings.setValue(GAMMA, value);
|
||||
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
|
||||
//emit(changedImageOptions());
|
||||
// emit(changedImageOptions());
|
||||
}
|
||||
|
||||
void OptionsDialog::resetImageConfig()
|
||||
@ -299,16 +299,16 @@ void OptionsDialog::resetImageConfig()
|
||||
settings.setValue(CONTRAST, 100);
|
||||
settings.setValue(GAMMA, 100);
|
||||
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
|
||||
//emit(changedImageOptions());
|
||||
// emit(changedImageOptions());
|
||||
}
|
||||
|
||||
void OptionsDialog::show()
|
||||
{
|
||||
//TODO solucionar el tema de las settings, esto sólo debería aparecer en una única línea de código
|
||||
// TODO solucionar el tema de las settings, esto sólo debería aparecer en una única línea de código
|
||||
QSettings *s = new QSettings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
|
||||
//fitToWidthRatioS->disconnect();
|
||||
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
//connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
|
||||
// fitToWidthRatioS->disconnect();
|
||||
// fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||
// connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
|
||||
QDialog::show();
|
||||
delete s;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
OptionsDialog(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
//QLabel * pathLabel;
|
||||
// QLabel * pathLabel;
|
||||
QLineEdit *pathEdit;
|
||||
QPushButton *pathFindButton;
|
||||
QCheckBox *quickNavi;
|
||||
@ -32,11 +32,11 @@ private:
|
||||
|
||||
QLabel *zoomLevel;
|
||||
|
||||
//QLabel * slideSizeLabel;
|
||||
// QLabel * slideSizeLabel;
|
||||
QSlider *slideSize;
|
||||
|
||||
//QLabel * fitToWidthRatioLabel;
|
||||
//QSlider * fitToWidthRatioS;
|
||||
// QLabel * fitToWidthRatioLabel;
|
||||
// QSlider * fitToWidthRatioS;
|
||||
|
||||
QLabel *backgroundColor;
|
||||
QPushButton *selectBackgroundColorButton;
|
||||
@ -54,7 +54,7 @@ public slots:
|
||||
void restoreOptions(QSettings *settings) override;
|
||||
void findFolder();
|
||||
void updateColor(const QColor &color);
|
||||
//void fitToWidthRatio(int value);
|
||||
// void fitToWidthRatio(int value);
|
||||
void brightnessChanged(int value);
|
||||
void contrastChanged(int value);
|
||||
void gammaChanged(int value);
|
||||
@ -66,7 +66,7 @@ signals:
|
||||
void changedOptions();
|
||||
void changedImageOptions();
|
||||
void changedFilters(int brightness, int contrast, int gamma);
|
||||
//void fitToWidthRatioChanged(float ratio);
|
||||
// void fitToWidthRatioChanged(float ratio);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -50,7 +50,7 @@ void PageLabelWidget::show()
|
||||
}
|
||||
|
||||
QWidget::show();
|
||||
//connect(animation,SIGNAL(finished()),this,SLOT(QWidget::hide()));
|
||||
// connect(animation,SIGNAL(finished()),this,SLOT(QWidget::hide()));
|
||||
animation->disconnect();
|
||||
|
||||
animation->setStartValue(QPoint((parent->geometry().size().width() - this->width()), -this->height()));
|
||||
@ -66,7 +66,7 @@ void PageLabelWidget::hide()
|
||||
if (parent == nullptr) {
|
||||
return;
|
||||
}
|
||||
//connect(animation,SIGNAL(finished()),this,SLOT(setHidden()));
|
||||
// connect(animation,SIGNAL(finished()),this,SLOT(setHidden()));
|
||||
animation->setStartValue(QPoint((parent->geometry().size().width() - this->width()), 0));
|
||||
animation->setEndValue(QPoint((parent->geometry().size().width() - this->width()), -this->height()));
|
||||
animation->start();
|
||||
|
@ -151,8 +151,8 @@ QImage MeanNoiseReductionFilter::setFilter(const QImage &image)
|
||||
}
|
||||
}
|
||||
result.setPixel(i, j, QColor(r / neighborghoodSize, g / neighborghoodSize, b / neighborghoodSize).rgb());
|
||||
//qDebug((QString::number(redChannel.at(4))+" "+QString::number(greenChannel.at(4))+" "+QString::number(blueChannel.at(4))).toAscii());
|
||||
//qDebug((QString::number(redChannel.size())+" "+QString::number(greenChannel.size())+" "+QString::number(blueChannel.size())).toAscii());
|
||||
// qDebug((QString::number(redChannel.at(4))+" "+QString::number(greenChannel.at(4))+" "+QString::number(blueChannel.at(4))).toAscii());
|
||||
// qDebug((QString::number(redChannel.size())+" "+QString::number(greenChannel.size())+" "+QString::number(blueChannel.size())).toAscii());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -213,15 +213,15 @@ BrightnessFilter::BrightnessFilter(int l)
|
||||
QImage BrightnessFilter::setFilter(const QImage &image)
|
||||
{
|
||||
/*int width = image.width();
|
||||
int height = image.height();
|
||||
QImage result(width,height,image.format());
|
||||
int height = image.height();
|
||||
QImage result(width,height,image.format());
|
||||
|
||||
for(int j=0;j<height;j++){
|
||||
for(int i=0;i<width;i++){
|
||||
result.setPixel(i,j,QColor(image.pixel(i,j)).light(level).rgb());
|
||||
}
|
||||
}
|
||||
return result;*/
|
||||
for(int j=0;j<height;j++){
|
||||
for(int i=0;i<width;i++){
|
||||
result.setPixel(i,j,QColor(image.pixel(i,j)).light(level).rgb());
|
||||
}
|
||||
}
|
||||
return result;*/
|
||||
if (level == -1) {
|
||||
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
|
||||
return changeBrightness(image, settings.value(BRIGHTNESS, 0).toInt());
|
||||
@ -242,61 +242,61 @@ ContrastFilter::ContrastFilter(int l)
|
||||
QImage ContrastFilter::setFilter(const QImage &image)
|
||||
{
|
||||
/*int width = image.width();
|
||||
int height = image.height();
|
||||
QImage result(width,height,image.format());
|
||||
int height = image.height();
|
||||
QImage result(width,height,image.format());
|
||||
|
||||
int min,max,v;
|
||||
min = 0;
|
||||
max = 255;
|
||||
int sum = 0;
|
||||
int min,max,v;
|
||||
min = 0;
|
||||
max = 255;
|
||||
int sum = 0;
|
||||
|
||||
QVector<int> hist(256,0);
|
||||
QVector<int> hist(256,0);
|
||||
|
||||
for(int j=0;j<height;j++){
|
||||
for(int i=0;i<width;i++){
|
||||
hist[QColor(image.pixel(i,j)).lightness()]++;
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
for(int j=0;j<height;j++){
|
||||
for(int i=0;i<width;i++){
|
||||
hist[QColor(image.pixel(i,j)).lightness()]++;
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
|
||||
long double count = sum;
|
||||
long double new_count = 0.0;
|
||||
long double percentage,next_percentage;
|
||||
long double count = sum;
|
||||
long double new_count = 0.0;
|
||||
long double percentage,next_percentage;
|
||||
|
||||
for (int i = 0; i < 254; i++)
|
||||
{
|
||||
new_count += hist[i];
|
||||
percentage = new_count/count;
|
||||
next_percentage = (new_count+hist[i+1])/count;
|
||||
if(fabs (percentage - 0.006) < fabs (next_percentage - 0.006))
|
||||
{
|
||||
min = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 254; i++)
|
||||
{
|
||||
new_count += hist[i];
|
||||
percentage = new_count/count;
|
||||
next_percentage = (new_count+hist[i+1])/count;
|
||||
if(fabs (percentage - 0.006) < fabs (next_percentage - 0.006))
|
||||
{
|
||||
min = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
new_count=0.0;
|
||||
for (int i = 255; i > 1; i--)
|
||||
{
|
||||
new_count += hist[i];
|
||||
percentage = new_count/count;
|
||||
next_percentage = (new_count+hist[i-1])/count;
|
||||
if(fabs (percentage - 0.006) < fabs (next_percentage - 0.006))
|
||||
{
|
||||
max = i-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
QColor c;
|
||||
int range = max - min;
|
||||
for(int j=0;j<height;j++){
|
||||
for(int i=0;i<width;i++){
|
||||
c = QColor(image.pixel(i,j));
|
||||
result.setPixel(i,j,c.light(((c.lightness()-min)/range*1.0)*255).rgb());
|
||||
}
|
||||
}
|
||||
new_count=0.0;
|
||||
for (int i = 255; i > 1; i--)
|
||||
{
|
||||
new_count += hist[i];
|
||||
percentage = new_count/count;
|
||||
next_percentage = (new_count+hist[i-1])/count;
|
||||
if(fabs (percentage - 0.006) < fabs (next_percentage - 0.006))
|
||||
{
|
||||
max = i-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
QColor c;
|
||||
int range = max - min;
|
||||
for(int j=0;j<height;j++){
|
||||
for(int i=0;i<width;i++){
|
||||
c = QColor(image.pixel(i,j));
|
||||
result.setPixel(i,j,c.light(((c.lightness()-min)/range*1.0)*255).rgb());
|
||||
}
|
||||
}
|
||||
|
||||
return result;*/
|
||||
return result;*/
|
||||
if (level == -1) {
|
||||
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
|
||||
return changeContrast(image, settings.value(CONTRAST, 100).toInt());
|
||||
@ -393,13 +393,13 @@ Render::~Render()
|
||||
delete pr;
|
||||
}
|
||||
|
||||
//TODO move to share_ptr
|
||||
// TODO move to share_ptr
|
||||
foreach (ImageFilter *filter, filters)
|
||||
delete filter;
|
||||
}
|
||||
//Este método se encarga de forzar el renderizado de las páginas.
|
||||
//Actualiza el buffer según es necesario.
|
||||
//si la pagina actual no está renderizada, se lanza un hilo que la renderize (double or single page mode) y se emite una señal que indica que se está renderizando.
|
||||
// Este método se encarga de forzar el renderizado de las páginas.
|
||||
// Actualiza el buffer según es necesario.
|
||||
// si la pagina actual no está renderizada, se lanza un hilo que la renderize (double or single page mode) y se emite una señal que indica que se está renderizando.
|
||||
void Render::render()
|
||||
{
|
||||
updateBuffer();
|
||||
@ -408,29 +408,29 @@ void Render::render()
|
||||
if (pagesReady[currentIndex]) {
|
||||
pageRenders[currentPageBufferedIndex] = new PageRender(this, currentIndex, comic->getRawData()->at(currentIndex), buffer[currentPageBufferedIndex], imageRotation, filters);
|
||||
} else
|
||||
//las páginas no están listas, y se están cargando en el cómic
|
||||
emit processingPage(); //para evitar confusiones esta señal debería llamarse de otra forma
|
||||
// las páginas no están listas, y se están cargando en el cómic
|
||||
emit processingPage(); // para evitar confusiones esta señal debería llamarse de otra forma
|
||||
|
||||
//si se ha creado un hilo para renderizar la página actual, se arranca
|
||||
// si se ha creado un hilo para renderizar la página actual, se arranca
|
||||
if (pageRenders[currentPageBufferedIndex] != 0) {
|
||||
//se conecta la señal pageReady del hilo, con el SLOT prepareAvailablePage
|
||||
// se conecta la señal pageReady del hilo, con el SLOT prepareAvailablePage
|
||||
connect(pageRenders[currentPageBufferedIndex], &PageRender::pageReady, this, &Render::prepareAvailablePage);
|
||||
//se emite la señal de procesando, debido a que los hilos se arrancan aquí
|
||||
// se emite la señal de procesando, debido a que los hilos se arrancan aquí
|
||||
if (filters.size() > 0)
|
||||
emit processingPage();
|
||||
pageRenders[currentPageBufferedIndex]->start();
|
||||
pageRenders[currentPageBufferedIndex]->setPriority(QThread::TimeCriticalPriority);
|
||||
} else
|
||||
//en qué caso sería necesario hacer esto??? //TODO: IMPORTANTE, puede que no sea necesario.
|
||||
// en qué caso sería necesario hacer esto??? //TODO: IMPORTANTE, puede que no sea necesario.
|
||||
emit processingPage();
|
||||
} else
|
||||
//no hay ninguna página lista para ser renderizada, es necesario esperar.
|
||||
// no hay ninguna página lista para ser renderizada, es necesario esperar.
|
||||
emit processingPage();
|
||||
} else
|
||||
// la página actual está lista
|
||||
{
|
||||
//emit currentPageReady();
|
||||
//make prepareAvailablePage the only function that emits currentPageReady()
|
||||
// emit currentPageReady();
|
||||
// make prepareAvailablePage the only function that emits currentPageReady()
|
||||
prepareAvailablePage(currentIndex);
|
||||
}
|
||||
fillBuffer();
|
||||
@ -567,7 +567,7 @@ bool Render::currentPageIsDoublePage()
|
||||
|
||||
bool Render::nextPageIsDoublePage()
|
||||
{
|
||||
//this function is not used right now
|
||||
// this function is not used right now
|
||||
if (buffer[currentPageBufferedIndex + 2]->isNull() || buffer[currentPageBufferedIndex + 3]->isNull()) {
|
||||
return false;
|
||||
}
|
||||
@ -629,7 +629,7 @@ void Render::prepareAvailablePage(int page)
|
||||
emit currentPageReady();
|
||||
}
|
||||
} else {
|
||||
//check for last page in double page mode
|
||||
// check for last page in double page mode
|
||||
if ((currentIndex == page) && (currentIndex + 1) >= (int)comic->numPages()) {
|
||||
emit currentPageReady();
|
||||
} else if ((currentIndex == page && !buffer[currentPageBufferedIndex + 1]->isNull()) ||
|
||||
@ -658,7 +658,7 @@ void Render::load(const QString &path, int atPage)
|
||||
//-----------------------------------------------------------------------------
|
||||
void Render::load(const QString &path, const ComicDB &comicDB)
|
||||
{
|
||||
//TODO prepare filters
|
||||
// TODO prepare filters
|
||||
for (int i = 0; i < filters.count(); i++) {
|
||||
if (typeid(*filters[i]) == typeid(BrightnessFilter)) {
|
||||
if (comicDB.info.brightness == -1)
|
||||
@ -700,7 +700,7 @@ void Render::createComic(const QString &path)
|
||||
}
|
||||
comic = FactoryComic::newComic(path);
|
||||
|
||||
if (comic == nullptr) //archivo no encontrado o no válido
|
||||
if (comic == nullptr) // archivo no encontrado o no válido
|
||||
{
|
||||
emit errorOpening();
|
||||
reset();
|
||||
@ -721,8 +721,8 @@ void Render::createComic(const QString &path)
|
||||
|
||||
connect(comic, &Comic::bookmarksUpdated, this, &Render::bookmarksUpdated, Qt::QueuedConnection);
|
||||
|
||||
//connect(comic,SIGNAL(isLast()),this,SIGNAL(isLast()));
|
||||
//connect(comic,SIGNAL(isCover()),this,SIGNAL(isCover()));
|
||||
// connect(comic,SIGNAL(isLast()),this,SIGNAL(isLast()));
|
||||
// connect(comic,SIGNAL(isCover()),this,SIGNAL(isCover()));
|
||||
|
||||
pagesReady.clear();
|
||||
}
|
||||
@ -770,13 +770,13 @@ void Render::reset()
|
||||
loadedComic = false;
|
||||
invalidate();
|
||||
}
|
||||
//si se solicita la siguiente página, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
|
||||
//la página sólo se renderiza, si realmente ha cambiado.
|
||||
// si se solicita la siguiente página, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
|
||||
// la página sólo se renderiza, si realmente ha cambiado.
|
||||
void Render::nextPage()
|
||||
{
|
||||
int nextPage; //indica cuál será la próxima página
|
||||
int nextPage; // indica cuál será la próxima página
|
||||
nextPage = comic->nextPage();
|
||||
//se fuerza renderizado si la página ha cambiado
|
||||
// se fuerza renderizado si la página ha cambiado
|
||||
if (currentIndex != nextPage) {
|
||||
previousIndex = currentIndex;
|
||||
currentIndex = nextPage;
|
||||
@ -805,14 +805,14 @@ void Render::nextDoublePage()
|
||||
}
|
||||
}
|
||||
|
||||
//si se solicita la página anterior, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
|
||||
//la página sólo se renderiza, si realmente ha cambiado.
|
||||
// si se solicita la página anterior, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
|
||||
// la página sólo se renderiza, si realmente ha cambiado.
|
||||
void Render::previousPage()
|
||||
{
|
||||
int previousPage; //indica cuál será la próxima página
|
||||
int previousPage; // indica cuál será la próxima página
|
||||
previousPage = comic->previousPage();
|
||||
|
||||
//se fuerza renderizado si la página ha cambiado
|
||||
// se fuerza renderizado si la página ha cambiado
|
||||
if (currentIndex != previousPage) {
|
||||
previousIndex = currentIndex;
|
||||
currentIndex = previousPage;
|
||||
@ -825,7 +825,7 @@ void Render::previousPage()
|
||||
|
||||
void Render::previousDoublePage()
|
||||
{
|
||||
int previousPage; //indica cuál será la próxima página
|
||||
int previousPage; // indica cuál será la próxima página
|
||||
previousPage = qMax(currentIndex - 2, 0);
|
||||
if (currentIndex != previousPage) {
|
||||
comic->setIndex(previousPage);
|
||||
@ -867,7 +867,7 @@ void Render::pageRawDataReady(int page)
|
||||
for (int i = 0; i < pagesEmited.size(); i++) {
|
||||
if (pagesEmited.at(i) >= pagesReady.size()) {
|
||||
pagesEmited.clear();
|
||||
return; //Oooops, something went wrong
|
||||
return; // Oooops, something went wrong
|
||||
}
|
||||
|
||||
pagesReady[pagesEmited.at(i)] = true;
|
||||
@ -884,7 +884,7 @@ void Render::pageRawDataReady(int page)
|
||||
}
|
||||
}
|
||||
|
||||
//sólo se renderiza la página, si ha habido un cambio de página
|
||||
// sólo se renderiza la página, si ha habido un cambio de página
|
||||
void Render::goTo(int index)
|
||||
{
|
||||
|
||||
@ -911,19 +911,19 @@ void Render::rotateLeft()
|
||||
reload();
|
||||
}
|
||||
|
||||
//Actualiza el buffer, añadiendo las imágenes (vacías) necesarias para su posterior renderizado y
|
||||
//eliminado aquellas que ya no sean necesarias. También libera los hilos (no estoy seguro de que sea responsabilidad suya)
|
||||
//Calcula el número de nuevas páginas que hay que buferear y si debe hacerlo por la izquierda o la derecha (según sea el sentido de la lectura)
|
||||
// Actualiza el buffer, añadiendo las imágenes (vacías) necesarias para su posterior renderizado y
|
||||
// eliminado aquellas que ya no sean necesarias. También libera los hilos (no estoy seguro de que sea responsabilidad suya)
|
||||
// Calcula el número de nuevas páginas que hay que buferear y si debe hacerlo por la izquierda o la derecha (según sea el sentido de la lectura)
|
||||
void Render::updateBuffer()
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
int windowSize = currentIndex - previousIndex;
|
||||
|
||||
if (windowSize > 0) //add pages to right pages and remove on the left
|
||||
if (windowSize > 0) // add pages to right pages and remove on the left
|
||||
{
|
||||
windowSize = qMin(windowSize, buffer.size());
|
||||
for (int i = 0; i < windowSize; i++) {
|
||||
//renders
|
||||
// renders
|
||||
PageRender *pr = pageRenders.front();
|
||||
pageRenders.pop_front();
|
||||
if (pr != nullptr) {
|
||||
@ -932,20 +932,20 @@ void Render::updateBuffer()
|
||||
}
|
||||
pageRenders.push_back(0);
|
||||
|
||||
//images
|
||||
// images
|
||||
|
||||
if (buffer.front() != 0)
|
||||
delete buffer.front();
|
||||
buffer.pop_front();
|
||||
buffer.push_back(new QImage());
|
||||
}
|
||||
} else //add pages to left pages and remove on the right
|
||||
} else // add pages to left pages and remove on the right
|
||||
{
|
||||
if (windowSize < 0) {
|
||||
windowSize = -windowSize;
|
||||
windowSize = qMin(windowSize, buffer.size());
|
||||
for (int i = 0; i < windowSize; i++) {
|
||||
//renders
|
||||
// renders
|
||||
PageRender *pr = pageRenders.back();
|
||||
pageRenders.pop_back();
|
||||
if (pr != nullptr) {
|
||||
@ -954,7 +954,7 @@ void Render::updateBuffer()
|
||||
}
|
||||
pageRenders.push_front(0);
|
||||
|
||||
//images
|
||||
// images
|
||||
buffer.push_front(new QImage());
|
||||
QImage *p = buffer.back();
|
||||
if (p != nullptr)
|
||||
@ -977,7 +977,7 @@ void Render::fillBuffer()
|
||||
buffer[currentPageBufferedIndex + i]->isNull() &&
|
||||
i <= numRightPages &&
|
||||
pageRenders[currentPageBufferedIndex + i] == 0 &&
|
||||
pagesReady[currentIndex + i]) //preload next pages
|
||||
pagesReady[currentIndex + i]) // preload next pages
|
||||
{
|
||||
pageRenders[currentPageBufferedIndex + i] = new PageRender(this, currentIndex + i, comic->getRawData()->at(currentIndex + i), buffer[currentPageBufferedIndex + i], imageRotation, filters);
|
||||
connect(pageRenders[currentPageBufferedIndex + i], &PageRender::pageReady, this, &Render::prepareAvailablePage);
|
||||
@ -988,7 +988,7 @@ void Render::fillBuffer()
|
||||
buffer[currentPageBufferedIndex - i]->isNull() &&
|
||||
i <= numLeftPages &&
|
||||
pageRenders[currentPageBufferedIndex - i] == 0 &&
|
||||
pagesReady[currentIndex - i]) //preload previous pages
|
||||
pagesReady[currentIndex - i]) // preload previous pages
|
||||
{
|
||||
pageRenders[currentPageBufferedIndex - i] = new PageRender(this, currentIndex - i, comic->getRawData()->at(currentIndex - i), buffer[currentPageBufferedIndex - i], imageRotation, filters);
|
||||
connect(pageRenders[currentPageBufferedIndex - i], &PageRender::pageReady, this, &Render::prepareAvailablePage);
|
||||
@ -997,8 +997,8 @@ void Render::fillBuffer()
|
||||
}
|
||||
}
|
||||
|
||||
//Método que debe ser llamado cada vez que la estructura del buffer se vuelve inconsistente con el modo de lectura actual.
|
||||
//se terminan todos los hilos en ejecución y se libera la memoria (de hilos e imágenes)
|
||||
// Método que debe ser llamado cada vez que la estructura del buffer se vuelve inconsistente con el modo de lectura actual.
|
||||
// se terminan todos los hilos en ejecución y se libera la memoria (de hilos e imágenes)
|
||||
void Render::invalidate()
|
||||
{
|
||||
for (int i = 0; i < pageRenders.size(); i++) {
|
||||
@ -1019,7 +1019,7 @@ void Render::doublePageSwitch()
|
||||
{
|
||||
doublePage = !doublePage;
|
||||
if (comic) {
|
||||
//invalidate();
|
||||
// invalidate();
|
||||
update();
|
||||
}
|
||||
}
|
||||
@ -1028,7 +1028,7 @@ void Render::setManga(bool manga)
|
||||
{
|
||||
doubleMangaPage = manga;
|
||||
if (comic && doublePage) {
|
||||
//invalidate();
|
||||
// invalidate();
|
||||
update();
|
||||
}
|
||||
}
|
||||
@ -1037,7 +1037,7 @@ void Render::doubleMangaPageSwitch()
|
||||
{
|
||||
doubleMangaPage = !doubleMangaPage;
|
||||
if (comic && doublePage) {
|
||||
//invalidate();
|
||||
// invalidate();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
@ -109,20 +109,20 @@ signals:
|
||||
|
||||
/*class DoublePageRender : public PageRender
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
DoublePageRender(Render * render, int firstPage, const QByteArray & firstPageData,const QByteArray & secondPageData, QImage * page,unsigned int degrees=0, QVector<ImageFilter *> filters = QVector<ImageFilter *>());
|
||||
DoublePageRender(Render * render, int firstPage, const QByteArray & firstPageData,const QByteArray & secondPageData, QImage * page,unsigned int degrees=0, QVector<ImageFilter *> filters = QVector<ImageFilter *>());
|
||||
private:
|
||||
int numPage;
|
||||
QByteArray data;
|
||||
QByteArray data2;
|
||||
QImage * page;
|
||||
unsigned int degrees;
|
||||
QVector<ImageFilter *> filters;
|
||||
void run();
|
||||
Render * render;
|
||||
int numPage;
|
||||
QByteArray data;
|
||||
QByteArray data2;
|
||||
QImage * page;
|
||||
unsigned int degrees;
|
||||
QVector<ImageFilter *> filters;
|
||||
void run();
|
||||
Render * render;
|
||||
signals:
|
||||
void pageReady(int);
|
||||
void pageReady(int);
|
||||
|
||||
};
|
||||
*/
|
||||
@ -179,7 +179,7 @@ public slots:
|
||||
void reload();
|
||||
void updateFilters(int brightness, int contrast, int gamma);
|
||||
Bookmarks *getBookmarks();
|
||||
//sets the firt page to render
|
||||
// sets the firt page to render
|
||||
void renderAt(int page);
|
||||
|
||||
signals:
|
||||
@ -205,7 +205,7 @@ private:
|
||||
bool doubleMangaPage;
|
||||
int previousIndex;
|
||||
int currentIndex;
|
||||
//QPixmap * currentPage;
|
||||
// QPixmap * currentPage;
|
||||
int currentPageBufferedIndex;
|
||||
int numLeftPages;
|
||||
int numRightPages;
|
||||
|
@ -32,7 +32,7 @@ ShortcutsDialog::ShortcutsDialog(QWidget *parent)
|
||||
//"<p><b>General functions:</b><hr/><b>O</b> : Open comic<br/><b>Esc</b> : Exit</p>"
|
||||
shortcuts->setReadOnly(true);
|
||||
shortcutsLayout->addWidget(shortcuts);
|
||||
//shortcutsLayout->addWidget(shortcuts2);
|
||||
// shortcutsLayout->addWidget(shortcuts2);
|
||||
shortcutsLayout->setSpacing(0);
|
||||
mainLayout->addLayout(shortcutsLayout);
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
@ -56,7 +56,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
|
||||
|
||||
auto layout = new QVBoxLayout(this);
|
||||
|
||||
//TITLE BAR
|
||||
// TITLE BAR
|
||||
auto titleBar = new QHBoxLayout();
|
||||
auto close = new QPushButton(QIcon(QPixmap(":/images/close.png")), "");
|
||||
close->setFlat(true);
|
||||
@ -73,7 +73,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
|
||||
|
||||
layout->addLayout(titleBar);
|
||||
|
||||
//INPUT TEXT
|
||||
// INPUT TEXT
|
||||
text = new QTextEdit(this);
|
||||
text->setMinimumHeight(110);
|
||||
text->setMaximumHeight(110);
|
||||
@ -81,7 +81,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
|
||||
layout->addWidget(text);
|
||||
text->setStyleSheet("QTextEdit{border:none;background:#2a2a2a;color:white; font-size:12px; padding:6px;}" + scrollBarStyle);
|
||||
|
||||
//COMBOBOXES
|
||||
// COMBOBOXES
|
||||
auto combos = new QHBoxLayout();
|
||||
from = new QComboBox(this);
|
||||
to = new QComboBox(this);
|
||||
@ -112,7 +112,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
|
||||
layout->addSpacing(12);
|
||||
layout->addLayout(combos);
|
||||
|
||||
//RESULTS
|
||||
// RESULTS
|
||||
auto resultsTitleLayout = new QHBoxLayout();
|
||||
resultsTitle = new QLabel(tr("Translation"));
|
||||
resultsTitle->setStyleSheet("QLabel {font-family:Arial;font-size:14px;color:#e3e3e3;}");
|
||||
@ -136,7 +136,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
//CLEAR BUTTON
|
||||
// CLEAR BUTTON
|
||||
clearButton = new QPushButton(tr("clear"));
|
||||
layout->addWidget(clearButton, 0, Qt::AlignRight);
|
||||
clearButton->setMinimumWidth(95);
|
||||
@ -162,7 +162,7 @@ YACReaderTranslator::YACReaderTranslator(Viewer *parent)
|
||||
connect(speakButton, &QAbstractButton::pressed, this, &YACReaderTranslator::play);
|
||||
connect(clearButton, &QAbstractButton::pressed, this, &YACReaderTranslator::clear);
|
||||
|
||||
//multimedia/phonon
|
||||
// multimedia/phonon
|
||||
#if QT_VERSION >= 0x050000
|
||||
player = new QMediaPlayer;
|
||||
#else
|
||||
@ -289,7 +289,7 @@ void YACReaderTranslator::populateCombos()
|
||||
|
||||
void YACReaderTranslator::play()
|
||||
{
|
||||
//QMessageBox::question(this,"xxx",ttsSource.toString());
|
||||
// QMessageBox::question(this,"xxx",ttsSource.toString());
|
||||
#if QT_VERSION >= 0x050000
|
||||
|
||||
player->setMedia(ttsSource);
|
||||
|
@ -45,10 +45,10 @@ Viewer::Viewer(QWidget *parent)
|
||||
translatorAnimation->setDuration(150);
|
||||
translatorXPos = -10000;
|
||||
translator->move(-translator->width(), 10);
|
||||
//current comic page
|
||||
// current comic page
|
||||
content = new QLabel(this);
|
||||
configureContent(tr("Press 'O' to open comic."));
|
||||
//scroll area configuration
|
||||
// scroll area configuration
|
||||
setBackgroundRole(QPalette::Dark);
|
||||
setWidget(content);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
@ -71,7 +71,7 @@ Viewer::Viewer(QWidget *parent)
|
||||
|
||||
QSettings *settings = new QSettings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
|
||||
|
||||
//CONFIG GOTO_FLOW--------------------------------------------------------
|
||||
// CONFIG GOTO_FLOW--------------------------------------------------------
|
||||
#ifndef NO_OPENGL
|
||||
|
||||
OpenGLChecker openGLChecker;
|
||||
@ -113,7 +113,7 @@ Viewer::Viewer(QWidget *parent)
|
||||
|
||||
setMouseTracking(true);
|
||||
|
||||
//animations
|
||||
// animations
|
||||
verticalScroller = new QPropertyAnimation(verticalScrollBar(), "sliderPosition");
|
||||
connect(verticalScroller, &QVariantAnimation::valueChanged, this, &Viewer::backgroundChanges);
|
||||
horizontalScroller = new QPropertyAnimation(horizontalScrollBar(), "sliderPosition");
|
||||
@ -151,27 +151,27 @@ Viewer::~Viewer()
|
||||
|
||||
void Viewer::createConnections()
|
||||
{
|
||||
//magnifyingGlass (update mg after a background change
|
||||
// magnifyingGlass (update mg after a background change
|
||||
connect(this, &Viewer::backgroundChanges, mglass, QOverload<>::of(&MagnifyingGlass::updateImage));
|
||||
|
||||
//goToDialog
|
||||
// goToDialog
|
||||
connect(goToDialog, &GoToDialog::goToPage, this, &Viewer::goTo);
|
||||
|
||||
//goToFlow goTo
|
||||
// goToFlow goTo
|
||||
connect(goToFlow, &GoToFlowWidget::goToPage, this, &Viewer::goTo);
|
||||
|
||||
//current time
|
||||
// current time
|
||||
auto t = new QTimer(this);
|
||||
connect(t, &QTimer::timeout, this, &Viewer::updateInformation);
|
||||
t->start(1000);
|
||||
|
||||
//hide cursor
|
||||
// hide cursor
|
||||
connect(hideCursorTimer, &QTimer::timeout, this, &Viewer::hideCursor);
|
||||
|
||||
//bookmarks
|
||||
// bookmarks
|
||||
connect(bd, &BookmarksDialog::goToPage, this, &Viewer::goTo);
|
||||
|
||||
//render
|
||||
// render
|
||||
connect(render, QOverload<>::of(&Render::errorOpening), this, &Viewer::resetContent);
|
||||
connect(render, QOverload<>::of(&Render::errorOpening), this, QOverload<>::of(&Viewer::showMessageErrorOpening));
|
||||
connect(render, QOverload<QString>::of(&Render::errorOpening), this, QOverload<QString>::of(&Viewer::showMessageErrorOpening));
|
||||
@ -190,16 +190,16 @@ void Viewer::createConnections()
|
||||
connect(render, &Render::bookmarksUpdated, this, &Viewer::setBookmarks);
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
// Deprecated
|
||||
void Viewer::prepareForOpening()
|
||||
{
|
||||
if (render->hasLoadedComic())
|
||||
save();
|
||||
//bd->setBookmarks(*bm);
|
||||
// bd->setBookmarks(*bm);
|
||||
|
||||
goToFlow->reset();
|
||||
|
||||
//render->update();
|
||||
// render->update();
|
||||
|
||||
verticalScrollBar()->setSliderPosition(verticalScrollBar()->minimum());
|
||||
|
||||
@ -225,7 +225,7 @@ void Viewer::open(QString pathFile, const ComicDB &comic)
|
||||
void Viewer::showMessageErrorOpening()
|
||||
{
|
||||
QMessageBox::critical(this, tr("Not found"), tr("Comic not found"));
|
||||
//resetContent(); --> not needed
|
||||
// resetContent(); --> not needed
|
||||
}
|
||||
|
||||
void Viewer::showMessageErrorOpening(QString message)
|
||||
@ -286,7 +286,7 @@ void Viewer::showGoToDialog()
|
||||
}
|
||||
void Viewer::goTo(unsigned int page)
|
||||
{
|
||||
direction = 1; //in "go to" direction is always fordward
|
||||
direction = 1; // in "go to" direction is always fordward
|
||||
render->goTo(page);
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ void Viewer::updatePage()
|
||||
|
||||
void Viewer::updateContentSize()
|
||||
{
|
||||
//there is an image to resize
|
||||
// there is an image to resize
|
||||
if (currentPage != nullptr && !currentPage->isNull()) {
|
||||
QSize pagefit = currentPage->size();
|
||||
bool stretchImages = Configuration::getConfiguration().getEnlargeImages();
|
||||
@ -350,7 +350,7 @@ void Viewer::updateContentSize()
|
||||
}
|
||||
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
||||
break;
|
||||
//if everything fails showing the full page is a good idea
|
||||
// if everything fails showing the full page is a good idea
|
||||
case YACReader::FitMode::FullPage:
|
||||
default:
|
||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||
@ -360,11 +360,11 @@ void Viewer::updateContentSize()
|
||||
if (zoom != 100) {
|
||||
pagefit.scale(floor(pagefit.width() * zoom / 100.0f), 0, Qt::KeepAspectRatioByExpanding);
|
||||
}
|
||||
//apply scaling
|
||||
// apply scaling
|
||||
content->resize(pagefit);
|
||||
|
||||
//TODO: updtateContentSize should only scale the pixmap once
|
||||
if (devicePixelRatio() > 1) //only in retina display
|
||||
// TODO: updtateContentSize should only scale the pixmap once
|
||||
if (devicePixelRatio() > 1) // only in retina display
|
||||
{
|
||||
QPixmap page = currentPage->scaled(content->width() * devicePixelRatio(), content->height() * devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
page.setDevicePixelRatio(devicePixelRatio());
|
||||
@ -373,7 +373,7 @@ void Viewer::updateContentSize()
|
||||
|
||||
emit backgroundChanges();
|
||||
}
|
||||
content->update(); //TODO, it shouldn't be neccesary
|
||||
content->update(); // TODO, it shouldn't be neccesary
|
||||
}
|
||||
|
||||
void Viewer::increaseZoomFactor()
|
||||
@ -399,13 +399,13 @@ void Viewer::decreaseZoomFactor()
|
||||
|
||||
int Viewer::getZoomFactor()
|
||||
{
|
||||
//this function is a placeholder for future refactoring work
|
||||
// this function is a placeholder for future refactoring work
|
||||
return zoom;
|
||||
}
|
||||
|
||||
void Viewer::setZoomFactor(int z)
|
||||
{
|
||||
//this function is mostly used to reset the zoom after a fitmode switch
|
||||
// this function is mostly used to reset the zoom after a fitmode switch
|
||||
if (z > 500)
|
||||
zoom = 500;
|
||||
else if (z < 30)
|
||||
@ -592,8 +592,8 @@ void Viewer::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
QKeySequence key(_key);
|
||||
/*if(goToFlow->isVisible() && event->key()!=Qt::Key_S)
|
||||
QCoreApplication::sendEvent(goToFlow,event);
|
||||
else*/
|
||||
QCoreApplication::sendEvent(goToFlow,event);
|
||||
else*/
|
||||
|
||||
if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_ACTION_Y)) {
|
||||
posByStep = height() / numScrollSteps;
|
||||
@ -746,9 +746,9 @@ void Viewer::mouseMoveEvent(QMouseEvent *event)
|
||||
if (Configuration::getConfiguration().getDisableShowOnMouseOver() == false) {
|
||||
if (goToFlow->isVisible()) {
|
||||
QPoint gtfPos = goToFlow->mapFrom(this, event->pos());
|
||||
if (gtfPos.y() < 0 || gtfPos.x() < 0 || gtfPos.x() > goToFlow->width()) //TODO this extra check is for Mavericks (mouseMove over goToFlowGL seems to be broken)
|
||||
if (gtfPos.y() < 0 || gtfPos.x() < 0 || gtfPos.x() > goToFlow->width()) // TODO this extra check is for Mavericks (mouseMove over goToFlowGL seems to be broken)
|
||||
animateHideGoToFlow();
|
||||
//goToFlow->hide();
|
||||
// goToFlow->hide();
|
||||
} else {
|
||||
int umbral = (width() - goToFlow->width()) / 2;
|
||||
if ((event->y() > height() - 15) && (event->x() > umbral) && (event->x() < width() - umbral)) {
|
||||
@ -802,10 +802,10 @@ void Viewer::hideMagnifyingGlass()
|
||||
void Viewer::informationSwitch()
|
||||
{
|
||||
information ? informationLabel->hide() : informationLabel->show();
|
||||
//informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
|
||||
// informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
|
||||
information = !information;
|
||||
Configuration::getConfiguration().setShowInformation(information);
|
||||
//TODO it shouldn't be neccesary
|
||||
// TODO it shouldn't be neccesary
|
||||
informationLabel->adjustSize();
|
||||
informationLabel->update();
|
||||
}
|
||||
@ -815,7 +815,7 @@ void Viewer::updateInformation()
|
||||
if (render->hasLoadedComic()) {
|
||||
informationLabel->setText(render->getCurrentPagesInformation() + " - " + QTime::currentTime().toString("HH:mm"));
|
||||
informationLabel->adjustSize();
|
||||
informationLabel->update(); //TODO it shouldn't be neccesary
|
||||
informationLabel->update(); // TODO it shouldn't be neccesary
|
||||
}
|
||||
}
|
||||
|
||||
@ -871,7 +871,7 @@ void Viewer::moveCursoToGoToFlow()
|
||||
return;
|
||||
}
|
||||
|
||||
//Move cursor to goToFlow widget on show (this avoid hide when mouse is moved)
|
||||
// Move cursor to goToFlow widget on show (this avoid hide when mouse is moved)
|
||||
int y = goToFlow->pos().y();
|
||||
int x1 = goToFlow->pos().x();
|
||||
int x2 = x1 + goToFlow->width();
|
||||
@ -899,14 +899,14 @@ void Viewer::rotateRight()
|
||||
render->rotateRight();
|
||||
}
|
||||
|
||||
//TODO
|
||||
// TODO
|
||||
void Viewer::setBookmark(bool set)
|
||||
{
|
||||
render->setBookmark();
|
||||
if (set) //add bookmark
|
||||
if (set) // add bookmark
|
||||
{
|
||||
render->setBookmark();
|
||||
} else //remove bookmark
|
||||
} else // remove bookmark
|
||||
{
|
||||
render->removeBookmark();
|
||||
}
|
||||
@ -979,7 +979,7 @@ void Viewer::configureContent(QString msg)
|
||||
content->setFont(QFont("courier new", 12));
|
||||
content->adjustSize();
|
||||
setFocus(Qt::ShortcutFocusReason);
|
||||
//emit showingText();
|
||||
// emit showingText();
|
||||
}
|
||||
|
||||
void Viewer::hideCursor()
|
||||
@ -1083,7 +1083,7 @@ void Viewer::updateConfig(QSettings *settings)
|
||||
setPalette(palette);
|
||||
}
|
||||
|
||||
//deprecated
|
||||
// deprecated
|
||||
void Viewer::updateImageOptions()
|
||||
{
|
||||
render->reload();
|
||||
@ -1110,7 +1110,7 @@ void Viewer::showIsCoverMessage()
|
||||
emit(openPreviousComic());
|
||||
}
|
||||
|
||||
shouldOpenNext = false; //single page comic
|
||||
shouldOpenNext = false; // single page comic
|
||||
}
|
||||
|
||||
void Viewer::showIsLastMessage()
|
||||
@ -1124,7 +1124,7 @@ void Viewer::showIsLastMessage()
|
||||
emit(openNextComic());
|
||||
}
|
||||
|
||||
shouldOpenPrevious = false; //single page comic
|
||||
shouldOpenPrevious = false; // single page comic
|
||||
}
|
||||
|
||||
unsigned int Viewer::getIndex()
|
||||
@ -1140,7 +1140,7 @@ int Viewer::getCurrentPageNumber()
|
||||
void Viewer::updateComic(ComicDB &comic)
|
||||
{
|
||||
if (render->hasLoadedComic()) {
|
||||
//set currentPage
|
||||
// set currentPage
|
||||
if (!doublePage || (doublePage && render->currentPageIsDoublePage() == false)) {
|
||||
comic.info.currentPage = render->getIndex() + 1;
|
||||
} else {
|
||||
@ -1148,7 +1148,7 @@ void Viewer::updateComic(ComicDB &comic)
|
||||
comic.info.currentPage = std::min(render->numPages(), render->getIndex() + 1);
|
||||
}
|
||||
}
|
||||
//set bookmarks
|
||||
// set bookmarks
|
||||
Bookmarks *boomarks = render->getBookmarks();
|
||||
QList<int> boomarksList = boomarks->getBookmarkPages();
|
||||
int numBookmarks = boomarksList.size();
|
||||
@ -1158,8 +1158,8 @@ void Viewer::updateComic(ComicDB &comic)
|
||||
comic.info.bookmark2 = boomarksList[1];
|
||||
if (numBookmarks > 2)
|
||||
comic.info.bookmark3 = boomarksList[2];
|
||||
//set filters
|
||||
//TODO: avoid use settings for this...
|
||||
// set filters
|
||||
// TODO: avoid use settings for this...
|
||||
QSettings settings(YACReader::getSettingsPath() + "/YACReader.ini", QSettings::IniFormat);
|
||||
int brightness = settings.value(BRIGHTNESS, 0).toInt();
|
||||
int contrast = settings.value(CONTRAST, 100).toInt();
|
||||
|
@ -36,7 +36,7 @@ class Viewer : public QScrollArea, public ScrollManagement
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
bool fullscreen; //TODO, change by the right use of windowState();
|
||||
bool fullscreen; // TODO, change by the right use of windowState();
|
||||
public slots:
|
||||
void increaseZoomFactor();
|
||||
void decreaseZoomFactor();
|
||||
@ -98,7 +98,7 @@ public slots:
|
||||
void showMessageErrorOpening(QString);
|
||||
void processCRCError(QString message);
|
||||
void setBookmarks();
|
||||
//deprecated
|
||||
// deprecated
|
||||
void updateImageOptions();
|
||||
void updateFilters(int brightness, int contrast, int gamma);
|
||||
void showIsCoverMessage();
|
||||
@ -115,7 +115,7 @@ private:
|
||||
int zoom;
|
||||
|
||||
PageLabelWidget *informationLabel;
|
||||
//QTimer * scroller;
|
||||
// QTimer * scroller;
|
||||
QPropertyAnimation *verticalScroller;
|
||||
QPropertyAnimation *horizontalScroller;
|
||||
QParallelAnimationGroup *groupScroller;
|
||||
@ -124,9 +124,9 @@ private:
|
||||
GoToFlowWidget *goToFlow;
|
||||
QPropertyAnimation *showGoToFlowAnimation;
|
||||
GoToDialog *goToDialog;
|
||||
//!Image properties
|
||||
//! Comic
|
||||
//Comic * comic;
|
||||
//! Image properties
|
||||
//! Comic
|
||||
// Comic * comic;
|
||||
int index;
|
||||
QPixmap *currentPage;
|
||||
BookmarksDialog *bd;
|
||||
@ -137,7 +137,7 @@ private:
|
||||
bool drag;
|
||||
int numScrollSteps;
|
||||
|
||||
//!Widgets
|
||||
//! Widgets
|
||||
QLabel *content;
|
||||
|
||||
YACReaderTranslator *translator;
|
||||
@ -153,7 +153,7 @@ private:
|
||||
bool shouldOpenPrevious;
|
||||
|
||||
private:
|
||||
//!Magnifying glass
|
||||
//! Magnifying glass
|
||||
MagnifyingGlass *mglass;
|
||||
bool magnifyingGlassShowed;
|
||||
bool restoreMagnifyingGlass;
|
||||
@ -166,7 +166,7 @@ private:
|
||||
|
||||
void moveAction(const QKeySequence &key);
|
||||
|
||||
//!ZigzagScroll
|
||||
//! ZigzagScroll
|
||||
enum scrollDirection { UP,
|
||||
DOWN,
|
||||
LEFT,
|
||||
@ -179,9 +179,9 @@ public:
|
||||
Viewer(QWidget *parent = nullptr);
|
||||
~Viewer();
|
||||
const QPixmap *pixmap();
|
||||
//Comic * getComic(){return comic;}
|
||||
// Comic * getComic(){return comic;}
|
||||
const BookmarksDialog *getBookmarksDialog() { return bd; }
|
||||
//returns the current index starting in 1 [1,nPages]
|
||||
// returns the current index starting in 1 [1,nPages]
|
||||
unsigned int getIndex();
|
||||
void updateComic(ComicDB &comic);
|
||||
signals:
|
||||
|
@ -13,16 +13,16 @@ YACReaderLocalClient::YACReaderLocalClient(QObject *parent)
|
||||
{
|
||||
localSocket = new QLocalSocket(this);
|
||||
|
||||
//connect(localSocket, SIGNAL(readyRead()), this, SLOT(readMessage()));
|
||||
// connect(localSocket, SIGNAL(readyRead()), this, SLOT(readMessage()));
|
||||
|
||||
/*connect(socket, SIGNAL(error(QLocalSocket::LocalSocketError)),
|
||||
this, SLOT(displayError(QLocalSocket::LocalSocketError)));*/
|
||||
this, SLOT(displayError(QLocalSocket::LocalSocketError)));*/
|
||||
}
|
||||
YACReaderLocalClient::~YACReaderLocalClient()
|
||||
{
|
||||
delete localSocket;
|
||||
}
|
||||
//información de comic recibida...
|
||||
// información de comic recibida...
|
||||
void YACReaderLocalClient::readMessage()
|
||||
{
|
||||
}
|
||||
@ -49,7 +49,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, Q
|
||||
while (written != block.size() && tries < 200) {
|
||||
written += localSocket->write(block);
|
||||
localSocket->flush();
|
||||
if (written == previousWritten) //no bytes were written
|
||||
if (written == previousWritten) // no bytes were written
|
||||
tries++;
|
||||
previousWritten = written;
|
||||
}
|
||||
@ -61,7 +61,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, Q
|
||||
|
||||
localSocket->waitForBytesWritten(2000);
|
||||
|
||||
//QByteArray data;
|
||||
// QByteArray data;
|
||||
tries = 0;
|
||||
int dataAvailable = 0;
|
||||
QByteArray packageSize;
|
||||
@ -70,7 +70,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, Q
|
||||
packageSize.append(localSocket->read(sizeof(quint32) - packageSize.size()));
|
||||
localSocket->waitForReadyRead(100);
|
||||
if (dataAvailable == packageSize.size()) {
|
||||
tries++; //TODO apply 'tries' fix
|
||||
tries++; // TODO apply 'tries' fix
|
||||
}
|
||||
dataAvailable = packageSize.size();
|
||||
}
|
||||
@ -79,7 +79,7 @@ bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB &comic, Q
|
||||
QLOG_ERROR() << "Requesting Comic Info : unable to read package size";
|
||||
return false;
|
||||
}
|
||||
QDataStream sizeStream(packageSize); //localSocket->read(sizeof(quint32)));
|
||||
QDataStream sizeStream(packageSize); // localSocket->read(sizeof(quint32)));
|
||||
sizeStream.setVersion(QDataStream::Qt_4_8);
|
||||
quint32 totalSize = 0;
|
||||
sizeStream >> totalSize;
|
||||
@ -119,7 +119,7 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB &comic)
|
||||
{
|
||||
localSocket->connectToServer(YACREADERLIBRARY_GUID);
|
||||
if (localSocket->isOpen()) {
|
||||
//QLOG_INFO() << "Connection opened for sending ComicInfo";
|
||||
// QLOG_INFO() << "Connection opened for sending ComicInfo";
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_8);
|
||||
@ -141,7 +141,7 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB &comic)
|
||||
}
|
||||
localSocket->waitForBytesWritten(2000);
|
||||
localSocket->close();
|
||||
//QLOG_INFO() << QString("Sending Comic Info : writen data (%1,%2)").arg(written).arg(block.size());
|
||||
// QLOG_INFO() << QString("Sending Comic Info : writen data (%1,%2)").arg(written).arg(block.size());
|
||||
if (tries == 100 && written != block.size()) {
|
||||
emit finished();
|
||||
QLOG_ERROR() << QString("Sending Comic Info : unable to write data (%1,%2)").arg(written).arg(block.size());
|
||||
@ -160,7 +160,7 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB &comic, qulo
|
||||
{
|
||||
localSocket->connectToServer(YACREADERLIBRARY_GUID);
|
||||
if (localSocket->isOpen()) {
|
||||
//QLOG_INFO() << "Connection opened for sending ComicInfo";
|
||||
// QLOG_INFO() << "Connection opened for sending ComicInfo";
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_8);
|
||||
@ -183,7 +183,7 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB &comic, qulo
|
||||
}
|
||||
localSocket->waitForBytesWritten(2000);
|
||||
localSocket->close();
|
||||
//QLOG_INFO() << QString("Sending Comic Info : writen data (%1,%2)").arg(written).arg(block.size());
|
||||
// QLOG_INFO() << QString("Sending Comic Info : writen data (%1,%2)").arg(written).arg(block.size());
|
||||
if (tries == 100 && written != block.size()) {
|
||||
emit finished();
|
||||
QLOG_ERROR() << QString("Sending Comic Info : unable to write data (%1,%2)").arg(written).arg(block.size());
|
||||
|
Reference in New Issue
Block a user