Merged luisangelsm/yacreader into default

This commit is contained in:
Felix Kauselmann
2014-06-25 18:18:32 +02:00
16 changed files with 225 additions and 11 deletions

View File

@ -19,7 +19,6 @@ win32 {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32
isEqual(QT_MAJOR_VERSION, 5) {
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
@ -37,6 +36,8 @@ CONFIG -= embed_manifest_exe
unix:!macx{
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -std=c++11
isEqual(QT_MAJOR_VERSION, 5) {
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
@ -191,3 +192,54 @@ isEqual(QT_MAJOR_VERSION, 5) {
Release:DESTDIR = ../release
Debug:DESTDIR = ../debug
}
win32:!exists (../compressed_archive/lib7zip) {
error(You\'ll need 7zip source code to compile YACReader. \
Please check the compressed_archive folder for further instructions.)
}
unix:exists (../compressed_archive/libp7zip) {
message(Found p7zip source code...)
system(patch -d ../compressed_archive -N -p0 -i libp7zip.patch)
} else {
error(You\'ll need 7zip source code to compile YACReader. \
Please check the compressed_archive folder for further instructions.)
}
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\\\"" "BINDIR=\\\"$$BINDIR\\\""
#MAKE INSTALL
INSTALLS += bin icon desktop server translation
bin.path = $$BINDIR
isEmpty(DESTDIR) {
bin.files = YACReaderLibrary
} else {
bin.files = $$DESTDIR/YACReaderLibrary
}
server.path = $$DATADIR/YACReader
server.files = ../release/server
icon.path = $$DATADIR/YACReader
icon.prefix = ../images
icon.files = iconLibrary.png db.png coversPackage.png
desktop.path = $$DATADIR/applications
desktop.extra = desktop-file-edit --set-icon=$$DATADIR/YACReader/iconLibrary.png $$PWD/../YACReaderLibrary.desktop
desktop.files = ../YACReaderLibrary.desktop
#TODO: icons should be located at /usr/share/icons and have the same basename as their application
translation.path = $$DATADIR/YACReader/languages
translation.files = ../release/languages/yacreaderlibrary_*
}

View File

@ -73,7 +73,11 @@ void LibraryCreator::run()
stopRunning = false;
//check for 7z lib
#if defined Q_OS_UNIX && !defined Q_OS_MAC
QLibrary *sevenzLib = new QLibrary(QString(LIBDIR)+"/p7zip/7z.so");
#else
QLibrary *sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z");
#endif
if(!sevenzLib->load())
{
QLOG_ERROR() << "Loading 7z.dll : " + sevenzLib->errorString() << endl;

View File

@ -1148,9 +1148,9 @@ void LibraryWindow::openComic()
yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\" \"%2\" \"%3\"").arg(path).arg(comicId).arg(libraryId)/*.arg(page).arg(bookmark1).arg(bookmark2).arg(bookmark3).arg(brightness).arg(contrast).arg(gamma)*/,QStringList());
#endif
#ifdef Q_OS_LINUX
#if defined Q_OS_UNIX && !defined Q_OS_MAC
QStringList parameters = QStringList() << path << QString::number(comicId) << QString::number(libraryId);
yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader"),parameters);
yacreaderFound = QProcess::startDetached(QString("YACReader"),parameters);
#endif
if(!yacreaderFound)
QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary."));

View File

@ -92,15 +92,20 @@ void logSystemAndConfig()
#endif
#ifdef Q_OS_WIN
if(QLibrary::isLibrary(QApplication::applicationDirPath()+"/utils/7z.dll"))
if(QLibrary::isLibrary(QApplication::applicationDirPath()+"/utils/7z.dll")) {
#elif defined Q_OS_UNIX && !defined Q_OS_MAC
if(QLibrary::isLibrary(QString(LIBDIR)+"/p7zip/7z.so"))
#else
if(QLibrary::isLibrary(QApplication::applicationDirPath()+"/utils/7z.so"))
#endif
QLOG_INFO() << "7z : found";
else
QLOG_ERROR() << "7z : not found";
#if defined Q_OS_UNIX && !defined Q_OS_MAC
if(QFileInfo(QString(BINDIR)+"/qrencode").exists())
#else
if(QFileInfo(QApplication::applicationDirPath()+"/utils/qrencode.exe").exists() || QFileInfo("./util/qrencode").exists())
#endif
QLOG_INFO() << "qrencode : found";
else
QLOG_INFO() << "qrencode : not found";
@ -150,11 +155,19 @@ int main( int argc, char ** argv )
QTranslator translator;
QString sufix = QLocale::system().name();
#if defined Q_OS_UNIX && !defined Q_OS_MAC
translator.load(QString(DATADIR) +"/YACReader/languages/yacreaderlibrary_"+sufix);
#else
translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreaderlibrary_"+sufix);
#endif
app.installTranslator(&translator);
QTranslator viewerTranslator;
#if defined Q_OS_UNIX && !defined Q_OS_MAC
viewerTranslator.load(QString(DATADIR)+"/YACReader/languages/yacreader_"+sufix);
#else
viewerTranslator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix);
#endif
app.installTranslator(&viewerTranslator);
app.setApplicationName("YACReaderLibrary");

View File

@ -14,7 +14,11 @@ void PackageManager::createPackage(const QString & libraryPath,const QString & d
_7z = new QProcess();
connect(_7z,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError)));
connect(_7z,SIGNAL(finished(int,QProcess::ExitStatus)),this,SIGNAL(exported()));
#if defined Q_OS_UNIX && !defined Q_OS_MAC
_7z->start("7z",attributes); //TODO: use 7z.so
#else
_7z->start(QCoreApplication::applicationDirPath()+"/utils/7zip",attributes); //TODO: use 7z.dll
#endif
}
void PackageManager::extractPackage(const QString & packagePath,const QString & destDir)
@ -26,7 +30,11 @@ void PackageManager::extractPackage(const QString & packagePath,const QString &
_7z = new QProcess();
connect(_7z,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError)));
connect(_7z,SIGNAL(finished(int,QProcess::ExitStatus)),this,SIGNAL(imported()));
#if defined Q_OS_UNIX && !defined Q_OS_MAC
_7z->start("7z",attributes); //TODO: use 7z.so
#else
_7z->start(QCoreApplication::applicationDirPath()+"/utils/7zip",attributes); //TODO: use 7z.dll
#endif
}
void PackageManager::cancel()

View File

@ -24,8 +24,13 @@ StaticFileController::StaticFileController(QSettings* settings, QObject* parent)
if (QDir::isRelativePath(docroot))
#endif
{
#if defined Q_OS_UNIX && ! defined Q_OS_MAC
QFileInfo configFile(QString(DATADIR)+"/YACReader");
docroot=QFileInfo(QString(DATADIR)+"/YACReader",docroot).absoluteFilePath();
#else
QFileInfo configFile(QApplication::applicationDirPath());
docroot=QFileInfo(QApplication::applicationDirPath(),docroot).absoluteFilePath();
#endif
}
qDebug("StaticFileController: docroot=%s, encoding=%s, maxAge=%i",qPrintable(docroot),qPrintable(encoding),maxAge);
maxCachedFileSize=settings->value("maxCachedFileSize","65536").toInt();

View File

@ -22,8 +22,13 @@ TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent)
if (QDir::isRelativePath(templatePath))
#endif
{
#if defined Q_OS_UNIX && !defined Q_OS_MAC
QFileInfo configFile(QString(DATADIR)+"/YACReader");
templatePath=QFileInfo(QString(DATADIR)+"/YACReader",templatePath).absoluteFilePath();
#else
QFileInfo configFile(QApplication::applicationDirPath());
templatePath=QFileInfo(QApplication::applicationDirPath(),templatePath).absoluteFilePath();
#endif
}
fileNameSuffix=settings->value("suffix",".tpl").toString();
QString encoding=settings->value("encoding").toString();

View File

@ -26,8 +26,11 @@ QString Static::getConfigDir() {
return configDir;
}
// Search config file
#if defined Q_OS_UNIX && !defined Q_OS_MAC
QString binDir=(QString(DATADIR) + "/YACReader");
#else
QString binDir=QCoreApplication::applicationDirPath();
#endif
QString organization=QCoreApplication::organizationName();
QString configFileName=QCoreApplication::applicationName()+".ini";

View File

@ -282,7 +282,11 @@ void ServerConfigDialog::generateQR(const QString & serverAddress)
attributes << "-o" << "-" /*QCoreApplication::applicationDirPath()+"/utils/tmp.png"*/ << "-s" << "8" << "-l" << "H" << "-m" << "0" << serverAddress;
connect(qrGenerator,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(updateImage(void)));
connect(qrGenerator,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError))); //TODO: implement openingError
#if defined Q_OS_UNIX && !defined Q_OS_MAC
qrGenerator->start(QString("qrencode"),attributes);
#else
qrGenerator->start(QCoreApplication::applicationDirPath()+"/utils/qrencode",attributes);
#endif
}
void ServerConfigDialog::updateImage()