Permalink
Browse files

CleanUp & Adding artwork

  • Loading branch information...
vookimedlo committed Sep 16, 2017
1 parent a8c9d29 commit b9d316731934df12968bbe5a2daa61a622a25c74
@@ -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!
@@ -1,30 +1,33 @@
#-------------------------------------------------
#
# Project created by QtCreator 2017-01-02T20:42:10
#
#-------------------------------------------------
QT += core gui widgets
greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
TARGET = VookiImageViever
TEMPLATE = app
# std::make_unique is part of c++14
#
CONFIG += c++14
SOURCES += \
../../src/main.cpp \
../../src/ui/MainWindow.cpp \
../../src/ui/ImageArea.cpp
HEADERS += \
../../src/ui/MainWindow.h \
../../src/ui/ImageArea.h
FORMS += \
../../src/ui/forms/MainWindow.ui
#-------------------------------------------------
#
# Project created by QtCreator 2017-01-02T20:42:10
#
#-------------------------------------------------
QT += core gui widgets
TARGET = VookiImageViewer
TEMPLATE = app
# std::make_unique is part of c++14
#
CONFIG += c++14
RESOURCES += \
../../src/resource/vookiimageviewer.qrc
SOURCES += \
../../src/main.cpp \
../../src/ui/MainWindow.cpp \
../../src/ui/ImageArea.cpp
HEADERS += \
../../src/ui/MainWindow.h \
../../src/ui/ImageArea.h
FORMS += \
../../src/ui/forms/MainWindow.ui
@@ -1,5 +1,5 @@
#include "ui/MainWindow.h"
#include <QApplication>
#include "ui/MainWindow.h"
int main(int argc, char *argv[])
{
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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>
@@ -1,11 +1,12 @@
#include "ImageArea.h"
#include <QColor>
#include <QImage>
#include <QPainter>
#include <QRect>
#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));
scaledImage.fill(qRgb(0, 0, 0));
@@ -22,7 +23,6 @@ bool ImageArea::showImage(const QString &fileName)
return true;
}
void ImageArea::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
@@ -1,19 +1,11 @@
#ifndef IMAGEAREA_H
#define IMAGEAREA_H
#pragma once
#include <QWidget>
class ImageArea : public QWidget
{
Q_OBJECT
private:
bool isFitToWindow;
double scaleFactor;
QImage originalImage;
QImage scaledImage;
QImage finalImage;
public:
ImageArea(QWidget *parent = 0);
@@ -30,6 +22,11 @@ public slots:
private:
void scaleImage();
};
#endif // IMAGEAREA_H
private:
bool isFitToWindow;
double scaleFactor;
QImage originalImage;
QImage scaledImage;
QImage finalImage;
};
@@ -1,21 +1,18 @@
#include "MainWindow.h"
#include "ui_MainWindow.h"
#include <QFileSystemModel>
#include <QPainter>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
fileSystemModel(new QFileSystemModel())
{
ui->setupUi(this);
ui.setupUi(this);
fileSystemModel->setRootPath(QDir::currentPath());
ui->treeView->setModel(fileSystemModel);
ui.treeView->setModel(fileSystemModel);
for(int i = 1; i < fileSystemModel->columnCount(); i++)
ui->treeView->setColumnHidden(i, true);
ui.treeView->setColumnHidden(i, true);
QStringList filters;
filters << "*.JPG";
@@ -35,51 +32,51 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_action_Quit_triggered()
void MainWindow::onQuitTriggered()
{
close();
}
void MainWindow::on_action_FullScreen_triggered()
void MainWindow::onFullScreenTriggered()
{
if(isFullScreen())
{
showNormal();
ui->toolBar->show();
ui->mainToolBar->show();
ui->dockWidget->show();
ui->statusBar->show();
ui.toolBar->show();
ui.mainToolBar->show();
ui.dockWidget->show();
ui.statusBar->show();
}
else
{
ui->toolBar->hide();
ui->mainToolBar->hide();
ui->dockWidget->hide();
ui->statusBar->hide();
ui.toolBar->hide();
ui.mainToolBar->hide();
ui.dockWidget->hide();
ui.statusBar->hide();
showFullScreen();
}
}
void MainWindow::on_treeView_doubleClicked(const QModelIndex &index)
void MainWindow::onTreeViewDoubleClicked(const QModelIndex &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);
}
@@ -1,14 +1,8 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#pragma once
#include <QtGui>
#include <QtCore>
#include <QtWidgets>
namespace Ui {
class MainWindow;
}
#include "ui_MainWindow.h"
//Forward declarations
class QFileSystemModel;
class MainWindow : public QMainWindow
@@ -20,20 +14,15 @@ class MainWindow : public QMainWindow
~MainWindow();
private slots:
void on_action_Quit_triggered();
void on_treeView_doubleClicked(const QModelIndex &index);
void on_actionZoom_In_triggered();
void on_actionZoom_Out_triggered();
void on_actionFi_t_to_Window_toggled(bool arg1);
void onQuitTriggered();
void onZoomInTriggered();
void onZoomOutTriggered();
void onFitToWindowToggled(bool toggled);
void onFullScreenTriggered();
void onTreeViewDoubleClicked(const QModelIndex &index);
void on_action_FullScreen_triggered();
private:
Ui::MainWindow *ui;
Ui::MainWindow ui;
QFileSystemModel *fileSystemModel;
};
#endif // MAINWINDOW_H
Oops, something went wrong.

0 comments on commit b9d3167

Please sign in to comment.