Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
first commit
  • Loading branch information
GoaSkin committed Apr 4, 2020
1 parent 939891f commit a92e904
Show file tree
Hide file tree
Showing 30 changed files with 21,267 additions and 0 deletions.
Binary file added source/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions source/dropgraphicsscene.cpp
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()
{}

31 changes: 31 additions & 0 deletions source/dropgraphicsscene.h
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_*/
44 changes: 44 additions & 0 deletions source/dropgraphicsview.cpp
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()
{}

34 changes: 34 additions & 0 deletions source/dropgraphicsview.h
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_*/
14 changes: 14 additions & 0 deletions source/main.cpp
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();
}
38 changes: 38 additions & 0 deletions source/oscdialog.cpp
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()
{

}

24 changes: 24 additions & 0 deletions source/oscdialog.h
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_*/
Loading

0 comments on commit a92e904

Please sign in to comment.