Skip to content

Commit

Permalink
CleanUp & Adding artwork
Browse files Browse the repository at this point in the history
  • Loading branch information
vookimedlo committed Sep 16, 2017
1 parent a8c9d29 commit b9d3167
Show file tree
Hide file tree
Showing 15 changed files with 252 additions and 124 deletions.
5 changes: 5 additions & 0 deletions LICENSE-IMAGES
@@ -0,0 +1,5 @@
All images located at src/resource/image are subject of following license [https://icon54.com/license-agreement/]

In this case, the purchaser is me [Michal Duda - @vookimedlo.cz], who is also owner of this "VookiImageViewer" project.

You are not allowed to use those images outside this project without a proper license!
59 changes: 31 additions & 28 deletions build/qmake/project.pro
@@ -1,30 +1,33 @@
#-------------------------------------------------
#
# Project created by QtCreator 2017-01-02T20:42:10
# #
#------------------------------------------------- #-------------------------------------------------

#-------------------------------------------------
QT += core gui widgets #

# Project created by QtCreator 2017-01-02T20:42:10
greaterThan(QT_MAJOR_VERSION, 5): QT += widgets #

#-------------------------------------------------
TARGET = VookiImageViever
TEMPLATE = app QT += core gui widgets


# std::make_unique is part of c++14 TARGET = VookiImageViewer
# TEMPLATE = app
CONFIG += c++14

# std::make_unique is part of c++14
SOURCES += \ #
../../src/main.cpp \ CONFIG += c++14
../../src/ui/MainWindow.cpp \
../../src/ui/ImageArea.cpp RESOURCES += \

../../src/resource/vookiimageviewer.qrc


HEADERS += \ SOURCES += \
../../src/ui/MainWindow.h \ ../../src/main.cpp \
../../src/ui/ImageArea.h ../../src/ui/MainWindow.cpp \

../../src/ui/ImageArea.cpp
FORMS += \
../../src/ui/forms/MainWindow.ui

HEADERS += \
../../src/ui/MainWindow.h \
../../src/ui/ImageArea.h

FORMS += \
../../src/ui/forms/MainWindow.ui

2 changes: 1 addition & 1 deletion src/main.cpp
@@ -1,5 +1,5 @@
#include "ui/MainWindow.h"
#include <QApplication> #include <QApplication>
#include "ui/MainWindow.h"


int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
Expand Down
Binary file added src/resource/image/Full-Screen_240px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/resource/image/Power.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/resource/image/Preferences 1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/resource/image/Search.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/resource/image/Zoom In.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/resource/image/Zoom Out.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/resource/vookiimageviewer.qrc
@@ -0,0 +1,10 @@
<RCC>
<qresource prefix="/images">
<file alias="fullscreen">image/Full-Screen_240px.png</file>
<file alias="quit">image/Power.png</file>
<file alias="preferences">image/Preferences 1.png</file>
<file alias="originalsize">image/Search.png</file>
<file alias="zoomin">image/Zoom In.png</file>
<file alias="zoomout">image/Zoom Out.png</file>
</qresource>
</RCC>
6 changes: 3 additions & 3 deletions src/ui/ImageArea.cpp
@@ -1,11 +1,12 @@
#include "ImageArea.h" #include "ImageArea.h"

#include <QColor> #include <QColor>
#include <QImage> #include <QImage>
#include <QPainter> #include <QPainter>
#include <QRect>
#include <QPaintEvent> #include <QPaintEvent>
#include <QRect>


ImageArea::ImageArea(QWidget *parent): isFitToWindow(false), scaleFactor(1.0), originalImage(), scaledImage(), finalImage(), QWidget(parent) ImageArea::ImageArea(QWidget *parent): QWidget(parent), isFitToWindow(false), scaleFactor(1.0), originalImage(), scaledImage(), finalImage()
{ {
originalImage.fill(qRgb(0, 0, 0)); originalImage.fill(qRgb(0, 0, 0));
scaledImage.fill(qRgb(0, 0, 0)); scaledImage.fill(qRgb(0, 0, 0));
Expand All @@ -22,7 +23,6 @@ bool ImageArea::showImage(const QString &fileName)
return true; return true;
} }



void ImageArea::paintEvent(QPaintEvent *event) void ImageArea::paintEvent(QPaintEvent *event)
{ {
QPainter painter(this); QPainter painter(this);
Expand Down
19 changes: 8 additions & 11 deletions src/ui/ImageArea.h
@@ -1,19 +1,11 @@
#ifndef IMAGEAREA_H #pragma once
#define IMAGEAREA_H


#include <QWidget> #include <QWidget>


class ImageArea : public QWidget class ImageArea : public QWidget
{ {
Q_OBJECT Q_OBJECT


private:
bool isFitToWindow;
double scaleFactor;
QImage originalImage;
QImage scaledImage;
QImage finalImage;

public: public:
ImageArea(QWidget *parent = 0); ImageArea(QWidget *parent = 0);


Expand All @@ -30,6 +22,11 @@ public slots:


private: private:
void scaleImage(); void scaleImage();
};


#endif // IMAGEAREA_H private:
bool isFitToWindow;
double scaleFactor;
QImage originalImage;
QImage scaledImage;
QImage finalImage;
};
47 changes: 22 additions & 25 deletions src/ui/MainWindow.cpp
@@ -1,21 +1,18 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "ui_MainWindow.h"



#include <QFileSystemModel> #include <QFileSystemModel>
#include <QPainter> #include <QPainter>


MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::MainWindow),
fileSystemModel(new QFileSystemModel()) fileSystemModel(new QFileSystemModel())
{ {
ui->setupUi(this); ui.setupUi(this);


fileSystemModel->setRootPath(QDir::currentPath()); fileSystemModel->setRootPath(QDir::currentPath());
ui->treeView->setModel(fileSystemModel); ui.treeView->setModel(fileSystemModel);
for(int i = 1; i < fileSystemModel->columnCount(); i++) for(int i = 1; i < fileSystemModel->columnCount(); i++)
ui->treeView->setColumnHidden(i, true); ui.treeView->setColumnHidden(i, true);


QStringList filters; QStringList filters;
filters << "*.JPG"; filters << "*.JPG";
Expand All @@ -35,51 +32,51 @@ MainWindow::MainWindow(QWidget *parent) :


MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete ui;
} }


void MainWindow::on_action_Quit_triggered() void MainWindow::onQuitTriggered()
{ {
close(); close();
} }


void MainWindow::on_action_FullScreen_triggered() void MainWindow::onFullScreenTriggered()
{ {
if(isFullScreen()) if(isFullScreen())
{ {
showNormal(); showNormal();
ui->toolBar->show(); ui.toolBar->show();
ui->mainToolBar->show(); ui.mainToolBar->show();
ui->dockWidget->show(); ui.dockWidget->show();
ui->statusBar->show(); ui.statusBar->show();
} }
else else
{ {
ui->toolBar->hide(); ui.toolBar->hide();
ui->mainToolBar->hide(); ui.mainToolBar->hide();
ui->dockWidget->hide(); ui.dockWidget->hide();
ui->statusBar->hide(); ui.statusBar->hide();
showFullScreen(); showFullScreen();
} }
} }


void MainWindow::on_treeView_doubleClicked(const QModelIndex &index) void MainWindow::onTreeViewDoubleClicked(const QModelIndex &index)
{ {
QString filePath = fileSystemModel->filePath(index); QString filePath = fileSystemModel->filePath(index);
ui->imageAreaWidget->showImage(filePath); ui.imageAreaWidget->showImage(filePath);
} }


void MainWindow::on_actionZoom_In_triggered() void MainWindow::onZoomInTriggered()
{ {
ui->imageAreaWidget->zoomImageIn(0.10); ui.imageAreaWidget->zoomImageIn(0.10);
} }


void MainWindow::on_actionZoom_Out_triggered() void MainWindow::onZoomOutTriggered()
{ {
ui->imageAreaWidget->zoomImageOut(0.10); ui.imageAreaWidget->zoomImageOut(0.10);
} }


void MainWindow::on_actionFi_t_to_Window_toggled(bool checked) void MainWindow::onFitToWindowToggled(bool toggled)
{ {
ui->imageAreaWidget->setFitToWindow(checked); ui.imageAreaWidget->setFitToWindow(toggled);
} }
31 changes: 10 additions & 21 deletions src/ui/MainWindow.h
@@ -1,14 +1,8 @@
#ifndef MAINWINDOW_H #pragma once
#define MAINWINDOW_H


#include <QtGui> #include "ui_MainWindow.h"
#include <QtCore>
#include <QtWidgets>

namespace Ui {
class MainWindow;
}


//Forward declarations
class QFileSystemModel; class QFileSystemModel;


class MainWindow : public QMainWindow class MainWindow : public QMainWindow
Expand All @@ -20,20 +14,15 @@ class MainWindow : public QMainWindow
~MainWindow(); ~MainWindow();


private slots: private slots:
void on_action_Quit_triggered(); void onQuitTriggered();

void onZoomInTriggered();
void on_treeView_doubleClicked(const QModelIndex &index); void onZoomOutTriggered();

void onFitToWindowToggled(bool toggled);
void on_actionZoom_In_triggered(); void onFullScreenTriggered();

void onTreeViewDoubleClicked(const QModelIndex &index);
void on_actionZoom_Out_triggered();

void on_actionFi_t_to_Window_toggled(bool arg1);


void on_action_FullScreen_triggered();
private: private:
Ui::MainWindow *ui; Ui::MainWindow ui;
QFileSystemModel *fileSystemModel; QFileSystemModel *fileSystemModel;
}; };


#endif // MAINWINDOW_H

0 comments on commit b9d3167

Please sign in to comment.