Fixes directory problem with drag and rop
This commit is contained in:
parent
dd1400e35d
commit
5e400c5d51
@ -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
|
||||
|
@ -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>
|
||||
|
46
picture.cpp
46
picture.cpp
@ -16,22 +16,20 @@ Picture::~Picture(){
|
||||
delete ui;
|
||||
}
|
||||
void Picture::dragEnterEvent(QDragEnterEvent *event){
|
||||
if(event->mimeData()->hasUrls()){
|
||||
event->acceptProposedAction();
|
||||
|
||||
}
|
||||
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{
|
||||
// qDebug()<<fileName;
|
||||
//}
|
||||
//qDebug() << "Dropped file:" << fileName;
|
||||
}
|
||||
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{
|
||||
// qDebug()<<fileName;
|
||||
//}
|
||||
//qDebug() << "Dropped file:" << fileName;
|
||||
}
|
||||
}
|
||||
|
||||
void Picture::changeDirectory(){
|
||||
@ -62,23 +60,15 @@ void Picture::on_cd_clicked(){
|
||||
}
|
||||
void Picture::on_erase_clicked(){
|
||||
bool ignored=false;
|
||||
QStringList myStringList;
|
||||
for (int i = 0; i < ui->fileList->count(); ++i)
|
||||
myStringList.append(ui->fileList->item(i)->text());
|
||||
qDebug() << myStringList;
|
||||
QStringList myStringList;
|
||||
for (int i = 0; i < ui->fileList->count(); ++i)
|
||||
myStringList.append(ui->fileList->item(i)->text());
|
||||
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();
|
||||
|
@ -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">
|
||||
|
66
preview.ui
66
preview.ui
@ -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>
|
Loading…
Reference in New Issue
Block a user