Accept file path to open as command line argument
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "photocapture.h"
|
#include "photocapture.h"
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@@ -134,6 +135,20 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
|||||||
QStringList standardLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
|
QStringList standardLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
|
||||||
if(standardLocations.size())
|
if(standardLocations.size())
|
||||||
_lastDir = standardLocations.first();
|
_lastDir = standardLocations.first();
|
||||||
|
|
||||||
|
QStringList args = QCoreApplication::arguments();
|
||||||
|
args.removeFirst();
|
||||||
|
for(auto &arg : args)
|
||||||
|
{
|
||||||
|
QFileInfo info(arg);
|
||||||
|
if(info.exists())
|
||||||
|
{
|
||||||
|
m_ringList->setFile(info.canonicalFilePath());
|
||||||
|
updateWindowTitle();
|
||||||
|
_lastDir = info.absoluteDir().absolutePath();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
|||||||
Reference in New Issue
Block a user