Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,067 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2014-07-26T00:35:15 | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += core gui | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
TARGET = VpkCompare | ||
TEMPLATE = app | ||
|
||
|
||
SOURCES += \ | ||
vpkcompare.cpp \ | ||
main.cpp \ | ||
dropenabledlistwidget.cpp \ | ||
ignoredfilesdialog.cpp \ | ||
addignoredfiledialog.cpp | ||
|
||
HEADERS += \ | ||
vpkcompare.h \ | ||
dropenabledlistwidget.h \ | ||
ignoredfilesdialog.h \ | ||
addignoredfiledialog.h | ||
|
||
FORMS += \ | ||
vpkcompare.ui \ | ||
ignoredfilesdialog.ui \ | ||
addignoredfiledialog.ui | ||
|
||
RESOURCES += |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "addignoredfiledialog.h" | ||
#include "ui_addignoredfiledialog.h" | ||
|
||
AddIgnoredFileDialog::AddIgnoredFileDialog(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::AddIgnoredFileDialog) | ||
{ | ||
ui->setupUi(this); | ||
} | ||
|
||
AddIgnoredFileDialog::~AddIgnoredFileDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
QString AddIgnoredFileDialog::filename() const | ||
{ | ||
return ui->filename->text(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef ADDIGNOREDFILEDIALOG_H | ||
#define ADDIGNOREDFILEDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
namespace Ui { | ||
class AddIgnoredFileDialog; | ||
} | ||
|
||
class AddIgnoredFileDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit AddIgnoredFileDialog(QWidget *parent = 0); | ||
~AddIgnoredFileDialog(); | ||
|
||
QString filename() const; | ||
|
||
private: | ||
Ui::AddIgnoredFileDialog *ui; | ||
}; | ||
|
||
#endif // ADDIGNOREDFILEDIALOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>AddIgnoredFileDialog</class> | ||
<widget class="QDialog" name="AddIgnoredFileDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>266</width> | ||
<height>73</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Enter the Name of the File to Ignore</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QLineEdit" name="filename"/> | ||
</item> | ||
<item> | ||
<widget class="QDialogButtonBox" name="buttonBox"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="standardButtons"> | ||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<spacer name="verticalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>20</width> | ||
<height>0</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>accepted()</signal> | ||
<receiver>AddIgnoredFileDialog</receiver> | ||
<slot>accept()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>248</x> | ||
<y>254</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>157</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>rejected()</signal> | ||
<receiver>AddIgnoredFileDialog</receiver> | ||
<slot>reject()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>316</x> | ||
<y>260</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>286</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#include "dropenabledlistwidget.h" | ||
|
||
#include <iostream> | ||
|
||
#include <QDir> | ||
#include <QDragEnterEvent> | ||
#include <QEvent> | ||
|
||
#include <QMimeData> | ||
|
||
DropEnabledListWidget::DropEnabledListWidget(QWidget *parent) : | ||
QListWidget(parent) | ||
{ | ||
setAcceptDrops(true); | ||
} | ||
|
||
void DropEnabledListWidget::dragEnterEvent(QDragEnterEvent *event) | ||
{ | ||
QStringList formats = event->mimeData()->formats(); | ||
for (int i = 0; i < formats.size(); ++i) | ||
{ | ||
// std::cout << formats[i].toLatin1().data() << std::endl; | ||
}//*/ | ||
if (event->mimeData()->hasFormat("application/x-qt-windows-mime;value=\"FileNameW\"")) | ||
{ | ||
event->acceptProposedAction(); | ||
//std::cout << "accepted x-qt-windows-mime proposed action" << std::endl; | ||
} | ||
else if (event->mimeData()->hasUrls()) | ||
{ | ||
event->acceptProposedAction(); | ||
//std::cout << "accepted proposed action" << std::endl; | ||
} | ||
} | ||
|
||
void DropEnabledListWidget::dragMoveEvent(QDragMoveEvent * event) | ||
{ | ||
if (event->mimeData()->hasFormat("application/x-qt-windows-mime;value=\"FileNameW\"")) | ||
{ | ||
event->acceptProposedAction(); | ||
//std::cout << "accepted proposed action" << std::endl; | ||
} | ||
else if (event->mimeData()->hasUrls()) | ||
{ | ||
event->acceptProposedAction(); | ||
//std::cout << "accepted proposed action" << std::endl; | ||
} | ||
} | ||
|
||
void DropEnabledListWidget::dropEvent(QDropEvent *event) | ||
{ | ||
//textBrowser->setPlainText(event->mimeData()->text()); | ||
//mimeTypeCombo->clear(); | ||
//mimeTypeCombo->addItems(event->mimeData()->formats()); | ||
|
||
QList<QUrl> urls = event->mimeData()->urls(); | ||
for (int i = 0; i < urls.size(); ++i) | ||
{ | ||
if (urls[i].isLocalFile()) | ||
{ | ||
QListWidgetItem *item = new QListWidgetItem(QDir::toNativeSeparators(urls[i].toLocalFile())); | ||
item->setFlags(item->flags() | Qt::ItemIsEditable); | ||
this->addItem(item); | ||
} | ||
//std::cout << urls[i].fileName().toLatin1().data() << std::endl; | ||
} | ||
|
||
//std::cout << .data() << std::endl; | ||
//this->addItem(QString::fromWCharArray((wchar_t*)event->mimeData()->data("application/x-qt-windows-mime;value=\"FileNameW\"").data())); | ||
|
||
event->acceptProposedAction(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef DROPENABLEDLISTWIDGET_H | ||
#define DROPENABLEDLISTWIDGET_H | ||
|
||
#include <QListWidget> | ||
|
||
class DropEnabledListWidget : public QListWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit DropEnabledListWidget(QWidget *parent = 0); | ||
|
||
|
||
|
||
signals: | ||
|
||
public slots: | ||
|
||
protected: | ||
virtual void dragEnterEvent(QDragEnterEvent *event); | ||
void dragMoveEvent(QDragMoveEvent * event); | ||
virtual void dropEvent(QDropEvent *event); | ||
}; | ||
|
||
#endif // DROPENABLEDLISTWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include "ignoredfilesdialog.h" | ||
#include "ui_ignoredfilesdialog.h" | ||
#include "addignoredfiledialog.h" | ||
|
||
IgnoredFilesDialog::IgnoredFilesDialog(QWidget *parent, QStringList ignore_list) : | ||
QDialog(parent), | ||
ui(new Ui::IgnoredFilesDialog) | ||
{ | ||
ui->setupUi(this); | ||
for (int i = 0; i < ignore_list.size(); ++i) | ||
{ | ||
QListWidgetItem *item = new QListWidgetItem(ignore_list[i]); | ||
item->setFlags(item->flags() | Qt::ItemIsEditable); | ||
ui->ignore_list->addItem(item); | ||
} | ||
//ui->ignore_list->insertItems(0, ignore_list); | ||
} | ||
|
||
IgnoredFilesDialog::~IgnoredFilesDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
QStringList IgnoredFilesDialog::ignoreList() const | ||
{ | ||
QStringList result; | ||
for (int i = 0; i < ui->ignore_list->count(); ++i) | ||
{ | ||
result.append(ui->ignore_list->item(i)->text()); | ||
} | ||
return result; | ||
} | ||
|
||
void IgnoredFilesDialog::on_add_clicked() | ||
{ | ||
AddIgnoredFileDialog dialog(this); | ||
//connect(dialog_, SIGNAL(accepted()), this, SLOT(on_addignoredfiledialog_accepted())); | ||
if (QDialog::Accepted == dialog.exec()) | ||
{ | ||
if (!dialog.filename().isEmpty()) | ||
{ | ||
QListWidgetItem *item = new QListWidgetItem(dialog.filename()); | ||
item->setFlags(item->flags() | Qt::ItemIsEditable); | ||
ui->ignore_list->addItem(item); | ||
//ui->ignore_list->addItem(dialog.filename()); | ||
} | ||
} | ||
} | ||
|
||
void IgnoredFilesDialog::on_remove_clicked() | ||
{ | ||
delete ui->ignore_list->takeItem(ui->ignore_list->currentRow()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef IGNOREDFILESDIALOG_H | ||
#define IGNOREDFILESDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
class AddIgnoredFileDialog; | ||
|
||
namespace Ui { | ||
class IgnoredFilesDialog; | ||
} | ||
|
||
class IgnoredFilesDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit IgnoredFilesDialog(QWidget *parent, QStringList ignore_list); | ||
~IgnoredFilesDialog(); | ||
|
||
QStringList ignoreList() const; | ||
|
||
private slots: | ||
void on_add_clicked(); | ||
|
||
void on_remove_clicked(); | ||
|
||
private: | ||
Ui::IgnoredFilesDialog *ui; | ||
}; | ||
|
||
#endif // IGNOREDFILESDIALOG_H |
Oops, something went wrong.