Fixes directory problem with drag and rop

This commit is contained in:
Austen Adler 2014-06-20 13:39:10 -04:00
parent dd1400e35d
commit 5e400c5d51
5 changed files with 22 additions and 101 deletions

View File

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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-06-18T20:10:29. -->
<!-- Written by QtCreator 3.0.1, 2014-06-20T13:04:41. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@ -18,13 +18,11 @@ Picture::~Picture(){
void Picture::dragEnterEvent(QDragEnterEvent *event){
if(event->mimeData()->hasUrls()){
event->acceptProposedAction();
}
}
void Picture::dropEvent(QDropEvent *event){
foreach (const QUrl &url, event->mimeData()->urls()) {
const QString &fileName = url.toLocalFile();
//if(fileName.contains(QRegExp("\.(?i)(jpe?g|png|gif)$"))){
ui->fileList->addItem(fileName);
//}else{
@ -68,17 +66,9 @@ void Picture::on_erase_clicked(){
qDebug() << myStringList;
//foreach(const QString &str,directory.entryList()){
foreach(const QString &str,myStringList){
QString tmp=QString("exiv2 rm ");
QImageReader reader(directory.absolutePath()+"/"+str);
QImageReader reader(str);
if(!reader.format().isEmpty()){
tmp+=directory.absolutePath()+"/"+str+">>/tmp/log";
std::string tmp2=tmp.toStdString();
char* a=new char[tmp2.size()+1];
a[tmp2.size()]=0;
memcpy(a,tmp2.c_str(),tmp2.size());
//exec(a);
//ui->log->append(str);
QString fullPath=directory.absolutePath()+"/"+str;
QString fullPath=str;
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString());
assert (image.get() != 0);
image->readMetadata();

View File

@ -19,8 +19,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>393</width>
<height>279</height>
<width>521</width>
<height>411</height>
</rect>
</property>
<property name="currentIndex">
@ -75,8 +75,6 @@
</layout>
</item>
</layout>
<zorder>layoutWidget</zorder>
<zorder>layoutWidget</zorder>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">

View File

@ -1,66 +0,0 @@
<?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>