-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first commit
- Loading branch information
Showing
30 changed files
with
21,267 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,34 @@ | ||
#include <QDebug> | ||
#include <QUrl> | ||
#include "dropgraphicsscene.h" | ||
|
||
dropGraphicsScene::dropGraphicsScene(QObject* parent) : QGraphicsScene(parent) | ||
{} | ||
|
||
void dropGraphicsScene::dragEnterEvent(QDragEnterEvent *event) | ||
{ | ||
event->acceptProposedAction(); | ||
} | ||
|
||
void dropGraphicsScene::dragMoveEvent(QDragMoveEvent *event) | ||
{ | ||
// event->acceptProposedAction(); | ||
} | ||
|
||
void dropGraphicsScene::dropEvent(QDropEvent *event) | ||
{ | ||
|
||
const QMimeData* mimeData = event->mimeData(); | ||
|
||
// check if it is an image file | ||
if (mimeData->hasUrls()) | ||
{ | ||
clear(); | ||
addPixmap(QPixmap(QUrl(mimeData->text()).toLocalFile()).scaled(this->width(), this->height(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation)); | ||
event->acceptProposedAction(); | ||
} | ||
} | ||
|
||
dropGraphicsScene::~dropGraphicsScene() | ||
{} | ||
|
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 _DROPGRAPHICSSCENE_H_ | ||
#define _DROPGRAPHICSSCENE_H_ | ||
|
||
#include <QDragEnterEvent> | ||
#include <QDragMoveEvent> | ||
#include <QDropEvent> | ||
#include <QGraphicsScene> | ||
#include <QMimeData> | ||
|
||
class dropGraphicsScene : public QGraphicsScene | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit dropGraphicsScene(QObject *parent = 0); | ||
~dropGraphicsScene(); | ||
|
||
private: | ||
QGraphicsScene scene; | ||
|
||
protected: | ||
void dragEnterEvent(QDragEnterEvent *event); | ||
void dragMoveEvent(QDragMoveEvent *event); | ||
void dropEvent(QDropEvent *event); | ||
|
||
protected slots: | ||
|
||
public slots: | ||
}; | ||
|
||
#endif /*_DROPGRAPHICSSCENE_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,44 @@ | ||
#include <QDebug> | ||
#include <QUrl> | ||
#include "dropgraphicsview.h" | ||
|
||
dropGraphicsView::dropGraphicsView(QWidget* parent) : QGraphicsView(parent) | ||
{ | ||
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | ||
this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | ||
this->setFrameShape(QFrame::Box); | ||
this->setFrameShadow(QFrame::Plain); | ||
this->setScene(&scene); | ||
scene.clear(); | ||
scene.addRect(QRect(0, 0, this->width(), this->height()), QPen(Qt::black), QBrush(Qt::SolidPattern)); | ||
} | ||
|
||
void dropGraphicsView::dragEnterEvent(QDragEnterEvent *event) | ||
{ | ||
event->acceptProposedAction(); | ||
} | ||
|
||
void dropGraphicsView::dragMoveEvent(QDragMoveEvent *event) | ||
{ | ||
event->acceptProposedAction(); | ||
} | ||
|
||
void dropGraphicsView::dropEvent(QDropEvent *event) | ||
{ | ||
const QMimeData* mimeData = event->mimeData(); | ||
scene.clear(); | ||
currentFile = QUrl(mimeData->text()).toLocalFile().trimmed(); | ||
scene.addPixmap(QPixmap(currentFile).scaled(this->width()-4, this->height()-4, Qt::IgnoreAspectRatio,Qt::SmoothTransformation)); | ||
event->acceptProposedAction(); | ||
} | ||
|
||
void dropGraphicsView::setImage(QString file) | ||
{ | ||
scene.clear(); | ||
currentFile = file; | ||
scene.addPixmap(QPixmap(currentFile).scaled(this->width()-4, this->height()-4, Qt::IgnoreAspectRatio,Qt::SmoothTransformation)); | ||
} | ||
|
||
dropGraphicsView::~dropGraphicsView() | ||
{} | ||
|
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,34 @@ | ||
#ifndef _DROPGRAPHICSVIEW_H_ | ||
#define _DROPGRAPHICSVIEW_H_ | ||
|
||
#include <QDragEnterEvent> | ||
#include <QDragMoveEvent> | ||
#include <QDropEvent> | ||
#include <QGraphicsView> | ||
#include <QMimeData> | ||
#include "dropgraphicsscene.h" | ||
|
||
class dropGraphicsView : public QGraphicsView | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit dropGraphicsView(QWidget *parent = 0); | ||
void setImage(QString file); | ||
QString currentFile; | ||
~dropGraphicsView(); | ||
|
||
private: | ||
dropGraphicsScene scene; | ||
|
||
protected: | ||
void dragEnterEvent(QDragEnterEvent *event); | ||
void dragMoveEvent(QDragMoveEvent *event); | ||
void dropEvent(QDropEvent *event); | ||
|
||
protected slots: | ||
|
||
public slots: | ||
}; | ||
|
||
#endif /*_DROPGRAPHICSVIEW_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,14 @@ | ||
#include <QApplication> | ||
#include "qkontrol.h" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication app(argc, argv); | ||
app.setApplicationName("qKontrol"); | ||
app.setWindowIcon(QIcon(":/images/qkontrol.ico")); | ||
qkontrolWindow win; | ||
win.show(); | ||
app.setQuitOnLastWindowClosed(true); | ||
|
||
return app.exec(); | ||
} |
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,38 @@ | ||
#include <QDialog> | ||
#include <QDir> | ||
#include <QSettings> | ||
#include "oscdialog.h" | ||
|
||
oscDialog::oscDialog(QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags) | ||
{ | ||
setupUi(this); | ||
|
||
// restore settings from INI file if it exists and update values | ||
if(QFile(QDir::homePath() + "/.qkontrol/osc.ini").exists()) | ||
{ | ||
QSettings* settings = new QSettings(QDir::homePath() + "/.qkontrol/osc.ini", QSettings::IniFormat); | ||
checkBoxOSC->setChecked(settings->value("enabled").toBool()); | ||
hostname->setText(settings->value("hostname").toString()); | ||
spinBoxLocalport->setValue(settings->value("local").toInt()); | ||
spinBoxRemoteport->setValue(settings->value("remote").toInt()); | ||
} | ||
|
||
connect(applyButton, SIGNAL(clicked()), this, SLOT(saveAndClose())); | ||
} | ||
|
||
// write dialog settings into INI file and close the dialog | ||
void oscDialog::saveAndClose() | ||
{ | ||
QSettings* settings = new QSettings(QDir::homePath() + "/.qkontrol/osc.ini", QSettings::IniFormat); | ||
settings->setValue("enabled", checkBoxOSC->isChecked()); | ||
settings->setValue("hostname", hostname->text()); | ||
settings->setValue("local", spinBoxLocalport->value()); | ||
settings->setValue("remote", spinBoxRemoteport->value()); | ||
accept(); | ||
} | ||
|
||
oscDialog::~oscDialog() | ||
{ | ||
|
||
} | ||
|
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 _OSCDIALOG_H_ | ||
#define _OSCDIALOG_H_ | ||
|
||
#include "ui_oscdialog.h" | ||
|
||
class oscDialog : public QDialog, public Ui_oscDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
oscDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); | ||
~oscDialog(); | ||
|
||
private: | ||
|
||
private slots: | ||
void saveAndClose(); | ||
|
||
protected slots: | ||
|
||
public slots: | ||
}; | ||
|
||
#endif /*_OSCDIALOG_H_*/ |
Oops, something went wrong.