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
|
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
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!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>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
46
picture.cpp
46
picture.cpp
@ -16,22 +16,20 @@ Picture::~Picture(){
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
void Picture::dragEnterEvent(QDragEnterEvent *event){
|
void Picture::dragEnterEvent(QDragEnterEvent *event){
|
||||||
if(event->mimeData()->hasUrls()){
|
if(event->mimeData()->hasUrls()){
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void Picture::dropEvent(QDropEvent *event){
|
void Picture::dropEvent(QDropEvent *event){
|
||||||
foreach (const QUrl &url, event->mimeData()->urls()) {
|
foreach (const QUrl &url, event->mimeData()->urls()) {
|
||||||
const QString &fileName = url.toLocalFile();
|
const QString &fileName = url.toLocalFile();
|
||||||
|
//if(fileName.contains(QRegExp("\.(?i)(jpe?g|png|gif)$"))){
|
||||||
//if(fileName.contains(QRegExp("\.(?i)(jpe?g|png|gif)$"))){
|
ui->fileList->addItem(fileName);
|
||||||
ui->fileList->addItem(fileName);
|
//}else{
|
||||||
//}else{
|
// qDebug()<<fileName;
|
||||||
// qDebug()<<fileName;
|
//}
|
||||||
//}
|
//qDebug() << "Dropped file:" << fileName;
|
||||||
//qDebug() << "Dropped file:" << fileName;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Picture::changeDirectory(){
|
void Picture::changeDirectory(){
|
||||||
@ -62,23 +60,15 @@ void Picture::on_cd_clicked(){
|
|||||||
}
|
}
|
||||||
void Picture::on_erase_clicked(){
|
void Picture::on_erase_clicked(){
|
||||||
bool ignored=false;
|
bool ignored=false;
|
||||||
QStringList myStringList;
|
QStringList myStringList;
|
||||||
for (int i = 0; i < ui->fileList->count(); ++i)
|
for (int i = 0; i < ui->fileList->count(); ++i)
|
||||||
myStringList.append(ui->fileList->item(i)->text());
|
myStringList.append(ui->fileList->item(i)->text());
|
||||||
qDebug() << myStringList;
|
qDebug() << myStringList;
|
||||||
//foreach(const QString &str,directory.entryList()){
|
//foreach(const QString &str,directory.entryList()){
|
||||||
foreach(const QString &str,myStringList){
|
foreach(const QString &str,myStringList){
|
||||||
QString tmp=QString("exiv2 rm ");
|
QImageReader reader(str);
|
||||||
QImageReader reader(directory.absolutePath()+"/"+str);
|
|
||||||
if(!reader.format().isEmpty()){
|
if(!reader.format().isEmpty()){
|
||||||
tmp+=directory.absolutePath()+"/"+str+">>/tmp/log";
|
QString fullPath=str;
|
||||||
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;
|
|
||||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString());
|
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fullPath.toStdString());
|
||||||
assert (image.get() != 0);
|
assert (image.get() != 0);
|
||||||
image->readMetadata();
|
image->readMetadata();
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>393</width>
|
<width>521</width>
|
||||||
<height>279</height>
|
<height>411</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
@ -75,8 +75,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
<zorder>layoutWidget</zorder>
|
|
||||||
<zorder>layoutWidget</zorder>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_2">
|
<widget class="QWidget" name="tab_2">
|
||||||
<attribute name="title">
|
<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