initial commit
@@ -1,52 +1,73 @@
|
||||
# C++ objects and libs
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
# This file is used to ignore files which are generated
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
*~
|
||||
*.autosave
|
||||
*.a
|
||||
*.la
|
||||
*.lai
|
||||
*.core
|
||||
*.moc
|
||||
*.o
|
||||
*.obj
|
||||
*.orig
|
||||
*.rej
|
||||
*.so
|
||||
*.so.*
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Qt-es
|
||||
object_script.*.Release
|
||||
object_script.*.Debug
|
||||
*_plugin_import.cpp
|
||||
*_pch.h.cpp
|
||||
*_resource.rc
|
||||
*.qm
|
||||
.#*
|
||||
*.*#
|
||||
core
|
||||
!core/
|
||||
tags
|
||||
.DS_Store
|
||||
.directory
|
||||
*.debug
|
||||
Makefile*
|
||||
*.prl
|
||||
*.app
|
||||
moc_*.cpp
|
||||
ui_*.h
|
||||
qrc_*.cpp
|
||||
Thumbs.db
|
||||
*.res
|
||||
*.rc
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
*.pro.user
|
||||
*.pro.user.*
|
||||
*.qbs.user
|
||||
*.qbs.user.*
|
||||
*.moc
|
||||
moc_*.cpp
|
||||
moc_*.h
|
||||
qrc_*.cpp
|
||||
ui_*.h
|
||||
*.qmlc
|
||||
*.jsc
|
||||
Makefile*
|
||||
*build-*
|
||||
*.qm
|
||||
*.prl
|
||||
|
||||
# Qt unit tests
|
||||
target_wrapper.*
|
||||
# qtcreator generated files
|
||||
*.pro.user*
|
||||
|
||||
# QtCreator
|
||||
*.autosave
|
||||
# xemacs temporary files
|
||||
*.flc
|
||||
|
||||
# QtCreator Qml
|
||||
*.qmlproject.user
|
||||
*.qmlproject.user.*
|
||||
# Vim temporary files
|
||||
.*.swp
|
||||
|
||||
# QtCreator CMake
|
||||
CMakeLists.txt.user*
|
||||
# Visual Studio generated files
|
||||
*.ib_pdb_index
|
||||
*.idb
|
||||
*.ilk
|
||||
*.pdb
|
||||
*.sln
|
||||
*.suo
|
||||
*.vcproj
|
||||
*vcproj.*.*.user
|
||||
*.ncb
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.vcxproj
|
||||
*vcxproj.*
|
||||
|
||||
# QtCreator 4.8< compilation database
|
||||
compile_commands.json
|
||||
# MinGW generated files
|
||||
*.Debug
|
||||
*.Release
|
||||
|
||||
# Python byte code
|
||||
*.pyc
|
||||
|
||||
# Binaries
|
||||
# --------
|
||||
*.dll
|
||||
*.exe
|
||||
|
||||
# QtCreator local machine specific files for imported projects
|
||||
*creator.user*
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
#include "ui_cmainwindow.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include <QImageReader>
|
||||
#include <QImageWriter>
|
||||
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
|
||||
|
||||
cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
ui(new Ui::cMainWindow),
|
||||
m_lpSplashScreen(lpSplashScreen)
|
||||
{
|
||||
initUI();
|
||||
createActions();
|
||||
|
||||
setImageFormats();
|
||||
}
|
||||
|
||||
cMainWindow::~cMainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
// if(m_working)
|
||||
// {
|
||||
// QMessageBox::information(this, tr("Close"), tr("Can't close, pictureConvert is working."));
|
||||
// event->ignore();
|
||||
// return;
|
||||
// }
|
||||
|
||||
QSettings settings;
|
||||
settings.setValue("main/width", QVariant::fromValue(size().width()));
|
||||
settings.setValue("main/height", QVariant::fromValue(size().height()));
|
||||
settings.setValue("main/x", QVariant::fromValue(x()));
|
||||
settings.setValue("main/y", QVariant::fromValue(y()));
|
||||
if(this->isMaximized())
|
||||
settings.setValue("main/maximized", QVariant::fromValue(true));
|
||||
else
|
||||
settings.setValue("main/maximized", QVariant::fromValue(false));
|
||||
|
||||
// settings.setValue("main/thumbnailSize", QVariant::fromValue(ui->m_lpThumbnailSize->value()));
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void cMainWindow::initUI()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
// QIcon::setThemeName("TangoMFK");
|
||||
|
||||
// m_lpFileListModel = new QStandardItemModel;
|
||||
// ui->m_lpFileList->setModel(m_lpFileListModel);
|
||||
|
||||
if(!settings.value("main/maximized").toBool())
|
||||
{
|
||||
qint32 iX = settings.value("main/x", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iY = settings.value("main/y", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iWidth = settings.value("main/width", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iHeight = settings.value("main/height", QVariant::fromValue(-1)).toInt();
|
||||
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
resize(iWidth, iHeight);
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
}
|
||||
|
||||
// m_lpProgressBar = new QProgressBar(this);
|
||||
// m_lpProgressBar->setVisible(false);
|
||||
// ui->m_lpStatusBar->addPermanentWidget(m_lpProgressBar);
|
||||
|
||||
// QStringList headerLabels = QStringList() << tr("icon") << tr("path") << tr("file") << tr("size") << tr("date") << tr("width") << tr("height") << ("");
|
||||
// m_lpFileListModel->setHorizontalHeaderLabels(headerLabels);
|
||||
}
|
||||
|
||||
void cMainWindow::createActions()
|
||||
{
|
||||
// setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
|
||||
// createFileActions();
|
||||
// createContextActions();
|
||||
|
||||
// connect(ui->m_lpFileList, &cTreeView::deleteEntrys, this, &cMainWindow::onDeleteEntrys);
|
||||
// connect(ui->m_lpThumbnailSize, &QSlider::valueChanged, this, &cMainWindow::onThumbnailSize);
|
||||
}
|
||||
|
||||
void cMainWindow::createContextActions()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::createFileActions()
|
||||
{
|
||||
// m_lpFileToolBar = addToolBar("file");
|
||||
|
||||
// const QIcon openIcon = QIcon::fromTheme("document-open");
|
||||
// m_lpOpenFileAction = m_lpFileToolBar->addAction(openIcon, tr("&Open..."), this, &cMainWindow::onAddFile);
|
||||
// m_lpOpenFileAction->setShortcut(QKeySequence::Open);
|
||||
|
||||
// const QIcon openDirectoryIcon = QIcon::fromTheme("folder");
|
||||
// m_lpOpenDirectoryAction = m_lpFileToolBar->addAction(openIcon, tr("&Open Folder..."), this, &cMainWindow::onAddFolder);
|
||||
|
||||
|
||||
// m_lpListToolBar = addToolBar("list");
|
||||
|
||||
// const QIcon deleteIcon = QIcon::fromTheme("edit-delete");
|
||||
// m_lpDeleteAction = m_lpListToolBar->addAction(deleteIcon, tr("&Delete"), this, &cMainWindow::onDeleteEntrys);
|
||||
// m_lpDeleteAction->setShortcut(QKeySequence::Delete);
|
||||
|
||||
// const QIcon clearIcon = QIcon::fromTheme("edit-clear");
|
||||
// m_lpClearAction = m_lpListToolBar->addAction(clearIcon, tr("&Clear"), this, &cMainWindow::onClearList);
|
||||
|
||||
|
||||
// m_lpActionToolBar = addToolBar("action");
|
||||
|
||||
// const QIcon convertIcon = QIcon::fromTheme("system-run");
|
||||
// m_lpConvertAction = m_lpActionToolBar->addAction(convertIcon, tr("&Convert"), this, &cMainWindow::onConvert);
|
||||
// m_lpConvertAction->setShortcut(QKeySequence::Delete);
|
||||
|
||||
// const QIcon stopIcon = QIcon::fromTheme("process-stop");
|
||||
// m_lpStopAction = m_lpActionToolBar->addAction(stopIcon, tr("&Stop"), this, &cMainWindow::onStop);
|
||||
}
|
||||
|
||||
void cMainWindow::setImageFormats()
|
||||
{
|
||||
QList<QByteArray> readList = QImageReader::supportedImageFormats();
|
||||
QList<QByteArray> writeList = QImageWriter::supportedImageFormats();
|
||||
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
db.setHostName("localhost");
|
||||
db.setDatabaseName("picturePrint.db");
|
||||
|
||||
if(!db.open())
|
||||
return;
|
||||
|
||||
QSqlQuery query;
|
||||
|
||||
query.prepare("SELECT shortname, description, extension FROM imageFormat;");
|
||||
if(!query.exec())
|
||||
{
|
||||
db.close();
|
||||
return;
|
||||
}
|
||||
|
||||
while(query.next())
|
||||
addImageFormat(query.value("shortname").toString(), query.value("description").toString(), query.value("extension").toString(), readList, writeList);
|
||||
|
||||
db.close();
|
||||
}
|
||||
|
||||
void cMainWindow::addImageFormat(const QString& shortName, const QString& description, const QString& extension, QList<QByteArray>& readList, QList<QByteArray>& writeList)
|
||||
{
|
||||
bool r = readList.contains(QByteArray(shortName.toUtf8()));
|
||||
bool w = writeList.contains(QByteArray(shortName.toUtf8()));
|
||||
|
||||
if(QString(shortName).isEmpty())
|
||||
r = true;
|
||||
|
||||
IMAGEFORMAT i;
|
||||
i.shortName = shortName;
|
||||
i.description = description;
|
||||
i.extension = extension;
|
||||
i.read = r;
|
||||
i.write = w;
|
||||
m_imageFormats.append(i);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef CMAINWINDOW_H
|
||||
#define CMAINWINDOW_H
|
||||
|
||||
|
||||
#include "csplashscreen.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QCloseEvent>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class cMainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
class cMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent = nullptr);
|
||||
~cMainWindow();
|
||||
|
||||
private:
|
||||
Ui::cMainWindow* ui;
|
||||
cSplashScreen* m_lpSplashScreen;
|
||||
|
||||
QList<IMAGEFORMAT> m_imageFormats;
|
||||
|
||||
void initUI();
|
||||
void createActions();
|
||||
void createFileActions();
|
||||
void createContextActions();
|
||||
|
||||
void setImageFormats();
|
||||
void addImageFormat(const QString& shortName, const QString& description, const QString& extension, QList<QByteArray>& readList, QList<QByteArray>& writeList);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
};
|
||||
#endif // CMAINWINDOW_H
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>cMainWindow</class>
|
||||
<widget class="QMainWindow" name="cMainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1 @@
|
||||
#include "common.h"
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __PRETTY_FUNCTION__ << ":"
|
||||
#elif __MINGW32__
|
||||
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __PRETTY_FUNCTION__ << ":"
|
||||
#else
|
||||
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __FUNCTION__ << ":"
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct tagIMAGEFORMAT
|
||||
{
|
||||
QString shortName;
|
||||
QString description;
|
||||
QString extension;
|
||||
bool read;
|
||||
bool write;
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\typedef IMAGEFORMAT*/
|
||||
} IMAGEFORMAT;
|
||||
|
||||
|
||||
#endif // COMMON_H
|
||||
@@ -0,0 +1,68 @@
|
||||
/*!
|
||||
\file csplashscreen.cpp
|
||||
|
||||
*/
|
||||
|
||||
#include "csplashscreen.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <QStyleOptionProgressBar>
|
||||
|
||||
|
||||
cSplashScreen::cSplashScreen(const QPixmap& pixmap, QFont& font) :
|
||||
QSplashScreen(pixmap),
|
||||
m_iMax(100),
|
||||
m_iProgress(0)
|
||||
{
|
||||
setFont(font);
|
||||
m_textDocument.setDefaultFont(font);
|
||||
}
|
||||
|
||||
void cSplashScreen::setMax(qint32 max)
|
||||
{
|
||||
m_iMax = max;
|
||||
}
|
||||
|
||||
void cSplashScreen::drawContents(QPainter *painter)
|
||||
{
|
||||
painter->translate(m_rect.topLeft());
|
||||
m_textDocument.setHtml(m_szMessage);
|
||||
m_textDocument.drawContents(painter);
|
||||
|
||||
QStyleOptionProgressBar pbstyle;
|
||||
pbstyle.initFrom(this);
|
||||
pbstyle.state = QStyle::State_Enabled;
|
||||
pbstyle.textVisible = false;
|
||||
pbstyle.minimum = 0;
|
||||
pbstyle.maximum = m_iMax;
|
||||
pbstyle.progress = m_iProgress;
|
||||
pbstyle.invertedAppearance = false;
|
||||
pbstyle.rect = QRect(0, 330, 390, 10); // Where is it.
|
||||
|
||||
// Draw it...
|
||||
style()->drawControl(QStyle::CE_ProgressBar, &pbstyle, painter, this);
|
||||
}
|
||||
|
||||
void cSplashScreen::showStatusMessage(const QString& message)
|
||||
{
|
||||
m_szMessage = message;
|
||||
showMessage(m_szMessage);
|
||||
}
|
||||
|
||||
void cSplashScreen::addStatusMessage(const QString& message)
|
||||
{
|
||||
m_szMessage.append(message);
|
||||
showMessage(m_szMessage);
|
||||
}
|
||||
|
||||
void cSplashScreen::setMessageRect(QRect rect)
|
||||
{
|
||||
m_rect = rect;
|
||||
m_textDocument.setTextWidth(rect.width());
|
||||
}
|
||||
|
||||
void cSplashScreen::setProgress(int value)
|
||||
{
|
||||
m_iProgress = value;
|
||||
update();
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*!
|
||||
\file csplashscreen.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CSPLASHSCREEN_H
|
||||
#define CSPLASHSCREEN_H
|
||||
|
||||
|
||||
#include <QSplashScreen>
|
||||
#include <QPainter>
|
||||
#include <QTextDocument>
|
||||
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cSplashScreen csplashscreen.h "csplashscreen.h"
|
||||
*/
|
||||
class cSplashScreen : public QSplashScreen
|
||||
{
|
||||
public:
|
||||
cSplashScreen(const QPixmap& pixmap, QFont &font);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn drawContents
|
||||
\param painter
|
||||
*/
|
||||
virtual void drawContents(QPainter *painter);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn showStatusMessage
|
||||
\param message
|
||||
*/
|
||||
void showStatusMessage(const QString &message);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn addStatusMessage
|
||||
\param message
|
||||
*/
|
||||
void addStatusMessage(const QString &message);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setMessageRect
|
||||
\param rect
|
||||
*/
|
||||
void setMessageRect(QRect rect);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setMax
|
||||
\param max
|
||||
*/
|
||||
void setMax(qint32 max);
|
||||
|
||||
private:
|
||||
QTextDocument m_textDocument; /*!< TODO: describe */
|
||||
QString m_szMessage; /*!< TODO: describe */
|
||||
QRect m_rect; /*!< TODO: describe */
|
||||
qint32 m_iMax; /*!< TODO: describe */
|
||||
qint32 m_iProgress; /*!< TODO: describe */
|
||||
public slots:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setProgress
|
||||
\param value
|
||||
*/
|
||||
void setProgress(int value);
|
||||
};
|
||||
|
||||
#endif // CSPLASHSCREEN_H
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 796 B |
|
After Width: | Height: | Size: 897 B |
|
After Width: | Height: | Size: 686 B |
|
After Width: | Height: | Size: 628 B |
|
After Width: | Height: | Size: 477 B |
|
After Width: | Height: | Size: 672 B |
|
After Width: | Height: | Size: 684 B |
|
After Width: | Height: | Size: 779 B |
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 756 B |
|
After Width: | Height: | Size: 866 B |
|
After Width: | Height: | Size: 911 B |
|
After Width: | Height: | Size: 773 B |
|
After Width: | Height: | Size: 498 B |
|
After Width: | Height: | Size: 807 B |
|
After Width: | Height: | Size: 680 B |
|
After Width: | Height: | Size: 776 B |
|
After Width: | Height: | Size: 617 B |
|
After Width: | Height: | Size: 561 B |
|
After Width: | Height: | Size: 591 B |
|
After Width: | Height: | Size: 441 B |
|
After Width: | Height: | Size: 650 B |
|
After Width: | Height: | Size: 635 B |
|
After Width: | Height: | Size: 436 B |
|
After Width: | Height: | Size: 435 B |
|
After Width: | Height: | Size: 330 B |
|
After Width: | Height: | Size: 317 B |
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 342 B |
|
After Width: | Height: | Size: 705 B |
|
After Width: | Height: | Size: 619 B |
|
After Width: | Height: | Size: 611 B |
|
After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 663 B |
|
After Width: | Height: | Size: 683 B |
|
After Width: | Height: | Size: 666 B |
|
After Width: | Height: | Size: 606 B |
|
After Width: | Height: | Size: 723 B |
|
After Width: | Height: | Size: 685 B |
|
After Width: | Height: | Size: 676 B |
|
After Width: | Height: | Size: 655 B |
|
After Width: | Height: | Size: 636 B |
|
After Width: | Height: | Size: 652 B |
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 681 B |
|
After Width: | Height: | Size: 882 B |
|
After Width: | Height: | Size: 756 B |
|
After Width: | Height: | Size: 619 B |
|
After Width: | Height: | Size: 868 B |
|
After Width: | Height: | Size: 693 B |
|
After Width: | Height: | Size: 540 B |
|
After Width: | Height: | Size: 628 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 660 B |
|
After Width: | Height: | Size: 429 B |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 764 B |
|
After Width: | Height: | Size: 782 B |
|
After Width: | Height: | Size: 770 B |
|
After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 764 B |
|
After Width: | Height: | Size: 799 B |
|
After Width: | Height: | Size: 935 B |
|
After Width: | Height: | Size: 534 B |
|
After Width: | Height: | Size: 514 B |
|
After Width: | Height: | Size: 650 B |
|
After Width: | Height: | Size: 912 B |
|
After Width: | Height: | Size: 583 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 686 B |
|
After Width: | Height: | Size: 558 B |
|
After Width: | Height: | Size: 574 B |
|
After Width: | Height: | Size: 932 B |
|
After Width: | Height: | Size: 422 B |
|
After Width: | Height: | Size: 550 B |
|
After Width: | Height: | Size: 474 B |
|
After Width: | Height: | Size: 928 B |
|
After Width: | Height: | Size: 603 B |
|
After Width: | Height: | Size: 652 B |
|
After Width: | Height: | Size: 720 B |
|
After Width: | Height: | Size: 553 B |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 452 B |
|
After Width: | Height: | Size: 650 B |
|
After Width: | Height: | Size: 734 B |
|
After Width: | Height: | Size: 707 B |
|
After Width: | Height: | Size: 757 B |
|
After Width: | Height: | Size: 793 B |