Commit ed6a220e authored by Florent D'Halluin's avatar Florent D'Halluin Committed by Guillaume Lazzara
Browse files

Update viewer

* viewer/viewer.cc,
* viewer/browser_widget.cc,
* viewer/browser_widget.hh:
Browse to the directory taken as first parameter.

* viewer/main.cc:
Add usage info.
parent 7fd561dd
......@@ -14,7 +14,7 @@
#include "browser_widget.hh"
BrowserWidget::BrowserWidget(QDirModel* files)
BrowserWidget::BrowserWidget(QDirModel* files, QString dir)
: files_(files),
view_(new QListView()),
path_(new QLabel(""))
......@@ -34,6 +34,9 @@ BrowserWidget::BrowserWidget(QDirModel* files)
| QDir::Readable | QDir::Drives);
view_->setRootIndex(files->index(QDir::currentPath()));
QDir d(dir);
if (d.isReadable())
view_->setRootIndex(files->index(d.absolutePath()));
view_->setRowHidden(0, true);
path_->setText(files->filePath(view_->rootIndex()));
connect(view_, SIGNAL(activated(const QModelIndex&)),
......
......@@ -23,7 +23,7 @@ class BrowserWidget
Q_OBJECT
public:
BrowserWidget(QDirModel* files);
BrowserWidget(QDirModel* files, QString dir = QString());
~BrowserWidget();
public slots:
......
......@@ -13,14 +13,25 @@
//
#include <QtGui>
#include <iostream>
#include "viewer.hh"
int main(int argc, char** argv)
{
if (argc > 2 ||
(argc == 2 &&
(QString(argv[1]) == "--help" || QString(argv[1]) == "-h")))
{
std::cout << "Usage:" << std::endl
<< argv[0] << " <image dir>" << std::endl;
return 0;
}
Viewer* viewer = Viewer::Instance(argc, argv);
if (!viewer)
return 0;
return -1;
return viewer->exec();
}
......@@ -119,7 +119,8 @@ Viewer::Viewer(int &argc, char** argv)
PropertyWidget* property_wgt = new PropertyWidget();
XmlWidget* xml_wgt = new XmlWidget();
BrowserWidget* browser_wgt = new BrowserWidget(files_);
BrowserWidget* browser_wgt =
new BrowserWidget(files_, argc != 2 ? QString() : argv[1]);
ImageWidget* image_wgt = new ImageWidget(scene_);
key_wgt_ = new KeyWidget(key_map_);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment