Moving preview window to new branch

This commit is contained in:
Austen Adler 2014-06-18 19:15:35 -04:00
parent 8f9d74199b
commit e5a1b2283e
6 changed files with 92 additions and 24 deletions

View File

@ -17,7 +17,8 @@ SOURCES += main.cpp\
HEADERS += picture.h HEADERS += picture.h
FORMS += picture.ui FORMS += picture.ui \
preview.ui
unix: CONFIG += link_pkgconfig unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += exiv2 unix: PKGCONFIG += exiv2

View File

@ -1,11 +1,11 @@
#include "picture.h" #include "picture.h"
#include <QApplication> #include <QApplication>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
Picture w; Picture w;
w.show(); w.show();
return a.exec(); return a.exec();
} }

View File

@ -1,11 +1,4 @@
#include "picture.h" #include "picture.h"
#include "ui_picture.h"
#include <syscall.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <QDebug>
#include <QImageReader>
Picture::Picture(QWidget *parent) : Picture::Picture(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::Picture){ ui(new Ui::Picture){
@ -42,7 +35,16 @@ void Picture::changeDirectory(){
} }
void Picture::fillList() { void Picture::fillList() {
ui->fileList->clear(); ui->fileList->clear();
ui->fileList->addItems(directory.entryList()); //ui->fileList->addItems(directory.entryList());
foreach(const QString &str,directory.entryList()){
QImageReader reader(directory.absolutePath()+"/"+str);
if(!reader.format().isEmpty()){
ui->fileList->addItem(str);
}
}
if(ui->fileList->count()==0){
ui->fileList->addItem("<NO PICTURES>");
}
} }
void Picture::on_cd_clicked(){ void Picture::on_cd_clicked(){
changeDirectory(); changeDirectory();
@ -75,9 +77,6 @@ void Picture::on_refresh_clicked(){
void Picture::on_clearLog_clicked(){ void Picture::on_clearLog_clicked(){
ui->log->setText(""); ui->log->setText("");
} }
void Picture::on_erase_pressed(){
void Picture::on_erase_pressed()
{
ui->log->append("Erasing metadata from images..."); ui->log->append("Erasing metadata from images...");
} }

View File

@ -4,9 +4,19 @@
#include <QMainWindow> #include <QMainWindow>
#include <QDir> #include <QDir>
#include <QFileDialog> #include <QFileDialog>
#include "ui_picture.h"
#include "ui_preview.h"
#include <syscall.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <QDebug>
#include <QImageReader>
#include <QDialog>
namespace Ui { namespace Ui {
class Picture; class Picture;
class Preview;
} }
class Picture : public QMainWindow class Picture : public QMainWindow
@ -19,21 +29,13 @@ public:
private slots: private slots:
void changeDirectory(); void changeDirectory();
void fillList(); void fillList();
void on_cd_clicked(); void on_cd_clicked();
void on_erase_clicked(); void on_erase_clicked();
void on_refresh_clicked(); void on_refresh_clicked();
void on_clearLog_clicked(); void on_clearLog_clicked();
void on_erase_pressed(); void on_erase_pressed();
private: private:
Ui::Picture *ui; Ui::Picture *ui;
QDir directory; QDir directory;
}; };
#endif // PICTURE_H #endif // PICTURE_H

View File

@ -50,7 +50,7 @@
<widget class="QPushButton" name="erase"> <widget class="QPushButton" name="erase">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>270</x> <x>310</x>
<y>10</y> <y>10</y>
<width>124</width> <width>124</width>
<height>27</height> <height>27</height>

66
preview.ui Normal file
View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>334</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>1</x>
<y>1</y>
<width>120</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Process this picture?</string>
</property>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>1</x>
<y>22</y>
<width>431</width>
<height>311</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGraphicsView" name="image"/>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="noButton">
<property name="text">
<string>No (n)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="yesButton">
<property name="text">
<string>Yes (y)</string>
</property>
</widget>
</item>
</layout>
</widget>
<zorder>buttonBox</zorder>
<zorder>image</zorder>
<zorder>buttonBox</zorder>
<zorder>noButton</zorder>
<zorder>yesButton</zorder>
</widget>
<resources/>
<connections/>
</ui>