mirror of
https://github.com/YACReader/yacreader
synced 2025-07-26 17:04:45 -04:00
merged changes from 7.1.0 branch
This commit is contained in:
@ -1285,8 +1285,8 @@ void LibraryWindow::openComic()
|
||||
//Invoke YACReader comicPath comicId libraryId NO-->currentPage bookmark1 bookmark2 bookmark3 brightness contrast gamma
|
||||
bool yacreaderFound = false;
|
||||
#ifdef Q_OS_MAC
|
||||
QString comicIdS = QString("%1").arg(comicId);
|
||||
QString libraryIdS = QString("%1").arg(libraryId);
|
||||
QString comicIdS = QString("--comicId=") + QString("%1").arg(comicId);
|
||||
QString libraryIdS = QString("--libraryId=") + QString("%1").arg(libraryId);
|
||||
QString yacreaderPath = QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app");
|
||||
if(yacreaderFound = QFileInfo(yacreaderPath).exists())
|
||||
QProcess::startDetached("open", QStringList() << "-n" << yacreaderPath << "--args" << path << comicIdS << libraryIdS ); /*<< page << bookmark1 << bookmark2 << bookmark3 << brightness << contrast << gamma*///,QStringList() << path);
|
||||
@ -1294,12 +1294,12 @@ void LibraryWindow::openComic()
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN /* \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\" \"%10\" */
|
||||
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());
|
||||
yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\" \"%2\" \"%3\"").arg(path).arg(QString("--comicId=") + QString::number(comicId)).arg(QString("--libraryId=") + QString::number(libraryId))/*.arg(page).arg(bookmark1).arg(bookmark2).arg(bookmark3).arg(brightness).arg(contrast).arg(gamma)*/,QStringList());
|
||||
#endif
|
||||
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
QStringList parameters = QStringList() << path << QString::number(comicId) << QString::number(libraryId);
|
||||
yacreaderFound = QProcess::startDetached(QString("YACReader"),parameters);
|
||||
QStringList parameters = QStringList() << path << (QString("--comicId=") + QString::number(comicId)) << (QString("--libraryId=") + QString::number(libraryId));
|
||||
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."));
|
||||
@ -1746,7 +1746,7 @@ void LibraryWindow::openContainingFolderComic()
|
||||
{
|
||||
QModelIndex modelIndex = comicsView->currentIndex();
|
||||
QFileInfo file = QDir::cleanPath(currentPath() + dmCV->getComicPath(modelIndex));
|
||||
#ifdef Q_OS_LINUX
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
QString path = file.absolutePath();
|
||||
QDesktopServices::openUrl(QUrl("file:///"+path, QUrl::TolerantMode));
|
||||
#endif
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <QSettings>
|
||||
#include <QLibrary>
|
||||
#include <QMessageBox>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "startup.h"
|
||||
@ -141,6 +142,31 @@ int main( int argc, char ** argv )
|
||||
app.setApplicationName("YACReaderLibrary");
|
||||
app.setOrganizationName("YACReader");
|
||||
|
||||
//simple command line parser
|
||||
//will be replaced by QCommandLineParser in the future
|
||||
//TODO: --headless, --server=[on|off], support for file and directory arguments
|
||||
if (argc > 1)
|
||||
{
|
||||
QTextStream parser(stdout);
|
||||
QStringList optlist = QCoreApplication::arguments().filter(QRegExp ("^-{1,2}"));
|
||||
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:" << "\tYACReaderLibrary [Option]" << endl << endl;
|
||||
parser << "Options:" << endl;
|
||||
parser << " none\t\t\tStart YACReaderLibrary" << endl;
|
||||
parser << " -h, --help\t\tDisplay help text and exit." << endl;
|
||||
parser << " -v, --version\t\tDisplay version information and exit." << endl;
|
||||
return 0;
|
||||
}
|
||||
parser << "Unsupported command line options. See YACReaderLibrary --help for further information." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString destLog = YACReader::getSettingsPath()+"/yacreaderlibrary.log";
|
||||
QDir().mkpath(YACReader::getSettingsPath());
|
||||
|
||||
|
@ -31,21 +31,23 @@ QList<QString> addresses()
|
||||
getifaddrs(&ifAddrStruct);
|
||||
|
||||
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next) {
|
||||
if (ifa ->ifa_addr->sa_family==AF_INET) { // check it is IP4
|
||||
// is a valid IP4 Address
|
||||
tmpAddrPtr=&((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
|
||||
char addressBuffer[INET_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);
|
||||
QString add(addressBuffer);
|
||||
localAddreses.push_back(QString(addressBuffer));
|
||||
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
|
||||
} else if (ifa->ifa_addr->sa_family==AF_INET6) { // check it is IP6
|
||||
// is a valid IP6 Address
|
||||
tmpAddrPtr=&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr;
|
||||
char addressBuffer[INET6_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN);
|
||||
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
|
||||
}
|
||||
if (ifa ->ifa_addr) {
|
||||
if (ifa ->ifa_addr->sa_family==AF_INET) { // check it is IP4
|
||||
// is a valid IP4 Address
|
||||
tmpAddrPtr=&((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
|
||||
char addressBuffer[INET_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);
|
||||
QString add(addressBuffer);
|
||||
localAddreses.push_back(QString(addressBuffer));
|
||||
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
|
||||
} else if (ifa->ifa_addr->sa_family==AF_INET6) { // check it is IP6
|
||||
// is a valid IP6 Address
|
||||
tmpAddrPtr=&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr;
|
||||
char addressBuffer[INET6_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN);
|
||||
//printf("%s IP Address %s\n", ifa->ifa_name, addressBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ifAddrStruct!=NULL) freeifaddrs(ifAddrStruct);
|
||||
return localAddreses;
|
||||
|
Reference in New Issue
Block a user