mirror of
https://github.com/YACReader/yacreader
synced 2025-07-20 22:14:41 -04:00
merged changes from 7.1.0 branch
This commit is contained in:
@ -175,8 +175,6 @@ void MainWindowViewer::setupUI()
|
||||
|
||||
setWindowTitle("YACReader");
|
||||
|
||||
openFromArgv();
|
||||
|
||||
checkNewVersion();
|
||||
|
||||
viewer->setFocusPolicy(Qt::StrongFocus);
|
||||
@ -200,50 +198,6 @@ void MainWindowViewer::setupUI()
|
||||
hideToolBars();
|
||||
}
|
||||
|
||||
void MainWindowViewer::openFromArgv()
|
||||
{
|
||||
if(QCoreApplication::arguments().count() == 2) //only path...
|
||||
{
|
||||
isClient = false;
|
||||
//TODO: new method open(QString)
|
||||
QString pathFile = QCoreApplication::arguments().at(1);
|
||||
QFileInfo fi(pathFile);
|
||||
currentDirectory = fi.absoluteDir().path();
|
||||
getSiblingComics(fi.absolutePath(),fi.fileName());
|
||||
|
||||
setWindowTitle("YACReader - " + fi.fileName());
|
||||
enableActions();
|
||||
viewer->open(pathFile);
|
||||
}
|
||||
else if(QCoreApplication::arguments().count() == 4)
|
||||
{
|
||||
|
||||
QString pathFile = QCoreApplication::arguments().at(1);
|
||||
currentDirectory = pathFile;
|
||||
quint64 comicId = QCoreApplication::arguments().at(2).toULongLong();
|
||||
libraryId = QCoreApplication::arguments().at(3).toULongLong();
|
||||
|
||||
enableActions();
|
||||
|
||||
currentComicDB.id = comicId;
|
||||
YACReaderLocalClient client;
|
||||
int tries = 1;
|
||||
bool success = false;
|
||||
while(!(success = client.requestComicInfo(libraryId,currentComicDB,siblingComics)) && tries != 0)
|
||||
tries--;
|
||||
|
||||
if(success)
|
||||
{
|
||||
isClient = true;
|
||||
open(pathFile+currentComicDB.path,currentComicDB,siblingComics);
|
||||
}
|
||||
else
|
||||
{isClient = false; QMessageBox::information(this,"Connection Error", "Unable to connect to YACReaderLibrary");/*error*/}
|
||||
|
||||
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::createActions()
|
||||
{
|
||||
openAction = new QAction(tr("&Open"),this);
|
||||
@ -691,6 +645,39 @@ void MainWindowViewer::open(QString path, ComicDB & comic, QList<ComicDB> & sibl
|
||||
openNextComicAction->setDisabled(true);
|
||||
}
|
||||
|
||||
void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId)
|
||||
{
|
||||
//QString pathFile = QCoreApplication::arguments().at(1);
|
||||
currentDirectory = path;
|
||||
//quint64 comicId = QCoreApplication::arguments().at(2).split("=").at(1).toULongLong();
|
||||
//libraryId = QCoreApplication::arguments().at(3).split("=").at(1).toULongLong();
|
||||
this->libraryId=libraryId;
|
||||
// this->path=path;
|
||||
|
||||
enableActions();
|
||||
|
||||
currentComicDB.id = comicId;
|
||||
YACReaderLocalClient client;
|
||||
int tries = 1;
|
||||
bool success = false;
|
||||
while(!(success = client.requestComicInfo(libraryId,currentComicDB,siblingComics)) && tries != 0)
|
||||
tries--;
|
||||
|
||||
if(success)
|
||||
{
|
||||
isClient = true;
|
||||
open(path+currentComicDB.path,currentComicDB,siblingComics);
|
||||
}
|
||||
else
|
||||
{
|
||||
isClient = false;
|
||||
QMessageBox::information(this,"Connection Error", "Unable to connect to YACReaderLibrary");
|
||||
//error
|
||||
}
|
||||
|
||||
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
|
||||
}
|
||||
|
||||
void MainWindowViewer::openComicFromPath(QString pathFile)
|
||||
{
|
||||
QFileInfo fi(pathFile);
|
||||
|
Reference in New Issue
Block a user