mirror of
https://github.com/YACReader/yacreader
synced 2025-07-21 22:44:56 -04:00
Add a method to ExtractDelegate for querying if the extraction has been cancelled.
This commit is contained in:
161
YACReader/Info.plist
Normal file
161
YACReader/Info.plist
Normal file
@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>YACReader.icns</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>YACReader</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yacreader.YACReader</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>YACReader Comic rar</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.yacreader.yacreader.rar</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>YACReader Comic zip</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.yacreader.yacreader.zip</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>YACReader Comic cbr</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.yacreader.yacreader.cbr</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>YACReader Comic cbz</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.yacreader.yacreader.cbz</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>YACReader Comic pdf</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.yacreader.yacreader.pdf</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>YACReader Comic</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.yacreader.yacreader.rar</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<string>rar</string>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/comic-rar</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>YACReader Comic</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.yacreader.yacreader.zip</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<string>zip</string>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/comic-zip</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>YACReader Comic</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.yacreader.yacreader.cbr</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<string>cbr</string>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/comic-cbr</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>YACReader Comic</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.yacreader.yacreader.cbz</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<string>cbz</string>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/comic-cbz</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>YACReader Comic</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.yacreader.yacreader.pdf</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<string>pdf</string>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/comic-pdf</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
BIN
YACReader/YACReader.icns
Normal file
BIN
YACReader/YACReader.icns
Normal file
Binary file not shown.
259
YACReader/YACReader.pro
Normal file
259
YACReader/YACReader.pro
Normal file
@ -0,0 +1,259 @@
|
||||
TEMPLATE = app
|
||||
TARGET = YACReader
|
||||
|
||||
QMAKE_TARGET_BUNDLE_PREFIX = "com.yacreader"
|
||||
|
||||
DEPENDPATH += . \
|
||||
release
|
||||
|
||||
DEFINES += NOMINMAX YACREADER
|
||||
QMAKE_MAC_SDK = macosx10.12
|
||||
|
||||
#load default build flags
|
||||
include (../config.pri)
|
||||
include (../dependencies/pdf_backend.pri)
|
||||
|
||||
unix:!macx{
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
}
|
||||
|
||||
unix:haiku {
|
||||
DEFINES += _BSD_SOURCE
|
||||
LIBS += -lnetwork -lbsd
|
||||
}
|
||||
|
||||
CONFIG(force_angle) {
|
||||
contains(QMAKE_TARGET.arch, x86_64) {
|
||||
Release:DESTDIR = ../release64_angle
|
||||
Debug:DESTDIR = ../debug64_angle
|
||||
} else {
|
||||
Release:DESTDIR = ../release_angle
|
||||
Debug:DESTDIR = ../debug_angle
|
||||
}
|
||||
} else {
|
||||
contains(QMAKE_TARGET.arch, x86_64) {
|
||||
Release:DESTDIR = ../release64
|
||||
Debug:DESTDIR = ../debug64
|
||||
} else {
|
||||
Release:DESTDIR = ../release
|
||||
Debug:DESTDIR = ../debug
|
||||
}
|
||||
}
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
INCLUDEPATH += ../common \
|
||||
../custom_widgets
|
||||
|
||||
!CONFIG(no_opengl):CONFIG(legacy_gl_widget) {
|
||||
INCLUDEPATH += ../common/gl_legacy \
|
||||
} else {
|
||||
INCLUDEPATH += ../common/gl \
|
||||
}
|
||||
|
||||
#there are going to be two builds for windows, OpenGL based and ANGLE based
|
||||
win32 {
|
||||
CONFIG(force_angle) {
|
||||
message("using ANGLE")
|
||||
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
|
||||
#linking extra libs are necesary for a successful compilation, a better approach should be
|
||||
#to remove any OpenGL (desktop) dependencies
|
||||
#the OpenGL stuff should be migrated to OpenGL ES
|
||||
DEFINES += FORCE_ANGLE
|
||||
} else {
|
||||
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
|
||||
}
|
||||
|
||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
|
||||
QMAKE_LFLAGS_RELEASE += /LTCG
|
||||
CONFIG -= embed_manifest_exe
|
||||
}
|
||||
|
||||
unix:!macx:!CONFIG(no_opengl) {
|
||||
LIBS += -lGLU
|
||||
}
|
||||
|
||||
macx {
|
||||
QT += macextras gui-private
|
||||
CONFIG += objective_c
|
||||
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
|
||||
}
|
||||
|
||||
QT += network widgets core multimedia
|
||||
!CONFIG(no_opengl) {
|
||||
QT += opengl
|
||||
}
|
||||
|
||||
#CONFIG += release
|
||||
CONFIG -= flat
|
||||
|
||||
# Sources
|
||||
HEADERS += ../common/comic.h \
|
||||
configuration.h \
|
||||
goto_dialog.h \
|
||||
magnifying_glass.h \
|
||||
main_window_viewer.h \
|
||||
viewer.h \
|
||||
goto_flow.h \
|
||||
options_dialog.h \
|
||||
../common/bookmarks.h \
|
||||
bookmarks_dialog.h \
|
||||
render.h \
|
||||
shortcuts_dialog.h \
|
||||
translator.h \
|
||||
goto_flow_widget.h \
|
||||
page_label_widget.h \
|
||||
goto_flow_toolbar.h \
|
||||
width_slider.h \
|
||||
notifications_label_widget.h \
|
||||
../common/pictureflow.h \
|
||||
../common/custom_widgets.h \
|
||||
../common/check_new_version.h \
|
||||
../common/qnaturalsorting.h \
|
||||
../common/yacreader_global.h \
|
||||
../common/yacreader_global_gui.h \
|
||||
../common/onstart_flow_selection_dialog.h \
|
||||
../common/comic_db.h \
|
||||
../common/folder.h \
|
||||
../common/library_item.h \
|
||||
yacreader_local_client.h \
|
||||
../common/http_worker.h \
|
||||
../common/exit_check.h \
|
||||
../common/scroll_management.h \
|
||||
../common/opengl_checker.h \
|
||||
../common/pdf_comic.h
|
||||
|
||||
!CONFIG(no_opengl) {
|
||||
CONFIG(legacy_gl_widget) {
|
||||
message("Using legacy YACReaderFlowGL (QGLWidget) header")
|
||||
DEFINES += YACREADER_LEGACY_FLOW_GL
|
||||
HEADERS += ../common/gl_legacy/yacreader_flow_gl.h
|
||||
} else {
|
||||
HEADERS += ../common/gl/yacreader_flow_gl.h
|
||||
}
|
||||
HEADERS += goto_flow_gl.h
|
||||
}
|
||||
|
||||
SOURCES += ../common/comic.cpp \
|
||||
configuration.cpp \
|
||||
goto_dialog.cpp \
|
||||
magnifying_glass.cpp \
|
||||
main_window_viewer.cpp \
|
||||
viewer.cpp \
|
||||
goto_flow.cpp \
|
||||
options_dialog.cpp \
|
||||
../common/bookmarks.cpp \
|
||||
bookmarks_dialog.cpp \
|
||||
render.cpp \
|
||||
shortcuts_dialog.cpp \
|
||||
translator.cpp \
|
||||
goto_flow_widget.cpp \
|
||||
page_label_widget.cpp \
|
||||
goto_flow_toolbar.cpp \
|
||||
width_slider.cpp \
|
||||
notifications_label_widget.cpp \
|
||||
../common/pictureflow.cpp \
|
||||
../common/custom_widgets.cpp \
|
||||
../common/check_new_version.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
../common/onstart_flow_selection_dialog.cpp \
|
||||
../common/comic_db.cpp \
|
||||
../common/folder.cpp \
|
||||
../common/library_item.cpp \
|
||||
yacreader_local_client.cpp \
|
||||
../common/http_worker.cpp \
|
||||
../common/yacreader_global.cpp \
|
||||
../common/yacreader_global_gui.cpp \
|
||||
../common/exit_check.cpp \
|
||||
../common/scroll_management.cpp \
|
||||
../common/opengl_checker.cpp
|
||||
|
||||
!CONFIG(no_opengl) {
|
||||
CONFIG(legacy_gl_widget) {
|
||||
message("using legacy YACReaderFlowGL (QGLWidget) source code")
|
||||
SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp
|
||||
} else {
|
||||
SOURCES += ../common/gl/yacreader_flow_gl.cpp
|
||||
}
|
||||
SOURCES += goto_flow_gl.cpp
|
||||
}
|
||||
|
||||
include(../custom_widgets/custom_widgets_yacreader.pri)
|
||||
CONFIG(7zip){
|
||||
include(../compressed_archive/wrapper.pri)
|
||||
} else:CONFIG(unarr){
|
||||
include(../compressed_archive/unarr/unarr-wrapper.pri)
|
||||
} else {
|
||||
error(No compression backend specified. Did you mess with the build system?)
|
||||
}
|
||||
include(../shortcuts_management/shortcuts_management.pri)
|
||||
|
||||
RESOURCES += yacreader_images.qrc \
|
||||
yacreader_files.qrc
|
||||
|
||||
win32:RESOURCES += yacreader_images_win.qrc
|
||||
unix:!macx:RESOURCES += yacreader_images_win.qrc
|
||||
macx:RESOURCES += yacreader_images_osx.qrc
|
||||
|
||||
include(../QsLog/QsLog.pri)
|
||||
|
||||
RC_FILE = icon.rc
|
||||
|
||||
macx {
|
||||
ICON = YACReader.icns
|
||||
QMAKE_INFO_PLIST = Info.plist
|
||||
}
|
||||
|
||||
TRANSLATIONS = yacreader_es.ts \
|
||||
yacreader_fr.ts \
|
||||
yacreader_ru.ts \
|
||||
yacreader_pt.ts \
|
||||
yacreader_nl.ts \
|
||||
yacreader_tr.ts \
|
||||
yacreader_de.ts \
|
||||
yacreader_source.ts
|
||||
|
||||
unix:!macx {
|
||||
#set install prefix if it's empty
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr
|
||||
}
|
||||
|
||||
BINDIR = $$PREFIX/bin
|
||||
LIBDIR = $$PREFIX/lib
|
||||
DATADIR = $$PREFIX/share
|
||||
|
||||
DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\""
|
||||
|
||||
#MAKE INSTALL
|
||||
|
||||
INSTALLS += bin docs icon desktop translation manpage
|
||||
|
||||
bin.path = $$BINDIR
|
||||
isEmpty(DESTDIR) {
|
||||
bin.files = YACReader
|
||||
} else {
|
||||
bin.files = $$DESTDIR/YACReader
|
||||
}
|
||||
|
||||
docs.path = $$DATADIR/doc/yacreader
|
||||
|
||||
#rename docs for better packageability
|
||||
docs.extra = cp ../README.txt ../README
|
||||
docs.files = ../README ../CHANGELOG.md
|
||||
|
||||
icon.path = $$DATADIR/icons/hicolor/48x48/apps
|
||||
icon.files = ../YACReader.png
|
||||
|
||||
desktop.path = $$DATADIR/applications
|
||||
desktop.files = ../YACReader.desktop
|
||||
|
||||
translation.path = $$DATADIR/yacreader/languages
|
||||
translation.files = ../release/languages/yacreader_*
|
||||
|
||||
manpage.path = $$DATADIR/man/man1
|
||||
manpage.files = ../YACReader.1
|
||||
|
||||
#remove leftover doc files when 'make clean' is invoked
|
||||
QMAKE_CLEAN += "../README"
|
||||
}
|
197
YACReader/bookmarks_dialog.cpp
Normal file
197
YACReader/bookmarks_dialog.cpp
Normal file
@ -0,0 +1,197 @@
|
||||
#include "bookmarks_dialog.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QFrame>
|
||||
#include <QImage>
|
||||
|
||||
#include "bookmarks.h"
|
||||
|
||||
BookmarksDialog::BookmarksDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
setModal(true);
|
||||
|
||||
//animation = new QPropertyAnimation(this,"windowOpacity");
|
||||
//animation->setDuration(150);
|
||||
|
||||
QHBoxLayout * layout = new QHBoxLayout();
|
||||
|
||||
//bookmarks
|
||||
QGridLayout * bookmarksL = new QGridLayout();
|
||||
|
||||
pages.push_back(new QLabel(tr("Lastest Page")));
|
||||
for(int i=0;i<3;i++)
|
||||
pages.push_back(new QLabel("-"));
|
||||
|
||||
QString labelsStyle = "QLabel {color:white;}";
|
||||
|
||||
foreach(QLabel * label,pages)
|
||||
{
|
||||
label->setStyleSheet(labelsStyle);
|
||||
}
|
||||
|
||||
int heightDesktopResolution = QApplication::desktop()->screenGeometry().height();
|
||||
int height,width;
|
||||
height = heightDesktopResolution*0.50;
|
||||
width = height*0.65;
|
||||
|
||||
coverSize = QSize(width,height);
|
||||
|
||||
for(int i=0;i<4;i++)
|
||||
{
|
||||
QLabel * l = new QLabel();
|
||||
l->setFixedSize(coverSize);
|
||||
l->setScaledContents(false);
|
||||
//l->setPixmap(QPixmap(":/images/notCover.png"));
|
||||
l->installEventFilter(this);
|
||||
images.push_back(l);
|
||||
}
|
||||
|
||||
for(int i=0;i<3;i++)
|
||||
bookmarksL->addWidget(pages.at(i+1),0,i,Qt::AlignCenter);
|
||||
|
||||
for(int i=0;i<3;i++)
|
||||
bookmarksL->addWidget(images.at(i+1),1,i,Qt::AlignCenter);
|
||||
|
||||
|
||||
//last page
|
||||
QGridLayout * lp = new QGridLayout();
|
||||
lp->addWidget(pages.at(0),0,0,Qt::AlignCenter);
|
||||
lp->addWidget(images.at(0),1,0,Qt::AlignCenter);
|
||||
|
||||
layout->addLayout(bookmarksL);
|
||||
QFrame *f = new QFrame( this );
|
||||
f->setFrameStyle( QFrame::VLine | QFrame::Sunken );
|
||||
layout->addWidget(f);
|
||||
layout->addLayout(lp);
|
||||
|
||||
QHBoxLayout * buttons = new QHBoxLayout();
|
||||
|
||||
cancel = new QPushButton(tr("Close"));
|
||||
cancel->setFlat(true);
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(hide()));
|
||||
buttons->addStretch();
|
||||
buttons->addWidget(cancel);
|
||||
|
||||
cancel->setStyleSheet("QPushButton {border: 1px solid #242424; background: #2e2e2e; color:white; padding: 5px 26px 5px 26px; font-size:12px;font-family:Arial; font-weight:bold;}");
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout();
|
||||
|
||||
l->addWidget(new QLabel("<font color=\"#FFFFFF\">"+tr("Click on any image to go to the bookmark")+"</font>"),0,Qt::AlignCenter);
|
||||
l->addLayout(layout);
|
||||
#ifdef Q_OS_MAC
|
||||
l->addLayout(buttons);
|
||||
#endif
|
||||
|
||||
QPalette Pal(palette());
|
||||
// set black background
|
||||
Pal.setColor(QPalette::Background, QColor("#454545"));
|
||||
this->setAutoFillBackground(true);
|
||||
this->setPalette(Pal);
|
||||
|
||||
setLayout(l);
|
||||
}
|
||||
|
||||
void BookmarksDialog::setBookmarks(const Bookmarks & bm)
|
||||
{
|
||||
lastPage = bm.getLastPage();
|
||||
if (lastPage > 0)
|
||||
{
|
||||
QPixmap p = QPixmap::fromImage(bm.getLastPagePixmap());
|
||||
if(p.isNull())
|
||||
{
|
||||
images.at(0)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
images.at(0)->setText(tr("Loading..."));
|
||||
}
|
||||
else
|
||||
{
|
||||
images.at(0)->setAlignment(Qt::AlignHCenter|Qt::AlignBottom);
|
||||
images.at(0)->setPixmap(p.scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
images.at(0)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
images.at(0)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
|
||||
}
|
||||
|
||||
QList<int> l = bm.getBookmarkPages();
|
||||
int s = l.count();
|
||||
for(int i=0;i<s;i++)
|
||||
{
|
||||
pages.at(i+1)->setText(QString::number(l.at(i)+1));
|
||||
QPixmap p = QPixmap::fromImage(bm.getBookmarkPixmap(l.at(i)));
|
||||
if(p.isNull())
|
||||
{
|
||||
images.at(i+1)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
images.at(i+1)->setText(tr("Loading..."));
|
||||
}
|
||||
else
|
||||
{
|
||||
images.at(i+1)->setAlignment(Qt::AlignHCenter|Qt::AlignBottom);
|
||||
images.at(i+1)->setPixmap(p.scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
}
|
||||
for(int i=s;i<3;i++)
|
||||
{
|
||||
pages.at(i+1)->setText("-");
|
||||
images.at(i+1)->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
images.at(i+1)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
}
|
||||
}
|
||||
|
||||
bool BookmarksDialog::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::MouseButtonPress)
|
||||
{
|
||||
if (obj == images.at(0))
|
||||
{
|
||||
emit(goToPage(lastPage));
|
||||
close();
|
||||
event->accept();
|
||||
}
|
||||
for(int i=1;i<=3;i++)
|
||||
{
|
||||
if(obj == images.at(i))
|
||||
{
|
||||
bool b;
|
||||
int page = pages.at(i)->text().toInt(&b)-1;
|
||||
if(b)
|
||||
{
|
||||
emit(goToPage(page));
|
||||
close();
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
// pass the event on to the parent class
|
||||
return QDialog::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void BookmarksDialog::keyPressEvent(QKeyEvent * event)
|
||||
{
|
||||
if(event->key() == Qt::Key_M)
|
||||
hide();
|
||||
}
|
||||
/*
|
||||
void BookmarksDialog::show()
|
||||
{
|
||||
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();
|
||||
}*/
|
45
YACReader/bookmarks_dialog.h
Normal file
45
YACReader/bookmarks_dialog.h
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef __BOOKMARKS_DIALOG_H
|
||||
#define __BOOKMARKS_DIALOG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
#include "bookmarks.h"
|
||||
|
||||
class BookmarksDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
QList<QLabel *> pages;
|
||||
QList<QLabel *> images;
|
||||
|
||||
int lastPage;
|
||||
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
|
||||
QSize coverSize;
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
//QPropertyAnimation * animation;
|
||||
|
||||
public:
|
||||
BookmarksDialog(QWidget * parent = 0);
|
||||
|
||||
public slots:
|
||||
void setBookmarks(const Bookmarks & bookmarks);
|
||||
//void show();
|
||||
//void hide();
|
||||
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
};
|
||||
|
||||
#endif // BOOKMARKS_DIALOG_H
|
79
YACReader/configuration.cpp
Normal file
79
YACReader/configuration.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
#include "configuration.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "yacreader_global.h"
|
||||
|
||||
Configuration::Configuration()
|
||||
{
|
||||
//read configuration
|
||||
//load("/YACReader.conf");
|
||||
}
|
||||
|
||||
QSettings *Configuration::getSettings()
|
||||
{
|
||||
return settings;
|
||||
}
|
||||
|
||||
/*Configuration::Configuration(const Configuration & conf)
|
||||
{
|
||||
//nothing
|
||||
}*/
|
||||
|
||||
void Configuration::load(QSettings * settings)
|
||||
{
|
||||
this->settings = settings;
|
||||
|
||||
//TODO set defaults
|
||||
if(!settings->contains(PATH))
|
||||
settings->setValue(PATH,".");
|
||||
if(!settings->contains(GO_TO_FLOW_SIZE))
|
||||
settings->setValue(GO_TO_FLOW_SIZE,QSize(126,200));
|
||||
if(!settings->contains(MAG_GLASS_SIZE))
|
||||
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
||||
if(!settings->contains(ZOOM_LEVEL))
|
||||
settings->setValue(MAG_GLASS_SIZE,QSize(350,175));
|
||||
if(!settings->contains(FLOW_TYPE))
|
||||
settings->setValue(FLOW_TYPE,0);
|
||||
if(!settings->contains(FULLSCREEN))
|
||||
settings->setValue(FULLSCREEN,false);
|
||||
if(!settings->contains(Y_WINDOW_SIZE))
|
||||
settings->setValue(Y_WINDOW_SIZE,QSize(0,0));
|
||||
if(!settings->contains(MAXIMIZED))
|
||||
settings->setValue(MAXIMIZED,false);
|
||||
if(!settings->contains(DOUBLE_PAGE))
|
||||
settings->setValue(DOUBLE_PAGE,false);
|
||||
if(!settings->contains(BACKGROUND_COLOR))
|
||||
settings->setValue(BACKGROUND_COLOR,QColor(40,40,40));
|
||||
if(!settings->contains(ALWAYS_ON_TOP))
|
||||
settings->setValue(ALWAYS_ON_TOP,false);
|
||||
if(!settings->contains(SHOW_TOOLBARS))
|
||||
settings->setValue(SHOW_TOOLBARS, true);
|
||||
if(!settings->contains(QUICK_NAVI_MODE))
|
||||
settings->setValue(QUICK_NAVI_MODE, false);
|
||||
//old fit stuff
|
||||
/*if(!settings->contains(FIT))
|
||||
settings->setValue(FIT,false);
|
||||
if(!settings->contains(FIT_TO_WIDTH_RATIO))
|
||||
settings->setValue(FIT_TO_WIDTH_RATIO,1);
|
||||
if(!settings->contains(ADJUST_TO_FULL_SIZE))
|
||||
settings->setValue(ADJUST_TO_FULL_SIZE,false);
|
||||
*/
|
||||
}
|
||||
void Configuration::updateOpenRecentList (QString path)
|
||||
{
|
||||
QStringList list = openRecentList();
|
||||
list.removeAll(path);
|
||||
list.prepend(path);
|
||||
//TODO: Make list lenght configurable
|
||||
while (list.length() > getOpenRecentSize())
|
||||
{
|
||||
list.removeLast();
|
||||
}
|
||||
settings->setValue("recentFiles", list);
|
||||
}
|
117
YACReader/configuration.h
Normal file
117
YACReader/configuration.h
Normal file
@ -0,0 +1,117 @@
|
||||
#ifndef __CONFIGURATION_H
|
||||
#define __CONFIGURATION_H
|
||||
#include <QString>
|
||||
#include <QSize>
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
#include <QColor>
|
||||
#include <QSettings>
|
||||
#include <QDate>
|
||||
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
#define CONF_FILE_PATH "."
|
||||
#define SLIDE_ASPECT_RATIO 1.585
|
||||
|
||||
using namespace YACReader;
|
||||
|
||||
class Configuration : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QSettings * settings;
|
||||
|
||||
QString defaultPath;
|
||||
//configuration properties
|
||||
QSize magnifyingGlassSize;
|
||||
QSize gotoSlideSize;
|
||||
float zoomLevel;
|
||||
bool adjustToWidth;
|
||||
bool fullScreen;
|
||||
FlowType flowType;
|
||||
float fitToWidthRatio;
|
||||
QPoint windowPos;
|
||||
QSize windowSize;
|
||||
bool maximized;
|
||||
bool doublePage;
|
||||
bool doubleMangaPage;
|
||||
bool alwaysOnTop;
|
||||
bool adjustToFullSize;
|
||||
QColor backgroundColor;
|
||||
|
||||
Configuration();
|
||||
//Configuration(const Configuration & conf);
|
||||
void load(const QString & path = CONF_FILE_PATH);
|
||||
|
||||
|
||||
public:
|
||||
static Configuration & getConfiguration()
|
||||
{
|
||||
static Configuration configuration;
|
||||
return configuration;
|
||||
};
|
||||
QSettings *getSettings();
|
||||
void load(QSettings * settings);
|
||||
QString getDefaultPath() { return settings->value(PATH).toString(); }
|
||||
void setDefaultPath(QString defaultPath){settings->setValue(PATH,defaultPath);}
|
||||
QSize getMagnifyingGlassSize() { return settings->value(MAG_GLASS_SIZE).toSize();}
|
||||
void setMagnifyingGlassSize(const QSize & mgs) { settings->setValue(MAG_GLASS_SIZE,mgs);}
|
||||
QSize getGotoSlideSize() { return settings->value(GO_TO_FLOW_SIZE).toSize();}
|
||||
void setGotoSlideSize(const QSize & gss) { settings->setValue(GO_TO_FLOW_SIZE,gss);}
|
||||
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat();}
|
||||
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL,zl);}
|
||||
|
||||
//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
|
||||
int getOpenRecentSize() { return settings->value("recentSize", 25).toInt();}
|
||||
QStringList openRecentList() { return settings->value("recentFiles").toStringList(); }
|
||||
void updateOpenRecentList (QString path);
|
||||
void clearOpenRecentList() { settings->remove("recentFiles"); }
|
||||
|
||||
//Old fitmodes
|
||||
/*
|
||||
bool getAdjustToWidth() {return settings->value(FIT).toBool();}
|
||||
void setAdjustToWidth(bool atw=true) {settings->setValue(FIT,atw);}
|
||||
float getFitToWidthRatio(){return settings->value(FIT_TO_WIDTH_RATIO).toFloat();}
|
||||
void setFitToWidthRatio(float r){settings->setValue(FIT_TO_WIDTH_RATIO,r);}
|
||||
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
||||
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
||||
*/
|
||||
|
||||
FlowType getFlowType(){return (FlowType)settings->value(FLOW_TYPE_SW).toInt();}
|
||||
void setFlowType(FlowType type){settings->setValue(FLOW_TYPE_SW,type);}
|
||||
bool getFullScreen(){return settings->value(FULLSCREEN).toBool();}
|
||||
void setFullScreen(bool f){settings->setValue(FULLSCREEN,f);}
|
||||
|
||||
QPoint getPos(){return settings->value(Y_WINDOW_POS).toPoint();}
|
||||
void setPos(QPoint p){settings->setValue(Y_WINDOW_POS,p);}
|
||||
QSize getSize(){return settings->value(Y_WINDOW_SIZE).toSize();}
|
||||
void setSize(QSize s){settings->setValue(Y_WINDOW_SIZE,s);}
|
||||
bool getMaximized(){return settings->value(MAXIMIZED).toBool();}
|
||||
void setMaximized(bool b){settings->setValue(MAXIMIZED,b);}
|
||||
bool getDoublePage(){return settings->value(DOUBLE_PAGE).toBool();}
|
||||
void setDoublePage(bool b){settings->setValue(DOUBLE_PAGE,b);}
|
||||
bool getDoubleMangaPage(){return settings->value(DOUBLE_MANGA_PAGE).toBool();}
|
||||
void setDoubleMangaPage(bool b){settings->setValue(DOUBLE_MANGA_PAGE,b);}
|
||||
|
||||
QColor getBackgroundColor(){return settings->value(BACKGROUND_COLOR).value<QColor>();}
|
||||
void setBackgroundColor(const QColor& color){settings->value(BACKGROUND_COLOR,color);}
|
||||
bool getAlwaysOnTop(){return settings->value(ALWAYS_ON_TOP).toBool();}
|
||||
void setAlwaysOnTop(bool b){ settings->setValue(ALWAYS_ON_TOP,b);}
|
||||
bool getShowToolbars(){return settings->value(SHOW_TOOLBARS).toBool();}
|
||||
void setShowToolbars(bool b){settings->setValue(SHOW_TOOLBARS,b);}
|
||||
bool getShowInformation(){return settings->value(SHOW_INFO,false).toBool();}
|
||||
void setShowInformation(bool b){settings->setValue(SHOW_INFO,b);}
|
||||
QDate getLastVersionCheck(){return settings->value(LAST_VERSION_CHECK).toDate();}
|
||||
void setLastVersionCheck(const QDate & date){ settings->setValue(LAST_VERSION_CHECK,date);}
|
||||
int getNumDaysBetweenVersionChecks() {return settings->value(NUM_DAYS_BETWEEN_VERSION_CHECKS,1).toInt();}
|
||||
void setNumDaysBetweenVersionChecks(int days) {return settings->setValue(NUM_DAYS_BETWEEN_VERSION_CHECKS,days);}
|
||||
bool getQuickNaviMode(){return settings->value(QUICK_NAVI_MODE).toBool();}
|
||||
bool getDisableShowOnMouseOver(){return settings->value(DISABLE_MOUSE_OVER_GOTO_FLOW).toBool();}
|
||||
};
|
||||
|
||||
#endif
|
84
YACReader/goto_dialog.cpp
Normal file
84
YACReader/goto_dialog.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
#include "goto_dialog.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QIntValidator>
|
||||
|
||||
|
||||
|
||||
GoToDialog::GoToDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
setupUI();
|
||||
}
|
||||
|
||||
void GoToDialog::setupUI()
|
||||
{
|
||||
textLabel = new QLabel(tr("Page : "));
|
||||
pageNumber = new QLineEdit;
|
||||
v = new QIntValidator(this);
|
||||
v->setBottom(1);
|
||||
pageNumber->setValidator(v);
|
||||
textLabel->setBuddy(pageNumber);
|
||||
textLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
|
||||
accept = new QPushButton(tr("Go To"));
|
||||
connect(accept,SIGNAL(clicked()),this,SLOT(goTo()));
|
||||
cancel = new QPushButton(tr("Cancel"));
|
||||
connect(cancel,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
QHBoxLayout *topLayout = new QHBoxLayout;
|
||||
|
||||
topLayout->addWidget(textLabel);
|
||||
topLayout->addWidget(pageNumber);
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(accept);
|
||||
bottomLayout->addWidget(cancel);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(numPagesLabel = new QLabel(tr("Total pages : ")));
|
||||
mainLayout->addLayout(topLayout);
|
||||
mainLayout->addStretch();
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
||||
QHBoxLayout *imgMainLayout = new QHBoxLayout;
|
||||
QLabel * imgLabel = new QLabel();
|
||||
QPixmap p(":/images/goto.png");
|
||||
imgLabel->setPixmap(p);
|
||||
imgMainLayout->addWidget(imgLabel);
|
||||
imgMainLayout->addLayout(mainLayout);
|
||||
|
||||
setLayout(imgMainLayout);
|
||||
|
||||
setWindowTitle(tr("Go to..."));
|
||||
setModal (true);
|
||||
|
||||
pageNumber->setFocusPolicy(Qt::StrongFocus);
|
||||
pageNumber->setFocus();
|
||||
}
|
||||
|
||||
void GoToDialog::goTo()
|
||||
{
|
||||
unsigned int page = pageNumber->text().toInt();
|
||||
pageNumber->clear();
|
||||
|
||||
if(page >= 1)
|
||||
emit(goToPage(page-1));
|
||||
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
void GoToDialog::setNumPages(unsigned int numPages)
|
||||
{
|
||||
numPagesLabel->setText(tr("Total pages : ")+QString::number(numPages));
|
||||
v->setTop(numPages);
|
||||
}
|
||||
|
||||
void GoToDialog::open()
|
||||
{
|
||||
pageNumber->setFocus();
|
||||
QDialog::open();
|
||||
}
|
32
YACReader/goto_dialog.h
Normal file
32
YACReader/goto_dialog.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef __GOTODIALOG_H
|
||||
#define __GOTODIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QIntValidator>
|
||||
|
||||
class GoToDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GoToDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QLabel * numPagesLabel;
|
||||
QLabel * textLabel;
|
||||
QLineEdit * pageNumber;
|
||||
QIntValidator * v;
|
||||
QPushButton * accept;
|
||||
QPushButton * cancel;
|
||||
void setupUI();
|
||||
public slots:
|
||||
void goTo();
|
||||
void setNumPages(unsigned int numPages);
|
||||
void open();
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
322
YACReader/goto_flow.cpp
Normal file
322
YACReader/goto_flow.cpp
Normal file
@ -0,0 +1,322 @@
|
||||
#include "goto_flow.h"
|
||||
#include "configuration.h"
|
||||
#include "comic.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QSize>
|
||||
#include <QImage>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QMutex>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QPixmap>
|
||||
#include <QThread>
|
||||
#include <QSize>
|
||||
#include <QIntValidator>
|
||||
#include <QWaitCondition>
|
||||
#include <QObject>
|
||||
#include <QEvent>
|
||||
#include <QLabel>
|
||||
|
||||
#include "yacreader_flow.h"
|
||||
|
||||
#include "goto_flow_toolbar.h"
|
||||
|
||||
|
||||
GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
|
||||
:GoToFlowWidget(parent),ready(false)
|
||||
{
|
||||
updateTimer = new QTimer;
|
||||
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateImageData()));
|
||||
|
||||
worker = new PageLoader(&mutexGoToFlow);
|
||||
|
||||
flow = new YACReaderFlow(this,flowType);
|
||||
flow->setReflectionEffect(PictureFlow::PlainReflection);
|
||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||
|
||||
flow->setSlideSize(imageSize);
|
||||
connect(flow,SIGNAL(centerIndexChanged(int)),this,SLOT(setPageNumber(int)));
|
||||
connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||
|
||||
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(showSlide(unsigned int)));
|
||||
|
||||
mainLayout->addWidget(flow);
|
||||
toolBar->raise();
|
||||
|
||||
resize(static_cast<int>(5*imageSize.width()),toolBar->height() + static_cast<int>(imageSize.height()*1.7));
|
||||
|
||||
this->setCursor(QCursor(Qt::ArrowCursor));
|
||||
}
|
||||
|
||||
GoToFlow::~GoToFlow()
|
||||
{
|
||||
delete flow;
|
||||
delete updateTimer;
|
||||
worker->deleteLater();
|
||||
}
|
||||
|
||||
void GoToFlow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
||||
QApplication::sendEvent(flow,event);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GoToFlowWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void GoToFlow::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
|
||||
toolBar->move(0, event->size().height() - toolBar->height());
|
||||
toolBar->setFixedWidth(width());
|
||||
}
|
||||
|
||||
|
||||
void GoToFlow::centerSlide(int slide)
|
||||
{
|
||||
if(flow->centerIndex()!=slide)
|
||||
{
|
||||
flow->setCenterIndex(slide);
|
||||
if(ready)// load images if pages are loaded.
|
||||
{
|
||||
//worker->reset(); //BUG FIXED : image didn't load if worker was working
|
||||
preload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GoToFlow::setNumSlides(unsigned int slides)
|
||||
{
|
||||
// numPagesLabel->setText(tr("Total pages : ")+QString::number(slides));
|
||||
// numPagesLabel->adjustSize();
|
||||
imagesReady.clear();
|
||||
imagesReady.fill(false,slides);
|
||||
|
||||
rawImages.clear();
|
||||
rawImages.resize(slides);
|
||||
|
||||
toolBar->setTop(slides);
|
||||
|
||||
SlideInitializer * si = new SlideInitializer(&mutexGoToFlow,flow,slides);
|
||||
|
||||
imagesLoaded.clear();
|
||||
imagesLoaded.fill(false,slides);
|
||||
|
||||
imagesSetted.clear();
|
||||
imagesSetted.fill(false,slides);
|
||||
|
||||
numImagesLoaded = 0;
|
||||
|
||||
connect(flow, SIGNAL(centerIndexChanged(int)), this, SLOT(preload()));
|
||||
connect(flow, SIGNAL(centerIndexChangedSilent(int)), this, SLOT(preload()));
|
||||
|
||||
ready = true;
|
||||
worker->reset();
|
||||
|
||||
si->start();
|
||||
}
|
||||
|
||||
void GoToFlow::reset()
|
||||
{
|
||||
updateTimer->stop();
|
||||
/*imagesLoaded.clear();
|
||||
numImagesLoaded = 0;
|
||||
imagesReady.clear();
|
||||
rawImages.clear();*/
|
||||
ready = false;
|
||||
}
|
||||
|
||||
void GoToFlow::setImageReady(int index,const QByteArray & image)
|
||||
{
|
||||
rawImages[index]=image;
|
||||
imagesReady[index]=true;
|
||||
preload();
|
||||
}
|
||||
|
||||
void GoToFlow::preload()
|
||||
{
|
||||
if(numImagesLoaded < imagesLoaded.size())
|
||||
updateTimer->start(30); //TODO comprobar rendimiento, antes era 70
|
||||
}
|
||||
|
||||
void GoToFlow::updateImageData()
|
||||
{
|
||||
// can't do anything, wait for the next possibility
|
||||
if(worker->busy())
|
||||
return;
|
||||
|
||||
// set image of last one
|
||||
int idx = worker->index();
|
||||
if( idx >= 0 && !worker->result().isNull())
|
||||
{
|
||||
if(!imagesSetted[idx])
|
||||
{
|
||||
flow->setSlide(idx, worker->result());
|
||||
imagesSetted[idx] = true;
|
||||
numImagesLoaded++;
|
||||
rawImages[idx].clear();; //release memory
|
||||
imagesLoaded[idx]=true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// try to load only few images on the left and right side
|
||||
// i.e. all visible ones plus some extra
|
||||
#define COUNT 8
|
||||
int indexes[2*COUNT+1];
|
||||
int center = flow->centerIndex();
|
||||
indexes[0] = center;
|
||||
for(int j = 0; j < COUNT; j++)
|
||||
{
|
||||
indexes[j*2+1] = center+j+1;
|
||||
indexes[j*2+2] = center-j-1;
|
||||
}
|
||||
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())
|
||||
{
|
||||
// schedule thumbnail generation
|
||||
|
||||
worker->generate(i, flow->slideSize(),rawImages[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// no need to generate anything? stop polling...
|
||||
updateTimer->stop();
|
||||
}
|
||||
|
||||
void GoToFlow::wheelEvent(QWheelEvent * event)
|
||||
{
|
||||
if(event->delta()<0)
|
||||
flow->showNext();
|
||||
else
|
||||
flow->showPrevious();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void GoToFlow::setFlowType(FlowType flowType)
|
||||
{
|
||||
flow->setFlowType(flowType);
|
||||
}
|
||||
|
||||
void GoToFlow::updateConfig(QSettings * settings)
|
||||
{
|
||||
GoToFlowWidget::updateConfig(settings);
|
||||
|
||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||
flow->setFlowType(Configuration::getConfiguration().getFlowType());
|
||||
resize(5*imageSize.width(), toolBar->height() + imageSize.height()*1.7);
|
||||
updateSize();
|
||||
}
|
||||
|
||||
void GoToFlow::setFlowRightToLeft(bool b)
|
||||
{
|
||||
flow->setFlowRightToLeft(b);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//SlideInitializer
|
||||
//-----------------------------------------------------------------------------
|
||||
SlideInitializer::SlideInitializer(QMutex * m,PictureFlow * flow,int slides)
|
||||
:QThread(),mutex(m),_flow(flow),_slides(slides)
|
||||
{
|
||||
|
||||
}
|
||||
void SlideInitializer::run()
|
||||
{
|
||||
mutex->lock();
|
||||
|
||||
_flow->clear();
|
||||
for(int i=0;i<_slides;i++)
|
||||
_flow->addSlide(QImage());
|
||||
_flow->setCenterIndex(0);
|
||||
|
||||
mutex->unlock();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
//PageLoader
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
PageLoader::PageLoader(QMutex * m):
|
||||
QThread(),mutex(m), restart(false), working(false), idx(-1)
|
||||
{
|
||||
}
|
||||
|
||||
PageLoader::~PageLoader()
|
||||
{
|
||||
mutex->lock();
|
||||
condition.wakeOne();
|
||||
mutex->unlock();
|
||||
wait();
|
||||
}
|
||||
|
||||
bool PageLoader::busy() const
|
||||
{
|
||||
return isRunning() ? working : false;
|
||||
}
|
||||
|
||||
void PageLoader::generate(int index, QSize size,const QByteArray & rImage)
|
||||
{
|
||||
mutex->lock();
|
||||
this->idx = index;
|
||||
//this->img = QImage();
|
||||
this->size = size;
|
||||
this->rawImage = rImage;
|
||||
mutex->unlock();
|
||||
|
||||
if (!isRunning())
|
||||
start();
|
||||
else
|
||||
{
|
||||
// already running, wake up whenever ready
|
||||
restart = true;
|
||||
condition.wakeOne();
|
||||
}
|
||||
}
|
||||
|
||||
void PageLoader::run()
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
// copy necessary data
|
||||
mutex->lock();
|
||||
this->working = true;
|
||||
//int idx = this->idx;
|
||||
|
||||
|
||||
QImage image;
|
||||
image.loadFromData(this->rawImage);
|
||||
// let everyone knows it is ready
|
||||
image = image.scaled(this->size,Qt::KeepAspectRatio,Qt::SmoothTransformation);
|
||||
|
||||
mutex->unlock();
|
||||
|
||||
mutex->lock();
|
||||
this->working = false;
|
||||
this->img = image;
|
||||
mutex->unlock();
|
||||
|
||||
// put to sleep
|
||||
mutex->lock();
|
||||
if (!this->restart)
|
||||
condition.wait(mutex);
|
||||
restart = false;
|
||||
mutex->unlock();
|
||||
}
|
||||
}
|
114
YACReader/goto_flow.h
Normal file
114
YACReader/goto_flow.h
Normal file
@ -0,0 +1,114 @@
|
||||
#ifndef __GOTO_FLOW_H
|
||||
#define __GOTO_FLOW_H
|
||||
|
||||
#include "goto_flow_widget.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include <QWaitCondition>
|
||||
#include <QMutex>
|
||||
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QPixmap;
|
||||
class QThread;
|
||||
class QSize;
|
||||
class QIntValidator;
|
||||
class QWaitCondition;
|
||||
class QEvent;
|
||||
class QLabel;
|
||||
|
||||
|
||||
class Comic;
|
||||
class SlideInitializer;
|
||||
class PageLoader;
|
||||
class YACReaderFlow;
|
||||
class PictureFlow;
|
||||
class QKeyEvent;
|
||||
|
||||
class GoToFlow : public GoToFlowWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GoToFlow(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
|
||||
~GoToFlow();
|
||||
bool ready; //comic is ready for read.
|
||||
private:
|
||||
YACReaderFlow * flow;
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
//Comic * comic;
|
||||
QSize imageSize;
|
||||
|
||||
QVector<bool> imagesLoaded;
|
||||
QVector<bool> imagesSetted;
|
||||
int numImagesLoaded;
|
||||
QVector<bool> imagesReady;
|
||||
QVector<QByteArray> rawImages;
|
||||
QTimer* updateTimer;
|
||||
PageLoader* worker;
|
||||
virtual void wheelEvent(QWheelEvent * event);
|
||||
QMutex mutexGoToFlow;
|
||||
|
||||
private slots:
|
||||
void preload();
|
||||
void updateImageData();
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
public slots:
|
||||
void centerSlide(int slide);
|
||||
void reset();
|
||||
void setNumSlides(unsigned int slides);
|
||||
void setImageReady(int index,const QByteArray & image);
|
||||
void setFlowType(FlowType flowType);
|
||||
void updateConfig(QSettings * settings);
|
||||
void setFlowRightToLeft(bool b);
|
||||
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
//SlideInitializer
|
||||
//-----------------------------------------------------------------------------
|
||||
class SlideInitializer : public QThread
|
||||
{
|
||||
public:
|
||||
SlideInitializer(QMutex * m,PictureFlow * flow,int slides);
|
||||
private:
|
||||
QMutex * mutex;
|
||||
PictureFlow * _flow;
|
||||
int _slides;
|
||||
void run();
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
//PageLoader
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class PageLoader : public QThread
|
||||
{
|
||||
public:
|
||||
PageLoader(QMutex * m);
|
||||
~PageLoader();
|
||||
// returns FALSE if worker is still busy and can't take the task
|
||||
bool busy() const;
|
||||
void generate(int index, QSize size,const QByteArray & rImage);
|
||||
void reset(){idx = -1;};
|
||||
int index() const { return idx; }
|
||||
QImage result() const { return img; }
|
||||
protected:
|
||||
void run();
|
||||
private:
|
||||
QMutex * mutex;
|
||||
QWaitCondition condition;
|
||||
|
||||
bool restart;
|
||||
bool working;
|
||||
int idx;
|
||||
|
||||
QSize size;
|
||||
QImage img;
|
||||
QByteArray rawImage;
|
||||
};
|
||||
|
||||
#endif
|
167
YACReader/goto_flow_gl.cpp
Normal file
167
YACReader/goto_flow_gl.cpp
Normal file
@ -0,0 +1,167 @@
|
||||
#include "goto_flow_gl.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QIntValidator>
|
||||
#include <QPushButton>
|
||||
#include <QPushButton>
|
||||
#include <QSize>
|
||||
#include <QApplication>
|
||||
|
||||
#include "configuration.h"
|
||||
|
||||
#include "goto_flow_toolbar.h"
|
||||
|
||||
|
||||
GoToFlowGL::GoToFlowGL(QWidget* parent, FlowType flowType)
|
||||
:GoToFlowWidget(parent)
|
||||
{
|
||||
Q_UNUSED(flowType)
|
||||
flow = new YACReaderPageFlowGL(this);
|
||||
flow->setShowMarks(false);
|
||||
|
||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||
|
||||
flow->setSlideSize(imageSize);
|
||||
connect(flow,SIGNAL(centerIndexChanged(int)),this,SLOT(setPageNumber(int)));
|
||||
connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||
|
||||
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(setCenterIndex(unsigned int)));
|
||||
|
||||
mainLayout->addWidget(flow);
|
||||
toolBar->raise();
|
||||
|
||||
resize(static_cast<int>(5*imageSize.width()),toolBar->height() + static_cast<int>(imageSize.height()*1.7));
|
||||
|
||||
this->setCursor(QCursor(Qt::ArrowCursor));
|
||||
}
|
||||
|
||||
GoToFlowGL::~GoToFlowGL()
|
||||
{
|
||||
delete flow;
|
||||
}
|
||||
|
||||
void GoToFlowGL::reset()
|
||||
{
|
||||
flow->reset();
|
||||
}
|
||||
|
||||
void GoToFlowGL::centerSlide(int slide)
|
||||
{
|
||||
if(flow->centerIndex()!=slide)
|
||||
{
|
||||
flow->setCenterIndex(slide);
|
||||
}
|
||||
}
|
||||
|
||||
void GoToFlowGL::setFlowType(FlowType flowType)
|
||||
{
|
||||
if(flowType == CoverFlowLike)
|
||||
flow->setPreset(presetYACReaderFlowClassicConfig);
|
||||
else if(flowType == Strip)
|
||||
flow->setPreset(presetYACReaderFlowStripeConfig);
|
||||
else if(flowType == StripOverlapped)
|
||||
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
|
||||
else
|
||||
flow->setPreset(defaultYACReaderFlowConfig);
|
||||
}
|
||||
|
||||
void GoToFlowGL::setNumSlides(unsigned int slides)
|
||||
{
|
||||
flow->populate(slides);
|
||||
toolBar->setTop(slides);
|
||||
}
|
||||
void GoToFlowGL::setImageReady(int index,const QByteArray & imageData)
|
||||
{
|
||||
flow->rawImages[index] = imageData;
|
||||
flow->imagesReady[index] = true;
|
||||
}
|
||||
|
||||
void GoToFlowGL::updateConfig(QSettings * settings)
|
||||
{
|
||||
GoToFlowWidget::updateConfig(settings);
|
||||
|
||||
Performance performance = medium;
|
||||
switch (settings->value(PERFORMANCE).toInt())
|
||||
{
|
||||
case 0:
|
||||
performance = low;
|
||||
break;
|
||||
case 1:
|
||||
performance = medium;
|
||||
break;
|
||||
case 2:
|
||||
performance = high;
|
||||
break;
|
||||
case 3:
|
||||
performance = ultraHigh;
|
||||
break;
|
||||
}
|
||||
|
||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||
resize(5*imageSize.width(), toolBar->height() + imageSize.height()*1.7);
|
||||
updateSize();
|
||||
|
||||
flow->setPerformance(performance);
|
||||
|
||||
switch (settings->value(FLOW_TYPE_GL).toInt())
|
||||
{
|
||||
case FlowType::CoverFlowLike:
|
||||
flow->setPreset(presetYACReaderFlowClassicConfig);
|
||||
break;
|
||||
case FlowType::Strip:
|
||||
flow->setPreset(presetYACReaderFlowStripeConfig);
|
||||
break;
|
||||
case FlowType::StripOverlapped:
|
||||
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
|
||||
break;
|
||||
case FlowType::Modern:
|
||||
flow->setPreset(defaultYACReaderFlowConfig);
|
||||
break;
|
||||
case FlowType::Roulette:
|
||||
flow->setPreset(pressetYACReaderFlowDownConfig);
|
||||
break;
|
||||
case FlowType::Custom:
|
||||
flow->setCF_RX(settings->value(X_ROTATION).toInt());
|
||||
flow->setCF_Y(settings->value(Y_POSITION).toInt());
|
||||
flow->setX_Distance(settings->value(COVER_DISTANCE).toInt());
|
||||
flow->setCenter_Distance(settings->value(CENTRAL_DISTANCE).toInt());
|
||||
flow->setCF_Z(settings->value(ZOOM_LEVEL).toInt());
|
||||
flow->setY_Distance(settings->value(Y_COVER_OFFSET).toInt());
|
||||
flow->setZ_Distance(settings->value(Z_COVER_OFFSET).toInt());
|
||||
flow->setRotation(settings->value(COVER_ROTATION).toInt());
|
||||
flow->setFadeOutDist(settings->value(FADE_OUT_DIST).toInt());
|
||||
flow->setLightStrenght(settings->value(LIGHT_STRENGTH).toInt());
|
||||
flow->setMaxAngle(settings->value(MAX_ANGLE).toInt());
|
||||
break;
|
||||
}
|
||||
if (Configuration::getConfiguration().getQuickNaviMode())
|
||||
flow->setFadeOutDist(20);
|
||||
}
|
||||
|
||||
void GoToFlowGL::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
||||
QApplication::sendEvent(flow,event);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GoToFlowWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void GoToFlowGL::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
|
||||
toolBar->move(0, event->size().height() - toolBar->height());
|
||||
toolBar->setFixedWidth(width());
|
||||
}
|
||||
|
||||
void GoToFlowGL::setFlowRightToLeft(bool b)
|
||||
{
|
||||
flow->setFlowRightToLeft(b);
|
||||
}
|
40
YACReader/goto_flow_gl.h
Normal file
40
YACReader/goto_flow_gl.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef __GOTO_FLOW_GL_H
|
||||
#define __GOTO_FLOW_GL_H
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "goto_flow_widget.h"
|
||||
#include "yacreader_flow_gl.h"
|
||||
|
||||
class QLineEdit;
|
||||
class QIntValidator;
|
||||
class QPushButton;
|
||||
class QPushButton;
|
||||
class QSize;
|
||||
class QKeyEvent;
|
||||
|
||||
class GoToFlowGL : public GoToFlowWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GoToFlowGL(QWidget* parent = 0,FlowType flowType = CoverFlowLike);
|
||||
~GoToFlowGL();
|
||||
void reset();
|
||||
void centerSlide(int slide);
|
||||
void setFlowType(FlowType flowType);
|
||||
void setNumSlides(unsigned int slides);
|
||||
void setImageReady(int index,const QByteArray & image);
|
||||
|
||||
void updateConfig(QSettings * settings);
|
||||
void setFlowRightToLeft(bool b);
|
||||
|
||||
signals:
|
||||
void goToPage(unsigned int page);
|
||||
private:
|
||||
YACReaderPageFlowGL * flow;
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
//Comic * comic;
|
||||
QSize imageSize;
|
||||
};
|
||||
|
||||
#endif
|
137
YACReader/goto_flow_toolbar.cpp
Normal file
137
YACReader/goto_flow_toolbar.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
#include "goto_flow_toolbar.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "configuration.h"
|
||||
|
||||
GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
|
||||
:QStackedWidget(parent)
|
||||
{
|
||||
//elementos interactivos
|
||||
QWidget * normal = new QWidget(this); // container widget
|
||||
QWidget * quickNavi = new QWidget(this); // container widget
|
||||
addWidget(normal);
|
||||
addWidget(quickNavi);
|
||||
QHBoxLayout * normalLayout = new QHBoxLayout(normal);
|
||||
QHBoxLayout * naviLayout = new QHBoxLayout(quickNavi);
|
||||
normal->setLayout(normalLayout);
|
||||
quickNavi->setLayout(naviLayout);
|
||||
|
||||
slider = new QSlider(Qt::Horizontal,this);
|
||||
slider->setStyleSheet(
|
||||
"QSlider::groove:horizontal {"
|
||||
" border: 1px solid #22FFFFFF;"
|
||||
" border-radius: 1px;"
|
||||
" background: #77000000;"
|
||||
" margin: 2px 0;"
|
||||
" padding: 1px;"
|
||||
"}"
|
||||
"QSlider::handle:horizontal {"
|
||||
" background: #55FFFFFF;"
|
||||
" width: 48px;"
|
||||
" border-radius: 1px;"
|
||||
"}"
|
||||
);
|
||||
|
||||
connect(slider, &QSlider::valueChanged, this, [&](int v) { emit(setCenter(v)); });
|
||||
|
||||
pageHint = new QLabel("<b>" + tr("Page : ") + "</b>",this);
|
||||
v = new QIntValidator(this);
|
||||
v->setBottom(1);
|
||||
edit = new QLineEdit(this);
|
||||
edit->setValidator(v);
|
||||
edit->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
edit->setStyleSheet("QLineEdit {border: 1px solid #77000000; background: #55000000; color: white; padding: 3px 5px 5px 5px; margin: 13px 5px 12px 5px; font-weight:bold}");
|
||||
QPixmap p(":/images/imgEdit.png");
|
||||
edit->setFixedSize(54,50);
|
||||
edit->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||
//edit->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
||||
//edit->resize(QSize(54,50));
|
||||
edit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
|
||||
//edit->setAutoFillBackground(false);
|
||||
connect(edit,SIGNAL(returnPressed()),this,SLOT(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->setStyleSheet(centerButtonCSS);
|
||||
centerButton->setFixedSize(26,50);
|
||||
centerButton->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
||||
connect(centerButton,SIGNAL(clicked()),this,SLOT(centerSlide()));
|
||||
|
||||
QString goToButtonCSS = "QPushButton {background-image: url(:/images/imgGoToSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
|
||||
"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->setStyleSheet(goToButtonCSS);
|
||||
goToButton->setFixedSize(32,50);
|
||||
goToButton->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
||||
|
||||
connect(goToButton,SIGNAL(clicked()),this,SLOT(goTo()));
|
||||
|
||||
normalLayout->setMargin(0);
|
||||
normalLayout->setSpacing(0);
|
||||
normalLayout->addStretch();
|
||||
normalLayout->addWidget(pageHint);
|
||||
normalLayout->addWidget(edit);
|
||||
normalLayout->addWidget(centerButton);
|
||||
normalLayout->addWidget(goToButton);
|
||||
normalLayout->addStretch();
|
||||
|
||||
naviLayout->setContentsMargins(5, 0, 0, 0);
|
||||
naviLayout->setSpacing(2);
|
||||
naviLayout->addWidget(slider);
|
||||
naviLayout->addWidget(goToButton);
|
||||
|
||||
updateOptions();
|
||||
|
||||
setFixedHeight(50);
|
||||
}
|
||||
|
||||
void GoToFlowToolBar::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
#ifdef YACREADER_LEGACY_FLOW_GL
|
||||
painter.fillRect(0,0,width(),height(),QColor("#FF000000"));
|
||||
#else
|
||||
painter.fillRect(0,0,width(),height(),QColor("#99000000"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void GoToFlowToolBar::setPage(int pageNumber)
|
||||
{
|
||||
edit->setText(QString::number(pageNumber+1));
|
||||
slider->setValue(pageNumber);
|
||||
}
|
||||
|
||||
void GoToFlowToolBar::setTop(int numPages)
|
||||
{
|
||||
v->setTop(numPages);
|
||||
slider->setMaximum(numPages-1); // min is 0
|
||||
}
|
||||
|
||||
void GoToFlowToolBar::goTo()
|
||||
{
|
||||
if(edit->text().toInt()!=0)
|
||||
emit(goTo(edit->text().toInt()-1));
|
||||
}
|
||||
|
||||
void GoToFlowToolBar::centerSlide()
|
||||
{
|
||||
if(edit->text().toInt()!=0)
|
||||
emit(setCenter(edit->text().toInt()-1));
|
||||
}
|
||||
|
||||
void GoToFlowToolBar::updateOptions()
|
||||
{
|
||||
if (Configuration::getConfiguration().getQuickNaviMode())
|
||||
setCurrentIndex(1);
|
||||
else
|
||||
setCurrentIndex(0);
|
||||
|
||||
slider->setInvertedAppearance(Configuration::getConfiguration().getDoubleMangaPage());
|
||||
}
|
40
YACReader/goto_flow_toolbar.h
Normal file
40
YACReader/goto_flow_toolbar.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef GOTO_FLOW_TOOLBAR_H
|
||||
#define GOTO_FLOW_TOOLBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStackedWidget>
|
||||
|
||||
class QLineEdit;
|
||||
class QIntValidator;
|
||||
class QPushButton;
|
||||
class QSlider;
|
||||
class QLabel;
|
||||
|
||||
class GoToFlowToolBar : public QStackedWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QLineEdit * edit;
|
||||
QSlider * slider;
|
||||
QIntValidator * v;
|
||||
QPushButton * centerButton;
|
||||
QPushButton * goToButton;
|
||||
QLabel * pageHint;
|
||||
QWidget * bar;
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
public:
|
||||
GoToFlowToolBar(QWidget * parent = 0);
|
||||
|
||||
public slots:
|
||||
void setPage(int pageNumber);
|
||||
void setTop(int numPages);
|
||||
void goTo();
|
||||
void centerSlide();
|
||||
void updateOptions();
|
||||
signals:
|
||||
void setCenter(unsigned int);
|
||||
void goTo(unsigned int);
|
||||
};
|
||||
|
||||
#endif
|
81
YACReader/goto_flow_widget.cpp
Normal file
81
YACReader/goto_flow_widget.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include "goto_flow_widget.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QHBoxLayout>
|
||||
#include <QKeyEvent>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "goto_flow_toolbar.h"
|
||||
#include "configuration.h"
|
||||
|
||||
GoToFlowWidget::GoToFlowWidget(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
mainLayout = new QVBoxLayout;
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setSpacing(0);
|
||||
|
||||
toolBar = new GoToFlowToolBar(this);
|
||||
|
||||
setLayout(mainLayout);
|
||||
|
||||
//toolBar->installEventFilter(this);
|
||||
}
|
||||
|
||||
GoToFlowWidget::~GoToFlowWidget() {
|
||||
delete toolBar;
|
||||
delete mainLayout;
|
||||
}
|
||||
|
||||
void GoToFlowWidget::setPageNumber(int page)
|
||||
{
|
||||
toolBar->setPage(page);
|
||||
}
|
||||
|
||||
void GoToFlowWidget::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Return: case Qt::Key_Enter:
|
||||
toolBar->goTo();
|
||||
toolBar->centerSlide();
|
||||
break;
|
||||
case Qt::Key_Space:
|
||||
toolBar->centerSlide();
|
||||
break;
|
||||
case Qt::Key_S:
|
||||
QCoreApplication::sendEvent(this->parent(),event);
|
||||
break;
|
||||
}
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void GoToFlowWidget::updateConfig(QSettings * settings)
|
||||
{
|
||||
Q_UNUSED(settings)
|
||||
toolBar->updateOptions();
|
||||
}
|
||||
|
||||
void GoToFlowWidget::updateSize()
|
||||
{
|
||||
// called by parent in resizeEvent
|
||||
// no need to update width when QuickNaviMode disabled
|
||||
// height is set in updateConfig
|
||||
if (Configuration::getConfiguration().getQuickNaviMode() && parentWidget() != nullptr)
|
||||
resize(parentWidget()->width(),height());
|
||||
}
|
||||
|
||||
/*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);
|
||||
}*/
|
40
YACReader/goto_flow_widget.h
Normal file
40
YACReader/goto_flow_widget.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef __GOTO_FLOW_WIDGET_H
|
||||
#define __GOTO_FLOW_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSettings>
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
using namespace YACReader;
|
||||
|
||||
class QSettings;
|
||||
class GoToFlowToolBar;
|
||||
class QVBoxLayout;
|
||||
|
||||
class GoToFlowWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
QVBoxLayout * mainLayout;
|
||||
GoToFlowToolBar * toolBar;
|
||||
public:
|
||||
GoToFlowWidget(QWidget * paret = 0);
|
||||
virtual ~GoToFlowWidget() = 0;
|
||||
public slots:
|
||||
virtual void reset() = 0;
|
||||
virtual void centerSlide(int slide) = 0;
|
||||
virtual void setPageNumber(int page);
|
||||
virtual void setFlowType(FlowType flowType) = 0;
|
||||
virtual void setNumSlides(unsigned int slides) = 0;
|
||||
virtual void setImageReady(int index,const QByteArray & image) = 0;
|
||||
virtual void updateSize();
|
||||
virtual void updateConfig(QSettings * settings);
|
||||
virtual void setFlowRightToLeft(bool b) = 0;
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
//bool eventFilter(QObject *, QEvent *);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
BIN
YACReader/icon.ico
Normal file
BIN
YACReader/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 153 KiB |
1
YACReader/icon.rc
Normal file
1
YACReader/icon.rc
Normal file
@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "icon.ico"
|
292
YACReader/magnifying_glass.cpp
Normal file
292
YACReader/magnifying_glass.cpp
Normal file
@ -0,0 +1,292 @@
|
||||
#include "magnifying_glass.h"
|
||||
#include "viewer.h"
|
||||
#include "configuration.h"
|
||||
#include "shortcuts_manager.h"
|
||||
|
||||
#include <QScrollBar>
|
||||
|
||||
MagnifyingGlass::MagnifyingGlass(int w, int h, QWidget * parent)
|
||||
:QLabel(parent),zoomLevel(0.5)
|
||||
{
|
||||
setup(QSize(w,h));
|
||||
}
|
||||
|
||||
MagnifyingGlass::MagnifyingGlass(const QSize & size, QWidget * parent)
|
||||
:QLabel(parent),zoomLevel(0.5)
|
||||
{
|
||||
setup(size);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::setup(const QSize & size)
|
||||
{
|
||||
resize(size);
|
||||
setScaledContents(true);
|
||||
setMouseTracking(true);
|
||||
setCursor(QCursor(QBitmap(1,1),QBitmap(1,1)));
|
||||
}
|
||||
|
||||
void MagnifyingGlass::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
updateImage();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void MagnifyingGlass::updateImage(int x, int y)
|
||||
{
|
||||
//image section augmented
|
||||
int zoomWidth = static_cast<int>(width() * zoomLevel);
|
||||
int zoomHeight = static_cast<int>(height() * zoomLevel);
|
||||
Viewer * p = (Viewer *)parent();
|
||||
int currentPos = p->verticalScrollBar()->sliderPosition();
|
||||
const QPixmap * image = p->pixmap();
|
||||
int iWidth = image->width();
|
||||
int iHeight = image->height();
|
||||
float wFactor = static_cast<float>(iWidth) / p->widget()->width();
|
||||
float hFactor = static_cast<float>(iHeight) / p->widget()->height();
|
||||
zoomWidth *= wFactor;
|
||||
zoomHeight *= hFactor;
|
||||
if(p->verticalScrollBar()->minimum()==p->verticalScrollBar()->maximum())
|
||||
{
|
||||
int xp = static_cast<int>(((x-p->widget()->pos().x())*wFactor)-zoomWidth/2);
|
||||
int yp = static_cast<int>((y-p->widget()->pos().y()+currentPos)*hFactor-zoomHeight/2);
|
||||
int xOffset=0;
|
||||
int yOffset=0;
|
||||
int zw=zoomWidth;
|
||||
int zh=zoomHeight;
|
||||
//int wOffset,hOffset=0;
|
||||
bool outImage = false;
|
||||
if(xp<0)
|
||||
{
|
||||
xOffset = -xp;
|
||||
xp=0;
|
||||
zw = zw - xOffset;
|
||||
outImage = true;
|
||||
}
|
||||
if(yp<0)
|
||||
{
|
||||
yOffset = -yp;
|
||||
yp=0;
|
||||
zh = zh - yOffset;
|
||||
outImage = true;
|
||||
}
|
||||
|
||||
if(xp+zoomWidth >= image->width())
|
||||
{
|
||||
zw -= xp+zw - image->width();
|
||||
outImage = true;
|
||||
}
|
||||
if(yp+zoomHeight >= image->height())
|
||||
{
|
||||
zh -= yp+zh - image->height();
|
||||
outImage = true;
|
||||
}
|
||||
if(outImage)
|
||||
{
|
||||
QImage img(zoomWidth,zoomHeight,QImage::Format_RGB32);
|
||||
img.fill(Configuration::getConfiguration().getBackgroundColor());
|
||||
if(zw>0&&zh>0)
|
||||
{
|
||||
QPainter painter(&img);
|
||||
painter.drawPixmap(xOffset,yOffset,p->pixmap()->copy(xp,yp,zw,zh));
|
||||
}
|
||||
setPixmap(QPixmap().fromImage(img));
|
||||
}
|
||||
else
|
||||
setPixmap(p->pixmap()->copy(xp,yp,zoomWidth,zoomHeight));
|
||||
}
|
||||
else
|
||||
{
|
||||
int xp = static_cast<int>(((x-p->widget()->pos().x())*wFactor)-zoomWidth/2);
|
||||
int yp = static_cast<int>((y+currentPos)*hFactor-zoomHeight/2);
|
||||
int xOffset=0;
|
||||
int yOffset=0;
|
||||
int zw=zoomWidth;
|
||||
int zh=zoomHeight;
|
||||
//int wOffset,hOffset=0;
|
||||
bool outImage = false;
|
||||
if(xp<0)
|
||||
{
|
||||
xOffset = -xp;
|
||||
xp=0;
|
||||
zw = zw - xOffset;
|
||||
outImage = true;
|
||||
}
|
||||
if(yp<0)
|
||||
{
|
||||
yOffset = -yp;
|
||||
yp=0;
|
||||
zh = zh - yOffset;
|
||||
outImage = true;
|
||||
}
|
||||
|
||||
if(xp+zoomWidth >= image->width())
|
||||
{
|
||||
zw -= xp+zw - image->width();
|
||||
outImage = true;
|
||||
}
|
||||
if(yp+zoomHeight >= image->height())
|
||||
{
|
||||
zh -= yp+zh - image->height();
|
||||
outImage = true;
|
||||
}
|
||||
if(outImage)
|
||||
{
|
||||
QImage img(zoomWidth,zoomHeight,QImage::Format_RGB32);
|
||||
img.fill(Configuration::getConfiguration().getBackgroundColor());
|
||||
if(zw>0&&zh>0)
|
||||
{
|
||||
QPainter painter(&img);
|
||||
painter.drawPixmap(xOffset,yOffset,p->pixmap()->copy(xp,yp,zw,zh));
|
||||
}
|
||||
setPixmap(QPixmap().fromImage(img));
|
||||
}
|
||||
else
|
||||
setPixmap(p->pixmap()->copy(xp,yp,zoomWidth,zoomHeight));
|
||||
}
|
||||
move(static_cast<int>(x-float(width())/2),static_cast<int>(y-float(height())/2));
|
||||
}
|
||||
|
||||
void MagnifyingGlass::updateImage()
|
||||
{
|
||||
if(isVisible())
|
||||
{
|
||||
QPoint p = QPoint(cursor().pos().x(),cursor().pos().y());
|
||||
p = this->parentWidget()->mapFromGlobal(p);
|
||||
updateImage(p.x(),p.y());
|
||||
}
|
||||
}
|
||||
void MagnifyingGlass::wheelEvent(QWheelEvent * event)
|
||||
{
|
||||
switch(event->modifiers())
|
||||
{
|
||||
//size
|
||||
case Qt::NoModifier:
|
||||
if(event->delta()<0)
|
||||
sizeUp();
|
||||
else
|
||||
sizeDown();
|
||||
break;
|
||||
//size height
|
||||
case Qt::ControlModifier:
|
||||
if(event->delta()<0)
|
||||
heightUp();
|
||||
else
|
||||
heightDown();
|
||||
break;
|
||||
//size width
|
||||
case Qt::AltModifier:
|
||||
if(event->delta()<0)
|
||||
widthUp();
|
||||
else
|
||||
widthDown();
|
||||
break;
|
||||
//zoom level
|
||||
case Qt::ShiftModifier:
|
||||
if(event->delta()<0)
|
||||
zoomIn();
|
||||
else
|
||||
zoomOut();
|
||||
break;
|
||||
}
|
||||
updateImage();
|
||||
event->setAccepted(true);
|
||||
}
|
||||
void MagnifyingGlass::zoomIn()
|
||||
{
|
||||
if(zoomLevel>0.2f)
|
||||
zoomLevel -= 0.025f;
|
||||
}
|
||||
|
||||
void MagnifyingGlass::zoomOut()
|
||||
{
|
||||
if(zoomLevel<0.9f)
|
||||
zoomLevel += 0.025f;
|
||||
}
|
||||
|
||||
void MagnifyingGlass::sizeUp()
|
||||
{
|
||||
Viewer * p = (Viewer *)parent();
|
||||
if(width()<(p->width()*0.90f))
|
||||
resize(width()+30,height()+15);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::sizeDown()
|
||||
{
|
||||
if(width()>175)
|
||||
resize(width()-30,height()-15);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::heightUp()
|
||||
{
|
||||
Viewer * p = (Viewer *)parent();
|
||||
if(height()<(p->height()*0.90f))
|
||||
resize(width(),height()+15);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::heightDown()
|
||||
{
|
||||
if(height()>80)
|
||||
resize(width(),height()-15);
|
||||
}
|
||||
|
||||
void MagnifyingGlass::widthUp()
|
||||
{
|
||||
Viewer * p = (Viewer *)parent();
|
||||
if(width()<(p->width()*0.90f))
|
||||
resize(width()+30,height());
|
||||
}
|
||||
|
||||
void MagnifyingGlass::widthDown()
|
||||
{
|
||||
if(width()>175)
|
||||
resize(width()-30,height());
|
||||
}
|
||||
|
||||
void MagnifyingGlass::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
bool validKey = false;
|
||||
|
||||
int _key = event->key();
|
||||
Qt::KeyboardModifiers modifiers = event->modifiers();
|
||||
|
||||
if(modifiers & Qt::ShiftModifier)
|
||||
_key |= Qt::SHIFT;
|
||||
if (modifiers & Qt::ControlModifier)
|
||||
_key |= Qt::CTRL;
|
||||
if (modifiers & Qt::MetaModifier)
|
||||
_key |= Qt::META;
|
||||
if (modifiers & Qt::AltModifier)
|
||||
_key |= Qt::ALT;
|
||||
|
||||
QKeySequence key(_key);
|
||||
|
||||
if (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y))
|
||||
{
|
||||
sizeUp();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_DOWN_MGLASS_ACTION_Y))
|
||||
{
|
||||
sizeDown();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_IN_MGLASS_ACTION_Y))
|
||||
{
|
||||
zoomIn();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_OUT_MGLASS_ACTION_Y))
|
||||
{
|
||||
zoomOut();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
if(validKey)
|
||||
{
|
||||
updateImage();
|
||||
event->setAccepted(true);
|
||||
}
|
||||
}
|
34
YACReader/magnifying_glass.h
Normal file
34
YACReader/magnifying_glass.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef __MAGNIFYING_GLASS
|
||||
#define __MAGNIFYING_GLASS
|
||||
|
||||
#include <QLabel>
|
||||
#include <QtGui>
|
||||
#include <QMouseEvent>
|
||||
#include <QWidget>
|
||||
|
||||
class MagnifyingGlass : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
float zoomLevel;
|
||||
void setup(const QSize & size);
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
public:
|
||||
MagnifyingGlass(int width,int height,QWidget * parent);
|
||||
MagnifyingGlass(const QSize & size, QWidget * parent);
|
||||
void mouseMoveEvent(QMouseEvent * event);
|
||||
public slots:
|
||||
void updateImage(int x, int y);
|
||||
void updateImage();
|
||||
void wheelEvent(QWheelEvent * event);
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void sizeUp();
|
||||
void sizeDown();
|
||||
void heightUp();
|
||||
void heightDown();
|
||||
void widthUp();
|
||||
void widthDown();
|
||||
};
|
||||
|
||||
#endif
|
183
YACReader/main.cpp
Normal file
183
YACReader/main.cpp
Normal file
@ -0,0 +1,183 @@
|
||||
#include <QApplication>
|
||||
#include <QPixmap>
|
||||
#include <QLabel>
|
||||
//#include <QMetaObject>
|
||||
#include <QPushButton>
|
||||
#include <QMainWindow>
|
||||
#include <QtCore>
|
||||
#include <QThread>
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include <QTranslator>
|
||||
#include <QSysInfo>
|
||||
#include "main_window_viewer.h"
|
||||
#include "configuration.h"
|
||||
#include "exit_check.h"
|
||||
|
||||
#include "QsLog.h"
|
||||
#include "QsLogDest.h"
|
||||
|
||||
using namespace QsLogging;
|
||||
|
||||
#if defined(WIN32) && defined(_DEBUG)
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ )
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include <QEvent>
|
||||
class YACReaderApplication: public QApplication
|
||||
{
|
||||
public:
|
||||
YACReaderApplication(int & argc, char ** argv) : QApplication(argc,argv)
|
||||
{}
|
||||
|
||||
void setWindow(MainWindowViewer * w)
|
||||
{
|
||||
window = w;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool event(QEvent * event)
|
||||
{
|
||||
switch(event->type())
|
||||
{
|
||||
case QEvent::FileOpen:
|
||||
window->openComicFromPath(static_cast<QFileOpenEvent *>(event)->file());
|
||||
return true;
|
||||
default:
|
||||
return QApplication::event(event);
|
||||
}
|
||||
}
|
||||
private:
|
||||
MainWindowViewer * window;
|
||||
};
|
||||
#endif
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
|
||||
#endif
|
||||
|
||||
//fix for misplaced text in Qt4.8 and Mavericks
|
||||
#ifdef Q_OS_MAC
|
||||
#if QT_VERSION < 0x050000
|
||||
if(QSysInfo::MacintoshVersion > QSysInfo::MV_10_8)
|
||||
QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
YACReaderApplication app(argc,argv);
|
||||
#else
|
||||
QApplication app(argc, argv);
|
||||
#endif
|
||||
|
||||
#ifdef FORCE_ANGLE
|
||||
app.setAttribute(Qt::AA_UseOpenGLES);
|
||||
#endif
|
||||
|
||||
app.setApplicationName("YACReader");
|
||||
app.setOrganizationName("YACReader");
|
||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
//simple command line parser
|
||||
//will be replaced by QCommandLineParser in the future
|
||||
QStringList optlist;
|
||||
QStringList arglist;
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
//extract options and arguments
|
||||
optlist = QCoreApplication::arguments().filter(QRegExp ("^-{1,2}")); //options starting with "-"
|
||||
arglist = QCoreApplication::arguments().filter(QRegExp ("^(?!-{1,2})")); //positional arguments
|
||||
//deal with standard options
|
||||
if (!optlist.isEmpty())
|
||||
{
|
||||
QTextStream parser(stdout);
|
||||
if (optlist.contains("--version") || optlist.contains("-v"))
|
||||
{
|
||||
parser << app.applicationName() << " " << QString(VERSION) << endl << "Copyright 2014 by Luis Angel San Martin Rodriguez" << endl;
|
||||
return 0;
|
||||
}
|
||||
if (optlist.contains("--help") || optlist.contains("-h"))
|
||||
{
|
||||
parser << endl << "Usage: YACReader [File|Directory|Option]" << endl << endl;
|
||||
parser << "Options:" << endl;
|
||||
parser << " -h, --help\t\tDisplay this text and exit." << endl;
|
||||
parser << " -v, --version\t\tDisplay version information and exit." << endl << endl;
|
||||
parser << "Arguments:" << endl;
|
||||
parser << " file\t\t\tOpen comic file." <<endl;
|
||||
parser << " directory\t\tOpen comic directory." << endl << endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString destLog = YACReader::getSettingsPath()+"/yacreader.log";
|
||||
QDir().mkpath(YACReader::getSettingsPath());
|
||||
|
||||
Logger& logger = Logger::instance();
|
||||
logger.setLoggingLevel(QsLogging::InfoLevel);
|
||||
|
||||
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination(
|
||||
destLog, EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
|
||||
DestinationPtr debugDestination(DestinationFactory::MakeDebugOutputDestination());
|
||||
logger.addDestination(debugDestination);
|
||||
logger.addDestination(fileDestination);
|
||||
|
||||
QTranslator translator;
|
||||
QString sufix = QLocale::system().name();
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
translator.load(QString(DATADIR)+"/yacreader/languages/yacreader_"+sufix);
|
||||
#else
|
||||
translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix);
|
||||
#endif
|
||||
app.installTranslator(&translator);
|
||||
MainWindowViewer * mwv = new MainWindowViewer();
|
||||
|
||||
//parser code for comic loading needs to be processed after MainWindowViewer creation
|
||||
//if we have a valid request, open it - if not, load normally
|
||||
if (argc > 1)
|
||||
{
|
||||
if (!optlist.filter("--comicId=").isEmpty() && !optlist.filter("--libraryId=").isEmpty())
|
||||
{
|
||||
if (arglist.count()>1)
|
||||
{
|
||||
mwv->open(arglist.at(1), optlist.filter("--comicId=").at(0).split("=").at(1).toULongLong(), optlist.filter("--libraryId=").at(0).split("=").at(1).toULongLong());
|
||||
}
|
||||
}
|
||||
else if ((arglist.count()>1))
|
||||
{
|
||||
//open first positional argument, silently ignore all following positional arguments
|
||||
mwv->openComicFromPath(arglist.at(1));
|
||||
}
|
||||
}
|
||||
#ifdef Q_OS_MAC
|
||||
app.setWindow(mwv);
|
||||
#endif
|
||||
mwv->show();
|
||||
|
||||
int ret = app.exec();
|
||||
|
||||
delete mwv;
|
||||
|
||||
//Configuration::getConfiguration().save();
|
||||
|
||||
YACReader::exitCheck(ret);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// ugly workaround to avoid crash when app exit on MacOS Sierra due to Qt's QColorDialog bug.
|
||||
// cf. https://bugreports.qt.io/browse/QTBUG-56448
|
||||
QColorDialog colorDlg(0);
|
||||
colorDlg.setOption(QColorDialog::NoButtons);
|
||||
colorDlg.setCurrentColor(Qt::white);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
1692
YACReader/main_window_viewer.cpp
Normal file
1692
YACReader/main_window_viewer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
187
YACReader/main_window_viewer.h
Normal file
187
YACReader/main_window_viewer.h
Normal file
@ -0,0 +1,187 @@
|
||||
#ifndef __MAIN_WINDOW_VIEWER_H
|
||||
#define __MAIN_WINDOW_VIEWER_H
|
||||
#include <QMainWindow>
|
||||
#include <QScrollArea>
|
||||
#include <QToolBar>
|
||||
#include <QAction>
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QCloseEvent>
|
||||
#include <QSettings>
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include "yacreader_macosx_toolbar.h"
|
||||
#endif
|
||||
|
||||
#include "comic_db.h"
|
||||
|
||||
class Comic;
|
||||
class Viewer;
|
||||
class OptionsDialog;
|
||||
class HelpAboutDialog;
|
||||
class HttpVersionChecker;
|
||||
class ShortcutsDialog;
|
||||
class YACReaderSliderAction;
|
||||
class YACReaderSlider;
|
||||
class EditShortcutsDialog;
|
||||
|
||||
class MainWindowViewer : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
void open();
|
||||
void open(QString path, ComicDB & comic, QList<ComicDB> & siblings);
|
||||
void open(QString path, qint64 comicId, qint64 libraryId);
|
||||
void openFolder();
|
||||
void openRecent();
|
||||
void openLatestComic();
|
||||
void openComicFromRecentAction(QAction *action);
|
||||
void saveImage();
|
||||
void toggleToolBars();
|
||||
void hideToolBars();
|
||||
void showToolBars();
|
||||
void enableActions();
|
||||
void disableActions();
|
||||
void toggleFullScreen();
|
||||
void toFullScreen();
|
||||
void toNormal();
|
||||
void loadConfiguration();
|
||||
void newVersion();
|
||||
void openPreviousComic();
|
||||
void openNextComic();
|
||||
void openComicFromPath(QString pathFile);
|
||||
void openSiblingComic(QString pathFile);
|
||||
void openComic(QString pathFile);
|
||||
void openFolderFromPath(QString pathDir);
|
||||
void openFolderFromPath(QString pathFile, QString atFileName);
|
||||
void alwaysOnTopSwitch();
|
||||
void adjustToFullSizeSwitch();
|
||||
void fitToPageSwitch();
|
||||
void resetZoomLevel();
|
||||
void increasePageZoomLevel();
|
||||
void decreasePageZoomLevel();
|
||||
void reloadOptions();
|
||||
void fitToWidth();
|
||||
void fitToHeight();
|
||||
void toggleWidthHeight();
|
||||
void checkNewVersion();
|
||||
void processReset();
|
||||
void setUpShortcutsManagement();
|
||||
|
||||
void toggleFitToWidthSlider();
|
||||
|
||||
/*void viewComic();
|
||||
void prev();
|
||||
void next();
|
||||
void updatePage();*/
|
||||
|
||||
|
||||
private:
|
||||
//!State
|
||||
bool fullscreen;
|
||||
bool toolbars;
|
||||
bool alwaysOnTop;
|
||||
bool fromMaximized;
|
||||
|
||||
//QTBUG-41883
|
||||
QSize _size;
|
||||
QPoint _pos;
|
||||
|
||||
QString currentDirectory;
|
||||
QString currentDirectoryImgDest;
|
||||
//!Widgets
|
||||
Viewer * viewer;
|
||||
//GoToDialog * goToDialog;
|
||||
OptionsDialog * optionsDialog;
|
||||
HelpAboutDialog * had;
|
||||
//ShortcutsDialog * shortcutsDialog;
|
||||
EditShortcutsDialog * editShortcutsDialog;
|
||||
|
||||
//! ToolBars
|
||||
#ifdef Q_OS_MAC
|
||||
YACReaderMacOSXToolbar * comicToolBar;
|
||||
#else
|
||||
QToolBar * comicToolBar;
|
||||
#endif
|
||||
|
||||
//! Actions
|
||||
QAction *openAction;
|
||||
QAction *openFolderAction;
|
||||
QAction *openLatestComicAction;
|
||||
QList<QAction*> recentFilesActionList;
|
||||
QAction *clearRecentFilesAction;
|
||||
QAction *saveImageAction;
|
||||
QAction *openPreviousComicAction;
|
||||
QAction *openNextComicAction;
|
||||
QAction *nextAction;
|
||||
QAction *prevAction;
|
||||
QAction *adjustWidthAction;
|
||||
QAction *adjustHeightAction;
|
||||
QAction *goToPageAction;
|
||||
QAction *optionsAction;
|
||||
QAction *helpAboutAction;
|
||||
QAction *showMagnifyingGlassAction;
|
||||
QAction *setBookmarkAction;
|
||||
QAction *showBookmarksAction;
|
||||
QAction *leftRotationAction;
|
||||
QAction *rightRotationAction;
|
||||
QAction *showInfoAction;
|
||||
QAction *closeAction;
|
||||
QAction *doublePageAction;
|
||||
QAction *doubleMangaPageAction;
|
||||
QAction *showShorcutsAction;
|
||||
QAction *showDictionaryAction;
|
||||
QAction *alwaysOnTopAction;
|
||||
QAction *adjustToFullSizeAction;
|
||||
QAction *fitToPageAction;
|
||||
QAction *resetZoomAction;
|
||||
QAction *showZoomSliderlAction;
|
||||
QAction *increasePageZoomAction;
|
||||
QAction *decreasePageZoomAction;
|
||||
QAction *showFlowAction;
|
||||
|
||||
QAction *showEditShortcutsAction;
|
||||
|
||||
YACReaderSlider * zoomSliderAction;
|
||||
|
||||
HttpVersionChecker * versionChecker;
|
||||
QString previousComicPath;
|
||||
QString nextComicPath;
|
||||
//! Método que inicializa el interfaz.
|
||||
void setupUI();
|
||||
void createActions();
|
||||
void createToolBars();
|
||||
void refreshRecentFilesActionList();
|
||||
void clearRecentFiles();
|
||||
void getSiblingComics(QString path,QString currentComic);
|
||||
|
||||
//! Manejadores de evento:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
//void resizeEvent(QResizeEvent * event);
|
||||
void mouseDoubleClickEvent ( QMouseEvent * event );
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
|
||||
QSettings * settings;
|
||||
|
||||
ComicDB currentComicDB;
|
||||
QList<ComicDB> siblingComics;
|
||||
bool isClient;
|
||||
QString startComicPath;
|
||||
quint64 libraryId;
|
||||
|
||||
//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||
Qt::WindowFlags previousWindowFlags;
|
||||
QPoint previousPos;
|
||||
QSize previousSize;
|
||||
signals:
|
||||
void closed();
|
||||
protected:
|
||||
virtual void closeEvent ( QCloseEvent * event );
|
||||
void sendComic();
|
||||
public:
|
||||
MainWindowViewer();
|
||||
~MainWindowViewer();
|
||||
};
|
||||
#endif
|
76
YACReader/notifications_label_widget.cpp
Normal file
76
YACReader/notifications_label_widget.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
#include "notifications_label_widget.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
NotificationsLabelWidget::NotificationsLabelWidget(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(0);
|
||||
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
||||
effect = new QGraphicsOpacityEffect(this);
|
||||
effect->setOpacity(1.0);
|
||||
|
||||
anim = new QPropertyAnimation(effect,"opacity");
|
||||
anim->setDuration(500);
|
||||
anim->setStartValue(1.0);
|
||||
anim->setEndValue(0.0);
|
||||
anim->setEasingCurve(QEasingCurve::InExpo);
|
||||
|
||||
connect(anim,SIGNAL(finished()),this,SLOT(hide()));
|
||||
|
||||
textLabel = new QLabel(this);
|
||||
textLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
|
||||
textLabel->setStyleSheet("QLabel { color : white; font-size:24px; }");
|
||||
textLabel->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
||||
|
||||
textLabel->setFixedSize(200, 120);
|
||||
|
||||
//TODO check if the effects still be broken in OSX yet
|
||||
#ifndef Q_OS_MAC
|
||||
this->setGraphicsEffect(effect);
|
||||
#endif
|
||||
|
||||
layout->addWidget(textLabel);
|
||||
setLayout(layout);
|
||||
|
||||
setFixedSize(200, 120);
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
void NotificationsLabelWidget::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(QRectF(0, 0, width(), height()), 5.0, 5.0);
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.fillPath(path, QColor("#BB000000"));
|
||||
painter.drawPath(path);
|
||||
}
|
||||
|
||||
void NotificationsLabelWidget::flash()
|
||||
{
|
||||
updatePosition();
|
||||
anim->stop();
|
||||
anim->start();
|
||||
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
void NotificationsLabelWidget::setText(const QString & text)
|
||||
{
|
||||
textLabel->setText(text);
|
||||
}
|
||||
|
||||
void NotificationsLabelWidget::updatePosition()
|
||||
{
|
||||
QWidget * parent = dynamic_cast<QWidget *>(this->parent());
|
||||
if(parent == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
move(QPoint((parent->geometry().size().width()-this->width())/2,(parent->geometry().size().height()-this->height())/2));
|
||||
}
|
30
YACReader/notifications_label_widget.h
Normal file
30
YACReader/notifications_label_widget.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef NOTIFICATIONS_LABEL_WIDGET_H
|
||||
#define NOTIFICATIONS_LABEL_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
class QPropertyAnimation;
|
||||
class QGraphicsOpacityEffect;
|
||||
|
||||
class NotificationsLabelWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QLabel * textLabel;
|
||||
QPropertyAnimation * anim;
|
||||
QGraphicsOpacityEffect * effect;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
public:
|
||||
NotificationsLabelWidget(QWidget * parent);
|
||||
|
||||
public slots:
|
||||
void flash();
|
||||
void setText(const QString & text);
|
||||
void updatePosition();
|
||||
};
|
||||
|
||||
#endif
|
324
YACReader/options_dialog.cpp
Normal file
324
YACReader/options_dialog.cpp
Normal file
@ -0,0 +1,324 @@
|
||||
#include "options_dialog.h"
|
||||
#include "configuration.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QFileDialog>
|
||||
#include <QGroupBox>
|
||||
#include <QRadioButton>
|
||||
#include <QTabWidget>
|
||||
#include <QSlider>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QColorDialog>
|
||||
|
||||
#include "yacreader_spin_slider_widget.h"
|
||||
#include "yacreader_flow_config_widget.h"
|
||||
#ifndef NO_OPENGL
|
||||
#include "yacreader_gl_flow_config_widget.h"
|
||||
#endif
|
||||
|
||||
OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
:YACReaderOptionsDialog(parent)
|
||||
{
|
||||
|
||||
QTabWidget * tabWidget = new QTabWidget();
|
||||
|
||||
QVBoxLayout * layout = new QVBoxLayout(this);
|
||||
|
||||
QWidget * pageGeneral = new QWidget();
|
||||
QWidget * pageFlow = new QWidget();
|
||||
QWidget * pageImage = new QWidget();
|
||||
QVBoxLayout * layoutGeneral = new QVBoxLayout();
|
||||
QVBoxLayout * layoutFlow = new QVBoxLayout();
|
||||
QVBoxLayout * layoutImageV = new QVBoxLayout();
|
||||
QGridLayout * layoutImage = new QGridLayout();
|
||||
|
||||
QGroupBox *slideSizeBox = new QGroupBox(tr("\"Go to flow\" size"));
|
||||
//slideSizeLabel = new QLabel(,this);
|
||||
slideSize = new QSlider(this);
|
||||
slideSize->setMinimum(125);
|
||||
slideSize->setMaximum(350);
|
||||
slideSize->setPageStep(5);
|
||||
slideSize->setOrientation(Qt::Horizontal);
|
||||
QHBoxLayout * slideLayout = new QHBoxLayout();
|
||||
slideLayout->addWidget(slideSize);
|
||||
slideSizeBox->setLayout(slideLayout);
|
||||
|
||||
QGroupBox *pathBox = new QGroupBox(tr("My comics path"));
|
||||
|
||||
QHBoxLayout * path = new QHBoxLayout();
|
||||
path->addWidget(pathEdit = new QLineEdit());
|
||||
path->addWidget(pathFindButton = new QPushButton(QIcon(":/images/find_folder.png"),""));
|
||||
pathBox->setLayout(path);
|
||||
|
||||
connect(pathFindButton,SIGNAL(clicked()),this,SLOT(findFolder()));
|
||||
|
||||
//fitToWidthRatioLabel = new QLabel(tr("Page width stretch"),this);
|
||||
/*QGroupBox *fitBox = new QGroupBox(tr("Page width stretch"));
|
||||
fitToWidthRatioS = new QSlider(this);
|
||||
fitToWidthRatioS->setMinimum(50);
|
||||
fitToWidthRatioS->setMaximum(100);
|
||||
fitToWidthRatioS->setPageStep(5);
|
||||
fitToWidthRatioS->setOrientation(Qt::Horizontal);
|
||||
//connect(fitToWidthRatioS,SIGNAL(valueChanged(int)),this,SLOT(fitToWidthRatio(int)));
|
||||
QHBoxLayout * fitLayout = new QHBoxLayout;
|
||||
fitLayout->addWidget(fitToWidthRatioS);
|
||||
fitBox->setLayout(fitLayout);*/
|
||||
|
||||
QHBoxLayout * colorSelection = new QHBoxLayout;
|
||||
backgroundColor = new QLabel();
|
||||
QPalette pal = backgroundColor->palette();
|
||||
pal.setColor(backgroundColor->backgroundRole(), Qt::black);
|
||||
backgroundColor->setPalette(pal);
|
||||
backgroundColor->setAutoFillBackground(true);
|
||||
|
||||
colorDialog = new QColorDialog(Qt::red,this);
|
||||
connect(colorDialog,SIGNAL(colorSelected(QColor)),this,SLOT(updateColor(QColor)));
|
||||
|
||||
QGroupBox *colorBox = new QGroupBox(tr("Background color"));
|
||||
//backgroundColor->setMinimumWidth(100);
|
||||
colorSelection->addWidget(backgroundColor);
|
||||
colorSelection->addWidget(selectBackgroundColorButton = new QPushButton(tr("Choose")));
|
||||
colorSelection->setStretchFactor(backgroundColor,1);
|
||||
colorSelection->setStretchFactor(selectBackgroundColorButton,0);
|
||||
//colorSelection->addStretch();
|
||||
connect(selectBackgroundColorButton, SIGNAL(clicked()), colorDialog, SLOT(show()));
|
||||
colorBox->setLayout(colorSelection);
|
||||
|
||||
brightnessS = new YACReaderSpinSliderWidget(this,true);
|
||||
brightnessS->setRange(0,100);
|
||||
//brightnessS->setText(tr("Brightness"));
|
||||
brightnessS->setTracking(false);
|
||||
connect(brightnessS,SIGNAL(valueChanged(int)),this,SLOT(brightnessChanged(int)));
|
||||
|
||||
contrastS = new YACReaderSpinSliderWidget(this,true);
|
||||
contrastS->setRange(0,250);
|
||||
//contrastS->setText(tr("Contrast"));
|
||||
contrastS->setTracking(false);
|
||||
connect(contrastS,SIGNAL(valueChanged(int)),this,SLOT(contrastChanged(int)));
|
||||
|
||||
gammaS = new YACReaderSpinSliderWidget(this,true);
|
||||
gammaS->setRange(0,250);
|
||||
//gammaS->setText(tr("Gamma"));
|
||||
gammaS->setTracking(false);
|
||||
connect(gammaS,SIGNAL(valueChanged(int)),this,SLOT(gammaChanged(int)));
|
||||
//connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
|
||||
|
||||
quickNavi = new QCheckBox(tr("Quick Navigation Mode"));
|
||||
disableShowOnMouseOver = new QCheckBox(tr("Disable mouse over activation"));
|
||||
|
||||
QHBoxLayout * buttons = new QHBoxLayout();
|
||||
buttons->addStretch();
|
||||
buttons->addWidget(new QLabel(tr("Restart is needed")));
|
||||
buttons->addWidget(accept);
|
||||
buttons->addWidget(cancel);
|
||||
|
||||
layoutGeneral->addWidget(pathBox);
|
||||
layoutGeneral->addWidget(slideSizeBox);
|
||||
//layoutGeneral->addWidget(fitBox);
|
||||
layoutGeneral->addWidget(colorBox);
|
||||
layoutGeneral->addWidget(shortcutsBox);
|
||||
layoutGeneral->addStretch();
|
||||
|
||||
layoutFlow->addWidget(sw);
|
||||
#ifndef NO_OPENGL
|
||||
layoutFlow->addWidget(gl);
|
||||
layoutFlow->addWidget(useGL);
|
||||
#endif
|
||||
layoutFlow->addWidget(quickNavi);
|
||||
layoutFlow->addWidget(disableShowOnMouseOver);
|
||||
layoutFlow->addStretch();
|
||||
|
||||
layoutImage->addWidget(new QLabel(tr("Brightness")),0,0);
|
||||
layoutImage->addWidget(new QLabel(tr("Contrast")),1,0);
|
||||
layoutImage->addWidget(new QLabel(tr("Gamma")),2,0);
|
||||
layoutImage->addWidget(brightnessS,0,1);
|
||||
layoutImage->addWidget(contrastS,1,1);
|
||||
layoutImage->addWidget(gammaS,2,1);
|
||||
QPushButton * pushButton = new QPushButton(tr("Reset"));
|
||||
connect(pushButton,SIGNAL(pressed()),this,SLOT(resetImageConfig()));
|
||||
layoutImage->addWidget(pushButton,3,0);
|
||||
layoutImage->setColumnStretch(1,1);
|
||||
|
||||
|
||||
QGroupBox *imageBox = new QGroupBox(tr("Image options"));
|
||||
imageBox->setLayout(layoutImage);
|
||||
layoutImageV->addWidget(imageBox);
|
||||
layoutImageV->addStretch();
|
||||
|
||||
|
||||
pageGeneral->setLayout(layoutGeneral);
|
||||
pageFlow->setLayout(layoutFlow);
|
||||
pageImage->setLayout(layoutImageV);
|
||||
|
||||
tabWidget->addTab(pageGeneral,tr("General"));
|
||||
tabWidget->addTab(pageFlow,tr("Page Flow"));
|
||||
tabWidget->addTab(pageImage,tr("Image adjustment"));
|
||||
|
||||
layout->addWidget(tabWidget);
|
||||
layout->addLayout(buttons);
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
//disable vSyncCheck
|
||||
#ifndef NO_OPENGL
|
||||
gl->vSyncCheck->hide();
|
||||
#endif
|
||||
//restoreOptions(); //load options
|
||||
//resize(400,0);
|
||||
setModal (true);
|
||||
setWindowTitle(tr("Options"));
|
||||
|
||||
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
}
|
||||
|
||||
void OptionsDialog::findFolder()
|
||||
{
|
||||
QString s = QFileDialog::getExistingDirectory(0,tr("Comics directory"),".");
|
||||
if(!s.isEmpty())
|
||||
{
|
||||
pathEdit->setText(s);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::saveOptions()
|
||||
{
|
||||
|
||||
settings->setValue(GO_TO_FLOW_SIZE,QSize(static_cast<int>(slideSize->sliderPosition()/SLIDE_ASPECT_RATIO),slideSize->sliderPosition()));
|
||||
|
||||
if(sw->radio1->isChecked())
|
||||
settings->setValue(FLOW_TYPE_SW,0);
|
||||
if(sw->radio2->isChecked())
|
||||
settings->setValue(FLOW_TYPE_SW,1);
|
||||
if(sw->radio3->isChecked())
|
||||
settings->setValue(FLOW_TYPE_SW,2);
|
||||
|
||||
settings->setValue(PATH,pathEdit->text());
|
||||
|
||||
settings->setValue(BACKGROUND_COLOR,colorDialog->currentColor());
|
||||
//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());
|
||||
|
||||
YACReaderOptionsDialog::saveOptions();
|
||||
}
|
||||
|
||||
void OptionsDialog::restoreOptions(QSettings * settings)
|
||||
{
|
||||
YACReaderOptionsDialog::restoreOptions(settings);
|
||||
|
||||
slideSize->setSliderPosition(settings->value(GO_TO_FLOW_SIZE).toSize().height());
|
||||
switch(settings->value(FLOW_TYPE_SW).toInt())
|
||||
{
|
||||
case 0:
|
||||
sw->radio1->setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
sw->radio2->setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
sw->radio3->setChecked(true);
|
||||
break;
|
||||
default:
|
||||
sw->radio1->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
pathEdit->setText(settings->value(PATH).toString());
|
||||
|
||||
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
||||
//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());
|
||||
|
||||
brightnessS->setValue(settings->value(BRIGHTNESS,0).toInt());
|
||||
contrastS->setValue(settings->value(CONTRAST,100).toInt());
|
||||
gammaS->setValue(settings->value(GAMMA,100).toInt());
|
||||
}
|
||||
|
||||
|
||||
void OptionsDialog::updateColor(const QColor & color)
|
||||
{
|
||||
QPalette pal = backgroundColor->palette();
|
||||
pal.setColor(backgroundColor->backgroundRole(), color);
|
||||
backgroundColor->setPalette(pal);
|
||||
backgroundColor->setAutoFillBackground(true);
|
||||
colorDialog->setCurrentColor(color);
|
||||
|
||||
settings->setValue(BACKGROUND_COLOR,color);
|
||||
|
||||
emit(changedOptions());
|
||||
}
|
||||
|
||||
/*void OptionsDialog::fitToWidthRatio(int value)
|
||||
{
|
||||
Configuration::getConfiguration().setFitToWidthRatio(value/100.0);
|
||||
emit(fitToWidthRatioChanged(value/100.0));
|
||||
}*/
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
void OptionsDialog::resetImageConfig()
|
||||
{
|
||||
brightnessS->setValue(0);
|
||||
contrastS->setValue(100);
|
||||
gammaS->setValue(100);
|
||||
QSettings settings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||
settings.setValue(BRIGHTNESS,0);
|
||||
settings.setValue(CONTRAST,100);
|
||||
settings.setValue(GAMMA,100);
|
||||
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
|
||||
//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
|
||||
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)));
|
||||
QDialog::show();
|
||||
delete s;
|
||||
}
|
||||
|
||||
void OptionsDialog::setFilters(int brightness, int contrast, int gamma)
|
||||
{
|
||||
if(brightness != -1)
|
||||
brightnessS->setValue(brightness);
|
||||
else
|
||||
brightnessS->setValue(0);
|
||||
if(contrast != -1)
|
||||
contrastS->setValue(contrast);
|
||||
else
|
||||
contrastS->setValue(100);
|
||||
if(gamma != -1)
|
||||
gammaS->setValue(gamma);
|
||||
else
|
||||
gammaS->setValue(100);
|
||||
|
||||
}
|
72
YACReader/options_dialog.h
Normal file
72
YACReader/options_dialog.h
Normal file
@ -0,0 +1,72 @@
|
||||
#ifndef __OPTIONS_DIALOG_H
|
||||
#define __OPTIONS_DIALOG_H
|
||||
|
||||
#include "yacreader_options_dialog.h"
|
||||
|
||||
class QDialog;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QSlider;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
class QColorDialog;
|
||||
class YACReaderSpinSliderWidget;
|
||||
|
||||
|
||||
class OptionsDialog : public YACReaderOptionsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OptionsDialog(QWidget * parent = 0);
|
||||
private:
|
||||
//QLabel * pathLabel;
|
||||
QLineEdit * pathEdit;
|
||||
QPushButton * pathFindButton;
|
||||
QCheckBox * quickNavi;
|
||||
QCheckBox * disableShowOnMouseOver;
|
||||
|
||||
QLabel * magGlassSizeLabel;
|
||||
|
||||
QLabel * zoomLevel;
|
||||
|
||||
//QLabel * slideSizeLabel;
|
||||
QSlider * slideSize;
|
||||
|
||||
//QLabel * fitToWidthRatioLabel;
|
||||
//QSlider * fitToWidthRatioS;
|
||||
|
||||
QLabel * backgroundColor;
|
||||
QPushButton * selectBackgroundColorButton;
|
||||
|
||||
QColorDialog * colorDialog;
|
||||
|
||||
YACReaderSpinSliderWidget * brightnessS;
|
||||
|
||||
YACReaderSpinSliderWidget * contrastS;
|
||||
|
||||
YACReaderSpinSliderWidget * gammaS;
|
||||
|
||||
public slots:
|
||||
void saveOptions();
|
||||
void restoreOptions(QSettings * settings);
|
||||
void findFolder();
|
||||
void updateColor(const QColor & color);
|
||||
//void fitToWidthRatio(int value);
|
||||
void brightnessChanged(int value);
|
||||
void contrastChanged(int value);
|
||||
void gammaChanged(int value);
|
||||
void resetImageConfig();
|
||||
void show();
|
||||
void setFilters(int brightness, int contrast, int gamma);
|
||||
|
||||
signals:
|
||||
void changedOptions();
|
||||
void changedImageOptions();
|
||||
void changedFilters(int brightness, int contrast, int gamma);
|
||||
//void fitToWidthRatioChanged(float ratio);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
105
YACReader/page_label_widget.cpp
Normal file
105
YACReader/page_label_widget.cpp
Normal file
@ -0,0 +1,105 @@
|
||||
#include "page_label_widget.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
PageLabelWidget::PageLabelWidget(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
animation = new QPropertyAnimation(this,"pos");
|
||||
animation->setDuration(150);
|
||||
animation->setEndValue(QPoint((parent->geometry().size().width()-this->width()),-this->height()));
|
||||
|
||||
int verticalRes = QApplication::desktop()->screenGeometry().height();
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout;
|
||||
layout->setMargin(0);
|
||||
setContentsMargins(0,0,0,0);
|
||||
|
||||
QSize labelSize;
|
||||
if (verticalRes <= 1024)
|
||||
labelSize = QSize(135, 30);
|
||||
else if (verticalRes <= 1200)
|
||||
labelSize = QSize(170, 35);
|
||||
else
|
||||
labelSize = QSize(205, 45);
|
||||
|
||||
textLabel = new QLabel(this);
|
||||
textLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
|
||||
if(verticalRes <= 1024)
|
||||
textLabel->setStyleSheet("QLabel { color : white; font-size:12px; padding-left:8px; }");
|
||||
else if (verticalRes <= 1200)
|
||||
textLabel->setStyleSheet("QLabel { color : white; font-size:16px; padding-left:8px;}");
|
||||
else
|
||||
textLabel->setStyleSheet("QLabel { color : white; font-size:20px; padding-left:8px; }");
|
||||
|
||||
setFixedSize(labelSize);
|
||||
|
||||
if(parent != 0)
|
||||
move(QPoint((parent->geometry().size().width()-this->width()),-this->height()));
|
||||
|
||||
layout->addWidget(textLabel, 0 , Qt::AlignCenter);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void PageLabelWidget::show()
|
||||
{
|
||||
if(this->pos().y() <= 0 && animation->state()!=QPropertyAnimation::Running)
|
||||
{
|
||||
QWidget * parent = dynamic_cast<QWidget *>(this->parent());
|
||||
if(parent == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget::show();
|
||||
//connect(animation,SIGNAL(finished()),this,SLOT(QWidget::hide()));
|
||||
animation->disconnect();
|
||||
|
||||
animation->setStartValue(QPoint((parent->geometry().size().width()-this->width()),-this->height()));
|
||||
animation->setEndValue(QPoint((parent->geometry().size().width()-this->width()),0));
|
||||
animation->start();
|
||||
}
|
||||
}
|
||||
|
||||
void PageLabelWidget::hide()
|
||||
{
|
||||
if(this->pos().y() >= 0 && animation->state()!=QPropertyAnimation::Running)
|
||||
{
|
||||
QWidget * parent = dynamic_cast<QWidget *>(this->parent());
|
||||
if(parent == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//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();
|
||||
}
|
||||
}
|
||||
|
||||
void PageLabelWidget::setText(const QString & text)
|
||||
{
|
||||
textLabel->setText(text);
|
||||
}
|
||||
|
||||
void PageLabelWidget::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
painter.fillRect(0,0,width(),height(),QColor("#BB000000"));
|
||||
}
|
||||
|
||||
void PageLabelWidget::updatePosition()
|
||||
{
|
||||
QWidget * parent = dynamic_cast<QWidget *>(this->parent());
|
||||
if(parent == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
animation->stop();
|
||||
if (animation->endValue().toPoint().y() == 0)
|
||||
move(QPoint((parent->geometry().size().width()-this->width()),0));
|
||||
else
|
||||
move(QPoint((parent->geometry().size().width()-this->width()),-this->height()));
|
||||
}
|
29
YACReader/page_label_widget.h
Normal file
29
YACReader/page_label_widget.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef PAGE_LABEL_WIDGET_H
|
||||
#define PAGE_LABEL_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
class QPropertyAnimation;
|
||||
|
||||
class PageLabelWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QLabel * textLabel;
|
||||
QPropertyAnimation * animation;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *);
|
||||
|
||||
public:
|
||||
PageLabelWidget(QWidget * parent);
|
||||
|
||||
public slots:
|
||||
void show();
|
||||
void hide();
|
||||
void setText(const QString & text);
|
||||
void updatePosition();
|
||||
};
|
||||
|
||||
#endif
|
1196
YACReader/render.cpp
Normal file
1196
YACReader/render.cpp
Normal file
File diff suppressed because it is too large
Load Diff
216
YACReader/render.h
Normal file
216
YACReader/render.h
Normal file
@ -0,0 +1,216 @@
|
||||
#ifndef RENDER_H
|
||||
#define RENDER_H
|
||||
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QThread>
|
||||
#include <QByteArray>
|
||||
#include <QVector>
|
||||
#include "comic.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
// FILTERS
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <QThread>
|
||||
|
||||
class Comic;
|
||||
class ComicDB;
|
||||
class Render;
|
||||
|
||||
class ImageFilter {
|
||||
public:
|
||||
ImageFilter(){};
|
||||
virtual ~ImageFilter() {};
|
||||
virtual QImage setFilter(const QImage & image) = 0;
|
||||
inline int getLevel() {return level;};
|
||||
inline void setLevel(int l) {level = l;};
|
||||
protected:
|
||||
int level;
|
||||
};
|
||||
|
||||
class MeanNoiseReductionFilter : public ImageFilter {
|
||||
public:
|
||||
enum NeighborghoodSize{SMALL=9, LARGE=25 };
|
||||
MeanNoiseReductionFilter(enum NeighborghoodSize ns = SMALL);
|
||||
virtual QImage setFilter(const QImage & image);
|
||||
private:
|
||||
enum NeighborghoodSize neighborghoodSize;
|
||||
};
|
||||
|
||||
class MedianNoiseReductionFilter : public ImageFilter {
|
||||
public:
|
||||
enum NeighborghoodSize{SMALL=9, LARGE=25 };
|
||||
MedianNoiseReductionFilter(enum NeighborghoodSize ns = SMALL);
|
||||
virtual QImage setFilter(const QImage & image);
|
||||
private:
|
||||
enum NeighborghoodSize neighborghoodSize;
|
||||
};
|
||||
|
||||
class BrightnessFilter : public ImageFilter {
|
||||
public:
|
||||
BrightnessFilter(int l=-1);
|
||||
virtual QImage setFilter(const QImage & image);
|
||||
};
|
||||
|
||||
class ContrastFilter : public ImageFilter {
|
||||
public:
|
||||
ContrastFilter(int l=-1);
|
||||
virtual QImage setFilter(const QImage & image);
|
||||
};
|
||||
|
||||
class GammaFilter : public ImageFilter {
|
||||
public:
|
||||
GammaFilter(int l=-1);
|
||||
virtual QImage setFilter(const QImage & image);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// RENDER
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class PageRender : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PageRender();
|
||||
PageRender(Render * render,int numPage, const QByteArray & rawData, QImage * page,unsigned int degrees=0, QVector<ImageFilter *> filters = QVector<ImageFilter *>());
|
||||
int getNumPage(){return numPage;};
|
||||
void setData(const QByteArray & rawData){data = rawData;};
|
||||
void setPage(QImage * p){page = p;};
|
||||
void setRotation(unsigned int d){degrees = d;};
|
||||
void setFilters(QVector<ImageFilter *> f){filters = f;};
|
||||
private:
|
||||
int numPage;
|
||||
QByteArray data;
|
||||
QImage * page;
|
||||
unsigned int degrees;
|
||||
QVector<ImageFilter *> filters;
|
||||
void run();
|
||||
Render * render;
|
||||
signals:
|
||||
void pageReady(int);
|
||||
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// RENDER
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*class DoublePageRender : public PageRender
|
||||
{
|
||||
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 *>());
|
||||
private:
|
||||
int numPage;
|
||||
QByteArray data;
|
||||
QByteArray data2;
|
||||
QImage * page;
|
||||
unsigned int degrees;
|
||||
QVector<ImageFilter *> filters;
|
||||
void run();
|
||||
Render * render;
|
||||
signals:
|
||||
void pageReady(int);
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
class Render : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Render();
|
||||
~Render();
|
||||
|
||||
public slots:
|
||||
void render();
|
||||
QPixmap * getCurrentPage();
|
||||
QPixmap * getCurrentDoublePage();
|
||||
QPixmap * getCurrentDoubleMangaPage();
|
||||
bool currentPageIsDoublePage();
|
||||
bool nextPageIsDoublePage();
|
||||
bool previousPageIsDoublePage();
|
||||
void goTo(int index);
|
||||
void doublePageSwitch();
|
||||
void doubleMangaPageSwitch();
|
||||
void setRotation(int degrees);
|
||||
void setComic(Comic * c);
|
||||
void prepareAvailablePage(int page);
|
||||
void update();
|
||||
void setNumPages(unsigned int numPages);
|
||||
void pageRawDataReady(int page);
|
||||
//--comic interface
|
||||
void nextPage();
|
||||
void previousPage();
|
||||
void nextDoublePage();
|
||||
void previousDoublePage();
|
||||
void load(const QString & path, const ComicDB & comic);
|
||||
void load(const QString & path, int atPage);
|
||||
void createComic(const QString & path);
|
||||
void loadComic(const QString & path,const ComicDB & comic);
|
||||
void loadComic(const QString & path, int atPage);
|
||||
void startLoad();
|
||||
void rotateRight();
|
||||
void rotateLeft();
|
||||
unsigned int getIndex();
|
||||
unsigned int numPages();
|
||||
bool hasLoadedComic();
|
||||
void updateBuffer();
|
||||
void fillBuffer();
|
||||
void invalidate();
|
||||
QString getCurrentPagesInformation();
|
||||
void setBookmark();
|
||||
void removeBookmark();
|
||||
void save();
|
||||
void reset();
|
||||
void reload();
|
||||
void updateFilters(int brightness, int contrast, int gamma);
|
||||
Bookmarks * getBookmarks();
|
||||
//sets the firt page to render
|
||||
void renderAt(int page);
|
||||
|
||||
signals:
|
||||
void currentPageReady();
|
||||
void processingPage();
|
||||
void imagesLoaded();
|
||||
void imageLoaded(int index);
|
||||
void imageLoaded(int index,const QByteArray & image);
|
||||
void pageChanged(int index);
|
||||
void numPages(unsigned int numPages);
|
||||
void errorOpening();
|
||||
void errorOpening(QString);
|
||||
void crcError(QString);
|
||||
void currentPageIsBookmark(bool);
|
||||
void isLast();
|
||||
void isCover();
|
||||
|
||||
void bookmarksUpdated();
|
||||
|
||||
|
||||
private:
|
||||
Comic * comic;
|
||||
bool doublePage;
|
||||
bool doubleMangaPage;
|
||||
int previousIndex;
|
||||
int currentIndex;
|
||||
//QPixmap * currentPage;
|
||||
int currentPageBufferedIndex;
|
||||
int numLeftPages;
|
||||
int numRightPages;
|
||||
QList<PageRender *> pageRenders;
|
||||
QList<QImage *> buffer;
|
||||
void loadAll();
|
||||
void updateRightPages();
|
||||
void updateLeftPages();
|
||||
bool loadedComic;
|
||||
QList<int> pagesEmited;
|
||||
QVector<bool> pagesReady;
|
||||
int imageRotation;
|
||||
QVector<ImageFilter *> filters;
|
||||
QMutex mutex;
|
||||
|
||||
friend class PageRender;
|
||||
};
|
||||
|
||||
|
||||
#endif // RENDER_H
|
55
YACReader/shortcuts_dialog.cpp
Normal file
55
YACReader/shortcuts_dialog.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "shortcuts_dialog.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QTextEdit>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QTextCodec>
|
||||
|
||||
ShortcutsDialog::ShortcutsDialog(QWidget * parent)
|
||||
:QDialog(parent)//,Qt::FramelessWindowHint)
|
||||
{
|
||||
setModal(true);
|
||||
setWindowIcon(QIcon(":/images/shortcuts.png"));
|
||||
setWindowTitle(tr("YACReader keyboard shortcuts"));
|
||||
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout;
|
||||
|
||||
close = new QPushButton(tr("Close"));
|
||||
connect(close,SIGNAL(clicked()),this,SLOT(close()));
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout;
|
||||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(close);
|
||||
|
||||
QHBoxLayout * shortcutsLayout = new QHBoxLayout;
|
||||
|
||||
shortcuts = new QTextEdit();
|
||||
shortcuts->setFrameStyle(QFrame::NoFrame);
|
||||
|
||||
//"<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->setSpacing(0);
|
||||
mainLayout->addLayout(shortcutsLayout);
|
||||
mainLayout->addLayout(bottomLayout);
|
||||
|
||||
setLayout(mainLayout);
|
||||
|
||||
setFixedSize(QSize(700,500));
|
||||
|
||||
QFile f(":/files/shortcuts.html");
|
||||
f.open(QIODevice::ReadOnly);
|
||||
QTextStream txtS(&f);
|
||||
txtS.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
QString content = txtS.readAll();
|
||||
|
||||
f.close();
|
||||
|
||||
shortcuts->setHtml(content);
|
||||
|
||||
setWindowTitle(tr("Keyboard Shortcuts"));
|
||||
}
|
19
YACReader/shortcuts_dialog.h
Normal file
19
YACReader/shortcuts_dialog.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef SHORTCUTS_DIALOG_H
|
||||
#define SHORTCUTS_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
class ShortcutsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShortcutsDialog(QWidget * parent = 0);
|
||||
private:
|
||||
QTextEdit * shortcuts;
|
||||
QPushButton * close;
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // SHORTCUTS_DIALOG_H
|
429
YACReader/translator.cpp
Normal file
429
YACReader/translator.cpp
Normal file
@ -0,0 +1,429 @@
|
||||
#include <QUrl>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QMediaPlayer>
|
||||
#else
|
||||
#include <Phonon/MediaObject>
|
||||
#include <Phonon/MediaSource>
|
||||
#endif
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QPalette>
|
||||
#include <QMouseEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include "translator.h"
|
||||
|
||||
#include "yacreader_busy_widget.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
#include <QTextCodec>
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
#include <QComboBox>
|
||||
#include <QThread>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#define APPID "417CEAD93449502CC3C9B69FED26C54118E62BCC"
|
||||
|
||||
YACReaderTranslator::YACReaderTranslator(QWidget * parent)
|
||||
:QWidget(parent),drag(false)
|
||||
{
|
||||
QString scrollBarStyle = "QScrollBar:vertical { border: none; background: #404040; width: 7px; margin: 0 3px 0 0; }"
|
||||
"QScrollBar::handle:vertical { background: #DDDDDD; width: 7px; min-height: 20px; }"
|
||||
"QScrollBar::add-line:vertical { border: none; background: #404040; height: 10px; subcontrol-position: bottom; subcontrol-origin: margin; margin: 0 3px 0 0;}"
|
||||
|
||||
"QScrollBar::sub-line:vertical { border: none; background: #404040; height: 10px; subcontrol-position: top; subcontrol-origin: margin; margin: 0 3px 0 0;}"
|
||||
"QScrollBar::up-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-up.png') center top no-repeat;}"
|
||||
"QScrollBar::down-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-down.png') center top no-repeat;}"
|
||||
|
||||
"QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }";
|
||||
|
||||
this->setCursor(QCursor(Qt::ArrowCursor));
|
||||
this->setAutoFillBackground(true);
|
||||
this->setBackgroundRole(QPalette::Window);
|
||||
QPalette p(this->palette());
|
||||
p.setColor(QPalette::Window, QColor("#404040"));
|
||||
this->setPalette(p);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
|
||||
//TITLE BAR
|
||||
QHBoxLayout * titleBar = new QHBoxLayout();
|
||||
QPushButton * close = new QPushButton(QIcon(QPixmap(":/images/close.png")),"");
|
||||
close->setFlat(true);
|
||||
QLabel * title = new QLabel(tr("YACReader translator"));
|
||||
title->setStyleSheet("QLabel {font-size:18px; font-family:Arial; color:white;}");
|
||||
titleBar->addWidget(title);
|
||||
titleBar->addStretch();
|
||||
close->resize(14,14);
|
||||
close->setStyleSheet("QPushButton {margin:0;padding:0;border:none;}");
|
||||
titleBar->addWidget(close);
|
||||
titleBar->setContentsMargins(0,0,0,0);
|
||||
titleBar->setSpacing(0);
|
||||
connect(close,SIGNAL(clicked()),this->parent(),SLOT(animateHideTranslator()));
|
||||
|
||||
layout->addLayout(titleBar);
|
||||
|
||||
//INPUT TEXT
|
||||
text = new QTextEdit(this);
|
||||
text->setMinimumHeight(110);
|
||||
text->setMaximumHeight(110);
|
||||
layout->addSpacing(12);
|
||||
layout->addWidget(text);
|
||||
text->setStyleSheet("QTextEdit{border:none;background:#2a2a2a;color:white; font-size:12px; padding:6px;}"+scrollBarStyle);
|
||||
|
||||
//COMBOBOXES
|
||||
QHBoxLayout * combos = new QHBoxLayout();
|
||||
from = new QComboBox(this);
|
||||
to = new QComboBox(this);
|
||||
QString comboBoxStyle = "QComboBox {border:none;background:#2a2a2a;color:white;font-size:12px;font-family:Arial;padding-left:8px;}"
|
||||
"QComboBox::down-arrow {image: url(:/images/dropDownArrow.png);}"
|
||||
"QComboBox::drop-down {border:none; padding-right:10px;}"
|
||||
"QComboBox QAbstractItemView {border: none; background:#272727; color:white; selection-background-color: #202020; outline:none;}"
|
||||
"QComboBox QAbstractItemView::item {padding-left:8px;}" + scrollBarStyle
|
||||
;
|
||||
from->setStyleSheet(comboBoxStyle);
|
||||
to->setStyleSheet(comboBoxStyle);
|
||||
from->setFixedHeight(22);
|
||||
to->setFixedHeight(22);
|
||||
QLabel * arrow = new QLabel(this);
|
||||
QPixmap arrowPixmap(":/images/fromTo.png");
|
||||
arrow->setPixmap(arrowPixmap);
|
||||
QPushButton * searchButton = new QPushButton(this);
|
||||
searchButton->setIcon(QIcon(":/images/translatorSearch.png"));
|
||||
searchButton->setStyleSheet("QPushButton {border:none; background:#2a2a2a;}");
|
||||
searchButton->setFixedSize(22,22);
|
||||
combos->addWidget(from,1);
|
||||
combos->addSpacing(9);
|
||||
combos->addWidget(arrow,0);
|
||||
combos->addSpacing(9);
|
||||
combos->addWidget(to,1);
|
||||
combos->addSpacing(9);
|
||||
combos->addWidget(searchButton,0);
|
||||
layout->addSpacing(12);
|
||||
layout->addLayout(combos);
|
||||
|
||||
|
||||
//RESULTS
|
||||
QHBoxLayout * resultsTitleLayout = new QHBoxLayout();
|
||||
resultsTitle = new QLabel(tr("Translation"));
|
||||
resultsTitle->setStyleSheet("QLabel {font-family:Arial;font-size:14px;color:#e3e3e3;}");
|
||||
speakButton = new QPushButton(this);
|
||||
speakButton->setStyleSheet("QPushButton {border:none;}");
|
||||
speakButton->setIcon(QIcon(":/images/speaker.png"));
|
||||
resultsTitleLayout->addWidget(resultsTitle,0,Qt::AlignVCenter);
|
||||
resultsTitleLayout->addSpacing(10);
|
||||
resultsTitleLayout->addWidget(speakButton,0,Qt::AlignVCenter);
|
||||
resultsTitleLayout->addStretch();
|
||||
|
||||
layout->addSpacing(15);
|
||||
layout->addLayout(resultsTitleLayout);
|
||||
layout->addSpacing(12);
|
||||
|
||||
resultText = new QLabel();
|
||||
resultText->setWordWrap(true);
|
||||
resultText->setStyleSheet("QLabel {color:white;font-size:12px;}");
|
||||
resultText->setText("<EFBFBD>lkas lakj dflkaj lasd jflie lkajd fie kljads ijef lasei afsliej ljse f");
|
||||
layout->addWidget(resultText);
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
//CLEAR BUTTON
|
||||
clearButton = new QPushButton(tr("clear"));
|
||||
layout->addWidget(clearButton,0,Qt::AlignRight);
|
||||
clearButton->setMinimumWidth(95);
|
||||
clearButton->setStyleSheet("QPushButton {border:1px solid #212121; background:#2a2a2a; color:white; font-family:Arial; font-size:12px; padding-top:5px; padding-bottom:5px;}");
|
||||
|
||||
resize(400,479);
|
||||
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(18,12,18,12);
|
||||
setContentsMargins(0,0,0,0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
hideResults();
|
||||
populateCombos();
|
||||
|
||||
busyIndicator = new YACReaderBusyWidget(this);
|
||||
busyIndicator->move((this->width()-busyIndicator->width())/2,(this->height()-busyIndicator->height())*2/3);
|
||||
busyIndicator->hide();
|
||||
|
||||
show();
|
||||
|
||||
connect(searchButton,SIGNAL(pressed()),this,SLOT(translate()));
|
||||
connect(speakButton,SIGNAL(pressed()),this,SLOT(play()));
|
||||
connect(clearButton,SIGNAL(pressed()),this,SLOT(clear()));
|
||||
|
||||
//multimedia/phonon
|
||||
#if QT_VERSION >= 0x050000
|
||||
player = new QMediaPlayer;
|
||||
#else
|
||||
music = createPlayer(MusicCategory);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void YACReaderTranslator::hideResults()
|
||||
{
|
||||
resultsTitle->setHidden(true);
|
||||
speakButton->setHidden(true);
|
||||
resultText->setHidden(true);
|
||||
}
|
||||
|
||||
void YACReaderTranslator::clear()
|
||||
{
|
||||
hideResults();
|
||||
text->clear();
|
||||
}
|
||||
|
||||
void YACReaderTranslator::translate()
|
||||
{
|
||||
QString text = this->text->toPlainText();
|
||||
if(text.isEmpty())
|
||||
return;
|
||||
QString from = this->from->itemData(this->from->currentIndex()).toString();
|
||||
QString to = this->to->itemData(this->to->currentIndex()).toString();
|
||||
|
||||
TranslationLoader * translationLoader = new TranslationLoader(text,from,to);
|
||||
connect(translationLoader,SIGNAL(requestFinished(QString)),this,SLOT(setTranslation(QString)));
|
||||
connect(translationLoader,SIGNAL(error()),this,SLOT(error()));
|
||||
connect(translationLoader,SIGNAL(timeOut()),this,SLOT(error()));
|
||||
connect(translationLoader,SIGNAL(finished()),translationLoader,SLOT(deleteLater()));
|
||||
|
||||
TextToSpeachLoader * tts = new TextToSpeachLoader(text,from);
|
||||
connect(tts,SIGNAL(requestFinished(QUrl)),this,SLOT(setSpeak(QUrl)));
|
||||
connect(tts,SIGNAL(error()),this,SLOT(error()));
|
||||
connect(tts,SIGNAL(timeOut()),this,SLOT(error()));
|
||||
connect(tts,SIGNAL(finished()),tts,SLOT(deleteLater()));
|
||||
|
||||
translationLoader->start();
|
||||
tts->start();
|
||||
|
||||
resultsTitle->setText(tr("Translation"));
|
||||
|
||||
hideResults();
|
||||
|
||||
busyIndicator->show();
|
||||
}
|
||||
|
||||
void YACReaderTranslator::error()
|
||||
{
|
||||
resultsTitle->setText(tr("Service not available"));
|
||||
resultsTitle->setHidden(false);
|
||||
busyIndicator->hide();
|
||||
}
|
||||
|
||||
void YACReaderTranslator::setSpeak(const QUrl & url)
|
||||
{
|
||||
resultsTitle->setHidden(false);
|
||||
speakButton->setHidden(false);
|
||||
|
||||
ttsSource = url;
|
||||
}
|
||||
|
||||
void YACReaderTranslator::setTranslation(const QString & string)
|
||||
{
|
||||
resultText->setText(string);
|
||||
|
||||
resultsTitle->setHidden(false);
|
||||
resultText->setHidden(false);
|
||||
busyIndicator->hide();
|
||||
}
|
||||
|
||||
void YACReaderTranslator::populateCombos()
|
||||
{
|
||||
QList<QComboBox *> combos;
|
||||
combos.append(from);
|
||||
combos.append(to);
|
||||
|
||||
for(int i=0;i<combos.count();i++)
|
||||
{
|
||||
QComboBox * combo = combos.at(i);
|
||||
combo->addItem("Arabic","ar");
|
||||
combo->addItem("Bulgarian","bg");
|
||||
combo->addItem("Catalan","ca");
|
||||
combo->addItem("Chinese Simplified","zh-CHS");
|
||||
combo->addItem("Chinese Traditional","zh-CHT");
|
||||
combo->addItem("Czech","cs");
|
||||
combo->addItem("Danish","da");
|
||||
combo->addItem("Dutch","nl");
|
||||
combo->addItem("English","en");
|
||||
combo->addItem("Estonian","et");
|
||||
combo->addItem("Finnish","fi");
|
||||
combo->addItem("French","fr");
|
||||
combo->addItem("German","de");
|
||||
combo->addItem("Greek","el");
|
||||
combo->addItem("Haitian Creole","ht");
|
||||
combo->addItem("Hebrew","he");
|
||||
combo->addItem("Hindi","hi");
|
||||
combo->addItem("Hungarian","hu");
|
||||
combo->addItem("Indonesian","id");
|
||||
combo->addItem("Italian","it");
|
||||
combo->addItem("Japanese","ja");
|
||||
combo->addItem("Korean","ko");
|
||||
combo->addItem("Latvian","lv");
|
||||
combo->addItem("Lithuanian","lt");
|
||||
combo->addItem("Norwegian","no");
|
||||
combo->addItem("Polish","pl");
|
||||
combo->addItem("Portuguese","pt");
|
||||
combo->addItem("Romanian","ro");
|
||||
combo->addItem("Russian","ru");
|
||||
combo->addItem("Slovak","sk");
|
||||
combo->addItem("Slovenian","sl");
|
||||
combo->addItem("Spanish","es");
|
||||
combo->addItem("Swedish","sv");
|
||||
combo->addItem("Thai","th");
|
||||
combo->addItem("Turkish","tr");
|
||||
combo->addItem("Ukrainian","uk");
|
||||
combo->addItem("Vietnamese","vi");
|
||||
}
|
||||
from->setCurrentIndex(from->findText("English"));
|
||||
to->setCurrentIndex(from->findText("Spanish"));
|
||||
}
|
||||
|
||||
void YACReaderTranslator::play()
|
||||
{
|
||||
//QMessageBox::question(this,"xxx",ttsSource.toString());
|
||||
#if QT_VERSION >= 0x050000
|
||||
|
||||
player->setMedia(ttsSource);
|
||||
player->play();
|
||||
|
||||
#else
|
||||
MediaSource src(ttsSource);
|
||||
src.setAutoDelete(true);
|
||||
music->setCurrentSource(src);
|
||||
music->play();
|
||||
#endif
|
||||
}
|
||||
|
||||
YACReaderTranslator::~YACReaderTranslator()
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
#else
|
||||
delete music;
|
||||
#endif
|
||||
}
|
||||
|
||||
void YACReaderTranslator::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
QPoint p = mapTo(this,event->pos());
|
||||
if(p.y() < 40)
|
||||
{
|
||||
drag = true;
|
||||
click = event->pos();
|
||||
}
|
||||
}
|
||||
|
||||
void YACReaderTranslator::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
drag = false;
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void YACReaderTranslator::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
if(drag)
|
||||
this->move(QPoint(mapToParent(event->pos())-click));
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TranslationLoader::TranslationLoader(QString text, QString from, QString to)
|
||||
:QThread(),text(text),from(from),to(to)
|
||||
{
|
||||
}
|
||||
|
||||
void TranslationLoader::run()
|
||||
{
|
||||
QNetworkAccessManager manager;
|
||||
QEventLoop q;
|
||||
QTimer tT;
|
||||
|
||||
tT.setSingleShot(true);
|
||||
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
|
||||
connect(&manager, SIGNAL(finished(QNetworkReply*)),&q, SLOT(quit()));
|
||||
|
||||
QString url = "http://api.microsofttranslator.com/V2/Ajax.svc/Translate?appid=%1&from=%2&to=%3&text=%4&contentType=text/plain";
|
||||
url = url.arg(APPID).arg(from).arg(to).arg(text);
|
||||
|
||||
QNetworkReply *reply = manager.get(QNetworkRequest(QUrl(url)));
|
||||
|
||||
tT.start(5000); // 5s timeout
|
||||
q.exec();
|
||||
|
||||
if(tT.isActive()){
|
||||
// download complete
|
||||
if(reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QString utf8 = QString::fromUtf8(reply->readAll());
|
||||
utf8 = utf8.remove(0,1);
|
||||
utf8 = utf8.remove(utf8.count()-1,1);
|
||||
|
||||
QString translated(utf8);
|
||||
emit(requestFinished(translated));
|
||||
}
|
||||
else
|
||||
emit(error());
|
||||
} else {
|
||||
emit(timeOut());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
TextToSpeachLoader::TextToSpeachLoader(QString text, QString language)
|
||||
:QThread(),text(text),language(language)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void TextToSpeachLoader::run()
|
||||
{
|
||||
QNetworkAccessManager manager;
|
||||
QEventLoop q;
|
||||
QTimer tT;
|
||||
|
||||
tT.setSingleShot(true);
|
||||
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
|
||||
connect(&manager, SIGNAL(finished(QNetworkReply*)),&q, SLOT(quit()));
|
||||
|
||||
QString url = "http://api.microsofttranslator.com/V2/Ajax.svc/Speak?appid=%1&language=%2&text=%3&contentType=text/plain";
|
||||
url = url.arg(APPID).arg(language).arg(text);
|
||||
|
||||
QNetworkReply *reply = manager.get(QNetworkRequest(QUrl(url)));
|
||||
|
||||
tT.start(5000); // 5s timeout
|
||||
q.exec();
|
||||
|
||||
if(tT.isActive()){
|
||||
// download complete
|
||||
if(reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QString utf8 = QString::fromUtf8(reply->readAll());
|
||||
utf8 = utf8.remove(0,1);
|
||||
utf8 = utf8.remove(utf8.count()-1,1);
|
||||
utf8 = utf8.replace("\\","");
|
||||
|
||||
emit(requestFinished(QUrl(utf8)));
|
||||
}
|
||||
else
|
||||
emit(error());
|
||||
} else {
|
||||
emit(timeOut());
|
||||
}
|
||||
}
|
102
YACReader/translator.h
Normal file
102
YACReader/translator.h
Normal file
@ -0,0 +1,102 @@
|
||||
#ifndef __TRANSLATOR_H
|
||||
#define __TRANSLATOR_H
|
||||
|
||||
class QUrl;
|
||||
class QMouseEvent;
|
||||
class QPoint;
|
||||
class QTextEdit;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class YACReaderBusyWidget;
|
||||
|
||||
#include <QWidget>
|
||||
#include <QThread>
|
||||
#include <QUrl>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
class QMediaPlayer;
|
||||
#else
|
||||
#include<Phonon/MediaObject>
|
||||
using namespace Phonon;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
class YACReaderTranslator : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
YACReaderTranslator(QWidget * parent = 0);
|
||||
~YACReaderTranslator();
|
||||
|
||||
public slots:
|
||||
void play();
|
||||
|
||||
protected slots:
|
||||
void translate();
|
||||
void setSpeak(const QUrl & url);
|
||||
void setTranslation(const QString & string);
|
||||
void error();
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent ( QMouseEvent * event );
|
||||
void hideResults();
|
||||
|
||||
void populateCombos();
|
||||
bool drag;
|
||||
QPoint click;
|
||||
private:
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
QMediaPlayer *player;
|
||||
#else
|
||||
MediaObject * music;
|
||||
#endif
|
||||
|
||||
QTextEdit * text;
|
||||
QComboBox * from;
|
||||
QComboBox * to;
|
||||
QLabel * resultsTitle;
|
||||
QPushButton * speakButton;
|
||||
QLabel * resultText;
|
||||
YACReaderBusyWidget * busyIndicator;
|
||||
QUrl ttsSource;
|
||||
QPushButton * clearButton;
|
||||
|
||||
};
|
||||
|
||||
class TranslationLoader : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TranslationLoader(QString text, QString from, QString to);
|
||||
signals:
|
||||
void requestFinished(QString);
|
||||
void timeOut();
|
||||
void error();
|
||||
private:
|
||||
QString text;
|
||||
QString from;
|
||||
QString to;
|
||||
void run();
|
||||
};
|
||||
|
||||
class TextToSpeachLoader : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextToSpeachLoader(QString text, QString language);
|
||||
signals:
|
||||
void requestFinished(QUrl);
|
||||
void timeOut();
|
||||
void error();
|
||||
private:
|
||||
QString text;
|
||||
QString language;
|
||||
void run();
|
||||
};
|
||||
#endif
|
1222
YACReader/viewer.cpp
Normal file
1222
YACReader/viewer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
189
YACReader/viewer.h
Normal file
189
YACReader/viewer.h
Normal file
@ -0,0 +1,189 @@
|
||||
#ifndef __VIEWER_H
|
||||
#define __VIEWER_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include <QScrollArea>
|
||||
#include <QAction>
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QKeyEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <QWheelEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QCloseEvent>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QParallelAnimationGroup>
|
||||
#include <QSettings>
|
||||
|
||||
#include "scroll_management.h"
|
||||
|
||||
class ComicDB;
|
||||
class Comic;
|
||||
class MagnifyingGlass;
|
||||
class GoToFlow;
|
||||
class BookmarksDialog;
|
||||
class Render;
|
||||
class GoToDialog;
|
||||
class YACReaderTranslator;
|
||||
class GoToFlowWidget;
|
||||
class Bookmarks;
|
||||
class PageLabelWidget;
|
||||
class NotificationsLabelWidget;
|
||||
|
||||
class Viewer : public QScrollArea, public ScrollManagement
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
bool fullscreen; //TODO, change by the right use of windowState();
|
||||
public slots:
|
||||
void increaseZoomFactor();
|
||||
void decreaseZoomFactor();
|
||||
void setZoomFactor(int);
|
||||
int getZoomFactor();
|
||||
|
||||
void prepareForOpening();
|
||||
void open(QString pathFile, int atPage = -1);
|
||||
void open(QString pathFile, const ComicDB & comic);
|
||||
void prev();
|
||||
void next();
|
||||
void showGoToDialog();
|
||||
void goTo(unsigned int page);
|
||||
void updatePage();
|
||||
void updateContentSize();
|
||||
void updateVerticalScrollBar();
|
||||
void updateOptions();
|
||||
void scrollDown();
|
||||
void scrollUp();
|
||||
void scrollForwardHorizontalFirst();
|
||||
void scrollBackwardHorizontalFirst();
|
||||
void scrollForwardVerticalFirst();
|
||||
void scrollBackwardVerticalFirst();
|
||||
void magnifyingGlassSwitch();
|
||||
void showMagnifyingGlass();
|
||||
void hideMagnifyingGlass();
|
||||
void informationSwitch();
|
||||
void updateInformation();
|
||||
void goToFlowSwitch();
|
||||
void showGoToFlow();
|
||||
void moveCursoToGoToFlow();
|
||||
void animateShowGoToFlow();
|
||||
void animateHideGoToFlow();
|
||||
void rotateLeft();
|
||||
void rotateRight();
|
||||
bool magnifyingGlassIsVisible() {return magnifyingGlassShowed;}
|
||||
void setBookmark(bool);
|
||||
void save();
|
||||
void doublePageSwitch();
|
||||
void doubleMangaPageSwitch();
|
||||
void resetContent();
|
||||
void setLoadingMessage();
|
||||
void setPageUnavailableMessage();
|
||||
void configureContent(QString msg);
|
||||
void hideCursor();
|
||||
void showCursor();
|
||||
void createConnections();
|
||||
void translatorSwitch();
|
||||
void animateShowTranslator();
|
||||
void animateHideTranslator();
|
||||
virtual void mousePressEvent ( QMouseEvent * event );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent * event );
|
||||
void updateBackgroundColor(const QColor & color);
|
||||
void updateConfig(QSettings * settings);
|
||||
void showMessageErrorOpening();
|
||||
void showMessageErrorOpening(QString);
|
||||
void processCRCError(QString message);
|
||||
void setBookmarks();
|
||||
//deprecated
|
||||
void updateImageOptions();
|
||||
void updateFilters(int brightness, int contrast,int gamma);
|
||||
void showIsCoverMessage();
|
||||
void showIsLastMessage();
|
||||
int getCurrentPageNumber();
|
||||
void updateZoomRatio(int ratio);
|
||||
|
||||
private:
|
||||
bool information;
|
||||
bool doublePage;
|
||||
bool doubleMangaPage;
|
||||
|
||||
int zoom;
|
||||
|
||||
PageLabelWidget * informationLabel;
|
||||
//QTimer * scroller;
|
||||
QPropertyAnimation * verticalScroller;
|
||||
QPropertyAnimation * horizontalScroller;
|
||||
QParallelAnimationGroup * groupScroller;
|
||||
int posByStep;
|
||||
int nextPos;
|
||||
GoToFlowWidget * goToFlow;
|
||||
QPropertyAnimation * showGoToFlowAnimation;
|
||||
GoToDialog * goToDialog;
|
||||
//!Image properties
|
||||
//! Comic
|
||||
//Comic * comic;
|
||||
int index;
|
||||
QPixmap *currentPage;
|
||||
BookmarksDialog * bd;
|
||||
bool wheelStop;
|
||||
Render * render;
|
||||
QTimer * hideCursorTimer;
|
||||
int direction;
|
||||
bool drag;
|
||||
int numScrollSteps;
|
||||
|
||||
//!Widgets
|
||||
QLabel *content;
|
||||
|
||||
YACReaderTranslator * translator;
|
||||
int translatorXPos;
|
||||
QPropertyAnimation * translatorAnimation;
|
||||
|
||||
int yDragOrigin;
|
||||
int xDragOrigin;
|
||||
|
||||
NotificationsLabelWidget * notificationsLabel;
|
||||
|
||||
bool shouldOpenNext;
|
||||
bool shouldOpenPrevious;
|
||||
|
||||
private:
|
||||
//!Magnifying glass
|
||||
MagnifyingGlass *mglass;
|
||||
bool magnifyingGlassShowed;
|
||||
bool restoreMagnifyingGlass;
|
||||
|
||||
//! Manejadores de evento:
|
||||
void keyPressEvent(QKeyEvent * event);
|
||||
void resizeEvent(QResizeEvent * event);
|
||||
void wheelEvent(QWheelEvent * event);
|
||||
void mouseMoveEvent(QMouseEvent * event);
|
||||
|
||||
//!ZigzagScroll
|
||||
enum scrollDirection{ UP, DOWN, LEFT, RIGHT };
|
||||
bool isEdge(scrollDirection d);
|
||||
void scrollZigzag(scrollDirection d1, scrollDirection d2, bool forward);
|
||||
void scrollTo(int x, int y);
|
||||
|
||||
public:
|
||||
Viewer(QWidget * parent = 0);
|
||||
~Viewer();
|
||||
void toggleFullScreen();
|
||||
const QPixmap * pixmap();
|
||||
//Comic * getComic(){return comic;}
|
||||
const BookmarksDialog * getBookmarksDialog(){return bd;}
|
||||
//returns the current index starting in 1 [1,nPages]
|
||||
unsigned int getIndex();
|
||||
void updateComic(ComicDB & comic);
|
||||
signals:
|
||||
void backgroundChanges();
|
||||
void pageAvailable(bool);
|
||||
void pageIsBookmark(bool);
|
||||
void reset();
|
||||
void openNextComic();
|
||||
void openPreviousComic();
|
||||
void zoomUpdated(int);
|
||||
};
|
||||
|
||||
#endif
|
111
YACReader/width_slider.cpp
Normal file
111
YACReader/width_slider.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
#include "width_slider.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "configuration.h"
|
||||
|
||||
YACReaderSliderAction::YACReaderSliderAction (QWidget * parent)
|
||||
:QWidgetAction (parent) {
|
||||
|
||||
widget = new YACReaderSlider();
|
||||
setDefaultWidget(widget);
|
||||
|
||||
connect(widget,SIGNAL(zoomRatioChanged(int)),this,SIGNAL(zoomRatioChanged(int)));
|
||||
}
|
||||
|
||||
void YACReaderSliderAction::updateText(int value)
|
||||
{
|
||||
widget->updateText(value);
|
||||
}
|
||||
|
||||
void YACReaderSliderAction::updateZoomRatio(int value)
|
||||
{
|
||||
widget->updateZoomRatio(value);
|
||||
}
|
||||
|
||||
YACReaderSlider::YACReaderSlider(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
const int sliderWidth = 200;
|
||||
const int contentsMargin = 10;
|
||||
const int elementsSpacing = 10;
|
||||
const int percentageLabelWidth = 30;
|
||||
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
QHBoxLayout* pLayout = new QHBoxLayout();
|
||||
|
||||
pLayout->addStretch();
|
||||
|
||||
percentageLabel = new QLabel();
|
||||
percentageLabel->setStyleSheet("QLabel { color : white; }");
|
||||
percentageLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
slider = new QSlider();
|
||||
slider->setOrientation(Qt::Horizontal);
|
||||
|
||||
slider->setMinimumWidth(sliderWidth);
|
||||
|
||||
QPushButton *resetButton = new QPushButton(tr("Reset"));
|
||||
resetButton->setStyleSheet("QPushButton {border: 1px solid #BB242424; background: #BB2E2E2E; color:white; padding: 3px 5px 5px 5px;}");
|
||||
connect(resetButton, &QPushButton::clicked, this, &YACReaderSlider::resetValueToDefault);
|
||||
|
||||
pLayout->addWidget(percentageLabel, 1, Qt::AlignHCenter);
|
||||
pLayout->addWidget(slider, 0, Qt::AlignHCenter | Qt::AlignBottom);
|
||||
pLayout->addWidget(resetButton, 1, Qt::AlignHCenter | Qt::AlignBottom);
|
||||
pLayout->setSpacing(elementsSpacing);
|
||||
|
||||
pLayout->setMargin(0);
|
||||
|
||||
setLayout (pLayout);
|
||||
setAutoFillBackground(false);
|
||||
|
||||
setContentsMargins(contentsMargin,contentsMargin,contentsMargin,contentsMargin);
|
||||
setFixedSize(sliderWidth + 2 * contentsMargin + 2 * elementsSpacing + percentageLabelWidth + resetButton->sizeHint().width(), 45);
|
||||
|
||||
slider->setMinimum(30);
|
||||
slider->setMaximum(500);
|
||||
slider->setPageStep(5);
|
||||
|
||||
slider->setFocusPolicy(Qt::NoFocus);
|
||||
resetButton->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
slider->setValue(100);
|
||||
percentageLabel->setText(QString("%1%").arg(100));
|
||||
connect(slider, &QSlider::valueChanged, this, &YACReaderSlider::updateText);
|
||||
}
|
||||
|
||||
void YACReaderSlider::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
painter.fillRect(0,0,width(),height(),QColor("#BB000000"));
|
||||
}
|
||||
|
||||
void YACReaderSlider::show()
|
||||
{
|
||||
QWidget::show();
|
||||
setFocus();
|
||||
}
|
||||
|
||||
void YACReaderSlider::focusOutEvent(QFocusEvent * event)
|
||||
{
|
||||
QWidget::focusOutEvent(event);
|
||||
hide();
|
||||
}
|
||||
|
||||
void YACReaderSlider::updateText(int value)
|
||||
{
|
||||
percentageLabel->setText(QString("%1%").arg(value));
|
||||
emit zoomRatioChanged(value);
|
||||
}
|
||||
|
||||
void YACReaderSlider::updateZoomRatio(int value)
|
||||
{
|
||||
slider->setValue(value);
|
||||
percentageLabel->setText(QString("%1%").arg(value));
|
||||
}
|
||||
|
||||
void YACReaderSlider::resetValueToDefault()
|
||||
{
|
||||
slider->setValue(100);
|
||||
}
|
53
YACReader/width_slider.h
Normal file
53
YACReader/width_slider.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef WIDTH_SLIDER_H
|
||||
#define WIDTH_SLIDER_H
|
||||
|
||||
#include <QWidgetAction>
|
||||
|
||||
class QLabel;
|
||||
class QSlider;
|
||||
|
||||
class YACReaderSlider : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QLabel * percentageLabel;
|
||||
QSlider * slider;
|
||||
|
||||
public:
|
||||
YACReaderSlider (QWidget * parent = 0);
|
||||
void show();
|
||||
|
||||
protected:
|
||||
virtual void focusOutEvent(QFocusEvent * event);
|
||||
virtual void paintEvent(QPaintEvent *);
|
||||
|
||||
public slots:
|
||||
void updateText(int value);
|
||||
void updateZoomRatio(int value);
|
||||
void resetValueToDefault();
|
||||
|
||||
|
||||
signals:
|
||||
void zoomRatioChanged(int value);
|
||||
};
|
||||
|
||||
class YACReaderSliderAction : public QWidgetAction
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
YACReaderSlider * widget;
|
||||
|
||||
public:
|
||||
|
||||
YACReaderSliderAction (QWidget * parent = 0);
|
||||
|
||||
public slots:
|
||||
void updateText(int value);
|
||||
void updateZoomRatio(int value);
|
||||
|
||||
|
||||
signals:
|
||||
void zoomRatioChanged(int value);
|
||||
};
|
||||
|
||||
#endif
|
1053
YACReader/yacreader_de.ts
Normal file
1053
YACReader/yacreader_de.ts
Normal file
File diff suppressed because it is too large
Load Diff
1054
YACReader/yacreader_es.ts
Normal file
1054
YACReader/yacreader_es.ts
Normal file
File diff suppressed because it is too large
Load Diff
12
YACReader/yacreader_files.qrc
Normal file
12
YACReader/yacreader_files.qrc
Normal file
@ -0,0 +1,12 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>../files/about.html</file>
|
||||
<file>../files/helpYACReader.html</file>
|
||||
<file>../files/shortcuts.html</file>
|
||||
</qresource>
|
||||
|
||||
<qresource lang="es_ES">
|
||||
<file alias="/files/about.html">../files/about_es_ES.html</file>
|
||||
<file alias="/files/helpYACReader.html">../files/helpYACReader_es_ES.html</file>
|
||||
</qresource>
|
||||
</RCC>
|
1053
YACReader/yacreader_fr.ts
Normal file
1053
YACReader/yacreader_fr.ts
Normal file
File diff suppressed because it is too large
Load Diff
70
YACReader/yacreader_images.qrc
Normal file
70
YACReader/yacreader_images.qrc
Normal file
@ -0,0 +1,70 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>../images/icon.png</file>
|
||||
<file>../images/goto.png</file>
|
||||
<file>../images/find_folder.png</file>
|
||||
<file>../images/flow1.png</file>
|
||||
<file>../images/flow2.png</file>
|
||||
<file>../images/flow3.png</file>
|
||||
<file>../images/flow4.png</file>
|
||||
<file>../images/flow5.png</file>
|
||||
<file>../images/notCover.png</file>
|
||||
<file>../images/shortcuts.png</file>
|
||||
<file>../images/close.png</file>
|
||||
<file>../images/up.png</file>
|
||||
<file>../images/down.png</file>
|
||||
<file>../images/imgCenterSlide.png</file>
|
||||
<file>../images/imgGoToSlide.png</file>
|
||||
<file>../images/imgCenterSlidePressed.png</file>
|
||||
<file>../images/imgGoToSlidePressed.png</file>
|
||||
|
||||
<file>../images/helpImages/open.png</file>
|
||||
<file>../images/helpImages/openFolder.png</file>
|
||||
<file>../images/helpImages/next.png</file>
|
||||
<file>../images/helpImages/prev.png</file>
|
||||
<file>../images/helpImages/icon.png</file>
|
||||
<file>../images/helpImages/zoom.png</file>
|
||||
<file>../images/helpImages/fit.png</file>
|
||||
<file>../images/helpImages/goto.png</file>
|
||||
<file>../images/helpImages/help.png</file>
|
||||
<file>../images/helpImages/center.png</file>
|
||||
<file>../images/helpImages/options.png</file>
|
||||
<file>../images/helpImages/comicFolder.png</file>
|
||||
<file>../images/helpImages/save.png</file>
|
||||
<file>../images/helpImages/rotateL.png</file>
|
||||
<file>../images/helpImages/rotateR.png</file>
|
||||
<file>../images/helpImages/flow1.png</file>
|
||||
<file>../images/helpImages/flow2.png</file>
|
||||
<file>../images/helpImages/flow3.png</file>
|
||||
<file>../images/helpImages/bookmark.png</file>
|
||||
<file>../images/helpImages/setBookmark.png</file>
|
||||
<file>../images/helpImages/notCover.png</file>
|
||||
<file>../images/helpImages/previousComic.png</file>
|
||||
<file>../images/helpImages/nextComic.png</file>
|
||||
<file>../images/helpImages/deleteLibrary.png</file>
|
||||
<file>../images/helpImages/properties.png</file>
|
||||
<file>../images/helpImages/doublePage.png</file>
|
||||
<file>../images/helpImages/keyboard.png</file>
|
||||
<file>../images/helpImages/mouse.png</file>
|
||||
<file>../images/helpImages/speaker.png</file>
|
||||
<file>../images/defaultCover.png</file>
|
||||
<file>../images/onStartFlowSelection.png</file>
|
||||
<file>../images/onStartFlowSelection_es.png</file>
|
||||
<file>../images/useNewFlowButton.png</file>
|
||||
<file>../images/useOldFlowButton.png</file>
|
||||
<file>../images/fromTo.png</file>
|
||||
<file>../images/dropDownArrow.png</file>
|
||||
<file>../images/translatorSearch.png</file>
|
||||
<file>../images/speaker.png</file>
|
||||
<file>../images/clear_shortcut.png</file>
|
||||
<file>../images/accept_shortcut.png</file>
|
||||
<file>../images/shortcuts_group_comics.png</file>
|
||||
<file>../images/shortcuts_group_folders.png</file>
|
||||
<file>../images/shortcuts_group_general.png</file>
|
||||
<file>../images/shortcuts_group_libraries.png</file>
|
||||
<file>../images/shortcuts_group_mglass.png</file>
|
||||
<file>../images/shortcuts_group_page.png</file>
|
||||
<file>../images/shortcuts_group_reading.png</file>
|
||||
<file>../images/shortcuts_group_visualization.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
61
YACReader/yacreader_images_osx.qrc
Normal file
61
YACReader/yacreader_images_osx.qrc
Normal file
@ -0,0 +1,61 @@
|
||||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file alias="images/viewer_toolbar/bookmark.png">../images/viewer_toolbar/bookmark_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/bookmark@2x.png">../images/viewer_toolbar/bookmark_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/close.png">../images/viewer_toolbar/close_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/close@2x.png">../images/viewer_toolbar/close_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/doubleMangaPage.png">../images/viewer_toolbar/doubleMangaPage_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/doubleMangaPage@2x.png">../images/viewer_toolbar/doubleMangaPage_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/doublePage.png">../images/viewer_toolbar/doublePage_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/doublePage@2x.png">../images/viewer_toolbar/doublePage_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/fitToPage.png">../images/viewer_toolbar/fitToPage_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/fitToPage@2x.png">../images/viewer_toolbar/fitToPage_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/flow.png">../images/viewer_toolbar/flow_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/flow@2x.png">../images/viewer_toolbar/flow_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/full.png">../images/viewer_toolbar/full_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/full@2x.png">../images/viewer_toolbar/full_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/goto.png">../images/viewer_toolbar/goto_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/goto@2x.png">../images/viewer_toolbar/goto_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/help.png">../images/viewer_toolbar/help_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/help@2x.png">../images/viewer_toolbar/help_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/info.png">../images/viewer_toolbar/info_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/info@2x.png">../images/viewer_toolbar/info_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/magnifyingGlass.png">../images/viewer_toolbar/magnifyingGlass_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/magnifyingGlass@2x.png">../images/viewer_toolbar/magnifyingGlass_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/next.png">../images/viewer_toolbar/next_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/next@2x.png">../images/viewer_toolbar/next_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/open.png">../images/viewer_toolbar/open_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/open@2x.png">../images/viewer_toolbar/open_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/openFolder.png">../images/viewer_toolbar/openFolder_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/openFolder@2x.png">../images/viewer_toolbar/openFolder_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/openNext.png">../images/viewer_toolbar/openNext_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/openNext@2x.png">../images/viewer_toolbar/openNext_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/openPrevious.png">../images/viewer_toolbar/openPrevious_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/openPrevious@2x.png">../images/viewer_toolbar/openPrevious_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/options.png">../images/viewer_toolbar/options_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/options@2x.png">../images/viewer_toolbar/options_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/previous.png">../images/viewer_toolbar/previous_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/previous@2x.png">../images/viewer_toolbar/previous_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/rotateL.png">../images/viewer_toolbar/rotateL_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/rotateL@2x.png">../images/viewer_toolbar/rotateL_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/rotateR.png">../images/viewer_toolbar/rotateR_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/rotateR@2x.png">../images/viewer_toolbar/rotateR_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/save.png">../images/viewer_toolbar/save_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/save@2x.png">../images/viewer_toolbar/save_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/shortcuts.png">../images/viewer_toolbar/shortcuts_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/shortcuts@2x.png">../images/viewer_toolbar/shortcuts_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/showBookmarks.png">../images/viewer_toolbar/showBookmarks_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/showBookmarks@2x.png">../images/viewer_toolbar/showBookmarks_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/toHeight.png">../images/viewer_toolbar/toHeight_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/toHeight@2x.png">../images/viewer_toolbar/toHeight_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/toWidth.png">../images/viewer_toolbar/toWidth_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/toWidth@2x.png">../images/viewer_toolbar/toWidth_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/toWidthSlider.png">../images/viewer_toolbar/toWidthSlider_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/toWidthSlider@2x.png">../images/viewer_toolbar/toWidthSlider_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/translator.png">../images/viewer_toolbar/translator_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/translator@2x.png">../images/viewer_toolbar/translator_osx@2x.png</file>
|
||||
<file alias="images/viewer_toolbar/zoom.png">../images/viewer_toolbar/zoom_osx.png</file>
|
||||
<file alias="images/viewer_toolbar/zoom@2x.png">../images/viewer_toolbar/zoom_osx@2x.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
31
YACReader/yacreader_images_win.qrc
Normal file
31
YACReader/yacreader_images_win.qrc
Normal file
@ -0,0 +1,31 @@
|
||||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>../images/viewer_toolbar/bookmark.png</file>
|
||||
<file>../images/viewer_toolbar/close.png</file>
|
||||
<file>../images/viewer_toolbar/doublePage.png</file>
|
||||
<file>../images/viewer_toolbar/doubleMangaPage.png</file>
|
||||
<file>../images/viewer_toolbar/fitToPage.png</file>
|
||||
<file>../images/viewer_toolbar/flow.png</file>
|
||||
<file>../images/viewer_toolbar/full.png</file>
|
||||
<file>../images/viewer_toolbar/goto.png</file>
|
||||
<file>../images/viewer_toolbar/help.png</file>
|
||||
<file>../images/viewer_toolbar/info.png</file>
|
||||
<file>../images/viewer_toolbar/magnifyingGlass.png</file>
|
||||
<file>../images/viewer_toolbar/next.png</file>
|
||||
<file>../images/viewer_toolbar/open.png</file>
|
||||
<file>../images/viewer_toolbar/openFolder.png</file>
|
||||
<file>../images/viewer_toolbar/openNext.png</file>
|
||||
<file>../images/viewer_toolbar/openPrevious.png</file>
|
||||
<file>../images/viewer_toolbar/options.png</file>
|
||||
<file>../images/viewer_toolbar/previous.png</file>
|
||||
<file>../images/viewer_toolbar/rotateL.png</file>
|
||||
<file>../images/viewer_toolbar/rotateR.png</file>
|
||||
<file>../images/viewer_toolbar/save.png</file>
|
||||
<file>../images/viewer_toolbar/shortcuts.png</file>
|
||||
<file>../images/viewer_toolbar/showBookmarks.png</file>
|
||||
<file>../images/viewer_toolbar/toHeight.png</file>
|
||||
<file>../images/viewer_toolbar/toWidth.png</file>
|
||||
<file>../images/viewer_toolbar/translator.png</file>
|
||||
<file>../images/viewer_toolbar/zoom.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
171
YACReader/yacreader_local_client.cpp
Normal file
171
YACReader/yacreader_local_client.cpp
Normal file
@ -0,0 +1,171 @@
|
||||
#include "yacreader_local_client.h"
|
||||
#include "comic_db.h"
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include <QLocalSocket>
|
||||
|
||||
#include "QsLog.h"
|
||||
|
||||
using namespace YACReader;
|
||||
|
||||
YACReaderLocalClient::YACReaderLocalClient(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
localSocket = new QLocalSocket(this);
|
||||
|
||||
//connect(localSocket, SIGNAL(readyRead()), this, SLOT(readMessage()));
|
||||
|
||||
/*connect(socket, SIGNAL(error(QLocalSocket::LocalSocketError)),
|
||||
this, SLOT(displayError(QLocalSocket::LocalSocketError)));*/
|
||||
}
|
||||
YACReaderLocalClient::~YACReaderLocalClient()
|
||||
{
|
||||
delete localSocket;
|
||||
}
|
||||
//información de comic recibida...
|
||||
void YACReaderLocalClient::readMessage()
|
||||
{
|
||||
|
||||
}
|
||||
#include <QMessageBox>
|
||||
|
||||
bool YACReaderLocalClient::requestComicInfo(quint64 libraryId, ComicDB & comic, QList<ComicDB> & siblings)
|
||||
{
|
||||
localSocket->connectToServer(YACREADERLIBRARY_GUID);
|
||||
if(localSocket->isOpen())
|
||||
{
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_8);
|
||||
out << (quint32)0;
|
||||
out << (quint8)YACReader::RequestComicInfo;
|
||||
out << libraryId;
|
||||
out << comic;
|
||||
out.device()->seek(0);
|
||||
out << (quint32)(block.size() - sizeof(quint32));
|
||||
|
||||
int written = 0;
|
||||
int previousWritten = 0;
|
||||
quint16 tries = 0;
|
||||
while(written != block.size() && tries < 200)
|
||||
{
|
||||
written += localSocket->write(block);
|
||||
localSocket->flush();
|
||||
if(written == previousWritten) //no bytes were written
|
||||
tries++;
|
||||
previousWritten = written;
|
||||
}
|
||||
if(tries == 200)
|
||||
{
|
||||
localSocket->close();
|
||||
QLOG_ERROR() << "Requesting Comic Info : unable to send request";
|
||||
return false;
|
||||
}
|
||||
|
||||
localSocket->waitForBytesWritten(2000);
|
||||
|
||||
//QByteArray data;
|
||||
tries = 0;
|
||||
int dataAvailable = 0;
|
||||
QByteArray packageSize;
|
||||
localSocket->waitForReadyRead(1000);
|
||||
while(packageSize.size() < sizeof(quint32) && tries < 20)
|
||||
{
|
||||
packageSize.append(localSocket->read(sizeof(quint32) - packageSize.size()));
|
||||
localSocket->waitForReadyRead(100);
|
||||
if(dataAvailable == packageSize.size())
|
||||
{
|
||||
tries++; //TODO apply 'tries' fix
|
||||
}
|
||||
dataAvailable = packageSize.size();
|
||||
}
|
||||
if(tries == 20)
|
||||
{
|
||||
localSocket->close();
|
||||
QLOG_ERROR() << "Requesting Comic Info : unable to read package size";
|
||||
return false;
|
||||
}
|
||||
QDataStream sizeStream(packageSize);//localSocket->read(sizeof(quint32)));
|
||||
sizeStream.setVersion(QDataStream::Qt_4_8);
|
||||
quint32 totalSize = 0;
|
||||
sizeStream >> totalSize;
|
||||
|
||||
QByteArray data;
|
||||
|
||||
tries = 0;
|
||||
int dataRead = 0;
|
||||
localSocket->waitForReadyRead(1000);
|
||||
while((unsigned int)data.length() < totalSize && tries < 20 )
|
||||
{
|
||||
data.append(localSocket->readAll());
|
||||
if((unsigned int)data.length() < totalSize)
|
||||
localSocket->waitForReadyRead(100);
|
||||
if(data.length() == dataRead)
|
||||
tries++;
|
||||
dataRead = data.length();
|
||||
}
|
||||
|
||||
if(tries == 20)
|
||||
{
|
||||
localSocket->close();
|
||||
QLOG_ERROR() << "Requesting Comic Info : unable to read data (" << data.length() << "," << totalSize << ")";
|
||||
return false;
|
||||
}
|
||||
|
||||
QDataStream dataStream(data);
|
||||
dataStream >> comic;
|
||||
dataStream >> siblings;
|
||||
localSocket->close();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
QLOG_ERROR() << "Requesting Comic Info : unable to connect to the server";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB & comic)
|
||||
{
|
||||
localSocket->connectToServer(YACREADERLIBRARY_GUID);
|
||||
if(localSocket->isOpen())
|
||||
{
|
||||
//QLOG_INFO() << "Connection opened for sending ComicInfo";
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_8);
|
||||
out << (quint32)0;
|
||||
out << (quint8)YACReader::SendComicInfo;
|
||||
out << libraryId;
|
||||
out << comic;
|
||||
out.device()->seek(0);
|
||||
out << (quint32)(block.size() - sizeof(quint32));
|
||||
|
||||
int written, previousWritten;
|
||||
written = previousWritten = 0;
|
||||
int tries = 0;
|
||||
while(written != block.size() && tries < 100)
|
||||
{
|
||||
written += localSocket->write(block);
|
||||
if(written == previousWritten)
|
||||
tries++;
|
||||
previousWritten = written;
|
||||
}
|
||||
localSocket->waitForBytesWritten(2000);
|
||||
localSocket->close();
|
||||
//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());
|
||||
return false;
|
||||
}
|
||||
emit finished();
|
||||
return true;
|
||||
}
|
||||
|
||||
emit finished();
|
||||
QLOG_ERROR() << "Sending Comic Info : unable to connect to the server";
|
||||
return false;
|
||||
|
||||
}
|
27
YACReader/yacreader_local_client.h
Normal file
27
YACReader/yacreader_local_client.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef YACREADER_LOCAL_CLIENT_H
|
||||
#define YACREADER_LOCAL_CLIENT_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QLocalSocket;
|
||||
class ComicDB;
|
||||
|
||||
class YACReaderLocalClient : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit YACReaderLocalClient(QObject *parent = 0);
|
||||
~YACReaderLocalClient();
|
||||
signals:
|
||||
void finished();
|
||||
public slots:
|
||||
void readMessage();
|
||||
bool requestComicInfo(quint64 libraryId, ComicDB & comic,QList<ComicDB> & siblings);
|
||||
bool sendComicInfo(quint64 libraryId, ComicDB & comic);
|
||||
|
||||
private:
|
||||
QLocalSocket * localSocket;
|
||||
|
||||
};
|
||||
|
||||
#endif // YACREADER_LOCAL_CLIENT_H
|
1053
YACReader/yacreader_nl.ts
Normal file
1053
YACReader/yacreader_nl.ts
Normal file
File diff suppressed because it is too large
Load Diff
1053
YACReader/yacreader_pt.ts
Normal file
1053
YACReader/yacreader_pt.ts
Normal file
File diff suppressed because it is too large
Load Diff
1053
YACReader/yacreader_ru.ts
Normal file
1053
YACReader/yacreader_ru.ts
Normal file
File diff suppressed because it is too large
Load Diff
1009
YACReader/yacreader_source.ts
Normal file
1009
YACReader/yacreader_source.ts
Normal file
File diff suppressed because it is too large
Load Diff
942
YACReader/yacreader_tr.ts
Normal file
942
YACReader/yacreader_tr.ts
Normal file
@ -0,0 +1,942 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="tr_TR">
|
||||
<context>
|
||||
<name>ActionsShortcutsModel</name>
|
||||
<message>
|
||||
<source>None</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BookmarksDialog</name>
|
||||
<message>
|
||||
<source>Close</source>
|
||||
<translation>Kapat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loading...</source>
|
||||
<translation>Yükleniyor...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Click on any image to go to the bookmark</source>
|
||||
<translation>Yer imine git</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Lastest Page</source>
|
||||
<translation>Son Sayfa</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Configuration</name>
|
||||
<message>
|
||||
<source>There was a problem saving YACReader configuration. Please, check if you have enough permissions in the YACReader root folder.</source>
|
||||
<translation type="vanished">Yeni ayarlar kaydedilirken bir problem çıktı. Lütfen YACReader dosyasını açın.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Saving config file....</source>
|
||||
<translation type="vanished">Config dosyası kaydediliyor...</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditShortcutsDialog</name>
|
||||
<message>
|
||||
<source>Restore defaults</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>To change a shortcut, double click in the key combination and type the new keys.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shortcuts settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shortcut in use</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>The shortcut "%1" is already assigned to other function</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FileComic</name>
|
||||
<message>
|
||||
<source>File not found or not images in file</source>
|
||||
<translation type="vanished">Dosya bulunamadı yada dosyada resim yok</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z not found</source>
|
||||
<translation>7z bulunamadı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Comic not found</source>
|
||||
<translation type="vanished">Çizgi roman bulunamadı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Not found</source>
|
||||
<translation type="vanished">Bulunamadı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File error</source>
|
||||
<translation type="vanished">Dosya hatası</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z problem</source>
|
||||
<translation type="vanished">7z Problemli</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z reading</source>
|
||||
<translation type="vanished">7z Okunuyor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z crashed.</source>
|
||||
<translation type="vanished">7z Bozulmuş.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>problem reading from 7z</source>
|
||||
<translation type="vanished">7z Okunurken Problem Oluştu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z crashed</source>
|
||||
<translation type="vanished">7z Bozulması</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown error 7z</source>
|
||||
<translation type="vanished">Bilinmeyen 7z hatası</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>7z wasn't found in your PATH.</source>
|
||||
<translation type="vanished">7z Yolu Bulunamadı.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CRC error on page (%1): some of the pages will not be displayed correctly</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unknown error opening the file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Format not supported</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GoToDialog</name>
|
||||
<message>
|
||||
<source>Go To</source>
|
||||
<translation>Git</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Go to...</source>
|
||||
<translation>Git...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Total pages : </source>
|
||||
<translation>Toplam sayfa:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>Vazgeç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page : </source>
|
||||
<translation>Sayfa :</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GoToFlowToolBar</name>
|
||||
<message>
|
||||
<source>Page : </source>
|
||||
<translation>Sayfa : </translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>HelpAboutDialog</name>
|
||||
<message>
|
||||
<source>Help</source>
|
||||
<translation>Yardım</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>About</source>
|
||||
<translation>Hakkında</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindowViewer</name>
|
||||
<message>
|
||||
<source>C</source>
|
||||
<translation type="vanished">C</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>D</source>
|
||||
<translation type="vanished">D</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>G</source>
|
||||
<translation type="vanished">G</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I</source>
|
||||
<translation type="vanished">I</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>L</source>
|
||||
<translation type="vanished">L</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>M</source>
|
||||
<translation type="vanished">M</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>O</source>
|
||||
<translation type="vanished">O</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>R</source>
|
||||
<translation type="vanished">R</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Z</source>
|
||||
<translation type="vanished">Z</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Help</source>
|
||||
<translation>Yardım</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save</source>
|
||||
<translation>Kaydet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&File</source>
|
||||
<translation>&Dosya</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Next</source>
|
||||
<translation>&İleri</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Open</source>
|
||||
<translation>&Aç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close</source>
|
||||
<translation>Kapat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open Comic</source>
|
||||
<translation>Çizgi Romanı Aç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Go To</source>
|
||||
<translation>Git</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open image folder</source>
|
||||
<translation>Resim dosyasınıaç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Set bookmark</source>
|
||||
<translation>Yer imi yap</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>page_%1.jpg</source>
|
||||
<translation>sayfa_%1.jpg</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Switch to double page mode</source>
|
||||
<translation>Çift sayfa moduna geç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save current page</source>
|
||||
<translation>Geçerli sayfayı kaydet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Double page mode</source>
|
||||
<translation>Çift sayfa modu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Switch Magnifying glass</source>
|
||||
<translation>Büyüteç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open Folder</source>
|
||||
<translation>Dosyayı Aç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ctrl+O</source>
|
||||
<translation type="vanished">Ctrl+O</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Comic files</source>
|
||||
<translation>Çizgi Roman Dosyaları</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Go to previous page</source>
|
||||
<translation>Önceki sayfaya dön</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open a comic</source>
|
||||
<translation>Çizgi romanı aç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Image files (*.jpg)</source>
|
||||
<translation>Resim dosyaları (*.jpg)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Next Comic</source>
|
||||
<translation>Sırada ki çizgi roman</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Saving error log file....</source>
|
||||
<translation type="vanished">Hata dosyasını kaydet...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fit Width</source>
|
||||
<translation>Uygun Genişlik</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Options</source>
|
||||
<translation>Ayarlar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Info</source>
|
||||
<translation>Bilgiyi göster</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open folder</source>
|
||||
<translation>Dosyayı aç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Go to page ...</source>
|
||||
<translation>Sayfata git...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fit image to width</source>
|
||||
<translation>Görüntüyü sığdır</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Previous</source>
|
||||
<translation>&Geri</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Go to next page</source>
|
||||
<translation>Sonra ki sayfaya geç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show keyboard shortcuts</source>
|
||||
<translation>Kılavye kısayollarını göster</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open next comic</source>
|
||||
<translation>Sıradaki çizgi romanı aç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>There is a new version available</source>
|
||||
<translation>Yeni versiyon mevcut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show bookmarks</source>
|
||||
<translation>Yer imlerini göster</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open previous comic</source>
|
||||
<translation>Önceki çizgi romanı aç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rotate image to the left</source>
|
||||
<translation>Sayfayı sola yatır</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fit image to height</source>
|
||||
<translation>Uygun yüksekliğe getir</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show the bookmarks of the current comic</source>
|
||||
<translation>Bu çizgi romanın yer imlerini göster</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Dictionary</source>
|
||||
<translation>Sözlüğü göster</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>YACReader options</source>
|
||||
<translation>YACReader ayarları</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Help, About YACReader</source>
|
||||
<translation>YACReader hakkında yardım ve bilgi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show go to flow</source>
|
||||
<translation>Akışı göster</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Previous Comic</source>
|
||||
<translation>Önce ki çizgi roman</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show full size</source>
|
||||
<translation>Tam erken</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Magnifying glass</source>
|
||||
<translation>Büyüteç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Set a bookmark on the current page</source>
|
||||
<translation>Sayfayı yer imi olarak ayarla</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do you want to download the new version?</source>
|
||||
<translation>Yeni versiyonu indirmek ister misin ?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>There was a problem saving YACReader error log file. Please, check if you have enough permissions in the YACReader root folder.</source>
|
||||
<translation type="vanished">Kaydederken bir problem çıktı YACReader hata kayıt dosyası. Lütfen YACReader root dosyasını ziyaret edin.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rotate image to the right</source>
|
||||
<translation>Sayfayı sağa yator</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Always on top</source>
|
||||
<translation>Her zaman üstte</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Remind me in 14 days</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Not now</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fit Height</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fit to page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset zoom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show zoom slider</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zoom+</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zoom-</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Double page manga mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reverse reading order in double page mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit shortcuts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open recent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Comics</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Toggle fullscreen mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Hide/show toolbar</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>General</source>
|
||||
<translation type="unfinished">Genel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Size up magnifying glass</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Size down magnifying glass</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zoom in magnifying glass</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zoom out magnifying glass</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Magnifiying glass</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Toggle between fit to width and fit to height</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page adjustement</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Autoscroll down</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Autoscroll up</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Move down</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Move up</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Move left</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Move right</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Go to the first page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Go to the last page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reading</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open latest comic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open the latest comic opened in the previous reading session</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear open recent list</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>View</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Go</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Window</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Autoscroll forward, horizontal first</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Autoscroll backward, horizontal first</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Autoscroll forward, vertical first</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Autoscroll backward, vertical first</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>OptionsDialog</name>
|
||||
<message>
|
||||
<source>Gamma</source>
|
||||
<translation>Gama</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation>Yeniden başlat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>My comics path</source>
|
||||
<translation>Çizgi Romanlarım</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Image adjustment</source>
|
||||
<translation>Resim ayarları</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page width stretch</source>
|
||||
<translation type="vanished">Sayfayı uzat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>"Go to flow" size</source>
|
||||
<translation>Akış görünümüne git</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Choose</source>
|
||||
<translation>Seç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Image options</source>
|
||||
<translation>Sayfa ayarları</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Contrast</source>
|
||||
<translation>Kontrast</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Options</source>
|
||||
<translation>Ayarlar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Comics directory</source>
|
||||
<translation>Çizgi roman konumu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Background color</source>
|
||||
<translation>Arka plan rengi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page Flow</source>
|
||||
<translation>Sayfa akışı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>General</source>
|
||||
<translation>Genel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Brightness</source>
|
||||
<translation>Parlaklık</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restart is needed</source>
|
||||
<translation>Yeniden başlatılmalı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quick Navigation Mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Disable mouse over activation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<source>7z lib not found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unable to load 7z lib from ./utils</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ShortcutsDialog</name>
|
||||
<message>
|
||||
<source>Close</source>
|
||||
<translation>Kapat</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>YACReader keyboard shortcuts</source>
|
||||
<translation>YACReader klavye kısayolları</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Keyboard Shortcuts</source>
|
||||
<translation>Kılavye Kısayolları</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Viewer</name>
|
||||
<message>
|
||||
<source>Press 'O' to open comic.</source>
|
||||
<translation>'O'ya basarak aç.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cover!</source>
|
||||
<translation>Kapak!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Comic not found</source>
|
||||
<translation>Çizgi roman bulunamadı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Not found</source>
|
||||
<translation>Bulunamadı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Last page!</source>
|
||||
<translation>Son sayfa!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loading...please wait!</source>
|
||||
<translation>Yükleniyor... lütfen bekleyin!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error opening comic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CRC Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page not available!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>YACReaderDeletingProgress</name>
|
||||
<message>
|
||||
<source>cancel</source>
|
||||
<translation type="vanished">vazgeç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Please wait, deleting in progress...</source>
|
||||
<translation type="vanished">Lütfen bekle silme işlemi gerçekleştiriliyor...</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>YACReaderFieldEdit</name>
|
||||
<message>
|
||||
<source>Restore to default</source>
|
||||
<translation>Varsayılana ayarla</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Click to overwrite</source>
|
||||
<translation>Üzerine yazmak için tıkla</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>YACReaderFieldPlainTextEdit</name>
|
||||
<message>
|
||||
<source>Restore to default</source>
|
||||
<translation>Varsayılana ayarla</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Click to overwrite</source>
|
||||
<translation>Üstüne yazmak için tıkla</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>YACReaderFlowConfigWidget</name>
|
||||
<message>
|
||||
<source>CoverFlow look</source>
|
||||
<translation>Kapak akışı görünümü</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>How to show covers:</source>
|
||||
<translation>Kapaklar nasıl gözüksün:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stripe look</source>
|
||||
<translation>Şerit görünüm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Overlapped Stripe look</source>
|
||||
<translation>Çakışan şerit görünüm</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>YACReaderGLFlowConfigWidget</name>
|
||||
<message>
|
||||
<source>Zoom</source>
|
||||
<translation>Yakınlaş</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Light</source>
|
||||
<translation>Işık</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show advanced settings</source>
|
||||
<translation>Daha fazla ayar göster</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Roulette look</source>
|
||||
<translation>Rulet görünüm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cover Angle</source>
|
||||
<translation>Kapak Açısı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Stripe look</source>
|
||||
<translation>Strip görünüm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Position</source>
|
||||
<translation>Pozisyon</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Z offset</source>
|
||||
<translation>Z dengesi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Y offset</source>
|
||||
<translation>Y dengesi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Central gap</source>
|
||||
<translation>Boş merkaz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Presets:</source>
|
||||
<translation>Hazırlayan:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Overlapped Stripe look</source>
|
||||
<translation>Çakışan şerit görünüm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Modern look</source>
|
||||
<translation>Modern görünüm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>View angle</source>
|
||||
<translation>Bakış açısı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Max angle</source>
|
||||
<translation>Maksimum açı</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Custom:</source>
|
||||
<translation>Kişisel:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Classic look</source>
|
||||
<translation>Klasik görünüm</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cover gap</source>
|
||||
<translation>Kapak </translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>High Performance</source>
|
||||
<translation>Yüksek performans</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Performance:</source>
|
||||
<translation>Performans:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Use VSync (improve the image quality in fullscreen mode, worse performance)</source>
|
||||
<translation>VSync kullan</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Visibility</source>
|
||||
<translation>Görünülebilirlik</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Low Performance</source>
|
||||
<translation>Düşük Performans</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>YACReaderOptionsDialog</name>
|
||||
<message>
|
||||
<source>Save</source>
|
||||
<translation>Kaydet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Use hardware acceleration (restart needed)</source>
|
||||
<translation>Yüksek donanımlı kullan (yeniden başlatmak gerekli)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>Vazgeç</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit shortcuts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shortcuts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>YACReaderSideBar</name>
|
||||
<message>
|
||||
<source>Search folders and comics</source>
|
||||
<translation type="vanished">Dosyaları ve çizgi romanları ara</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>LIBRARIES</source>
|
||||
<translation type="vanished">KÜTÜPHANELER</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FOLDERS</source>
|
||||
<translation type="vanished">DOSYALAR</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>YACReaderSlider</name>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation type="unfinished">Yeniden başlat</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>YACReaderTranslator</name>
|
||||
<message>
|
||||
<source>YACReader translator</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Translation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>clear</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Service not available</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
Reference in New Issue
Block a user