Accept file path to open as command line argument
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <unistd.h>
|
||||
#include "photocapture.h"
|
||||
#include <QSettings>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/ioctl.h>
|
||||
@@ -134,6 +135,20 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||
QStringList standardLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
|
||||
if(standardLocations.size())
|
||||
_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()
|
||||
|
||||
Reference in New Issue
Block a user