* lazzara/afp/photos/gui/src/main_window.cc,
* lazzara/afp/photos/gui/src/main_window.hh: Add support for more
image format and handle directories with no image.
---
milena/sandbox/ChangeLog | 8 +++++
.../lazzara/afp/photos/gui/src/main_window.cc | 30 +++++++++++++++----
.../lazzara/afp/photos/gui/src/main_window.hh | 1 +
3 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 989709b..3fec0e3 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-29 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add support for more image types.
+
+ * lazzara/afp/photos/gui/src/main_window.cc,
+ * lazzara/afp/photos/gui/src/main_window.hh: Add support for more
+ image format and handle directories with no image.
+
2010-03-19 Guillaume Lazzara <z(a)lrde.epita.fr>
Improve options menu and progress dialog.
diff --git a/milena/sandbox/lazzara/afp/photos/gui/src/main_window.cc
b/milena/sandbox/lazzara/afp/photos/gui/src/main_window.cc
index 7a94cb0..5f4cc20 100644
--- a/milena/sandbox/lazzara/afp/photos/gui/src/main_window.cc
+++ b/milena/sandbox/lazzara/afp/photos/gui/src/main_window.cc
@@ -46,7 +46,12 @@ namespace mln
// Setup directory listing
QStringList filters;
- filters << "*.ppm";
+ filters << "*.ppm"
+ << "*.pgm"
+ << "*.pbm"
+ << "*.jpg"
+ << "*.png"
+ << "*.tiff";
dir_.setNameFilters(filters);
dir_.setFilter(QDir::Files);
dir_.setSorting(QDir::Name);
@@ -113,7 +118,7 @@ namespace mln
}
main_window::~main_window()
- {
+ {
if (process_.state() == QProcess::Running)
{
process_.disconnect();
@@ -147,7 +152,14 @@ namespace mln
progressBar_.setValue(0);
options_ = options;
- start_process();
+
+ if (current_file_ < file_list_.size())
+ start_process();
+ else
+ {
+ QMessageBox::critical(this, "No image found!", QString("This
application could not find any supported images in the provided directory. Supported file
types are: %1").arg(dir_.nameFilters().join(" ")));
+ stop_process();
+ }
}
void
@@ -166,10 +178,7 @@ namespace mln
if (current_file_ < file_list_.size())
start_process();
else
- {
- progressToolBar_->hide();
- emit process_finished();
- }
+ stop_process();
}
@@ -211,6 +220,13 @@ namespace mln
}
void
+ main_window::stop_process()
+ {
+ progressToolBar_->hide();
+ emit process_finished();
+ }
+
+ void
main_window::process__error_slot(QProcess::ProcessError)
{
qDebug() << "error";
diff --git a/milena/sandbox/lazzara/afp/photos/gui/src/main_window.hh
b/milena/sandbox/lazzara/afp/photos/gui/src/main_window.hh
index 27b42e3..eb6f008 100644
--- a/milena/sandbox/lazzara/afp/photos/gui/src/main_window.hh
+++ b/milena/sandbox/lazzara/afp/photos/gui/src/main_window.hh
@@ -77,6 +77,7 @@ namespace mln
void display_image(const QString& filename);
void start_process();
+ void stop_process();
void next_process();
void connect_process();
--
1.5.6.5
Show replies by date