Permalink
Browse files

Merge branch 'develop'

Added:
 Menu item 'File' -> 'Close All'.
 Save last directory and filter index in dialogs.
 Show original and new size in Resize dialog.
 Filters *.cpp and *.h in save conversion results dialog.
 Selection tool (mouse left, middle and right buttons).
 Moving tool for selected area or entire image.

Changed:
 Get changelog from server with versioning.
 Processing of mouse movements also outside the borders of the image.
 If there is selected area, tools line/rect/fill/pen used only inside it.

Fixed:
 Alpha-channel in Preview dialog for color presets.
 Save last scale value in Preview dialog.
 Preserve spaces for image suffix/prefix/delimiter in preset xml export/import.
 Some optimization in JS script evaluation and in dialog Options -> Conversion.
 Xml file not opened twice. Instead, tab with this file is actived.
  • Loading branch information...
riuson committed Oct 12, 2016
2 parents 29a5a98 + e8535c6 commit 466b2e23a03ccf57597fbae90b918ee75a3ebf5e
Showing with 3,648 additions and 762 deletions.
  1. +88 −4 classes/action-handlers/actionfilehandlers.cpp
  2. +2 −0 classes/action-handlers/actionfilehandlers.h
  3. +21 −196 classes/data/imagesmodel.cpp
  4. +2 −16 classes/data/imagesmodel.h
  5. +86 −0 classes/data/imagesscaledproxy.cpp
  6. +45 −0 classes/data/imagesscaledproxy.h
  7. +74 −0 classes/data/transposeproxy.cpp
  8. +46 −0 classes/data/transposeproxy.h
  9. +3 −9 classes/imageeditor/editor.cpp
  10. +0 −2 classes/imageeditor/editor.h
  11. +2 −0 classes/imageeditor/iimageeditorparams.h
  12. +2 −1 classes/imageeditor/iimageeditortool.h
  13. +46 −0 classes/imageeditor/iimageselection.h
  14. +3 −2 classes/imageeditor/toolcolor.cpp
  15. +2 −1 classes/imageeditor/toolcolor.h
  16. +6 −2 classes/imageeditor/toolfill.cpp
  17. +2 −1 classes/imageeditor/toolfill.h
  18. +34 −31 classes/imageeditor/toolline.cpp
  19. +2 −1 classes/imageeditor/toolline.h
  20. +326 −0 classes/imageeditor/toolmove.cpp
  21. +97 −0 classes/imageeditor/toolmove.h
  22. +6 −2 classes/imageeditor/toolpen.cpp
  23. +2 −1 classes/imageeditor/toolpen.h
  24. +34 −31 classes/imageeditor/toolrect.cpp
  25. +2 −1 classes/imageeditor/toolrect.h
  26. +276 −0 classes/imageeditor/toolselect.cpp
  27. +107 −0 classes/imageeditor/toolselect.h
  28. +12 −0 classes/imageeditor/toolsmanager.cpp
  29. +8 −1 classes/imageeditor/toolsmanager.h
  30. +3 −2 classes/imageeditor/toolzoom.cpp
  31. +2 −1 classes/imageeditor/toolzoom.h
  32. +24 −9 classes/operations/imageexport.cpp
  33. +3 −0 classes/operations/imageimport.cpp
  34. +21 −0 classes/parser/convert/bitmaphelper.cpp
  35. +2 −0 classes/parser/convert/bitmaphelper.h
  36. +34 −3 classes/parser/convert/converterhelper.cpp
  37. +8 −4 classes/parser/convert/convimage.cpp
  38. +4 −2 classes/parser/convert/convimage.h
  39. +44 −0 classes/settings/conversionpreviewoptions.cpp
  40. +36 −0 classes/settings/conversionpreviewoptions.h
  41. +145 −0 classes/settings/filedialogoptions.cpp
  42. +61 −0 classes/settings/filedialogoptions.h
  43. +27 −6 classes/settings/presets/imageoptions.cpp
  44. +14 −7 controls/fonts/font-editor/editortabfont.cpp
  45. +2 −0 controls/fonts/font-editor/editortabfont.h
  46. +55 −36 controls/imageeditor/windoweditor.cpp
  47. +4 −2 controls/imageeditor/windoweditor.h
  48. +61 −33 controls/main/mainwindow.cpp
  49. +2 −0 controls/main/mainwindow.h
  50. +6 −0 controls/main/mainwindow.ui
  51. +100 −0 controls/resize/columnsreorderproxy.cpp
  52. +54 −0 controls/resize/columnsreorderproxy.h
  53. +22 −5 controls/resize/dialogcanvasresize.cpp
  54. +8 −0 controls/resize/dialogcanvasresize.h
  55. +2 −2 controls/resize/imagesfilterproxy.cpp
  56. +1 −1 controls/resize/imagesfilterproxy.h
  57. +181 −0 controls/resize/imagesresizedproxy.cpp
  58. +52 −0 controls/resize/imagesresizedproxy.h
  59. +35 −5 controls/setup/dialogoptions.cpp
  60. +1 −1 controls/setup/dialogoptions.h
  61. +4 −0 controls/setup/dialogpreview.cpp
  62. +12 −11 controls/setup/parts/prepare/demogenerator.cpp
  63. +4 −3 controls/setup/parts/prepare/demogenerator.h
  64. +3 −3 controls/setup/parts/prepare/setuptabprepare.cpp
  65. +1 −1 controls/setup/parts/prepare/setuptabprepare.h
  66. +5 −0 controls/setup/parts/templates/setuptabtemplates.cpp
  67. +25 −4 controls/updates/dialogupdates.cpp
  68. +17 −0 lcd-image-converter.pro
  69. +26 −171 resources/history.xml
  70. +34 −37 resources/history.xsl
  71. +197 −0 resources/icons/tools/tool_move_circular.svg
  72. +198 −0 resources/icons/tools/tool_move_copy.svg
  73. +198 −0 resources/icons/tools/tool_move_cut.svg
  74. +67 −0 resources/icons/tools/tool_select.svg
  75. +103 −0 resources/icons/tools/tool_select_edit.svg
  76. +188 −0 resources/icons/tools/tool_select_move.svg
  77. +198 −110 resources/lcd-image-converter-ru.ts
  78. +6 −0 resources/resources.qrc
  79. +12 −1 resources/scan_scripts/scan_template.js
@@ -23,16 +23,21 @@
#include "editortabfont.h"
#include "dialogfontselect.h"
#include <QFileDialog>
#include <QDir>
#include <QFileInfo>
#include <QTextStream>
#include <QInputDialog>
#include <QLineEdit>
#include <QMap>
#include <QStringList>
#include "parser.h"
#include "widgetbitmapeditor.h"
#include "imainwindow.h"
#include "datacontainer.h"
#include "idocument.h"
#include "preset.h"
#include "tfontparameters.h"
#include "filedialogoptions.h"
//-----------------------------------------------------------------------------
ActionFileHandlers::ActionFileHandlers(QObject *parent) :
ActionHandlersBase(parent)
@@ -101,13 +106,27 @@ void ActionFileHandlers::open_triggered()
{
QFileDialog dialog(this->mMainWindow->parentWidget());
dialog.setAcceptMode(QFileDialog::AcceptOpen);
dialog.setDirectory(FileDialogOptions::directory(FileDialogOptions::Dialogs::OpenDocument));
dialog.setFileMode(QFileDialog::ExistingFiles);
dialog.setNameFilter(tr("XML Files (*.xml);;Images (*.bmp *.gif *.jpg *.jpeg *.png *.pbm *.pgm *.ppm *.tiff *.xbm *.xpm)"));
dialog.setWindowTitle(tr("Open xml or image file"));

QStringList filters;
filters << tr("XML Files (*.xml)")
<< tr("Images (*.bmp *.gif *.jpg *.jpeg *.png *.pbm *.pgm *.ppm *.tiff *.xbm *.xpm)");
dialog.setNameFilters(filters);
dialog.selectNameFilter(
filters.at(
FileDialogOptions::filterIndex(FileDialogOptions::Dialogs::OpenDocument) < filters.count()
?
FileDialogOptions::filterIndex(FileDialogOptions::Dialogs::OpenDocument)
:
0));

if (dialog.exec() == QDialog::Accepted)
{
QStringList filenames = dialog.selectedFiles();
FileDialogOptions::setDirectory(FileDialogOptions::Dialogs::OpenDocument, dialog.directory().absolutePath());
FileDialogOptions::setFilterIndex(FileDialogOptions::Dialogs::OpenDocument, filters.indexOf(dialog.selectedNameFilter()));

this->openFiles(filenames);
}
@@ -156,6 +175,17 @@ void ActionFileHandlers::saveAs_triggered()
dialog.setDefaultSuffix(QString("xml"));
dialog.setWindowTitle(tr("Save file as"));

QFileInfo outputFile(editor->document()->documentFilename());

if (outputFile.exists())
{
dialog.setDirectory(outputFile.dir());
}
else
{
dialog.setDirectory(FileDialogOptions::directory(FileDialogOptions::Dialogs::SaveDocument));
}

if (editor->document()->documentFilename().isEmpty())
{
dialog.selectFile(editor->document()->documentName());
@@ -167,6 +197,7 @@ void ActionFileHandlers::saveAs_triggered()

if (dialog.exec() == QDialog::Accepted)
{
FileDialogOptions::setDirectory(FileDialogOptions::Dialogs::SaveDocument, dialog.directory().absolutePath());
QString filename = dialog.selectedFiles().at(0);
editor->document()->save(filename);

@@ -180,6 +211,18 @@ void ActionFileHandlers::close_triggered()
emit closeRequest(this->mMainWindow->currentTab());
}
//-----------------------------------------------------------------------------
void ActionFileHandlers::closeAll_triggered()
{
QList<QWidget *> list;

this->mMainWindow->tabsList(&list);

for (int i = 0; i < list.count(); i++)
{
emit closeRequest(list.at(i));
}
}
//-----------------------------------------------------------------------------
void ActionFileHandlers::convert_triggered()
{
IEditor *editor = this->mMainWindow->currentEditor();
@@ -207,6 +250,19 @@ void ActionFileHandlers::convertAll_triggered()
//-----------------------------------------------------------------------------
void ActionFileHandlers::openFiles(const QStringList &filenames)
{
QList<QWidget*> existingTabs;
this->mMainWindow->tabsList(&existingTabs);
QMap<QString, QWidget *> existingFilesInEditors;
QString lastExistingFile;

for (int i = 0; i < existingTabs.count(); i++)
{
IEditor *editor = dynamic_cast<IEditor *> (existingTabs.at(i));

if (editor != NULL)
existingFilesInEditors.insert(editor->document()->documentFilename(), existingTabs.at(i));
}

// binary image
QStringList filesBinaryImage;
{
@@ -231,7 +287,7 @@ void ActionFileHandlers::openFiles(const QStringList &filenames)
{
QFileInfo info(filename);

if (info.exists() && info.suffix().toLower() == "xml")
if (info.exists() && info.suffix().toLower() == "xml" && !existingFilesInEditors.contains(filename))
{
QFile file(filename);
if (file.open(QIODevice::ReadWrite))
@@ -250,6 +306,10 @@ void ActionFileHandlers::openFiles(const QStringList &filenames)
file.close();
}
}
else if (existingFilesInEditors.keys().contains(filename))
{
lastExistingFile = filename;
}
}
}

@@ -260,7 +320,7 @@ void ActionFileHandlers::openFiles(const QStringList &filenames)
{
QFileInfo info(filename);

if (info.exists() && info.suffix().toLower() == "xml")
if (info.exists() && info.suffix().toLower() == "xml" && !existingFilesInEditors.contains(filename))
{
QFile file(filename);
if (file.open(QIODevice::ReadWrite))
@@ -279,13 +339,20 @@ void ActionFileHandlers::openFiles(const QStringList &filenames)
file.close();
}
}
else if (existingFilesInEditors.keys().contains(filename))
{
lastExistingFile = filename;
}
}
}


this->openBinaryImage(filesBinaryImage);
this->openImage(filesDocumentImage);
this->openFont(filesDocumentFont);

if (existingFilesInEditors.contains(lastExistingFile))
this->tabSelect(existingFilesInEditors.value(lastExistingFile));
}
//-----------------------------------------------------------------------------
void ActionFileHandlers::openFile(const QString &filename)
@@ -398,11 +465,26 @@ void ActionFileHandlers::convertDocument(IDocument *document, bool request)
QFileDialog dialog(qobject_cast<QWidget *>(this->parent()));
dialog.setAcceptMode(QFileDialog::AcceptSave);
dialog.selectFile(outputFileName);
dialog.setDirectory(FileDialogOptions::directory(FileDialogOptions::Dialogs::ConvertDocument));
dialog.setFileMode(QFileDialog::AnyFile);
dialog.setNameFilter(tr("C Files (*.c);;All Files (*.*)"));
dialog.setDefaultSuffix(QString("c"));
dialog.setWindowTitle(tr("Save result file as"));

QStringList filters;
filters << tr("C source code (*.c)")
<< tr("C++ source code (*.cpp)")
<< tr("C/C++ headers (*.h)")
<< tr("C/C++ files (*.c *.cpp *.h)")
<< tr("All Files (*.*)");
dialog.setNameFilters(filters);
dialog.selectNameFilter(
filters.at(
FileDialogOptions::filterIndex(FileDialogOptions::Dialogs::ConvertDocument) < filters.count()
?
FileDialogOptions::filterIndex(FileDialogOptions::Dialogs::ConvertDocument)
:
0));

if (outputFilenameNotSpecified)
{
dialog.selectFile(document->documentName());
@@ -415,6 +497,8 @@ void ActionFileHandlers::convertDocument(IDocument *document, bool request)
if (dialog.exec() == QDialog::Accepted)
{
outputFileName = dialog.selectedFiles().at(0);
FileDialogOptions::setDirectory(FileDialogOptions::Dialogs::ConvertDocument, dialog.directory().absolutePath());
FileDialogOptions::setFilterIndex(FileDialogOptions::Dialogs::ConvertDocument, filters.indexOf(dialog.selectedNameFilter()));
}
else
{
@@ -39,6 +39,7 @@ class ActionFileHandlers : public ActionHandlersBase
void closeRequest(QWidget *tab);
void tabChanged(QWidget *w);
void tabCreated(QWidget *w);
void tabSelect(QWidget *w);

public slots:
void newImage_triggered();
@@ -48,6 +49,7 @@ public slots:
void save_triggered();
void saveAs_triggered();
void close_triggered();
void closeAll_triggered();
void convert_triggered();
void convertAll_triggered();
void openFiles(const QStringList &filenames);
Oops, something went wrong.

0 comments on commit 466b2e2

Please sign in to comment.