Compare commits

..

58 Commits

Author SHA1 Message Date
a29302e2e6 Added additional poll method without timeout 2020-07-16 12:03:27 +03:00
a5e5c289db Merge pull request 'fix qad_export.h' (#51) from master into release
All checks were successful
SHS Gitea/libs/pipeline/head This commit looks good
2020-07-10 21:46:56 +03:00
a49aeda257 fix qad_export.h 2020-07-10 21:46:36 +03:00
79db8ea408 Merge pull request 'master' (#50) from master into release
All checks were successful
SHS Gitea/libs/pipeline/head This commit looks good
2020-07-10 09:21:40 +03:00
c359ba34a6 update pip 2020-07-09 22:25:46 +03:00
760c57a843 FindQAD multiple add target fix 2020-07-09 13:11:23 +03:00
61316462fa Imported targets for QAD 2020-06-28 17:11:42 +03:00
4e3baadd70 Merge pull request 'master' (#49) from master into release
All checks were successful
SHS Gitea/libs/pipeline/head This commit looks good
2020-06-28 01:16:49 +03:00
8324776fb8 fix for Qt4 2020-06-28 01:04:28 +03:00
65f3cc0698 pip update 2020-06-28 00:18:49 +03:00
b72ef08892 Merge pull request 'master' (#48) from master into release
All checks were successful
SHS Gitea/libs/pipeline/head This commit looks good
2020-06-26 09:56:46 +03:00
8363ad29ef pip 2020-06-26 09:51:27 +03:00
ab4f2a3d40 Graphic mouse signals fix 2020-06-25 12:05:45 +03:00
754d46a250 missing Graphic::setGraphicStyle(const Qt::PenStyle & style, int index) 2020-06-24 11:45:56 +03:00
ba5a30a7dd Android graphic fix 2020-06-24 02:09:08 +03:00
50efa51975 version 1.5.0
IconedLabel now remove spacings in case of empty text or icon
2020-06-23 19:57:16 +03:00
8bb52f59fe Merge pull request 'update pip' (#47) from master into release
Some checks failed
SHS Gitea/libs/pipeline/head There was a failure building this commit
2020-06-19 22:53:42 +03:00
3acec2297b Merge branch 'master' of https://git.shs.tools/SHS/libs 2020-06-19 22:53:05 +03:00
d39488397c update pip 2020-06-19 22:52:54 +03:00
97a0bad71d Merge pull request 'master' (#46) from master into release
Some checks failed
SHS Gitea/libs/pipeline/head Something is wrong with the build of this commit
2020-06-19 22:48:53 +03:00
f02c38884b LogView fixes and optimizations 2020-06-19 19:17:30 +03:00
a195ec4006 logview improvments and fixes 2020-06-18 22:46:16 +03:00
d15b6ff855 yet clean qad/graphic 2020-06-18 20:21:37 +03:00
bd6e672568 clean qad/graphic/graphic.cpp and qad/graphic/graphic.h 2020-06-18 19:57:15 +03:00
2c9279248d Merge pull request 'master' (#45) from master into release
All checks were successful
SHS Gitea/libs/pipeline/head This commit looks good
2020-06-17 22:58:20 +03:00
e67c1925b1 version 1.4.0_alpha
add LogView
patch MatrixEdit for old Qt
2020-06-17 22:15:47 +03:00
7741878f3e fxes for new qt 2020-06-15 11:08:35 +03:00
61e16d4f1b Merge pull request 'master' (#44) from master into release
All checks were successful
SHS Gitea/libs/pipeline/head This commit looks good
2020-06-10 15:38:40 +03:00
5bd869968e Merge branch 'master' of https://git.shs.tools/SHS/libs 2020-06-10 15:38:04 +03:00
94f1b68b6f pip 2020-06-10 15:38:00 +03:00
86439ae05c Merge pull request 'pip' (#43) from master into release
Some checks failed
SHS Gitea/libs/pipeline/head There was a failure building this commit
2020-06-10 15:11:55 +03:00
a64e03b28d pip 2020-06-10 15:11:36 +03:00
9d708342ca Merge pull request 'pip 1.20' (#42) from master into release
Some checks failed
SHS Gitea/libs/pipeline/head There was a failure building this commit
2020-06-10 14:38:27 +03:00
265251d47d pip 2020-06-10 14:36:43 +03:00
8962d051ea update pip to 1.20 2020-06-10 14:30:55 +03:00
e513e2f16a copyright clean 2020-06-10 14:12:43 +03:00
8ab6a4716f Merge pull request 'graphic default theme color in session save/load' (#40) from master into release 2020-06-09 21:00:58 +03:00
ab330967f3 version 2020-06-09 21:00:30 +03:00
46dd2eeaad graphic default theme color in session save/load 2020-06-09 20:57:49 +03:00
fdee11cbc0 Merge pull request 'pip' (#39) from master into release 2020-06-09 18:12:16 +03:00
4dbca6f145 pip 2020-06-09 18:05:26 +03:00
57c19a2e8c Merge pull request 'Jenkinsfile' (#37) from master into release
All checks were successful
SHS Gitea/libs/pipeline/head This commit looks good
2020-06-02 15:32:40 +03:00
14c8a359bd Jenkinsfile 2020-06-02 15:31:47 +03:00
e45464f480 Merge pull request 'fix PIMathMatrix in pip' (#36) from master into release
All checks were successful
SHS Gitea/libs/pipeline/head This commit looks good
2020-06-02 13:26:20 +03:00
892c2e48a3 Merge branch 'master' of https://git.shs.tools/SHS/libs 2020-06-02 13:06:08 +03:00
f0340c5d48 update pip 2020-06-02 13:06:03 +03:00
db37f8b963 Merge pull request 'master' (#34) from master into release
All checks were successful
SHS Gitea/libs/pipeline/head This commit looks good
2020-05-28 17:34:27 +03:00
a7f182a7cb Jenkinsfile doc, PIP 2020-05-28 17:32:31 +03:00
b8e4e7203f Jenkinsfile pip doc works
Some checks failed
pipdoc/pipeline/head Something is wrong with the build of this commit
2020-05-28 15:06:32 +03:00
1010eaf6db Jenkinsfile
All checks were successful
pipdoc/pipeline/head This commit looks good
2020-05-28 15:00:25 +03:00
007e3db9ef Jenkinsfile
Some checks failed
pipdoc/pipeline/head There was a failure building this commit
2020-05-28 14:59:04 +03:00
dbff7cec26 Merge branch 'master' of https://git.shs.tools/SHS/libs
Some checks failed
pipdoc/pipeline/head There was a failure building this commit
2020-05-28 14:44:29 +03:00
3c94cce018 Jenkinsfile 2020-05-28 14:44:20 +03:00
ab356664e2 pip PIVector2D resize
Some checks failed
pipdoc/pipeline/head Something is wrong with the build of this commit
2020-05-28 14:21:30 +03:00
2945c07a31 Jenkinsfile pip doc
Some checks failed
pipdoc/pipeline/head There was a failure building this commit
2020-05-28 14:04:35 +03:00
0ffcedb5ef Merge pull request 'master' (#33) from master into release
Some checks failed
pipdoc/pipeline/head There was a failure building this commit
2020-05-28 10:47:24 +03:00
87f49853b2 Merge branch 'master' of https://git.shs.tools/SHS/libs 2020-05-28 10:17:15 +03:00
c269dd6b9e update pip and matrixedit.ui size 2020-05-28 10:17:10 +03:00
35 changed files with 1125 additions and 342 deletions

View File

@@ -102,7 +102,7 @@ else()
endif() endif()
foreach(F ${PIP_FOLDERS}) foreach(F ${PIP_FOLDERS})
list(APPEND PIP_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/pip/src_main/${F}") list(APPEND PIP_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/pip/lib/main/${F}")
endforeach(F) endforeach(F)
#message(${PIP_INCLUDES}) #message(${PIP_INCLUDES})
if(CMAKE_CROSSCOMPILING OR (DEFINED ANDROID_PLATFORM)) if(CMAKE_CROSSCOMPILING OR (DEFINED ANDROID_PLATFORM))
@@ -156,6 +156,7 @@ else()
add_subdirectory(qad) add_subdirectory(qad)
set(_DIRS piqt piqt_utils qcd_utils) set(_DIRS piqt piqt_utils qcd_utils)
if (Qt5) if (Qt5)
list(APPEND _DIRS)
if (QGLVIEW) if (QGLVIEW)
list(APPEND _DIRS qglview) list(APPEND _DIRS qglview)
endif() endif()

21
Jenkinsfile vendored
View File

@@ -39,3 +39,24 @@ node {
sh "docker system prune -f" sh "docker system prune -f"
echo "${_msg}" echo "${_msg}"
} }
pipeline {
agent {
label 'master'
}
stages {
stage("PIP doc") {
steps {
checkout scm
sh "rm -rf share"
sh "rm -vf *.zip"
sh "mkdir -p build"
sh "cd build && cmake -DLIB=0 -DCMAKE_INSTALL_PREFIX=`pwd` ../"
sh "cd build && make doc"
sh "cd share/doc && zip -r ../../pip_doc.zip pip"
sh "cp share/doc/pip/html/pip.qch ./"
archiveArtifacts 'pip_doc.zip'
archiveArtifacts 'pip.qch'
}
}
}
}

2
pip

Submodule pip updated: 15515a2954...5df43a45f2

View File

@@ -23,7 +23,7 @@ list(APPEND QT_MULTILIB_LIST ${PROJECT_NAME})
set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE) set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE)
include_directories(${PIP_INCLUDES} ${QAD_INCLUDES}) include_directories(${PIP_INCLUDES} ${QAD_INCLUDES})
file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts") file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts")
pip_code_model(CCM "../pip/src_main/io_devices/piiodevice.h" "../pip/src_main/io_utils/pipacketextractor.h" OPTIONS "-DPIP_EXPORT" "-Es") pip_code_model(CCM "../pip/lib/main/io_devices/piiodevice.h" "../pip/lib/main/io_utils/pipacketextractor.h" OPTIONS "-DPIP_EXPORT" "-Es")
find_qt(${QtVersions} Core Gui) find_qt(${QtVersions} Core Gui)
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
qt_add_library(${PROJECT_NAME} ${LIBTYPE} out_CPP CCM) qt_add_library(${PROJECT_NAME} ${LIBTYPE} out_CPP CCM)

View File

@@ -1,6 +1,6 @@
project(piintrospector) project(piintrospector)
file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts") file(GLOB SRC "*.h" "*.cpp" "*.ui" "*.qrc" "lang/*.ts")
set(PII_ROOT "../../pip/src_main/introspection") set(PII_ROOT "../../pip/lib/main/introspection")
pip_code_model(PII_CCM "${PII_ROOT}/piintrospection_server_p.h" "${PII_ROOT}/piintrospection_threads_p.h" OPTIONS "-DPIP_EXPORT" "-Es") pip_code_model(PII_CCM "${PII_ROOT}/piintrospection_server_p.h" "${PII_ROOT}/piintrospection_threads_p.h" OPTIONS "-DPIP_EXPORT" "-Es")
find_qt(${QtVersions} Core Gui) find_qt(${QtVersions} Core Gui)
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)

View File

@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0017 NEW) # need include() with .cmake cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(qad) project(qad)
set(_QAD_MAJOR 1) set(_QAD_MAJOR 1)
set(_QAD_MINOR 3) set(_QAD_MINOR 5)
set(_QAD_REVISION 1) set(_QAD_REVISION 0)
set(_QAD_SUFFIX beta) set(_QAD_SUFFIX )
set(_QAD_COMPANY SHS) set(_QAD_COMPANY SHS)
set(_QAD_DOMAIN org.SHS) set(_QAD_DOMAIN org.SHS)

View File

@@ -34,8 +34,8 @@ class QAD_EXPORT EDockWidget: public QDockWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit EDockWidget(const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0): QDockWidget(title, parent, flags) {init();} explicit EDockWidget(const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = Qt::WindowFlags()): QDockWidget(title, parent, flags) {init();}
explicit EDockWidget(QWidget * parent = 0, Qt::WindowFlags flags = 0): QDockWidget(parent, flags) {init();} explicit EDockWidget(QWidget * parent = 0, Qt::WindowFlags flags = Qt::WindowFlags()): QDockWidget(parent, flags) {init();}
~EDockWidget() {delete btn_hide; delete btn_dock; delete lbl_title; delete lbl_icon; delete header;} ~EDockWidget() {delete btn_hide; delete btn_dock; delete lbl_title; delete lbl_icon; delete header;}
void setFeatures(QDockWidget::DockWidgetFeatures features); void setFeatures(QDockWidget::DockWidgetFeatures features);

View File

@@ -35,6 +35,7 @@
</message> </message>
<message> <message>
<location filename="../aboutwindow.cpp" line="33"/> <location filename="../aboutwindow.cpp" line="33"/>
<location filename="../aboutwindow.cpp" line="157"/>
<source>About</source> <source>About</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -43,53 +44,58 @@
<name>EMainWindow</name> <name>EMainWindow</name>
<message> <message>
<location filename="../emainwindow.cpp" line="12"/> <location filename="../emainwindow.cpp" line="12"/>
<location filename="../emainwindow.cpp" line="130"/>
<source>Clear recent list</source> <source>Clear recent list</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="15"/> <location filename="../emainwindow.cpp" line="15"/>
<location filename="../emainwindow.cpp" line="16"/> <location filename="../emainwindow.cpp" line="16"/>
<location filename="../emainwindow.cpp" line="126"/>
<location filename="../emainwindow.cpp" line="127"/>
<source>Show all</source> <source>Show all</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="17"/> <location filename="../emainwindow.cpp" line="17"/>
<location filename="../emainwindow.cpp" line="18"/> <location filename="../emainwindow.cpp" line="18"/>
<location filename="../emainwindow.cpp" line="128"/>
<location filename="../emainwindow.cpp" line="129"/>
<source>Hide all</source> <source>Hide all</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="136"/> <location filename="../emainwindow.cpp" line="152"/>
<source>Toolbars</source> <source>Toolbars</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="161"/> <location filename="../emainwindow.cpp" line="177"/>
<source>Docks</source> <source>Docks</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="379"/> <location filename="../emainwindow.cpp" line="395"/>
<source>Select file to open</source> <source>Select file to open</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="388"/> <location filename="../emainwindow.cpp" line="404"/>
<source>Select files to open</source> <source>Select files to open</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="398"/> <location filename="../emainwindow.cpp" line="414"/>
<source>Save changes%1?</source> <source>Save changes%1?</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="398"/> <location filename="../emainwindow.cpp" line="414"/>
<source> in</source> <source> in</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="411"/> <location filename="../emainwindow.cpp" line="427"/>
<source>Select file to save</source> <source>Select file to save</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -97,9 +103,42 @@
<context> <context>
<name>HistoryView</name> <name>HistoryView</name>
<message> <message>
<location filename="../historyview.cpp" line="16"/> <location filename="../historyview.cpp" line="17"/>
<location filename="../historyview.cpp" line="97"/>
<source>History cleared</source> <source>History cleared</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>LogView</name>
<message>
<location filename="../logview.ui" line="92"/>
<source>Category:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../logview.ui" line="119"/>
<location filename="../logview.cpp" line="37"/>
<location filename="../logview.cpp" line="133"/>
<source>Clear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../logview.cpp" line="35"/>
<location filename="../logview.cpp" line="131"/>
<source>Select All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../logview.cpp" line="36"/>
<location filename="../logview.cpp" line="132"/>
<source>Copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../logview.cpp" line="46"/>
<source>All</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS> </TS>

View File

@@ -35,6 +35,7 @@
</message> </message>
<message> <message>
<location filename="../aboutwindow.cpp" line="33"/> <location filename="../aboutwindow.cpp" line="33"/>
<location filename="../aboutwindow.cpp" line="157"/>
<source>About</source> <source>About</source>
<translation>О программе</translation> <translation>О программе</translation>
</message> </message>
@@ -43,53 +44,58 @@
<name>EMainWindow</name> <name>EMainWindow</name>
<message> <message>
<location filename="../emainwindow.cpp" line="12"/> <location filename="../emainwindow.cpp" line="12"/>
<location filename="../emainwindow.cpp" line="130"/>
<source>Clear recent list</source> <source>Clear recent list</source>
<translation>Очистить список недавних</translation> <translation>Очистить список недавних</translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="15"/> <location filename="../emainwindow.cpp" line="15"/>
<location filename="../emainwindow.cpp" line="16"/> <location filename="../emainwindow.cpp" line="16"/>
<location filename="../emainwindow.cpp" line="126"/>
<location filename="../emainwindow.cpp" line="127"/>
<source>Show all</source> <source>Show all</source>
<translation>Показать все</translation> <translation>Показать все</translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="17"/> <location filename="../emainwindow.cpp" line="17"/>
<location filename="../emainwindow.cpp" line="18"/> <location filename="../emainwindow.cpp" line="18"/>
<location filename="../emainwindow.cpp" line="128"/>
<location filename="../emainwindow.cpp" line="129"/>
<source>Hide all</source> <source>Hide all</source>
<translation>Скрыть все</translation> <translation>Скрыть все</translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="136"/> <location filename="../emainwindow.cpp" line="152"/>
<source>Toolbars</source> <source>Toolbars</source>
<translation>Панели инструментов</translation> <translation>Панели инструментов</translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="161"/> <location filename="../emainwindow.cpp" line="177"/>
<source>Docks</source> <source>Docks</source>
<translation>Окна</translation> <translation>Окна</translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="379"/> <location filename="../emainwindow.cpp" line="395"/>
<source>Select file to open</source> <source>Select file to open</source>
<translation>Выбрать файл для открытия</translation> <translation>Выбрать файл для открытия</translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="388"/> <location filename="../emainwindow.cpp" line="404"/>
<source>Select files to open</source> <source>Select files to open</source>
<translation>Выберите файлы для открытия</translation> <translation>Выберите файлы для открытия</translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="398"/> <location filename="../emainwindow.cpp" line="414"/>
<source>Save changes%1?</source> <source>Save changes%1?</source>
<translation>Сохранить изменения%1?</translation> <translation>Сохранить изменения%1?</translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="398"/> <location filename="../emainwindow.cpp" line="414"/>
<source> in</source> <source> in</source>
<translation> в</translation> <translation> в</translation>
</message> </message>
<message> <message>
<location filename="../emainwindow.cpp" line="411"/> <location filename="../emainwindow.cpp" line="427"/>
<source>Select file to save</source> <source>Select file to save</source>
<translation>Выберите файл для сохранения</translation> <translation>Выберите файл для сохранения</translation>
</message> </message>
@@ -97,9 +103,42 @@
<context> <context>
<name>HistoryView</name> <name>HistoryView</name>
<message> <message>
<location filename="../historyview.cpp" line="16"/> <location filename="../historyview.cpp" line="17"/>
<location filename="../historyview.cpp" line="97"/>
<source>History cleared</source> <source>History cleared</source>
<translation>История очищена</translation> <translation>История очищена</translation>
</message> </message>
</context> </context>
<context>
<name>LogView</name>
<message>
<location filename="../logview.ui" line="92"/>
<source>Category:</source>
<translation>Категория:</translation>
</message>
<message>
<location filename="../logview.ui" line="119"/>
<location filename="../logview.cpp" line="37"/>
<location filename="../logview.cpp" line="133"/>
<source>Clear</source>
<translation>Очистить</translation>
</message>
<message>
<location filename="../logview.cpp" line="35"/>
<location filename="../logview.cpp" line="131"/>
<source>Select All</source>
<translation>Выделить всё</translation>
</message>
<message>
<location filename="../logview.cpp" line="36"/>
<location filename="../logview.cpp" line="132"/>
<source>Copy</source>
<translation>Копировать</translation>
</message>
<message>
<location filename="../logview.cpp" line="46"/>
<source>All</source>
<translation>Все</translation>
</message>
</context>
</TS> </TS>

294
qad/application/logview.cpp Normal file
View File

@@ -0,0 +1,294 @@
#include "logview.h"
#include "ui_logview.h"
#include "qad_types.h"
#include "ecombobox.h"
#include <QTextDocument>
#include <QAbstractTextDocumentLayout>
#include <QTextEdit>
#include <QTextBlock>
#include <QScrollBar>
#include <QPixmap>
#include <QEvent>
LogView::Category::Category() {
bold = false;
}
void LogView::Category::makeIcon(QSize size, QSize size_icon) {
icon_image = QImage();
if (!image.isNull())
icon_image = image.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
QPixmap px = QPixmap::fromImage(image.scaled(size_icon, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
icon.addPixmap(px, QIcon::Active);
icon.addPixmap(px, QIcon::Disabled);
icon.addPixmap(px, QIcon::Normal);
icon.addPixmap(px, QIcon::Selected);
}
LogView::LogView(QWidget * parent): QWidget(parent) {
ui = new Ui::LogView();
ui->setupUi(this);
ui->textEdit->setContextMenuPolicy(Qt::ActionsContextMenu);
actionLogSelectAll = new QAction(QIcon(":/icons/select-all.png"), tr("Select All"), this);
actionLogCopy = new QAction(QIcon(":/icons/edit-copy.png"), tr("Copy"), this);
actionLogClear = new QAction(QIcon(":/icons/edit-clear.png"), tr("Clear"), this);
connect(actionLogSelectAll, SIGNAL(triggered(bool)), ui->textEdit, SLOT(selectAll()));
connect(actionLogCopy, SIGNAL(triggered(bool)), ui->textEdit, SLOT(copy()));
connect(actionLogClear, SIGNAL(triggered(bool)), ui->textEdit, SLOT(clear()));
ui->textEdit->addAction(actionLogSelectAll);
ui->textEdit->addAction(actionLogCopy);
ui->textEdit->addAction(actionLogClear);
ui->buttonClear->setDefaultAction(ui->actionClear);
ui->labelIconSearch->setFixedSize(preferredIconSize(1.2, this));
ui->comboCategory->addItem(tr("All"));
ui->textEdit->document()->setUndoRedoEnabled(false);
setLinesLimit(10000);
QTextCursor tc(ui->textEdit->document());
def_cf = tc.charFormat();
}
LogView::~LogView() {
delete ui;
}
const QTextEdit * LogView::textEdit() const {
return ui->textEdit;
}
void LogView::setLogFont(QFont f) {
ui->textEdit->document()->setDefaultFont(f);
QTextCursor tc(ui->textEdit->document());
def_cf = tc.charFormat();
}
QFont LogView::logFont() const {
return ui->textEdit->document()->defaultFont();
}
bool LogView::isFilterVisible() const {
return ui->widgetToolbar->isVisible();
}
int LogView::linesLimit() const {
int ret = ui->textEdit->document()->maximumBlockCount();
if (ret > 0) --ret;
return ret;
}
void LogView::registerCategory(const QString & label, QString keyword, const QImage & icon, QColor color, bool bold) {
QRegularExpression regexp(keyword,
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption)
#else
Qt::CaseInsensitive
#endif
);
registerCategory(label, regexp, icon, color, bold);
}
void LogView::registerCategory(const QString & label, QRegularExpression regexp, const QImage & icon, QColor color, bool bold) {
if (!regexp.isValid() || regexp.pattern().isEmpty()) return;
removeCategory(regexp);
Category c;
c.regexp = regexp;
c.label = label;
c.image = icon;
c.color = color;
c.bold = bold;
c.makeIcon(iconImageSize(), preferredIconSize(1., this));
categories.append(c);
ui->comboCategory->addItem(c.icon, label, QVariant(regexp));
}
void LogView::removeCategory(QString keyword) {
QRegularExpression regexp(keyword,
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption)
#else
Qt::CaseInsensitive
#endif
);
removeCategory(regexp);
}
void LogView::removeCategory(QRegularExpression regexp) {
Category c;
c.regexp = regexp;
categories.removeAll(c);
for (int i = 1; i < ui->comboCategory->count(); ++i) {
if (ui->comboCategory->itemData(i).
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
toRegularExpression()
#else
toRegExp()
#endif
.pattern() == regexp.pattern()) {
ui->comboCategory->removeItem(i);
--i;
}
}
}
void LogView::clearCategories() {
ui->comboCategory->blockSignals(true);
while (ui->comboCategory->count() > 1)
ui->comboCategory->removeItem(ui->comboCategory->count() - 1);
categories.clear();
ui->comboCategory->blockSignals(false);
filter();
}
void LogView::addText(const QString & text, bool insert_newline) {
if (text.isEmpty()) return;
QTextCursor tc(ui->textEdit->document());
QStringList sl = text.split("\n");
tc.movePosition(QTextCursor::End);
QScrollBar * bar = ui->textEdit->verticalScrollBar();
bool at_end = (bar->value() == bar->maximum()) || bar->isHidden();
for (int i = 0; i < sl.size(); ++i) {
tc.insertText(sl[i]);
if ((i < sl.size() - 1) || insert_newline)
newLine();
}
if (at_end)
scrollToBottom();
}
void LogView::changeEvent(QEvent * e) {
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
ui->comboCategory->setItemText(0, tr("All"));
actionLogSelectAll->setText(tr("Select All"));
actionLogCopy->setText(tr("Copy"));
actionLogClear->setText(tr("Clear"));
break;
case QEvent::Polish: {
ui->labelIconSearch->setFixedSize(preferredIconSize(1.2, this));
QSize is = iconImageSize(), is_i = preferredIconSize(1., this);
for (int i = 0; i < categories.size(); ++i)
categories[i].makeIcon(is, is_i);
} break;
default: break;
}
}
void LogView::newLine() {
QTextCursor tc(ui->textEdit->document());
tc.movePosition(QTextCursor::End);
tc.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
QString line = tc.selectedText();
QImage icon;
foreach (const Category & c, categories) {
if (line.contains(c.regexp)) {
QTextCharFormat cf = def_cf;
cf.setForeground(c.color);
if (c.bold)
cf.setFontWeight(QFont::Bold);
tc.setCharFormat(cf);
icon = c.icon_image;
break;
}
}
if (!icon.isNull()) {
tc.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
tc.insertImage(icon);
}
QRegularExpression regexp =
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
ui->comboCategory->currentData().toRegularExpression();
#else
ui->comboCategory->itemData(ui->comboCategory->currentIndex()).toRegExp();
#endif
QString fs = ui->lineEdit->text();
if (isFilterVisible())
filterBlock(tc.block(), fs, regexp);
tc.movePosition(QTextCursor::End);
tc.setCharFormat(def_cf);
tc.insertBlock();
}
QSize LogView::iconImageSize() {
int hei = QFontMetrics(ui->textEdit->document()->defaultFont()).height() / 1.25;
return QSize(hei, hei);
}
void LogView::filterBlock(QTextBlock block, const QString & fs, const QRegularExpression & regexp) {
bool vis = true;//, pvis = block.isVisible();
QString line = block.text();
if (!line.isEmpty()) {
if (line[0] == QChar::ObjectReplacementCharacter)
line.remove(0, 1);
}
if (regexp.isValid()) vis = vis && line.contains(regexp);
if (!fs.isEmpty()) vis = vis && line.contains(fs, Qt::CaseInsensitive);
block.setVisible(vis);
//qDebug() << "filterBlock" << line << vis;
//if (vis != pvis)
// ;//ui->textEdit->document()->mar
}
void LogView::setFilterVisible(bool yes) {
ui->widgetToolbar->setHidden(!yes);
filter();
}
void LogView::setLinesLimit(int l) {
ui->textEdit->document()->setMaximumBlockCount(l <= 0 ? 0 : l + 1);
}
void LogView::clear() {
ui->textEdit->clear();
}
void LogView::scrollToBottom() {
QScrollBar * bar = ui->textEdit->verticalScrollBar();
bar->setValue(bar->maximum());
}
void LogView::filter() {
QTextDocument * doc = ui->textEdit->document();
int bc = doc->blockCount();
QRegularExpression regexp;
QString fs;
if (isFilterVisible()) {
regexp =
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
ui->comboCategory->currentData().toRegularExpression();
#else
ui->comboCategory->itemData(ui->comboCategory->currentIndex()).toRegExp();
#endif
fs = ui->lineEdit->text();
}
QTextBlock bl;
for (int i = 0; i < bc; ++i) {
bl = doc->findBlockByNumber(i);
filterBlock(bl, fs, regexp);
}
doc->markContentsDirty(0, bl.position() + bl.length());
}

114
qad/application/logview.h Normal file
View File

@@ -0,0 +1,114 @@
/*
QAD - Qt ADvanced
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOGVIEW_H
#define LOGVIEW_H
#include <QWidget>
#include <QIcon>
#include <QImage>
#include <QTextBlockFormat>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
# include <QRegularExpression>
#else
# include <QRegExp>
typedef QRegExp QRegularExpression;
#endif
#include "qad_export.h"
class QTextEdit;
class QTextBlock;
class QAction;
namespace Ui {
class LogView;
}
class QAD_EXPORT LogView: public QWidget
{
Q_OBJECT
Q_PROPERTY(bool filterVisible READ isFilterVisible WRITE setFilterVisible)
Q_PROPERTY(int linesLimit READ linesLimit WRITE setLinesLimit)
Q_PROPERTY(QFont logFont READ logFont WRITE setLogFont)
public:
explicit LogView(QWidget * parent = 0);
~LogView();
const QTextEdit * textEdit() const;
void setLogFont(QFont f);
QFont logFont() const;
bool isFilterVisible() const;
int linesLimit() const;
void registerCategory(const QString & label,
QString keyword = QString(),
const QImage & icon = QImage(),
QColor color = QColor(),
bool bold = false);
void registerCategory(const QString & label,
QRegularExpression regexp,
const QImage & icon = QImage(),
QColor color = QColor(),
bool bold = false);
void removeCategory(QString keyword);
void removeCategory(QRegularExpression regexp);
void clearCategories();
void addText(const QString & text, bool insert_newline = true);
private:
struct Category {
Category();
void makeIcon(QSize size, QSize size_icon);
QString label;
QRegularExpression regexp;
QImage image, icon_image;
QIcon icon;
QColor color;
bool bold;
inline bool operator ==(const Category & it) const {return (regexp.pattern() == it.regexp.pattern());}
};
void changeEvent(QEvent * e);
void newLine();
QSize iconImageSize();
void filterBlock(QTextBlock block, const QString & fs, const QRegularExpression & regexp);
Ui::LogView * ui;
QList<Category> categories;
QTextCharFormat def_cf;
QAction * actionLogSelectAll, * actionLogCopy, * actionLogClear;
public slots:
void setFilterVisible(bool yes);
void setLinesLimit(int l);
void clear();
private slots:
void scrollToBottom();
void filter();
signals:
};
#endif // LOGVIEW_H

198
qad/application/logview.ui Normal file
View File

@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LogView</class>
<widget class="QWidget" name="LogView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>724</width>
<height>502</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="widgetToolbar" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="buttonClear"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelIconSearch">
<property name="pixmap">
<pixmap resource="qad_application.qrc">:/icons/edit-find.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="CLineEdit" name="lineEdit"/>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Category:</string>
</property>
</widget>
</item>
<item>
<widget class="EComboBox" name="comboCategory"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit">
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
<action name="actionClear">
<property name="icon">
<iconset resource="qad_application.qrc">
<normaloff>:/icons/edit-clear.png</normaloff>:/icons/edit-clear.png</iconset>
</property>
<property name="text">
<string>Clear</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>CLineEdit</class>
<extends>QLineEdit</extends>
<header>clineedit.h</header>
</customwidget>
<customwidget>
<class>EComboBox</class>
<extends>QComboBox</extends>
<header>ecombobox.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="qad_application.qrc"/>
</resources>
<connections>
<connection>
<sender>actionClear</sender>
<signal>triggered()</signal>
<receiver>LogView</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>361</x>
<y>250</y>
</hint>
</hints>
</connection>
<connection>
<sender>lineEdit</sender>
<signal>textChanged(QString)</signal>
<receiver>LogView</receiver>
<slot>filter()</slot>
<hints>
<hint type="sourcelabel">
<x>544</x>
<y>138</y>
</hint>
<hint type="destinationlabel">
<x>728</x>
<y>90</y>
</hint>
</hints>
</connection>
<connection>
<sender>comboCategory</sender>
<signal>currentIndexChanged(int)</signal>
<receiver>LogView</receiver>
<slot>filter()</slot>
<hints>
<hint type="sourcelabel">
<x>675</x>
<y>134</y>
</hint>
<hint type="destinationlabel">
<x>728</x>
<y>76</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>clear()</slot>
<slot>filter()</slot>
</slots>
</ui>

View File

@@ -0,0 +1,69 @@
#include "logview.h"
#include "logviewplugin.h"
#include <QtCore/QtPlugin>
LogViewPlugin::LogViewPlugin(QObject * parent): QObject(parent) {
m_initialized = false;
}
void LogViewPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
if (m_initialized)
return;
// Add extension registrations, etc. here
m_initialized = true;
}
bool LogViewPlugin::isInitialized() const {
return m_initialized;
}
QWidget * LogViewPlugin::createWidget(QWidget * parent) {
return new LogView(parent);
}
QString LogViewPlugin::name() const {
return QLatin1String("LogView");
}
QString LogViewPlugin::group() const {
return QLatin1String("Display Widgets");
}
QIcon LogViewPlugin::icon() const {
return QIcon(":/icons/logview.png");
}
QString LogViewPlugin::toolTip() const {
return QLatin1String("");
}
QString LogViewPlugin::whatsThis() const {
return QLatin1String("");
}
bool LogViewPlugin::isContainer() const {
return true;
}
QString LogViewPlugin::domXml() const {
return QLatin1String("<widget class=\"LogView\" name=\"logView\">\n</widget>\n");
}
QString LogViewPlugin::includeFile() const {
return QLatin1String("logview.h");
}

View File

@@ -0,0 +1,36 @@
#ifndef LOGVIEWPLUGIN_H
#define LOGVIEWPLUGIN_H
#include <QObject>
#if QT_VERSION >= 0x050000
# include <QtUiPlugin/QDesignerCustomWidgetInterface>
#else
# include <QDesignerCustomWidgetInterface>
#endif
class LogViewPlugin: public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
LogViewPlugin(QObject * parent = 0);
bool isContainer() const;
bool isInitialized() const;
QIcon icon() const;
QString domXml() const;
QString group() const;
QString includeFile() const;
QString name() const;
QString toolTip() const;
QString whatsThis() const;
QWidget * createWidget(QWidget * parent);
void initialize(QDesignerFormEditorInterface * core);
private:
bool m_initialized;
};
#endif // LOGVIEWPLUGIN_H

View File

@@ -2,12 +2,14 @@
#include "edockwidgetplugin.h" #include "edockwidgetplugin.h"
#include "emainwindowplugin.h" #include "emainwindowplugin.h"
#include "historyviewplugin.h" #include "historyviewplugin.h"
#include "logviewplugin.h"
QADApplication::QADApplication(QObject * parent): QObject(parent) { QADApplication::QADApplication(QObject * parent): QObject(parent) {
//m_widgets.append(new EDockWidgetPlugin(this)); //m_widgets.append(new EDockWidgetPlugin(this));
m_widgets.append(new EMainWindowPlugin(this)); m_widgets.append(new EMainWindowPlugin(this));
m_widgets.append(new HistoryViewPlugin(this)); m_widgets.append(new HistoryViewPlugin(this));
m_widgets.append(new LogViewPlugin(this));
} }
@@ -17,5 +19,5 @@ QList<QDesignerCustomWidgetInterface * > QADApplication::customWidgets() const {
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(qad_graphic_plugin, QADApplication) Q_EXPORT_PLUGIN2(qad_application_plugin, QADApplication)
#endif #endif

View File

@@ -27,6 +27,9 @@
<file>../icons/clear-history.png</file> <file>../icons/clear-history.png</file>
<file>../icons/layer-visible-off.png</file> <file>../icons/layer-visible-off.png</file>
<file>../icons/layer-visible-on.png</file> <file>../icons/layer-visible-on.png</file>
<file>../icons/logview.png</file>
<file>../icons/qt.png</file> <file>../icons/qt.png</file>
<file>../icons/select-all.png</file>
<file>../icons/select-none.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -1,3 +1,19 @@
#[[
Also create imported targets:
* QAD::Utils
* QAD::Widgets
* QAD::Application
* QAD::Blockview
* QAD::Graphic
* QAD::SQLTable
* QAD::TouchWidgets
* QAD::Doc
These targets include directories and dependencies
]]
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
cmake_policy(SET CMP0020 NEW) # Automatically link Qt executables to qtmain target on Windows cmake_policy(SET CMP0020 NEW) # Automatically link Qt executables to qtmain target on Windows
if(NOT LIBPROJECT) if(NOT LIBPROJECT)
@@ -41,6 +57,24 @@ find_file(QAD_H_INCLUDE "qad_types.h" HINTS ${PIP_DIR}/include/qad ${_QAD_INCDIR
#endif() #endif()
set(_SEARCH_DIR ${_QAD_LIBDIR} $ENV{SMSDK_DIR}/lib) set(_SEARCH_DIR ${_QAD_LIBDIR} $ENV{SMSDK_DIR}/lib)
set(_QAD_LIBS utils widgets application blockview graphic sql_table touch_widgets doc) set(_QAD_LIBS utils widgets application blockview graphic sql_table touch_widgets doc)
set(_ITN_utils "Utils" )
set(_ITN_widgets "Widgets" )
set(_ITN_application "Application" )
set(_ITN_blockview "Blockview" )
set(_ITN_graphic "Graphic" )
set(_ITN_sql_table "SQLTable" )
set(_ITN_touch_widgets "TouchWidgets")
set(_ITN_doc "Doc" )
set(_ITLL_widgets "QAD::Utils")
set(_ITLL_application "QAD::Widgets")
set(_ITLL_blockview "QAD::Widgets")
set(_ITLL_graphic "QAD::Widgets")
set(_ITLL_sql_table "QAD::Widgets")
set(_ITLL_touch_widgets "")
set(_ITLL_doc "")
if(LIBPROJECT) if(LIBPROJECT)
set(QAD_INCLUDES ${QAD_DIR}) set(QAD_INCLUDES ${QAD_DIR})
endif() endif()
@@ -52,15 +86,41 @@ foreach(_Q ${_QAD_LIBS})
else() else()
foreach(_v ${_QT_VERSIONS_}) foreach(_v ${_QT_VERSIONS_})
find_library(QAD${_v}_${_QU}_LIBRARY qad_${_Q}${_v} HINTS ${_SEARCH_DIR}) find_library(QAD${_v}_${_QU}_LIBRARY qad_${_Q}${_v} HINTS ${_SEARCH_DIR})
set(MULTILIB_${_Q}_SUFFIX_Qt${_v} ${_v}) set(MULTILIB_qad_${_Q}_SUFFIX_Qt${_v} ${_v})
if(hasParent) if(hasParent)
set(MULTILIB_${_Q}_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE) set(MULTILIB_qad_${_Q}_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
endif() endif()
#message(STATUS "MULTILIB_qad_${_Q}_SUFFIX_Qt${_v} = ${_v}")
endforeach() endforeach()
endif() endif()
#message(STATUS "Library qad_${_Q}5 (${_QU}) -> ${QAD5_${_QU}_LIBRARY} found in ${_SEARCH_DIR}") #message(STATUS "Library qad_${_Q}5 (${_QU}) -> ${QAD5_${_QU}_LIBRARY} found in ${_SEARCH_DIR}")
list(APPEND QT_MULTILIB_LIST qad_${_Q}) list(APPEND QT_MULTILIB_LIST qad_${_Q})
endforeach() endforeach()
foreach(_Q ${_QAD_LIBS})
string(TOUPPER ${_Q} _QU)
set(_target QAD::${_ITN_${_Q}})
string(REPLACE ":" "_" _target_str "${_target}")
foreach(_v ${_QT_VERSIONS_})
if(NOT TARGET ${_target}${_v})
set(_link_list)
foreach(_l ${_ITLL_${_Q}})
list(APPEND _link_list ${_l}${_v})
endforeach()
add_library(${_target}${_v} UNKNOWN IMPORTED)
set_target_properties(${_target}${_v} PROPERTIES
IMPORTED_LOCATION "${QAD${_v}_${_QU}_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${QAD_INCLUDES}"
INTERFACE_LINK_LIBRARIES "${_link_list}")
set(MULTILIB_${_target_str}_SUFFIX_Qt${_v} ${_v})
if(hasParent)
set(MULTILIB_${_target_str}_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
endif()
#message(STATUS "add imported ${_target}${_v}")
#message(STATUS "add MULTILIB MULTILIB_${_target_str}_SUFFIX_Qt${_v} ${_v}")
endif()
endforeach()
list(APPEND QT_MULTILIB_LIST ${_target})
endforeach()
list(APPEND QT_MULTILIB_LIST qglview qglengine_core qglengine_widgets) list(APPEND QT_MULTILIB_LIST qglview qglengine_core qglengine_widgets)
foreach(_v ${_QT_VERSIONS_}) foreach(_v ${_QT_VERSIONS_})
find_library(QGLVIEW${_v}_LIBRARY qglview${_v} ${_SEARCH_DIR}) find_library(QGLVIEW${_v}_LIBRARY qglview${_v} ${_SEARCH_DIR})

View File

@@ -536,8 +536,9 @@ endmacro()
macro(_qt_multitarget_suffix_ _OUT _IN _v) macro(_qt_multitarget_suffix_ _OUT _IN _v)
if (NOT "x${MULTILIB_${_IN}_SUFFIX_Qt${_v}}" STREQUAL "x") string(REPLACE ":" "_" _in_str "${_IN}")
set(${_OUT} "${MULTILIB_${_IN}_SUFFIX_Qt${_v}}") if (NOT "x${MULTILIB_${_in_str}_SUFFIX_Qt${_v}}" STREQUAL "x")
set(${_OUT} "${MULTILIB_${_in_str}_SUFFIX_Qt${_v}}")
else() else()
set(${_OUT} "${MULTILIB_SUFFIX_Qt${_v}}") set(${_OUT} "${MULTILIB_SUFFIX_Qt${_v}}")
endif() endif()
@@ -554,6 +555,7 @@ macro(qt_target_link_libraries _NAME)
list(FIND QT_MULTILIB_LIST "${_i}" _ind) list(FIND QT_MULTILIB_LIST "${_i}" _ind)
if (_ind GREATER -1) if (_ind GREATER -1)
_qt_multitarget_suffix_(_TS ${_i} ${_v}) _qt_multitarget_suffix_(_TS ${_i} ${_v})
#message(STATUS "${_i} in MULTILIB_LIST, suffix = ${_TS}")
list(APPEND _ARGS ${_i}${_TS}) list(APPEND _ARGS ${_i}${_TS})
else() else()
list(APPEND _ARGS ${_i}) list(APPEND _ARGS ${_i})

View File

@@ -16,6 +16,12 @@ extern "C" {
# ifndef MKD_TOC # ifndef MKD_TOC
# define MKD_TOC 0x00001000 # define MKD_TOC 0x00001000
# endif # endif
# ifndef MKD_AUTOLINK
# define MKD_AUTOLINK 0x00004000
# endif
# ifndef MKD_GITHUBTAGS
# define MKD_GITHUBTAGS 0x08000000
# endif
#endif #endif
static QString markdown_css = "table { margin: 5px; background-color: #cccccc; }" static QString markdown_css = "table { margin: 5px; background-color: #cccccc; }"
@@ -41,7 +47,7 @@ QString md2html(const QByteArray & src) {
mkd_set_flag_num(flagm, MKD_DLEXTRA); mkd_set_flag_num(flagm, MKD_DLEXTRA);
mkd_set_flag_num(flagm, MKD_FENCEDCODE); mkd_set_flag_num(flagm, MKD_FENCEDCODE);
#else #else
mkd_flag_t flagm = (MKD_DLEXTRA | MKD_FENCEDCODE); mkd_flag_t flagm = (MKD_DLEXTRA | MKD_FENCEDCODE | MKD_GITHUBTAGS | MKD_AUTOLINK);
#endif #endif
MMIOT MMIOT
#endif #endif

View File

@@ -5,10 +5,11 @@
#include "ui_graphic_conf.h" #include "ui_graphic_conf.h"
#include <QMetaObject> #include <QMetaObject>
#include <QMessageBox> #include <QMessageBox>
#if QT_VERSION < 0x050000 #include <QTapAndHoldGesture>
# include <QTapAndHoldGesture> #include <QPanGesture>
# include <QPanGesture> #include <QPinchGesture>
# include <QPinchGesture> #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
# include <QRandomGenerator>
#endif #endif
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID
# define HAS_GL # define HAS_GL
@@ -25,17 +26,6 @@ __GraphicRegistrator__ __graphic_registrator__;
Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this), line_x_max(this), line_y_min(this), line_y_max(this) { Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this), line_x_max(this), line_y_min(this), line_y_max(this) {
canvas_gl = 0; canvas_gl = 0;
QTranslator * trans = new QTranslator();
trans->load(":/lang/qad_graphic_" + QLocale::system().name().left(2));
if (trans->isEmpty())
trans->load("lang/qad_graphic_" + QLocale::system().name().left(2));
#if QT_VERSION >= 0x050000
if (!qApp->installTranslator(trans))
delete trans;
#else
qApp->installTranslator(trans);
#endif
fullscr_dialog = 0;
gesture_angle = 45.; gesture_angle = 45.;
leg_update = true; leg_update = true;
visible_update = fullscr = need_mouse_pan = false; visible_update = fullscr = need_mouse_pan = false;
@@ -47,10 +37,6 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
#endif #endif
ui = new Ui::Graphic(); ui = new Ui::Graphic();
ui->setupUi(this); ui->setupUi(this);
/*line_x_min.resize(70, 22);
line_x_max.resize(70, 22);
line_y_min.resize(70, 22);
line_y_max.resize(70, 22);*/
line_x_min.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); line_x_min.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
line_x_max.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); line_x_max.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
((QBoxLayout * )ui->widgetLY->layout())->insertWidget(0, &line_y_min); ((QBoxLayout * )ui->widgetLY->layout())->insertWidget(0, &line_y_min);
@@ -59,8 +45,6 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
((QBoxLayout * )ui->widgetLX->layout())->addWidget(&line_x_max); ((QBoxLayout * )ui->widgetLX->layout())->addWidget(&line_x_max);
tm.restart(); tm.restart();
grid_numbers_x = grid_numbers_y = 1; grid_numbers_x = grid_numbers_y = 1;
LN2 = qLn(2.);
LN5 = qLn(5.);
LN10 = qLn(10.); LN10 = qLn(10.);
line_x_min.setClearButtonVisible(true); line_x_min.setClearButtonVisible(true);
line_x_max.setClearButtonVisible(true); line_x_max.setClearButtonVisible(true);
@@ -84,10 +68,9 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
icon_exp_sy = QIcon(":/icons/expand_s_y.png"); icon_exp_sy = QIcon(":/icons/expand_s_y.png");
icon_pause_b = QImage(":/icons/pause-back.png"); icon_pause_b = QImage(":/icons/pause-back.png");
icon_pause_f = QImage(":/icons/pause-front.png"); icon_pause_f = QImage(":/icons/pause-front.png");
aupdate = grid = isFit = isEmpty = navigation = true; aupdate = grid = isFit = navigation = true;
aalias = mupdate = bufferActive = isOGL = cancel = isPrinting = guides = hasLblX = hasLblY = isHover = false; aalias = bufferActive = isOGL = cancel = guides = hasLblX = hasLblY = isHover = false;
pause_ = only_expand_x = only_expand_y = false; pause_ = only_expand_x = only_expand_y = false;
//qDebug() << -DBL_MAX/2. << DBL_MAX/2. << DBL_MIN;
limit_.setCoords(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX); limit_.setCoords(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX);
eminx = eminy = DBL_MAX; eminx = eminy = DBL_MAX;
emaxx = emaxy = DBL_MIN; emaxx = emaxy = DBL_MIN;
@@ -95,13 +78,9 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
axis_type_x = Numeric; axis_type_x = Numeric;
min_repaint_int = 25; min_repaint_int = 25;
inc_x = 1.; inc_x = 1.;
legy = 0;
buffer = 0; buffer = 0;
gridx = gridy = 1.; gridx = gridy = 1.;
history = 5.; history = 5.;
min_int = 1;
max_int = 200;
mdm = 10.;
visible_time = -1.; visible_time = -1.;
thick = lineThickness(); thick = lineThickness();
pause_phase = 0.; pause_phase = 0.;
@@ -113,8 +92,6 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
selbrush.setColor(QColor(60, 175, 255, 100)); selbrush.setColor(QColor(60, 175, 255, 100));
text_color = palette().color(QPalette::WindowText); text_color = palette().color(QPalette::WindowText);
grid_pen = QPen(palette().color(QPalette::Disabled, QPalette::WindowText), 0., Qt::DotLine); grid_pen = QPen(palette().color(QPalette::Disabled, QPalette::WindowText), 0., Qt::DotLine);
//graph_pen = QPen(Qt::red);
//graph_pen.setCosmetic(true);
graphics.append(GraphicType()); graphics.append(GraphicType());
curGraphic = 0; curGraphic = 0;
selpen = palette().color(QPalette::WindowText); selpen = palette().color(QPalette::WindowText);
@@ -162,7 +139,6 @@ void Graphic::timerEvent(QTimerEvent * ) {
bool Graphic::eventFilter(QObject * o, QEvent * e) { bool Graphic::eventFilter(QObject * o, QEvent * e) {
//qDebug() << "event" << o << e;
if (o == canvas) { if (o == canvas) {
switch (e->type()) { switch (e->type()) {
case QEvent::Gesture: case QEvent::Gesture:
@@ -192,25 +168,7 @@ bool Graphic::eventFilter(QObject * o, QEvent * e) {
} break; } break;
default: break; default: break;
} }
} /*else { }
if (fullscr) {
switch (e->type()) {
case QEvent::KeyPress:
if ((((QKeyEvent*)e)->key() != Qt::Key_Back) || !fullscr)
break;
case QEvent::Close:
leaveFullscreen();
return true;
case QEvent::OrientationChange:
case QEvent::Resize: {
QWidget * rw = canvas->parentWidget();
if (rw)
canvas->setGeometry(0, 0, rw->width(), rw->height());
} break;
default: break;
}
}
}*/
return QFrame::eventFilter(o, e); return QFrame::eventFilter(o, e);
} }
@@ -223,7 +181,6 @@ void Graphic::prepareCanvas(QWidget * w) {
connect(w, SIGNAL(wheelEvent(QWheelEvent * )), this, SLOT(canvasWheelEvent(QWheelEvent * ))); connect(w, SIGNAL(wheelEvent(QWheelEvent * )), this, SLOT(canvasWheelEvent(QWheelEvent * )));
connect(w, SIGNAL(leaveEvent(QEvent * )), this, SLOT(canvasLeaveEvent(QEvent * ))); connect(w, SIGNAL(leaveEvent(QEvent * )), this, SLOT(canvasLeaveEvent(QEvent * )));
connect(w, SIGNAL(keyPressEvent(QKeyEvent * )), this, SLOT(canvasKeyPressEvent(QKeyEvent * ))); connect(w, SIGNAL(keyPressEvent(QKeyEvent * )), this, SLOT(canvasKeyPressEvent(QKeyEvent * )));
//w->grabGesture(Qt::TapGesture);
w->grabGesture(Qt::TapAndHoldGesture); w->grabGesture(Qt::TapAndHoldGesture);
w->grabGesture(Qt::PanGesture); w->grabGesture(Qt::PanGesture);
w->grabGesture(Qt::PinchGesture); w->grabGesture(Qt::PinchGesture);
@@ -246,7 +203,6 @@ void Graphic::procGesture(QGesture * g) {
} break; } break;
case Qt::PinchGesture: { case Qt::PinchGesture: {
QPinchGesture * pg = (QPinchGesture*)g; QPinchGesture * pg = (QPinchGesture*)g;
//qDebug() << pg->totalRotationAngle();
Qt::KeyboardModifiers km = Qt::NoModifier; Qt::KeyboardModifiers km = Qt::NoModifier;
if (gesture_angle <= 20.) km = Qt::ControlModifier; if (gesture_angle <= 20.) km = Qt::ControlModifier;
if (gesture_angle >= 70.) km = Qt::ShiftModifier; if (gesture_angle >= 70.) km = Qt::ShiftModifier;
@@ -261,10 +217,8 @@ void Graphic::procGesture(QGesture * g) {
QMetaObject::invokeMethod(this, "enterFullscreen", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "enterFullscreen", Qt::QueuedConnection);
} break; } break;
default: default:
qDebug() << g;
break; break;
} }
//qDebug() << g;
} }
@@ -295,8 +249,6 @@ void Graphic::totalUpdate() {
void Graphic::canvasPaintEvent() { void Graphic::canvasPaintEvent() {
if (is_lines_update) return; if (is_lines_update) return;
//QMutexLocker ml(&mutex_);
//static int pwid = 0, phei = 0;
int wid = canvas->width(), hei = canvas->height(); int wid = canvas->width(), hei = canvas->height();
if (canvas->isHidden() || wid <= 1 || hei <= 1) return; if (canvas->isHidden() || wid <= 1 || hei <= 1) return;
lastw = wid; lastw = wid;
@@ -320,19 +272,6 @@ void Graphic::canvasPaintEvent() {
drawGuides(); drawGuides();
return; return;
} }
//if (!aupdate && !mupdate && pwid == wid && phei == hei) return;
/*if (pwid != wid || phei != hei) {
line_x_min.move(0, hei - 35);
line_x_max.move(0, 0);
line_y_min.move(70, hei - line_x_min.height());
line_y_max.move(wid - line_y_max.width(), hei - line_x_min.height());
}
line_x_min.setVisible(grid);
line_x_max.setVisible(grid);
line_y_min.setVisible(grid);
line_y_max.setVisible(grid);*/
//pwid = wid;
//phei = hei;
QPainter p; QPainter p;
#ifdef HAS_GL #ifdef HAS_GL
if (isOGL) { if (isOGL) {
@@ -364,7 +303,6 @@ void Graphic::canvasPaintEvent() {
else glDisable(GL_MULTISAMPLE); else glDisable(GL_MULTISAMPLE);
} }
#endif #endif
//p.setRenderHint(QPainter::HighQualityAntialiasing, aalias);
fp_size.clear(); fp_size.clear();
if (!aalias) p.translate(-0.5, -0.5); if (!aalias) p.translate(-0.5, -0.5);
drawGraphics(); drawGraphics();
@@ -418,7 +356,7 @@ void Graphic::canvasMouseMoveEvent(QMouseEvent * e) {
case gaMove: case gaMove:
dp = e->pos() - prevpos; dp = e->pos() - prevpos;
dp.rx() *= selrect.width() / double(gridborder.x() + 5 - lastw); dp.rx() *= selrect.width() / double(gridborder.x() + 5 - lastw);
dp.ry() *= selrect.height() / double(lasth - legy - gridborder.y() - 5); dp.ry() *= selrect.height() / double(lasth - gridborder.y() - 5);
if (e->modifiers() == Qt::ControlModifier) if (e->modifiers() == Qt::ControlModifier)
dp.setY(0.); dp.setY(0.);
if (e->modifiers() == Qt::ShiftModifier) if (e->modifiers() == Qt::ShiftModifier)
@@ -433,7 +371,7 @@ void Graphic::canvasMouseMoveEvent(QMouseEvent * e) {
void Graphic::canvasMousePressEvent(QMouseEvent * e) { void Graphic::canvasMousePressEvent(QMouseEvent * e) {
emit graphicMousePressEvent(canvas2real(QPointF(e->pos())), e->buttons()); emit graphicMousePressEvent(canvas2real(QPointF(e->pos())), e->button());
if (!navigation) return; if (!navigation) return;
if (gestures && !need_mouse_pan) return; if (gestures && !need_mouse_pan) return;
#ifdef HAS_GL #ifdef HAS_GL
@@ -477,7 +415,7 @@ void Graphic::canvasMousePressEvent(QMouseEvent * e) {
void Graphic::canvasMouseReleaseEvent(QMouseEvent * e) { void Graphic::canvasMouseReleaseEvent(QMouseEvent * e) {
emit graphicMouseReleaseEvent(canvas2real(QPointF(e->pos())), e->buttons()); emit graphicMouseReleaseEvent(canvas2real(QPointF(e->pos())), e->button());
if (gestures) return; if (gestures) return;
need_mouse_pan = false; need_mouse_pan = false;
if (!navigation) return; if (!navigation) return;
@@ -533,11 +471,18 @@ void Graphic::canvasMouseDoubleClickEvent(QMouseEvent * ) {
void Graphic::canvasWheelEvent(QWheelEvent * e) { void Graphic::canvasWheelEvent(QWheelEvent * e) {
//if (curaction != gaMove) return; #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
emit graphicWheelEvent(canvas2real(e->position()), e->delta()/* TODO: test use angleDelta()*/);
#else
emit graphicWheelEvent(canvas2real(QPointF(e->pos())), e->delta()); emit graphicWheelEvent(canvas2real(QPointF(e->pos())), e->delta());
#endif
if (gestures) return; if (gestures) return;
if (!navigation) return; if (!navigation) return;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
procZoom(e->position(), e->delta(), e->modifiers());
#else
procZoom(e->pos(), e->delta(), e->modifiers()); procZoom(e->pos(), e->delta(), e->modifiers());
#endif
totalUpdate(); totalUpdate();
} }
@@ -577,7 +522,6 @@ void Graphic::canvasKeyPressEvent(QKeyEvent * e) {
void Graphic::clear() { void Graphic::clear() {
//cout << "clear" << endl;
for (int i = 0; i < graphics.size(); ++i) { for (int i = 0; i < graphics.size(); ++i) {
graphics[i].polyline.clear(); graphics[i].polyline.clear();
graphics[i].polyline_pause.clear(); graphics[i].polyline_pause.clear();
@@ -591,9 +535,6 @@ void Graphic::clear() {
void Graphic::setAntialiasing(bool enabled) { void Graphic::setAntialiasing(bool enabled) {
if (aalias == enabled) return; if (aalias == enabled) return;
aalias = enabled; aalias = enabled;
/*QGLFormat f = canvas_gl->format();
f.setSampleBuffers(enabled);
canvas_gl->setFormat(f);*/
update(); update();
} }
@@ -630,7 +571,6 @@ void Graphic::setHistorySize(double val) {
x = pol.back().x() - history; x = pol.back().x() - history;
for (int j = pol.size() - 2; j >= 0 ; --j) for (int j = pol.size() - 2; j >= 0 ; --j)
if (pol[j].x() < x) { if (pol[j].x() < x) {
//qDebug() << pol.size() << j;
pol.erase(pol.begin(), pol.begin() + j); pol.erase(pol.begin(), pol.begin() + j);
break; break;
} }
@@ -747,8 +687,6 @@ void Graphic::addPoint(const QPointF & p, int graphic, bool update_) {
if (graphic >= graphics.size() || graphic < 0) return; if (graphic >= graphics.size() || graphic < 0) return;
GraphicType & t(graphics[graphic]); GraphicType & t(graphics[graphic]);
if (!t.cvrect.isNull() && !pause_) { if (!t.cvrect.isNull() && !pause_) {
// if (graphics[graphic].cvrect.contains(p))
// graphics[graphic].cvrect = QRectF();
if (t.cvrect.top() < p.y()) t.cvrect.setTop(p.y()); if (t.cvrect.top() < p.y()) t.cvrect.setTop(p.y());
if (t.cvrect.bottom() > p.y()) t.cvrect.setBottom(p.y()); if (t.cvrect.bottom() > p.y()) t.cvrect.setBottom(p.y());
if (t.cvrect.right() < p.x()) t.cvrect.setRight(p.x()); if (t.cvrect.right() < p.x()) t.cvrect.setRight(p.x());
@@ -815,9 +753,7 @@ void Graphic::saveImage() {
if (str == "") return; if (str == "") return;
ppath = str; ppath = str;
QPixmap im(canvas->size()); QPixmap im(canvas->size());
mupdate = true;
canvas->render(&im); canvas->render(&im);
mupdate = false;
im.save(ppath); im.save(ppath);
update(true); update(true);
} }
@@ -840,29 +776,24 @@ void Graphic::setOpenGL(bool on) {
ui->canvas_raster->show(); ui->canvas_raster->show();
canvas = ui->canvas_raster; canvas = ui->canvas_raster;
#endif #endif
/*line_x_min.setParent(canvas);
line_x_max.setParent(canvas);
line_y_min.setParent(canvas);
line_y_max.setParent(canvas);
line_x_min.show();
line_x_max.show();
line_y_min.show();
line_y_max.show();*/
update(); update();
} }
void Graphic::update(bool force) { void Graphic::update(bool force) {
mupdate = true;
repaintCanvas(force); repaintCanvas(force);
mupdate = false;
} }
void Graphic::setGraphicsCount(int arg, bool update) { void Graphic::setGraphicsCount(int arg, bool update) {
if (arg < 0) return; if (arg < 0) return;
while (graphics.size() < arg) while (graphics.size() < arg) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
graphics.append(GraphicType(tr("y(x)"), QColor::fromHsv((graphics.size() * 55) % 360, 255, 255 - QRandomGenerator::global()->generate() % 115)));
#else
graphics.append(GraphicType(tr("y(x)"), QColor::fromHsv((graphics.size() * 55) % 360, 255, 255 - qrand() % 115))); graphics.append(GraphicType(tr("y(x)"), QColor::fromHsv((graphics.size() * 55) % 360, 255, 255 - qrand() % 115)));
#endif
}
while (graphics.size() > arg) { while (graphics.size() > arg) {
delete graphics.back().pb; delete graphics.back().pb;
graphics.pop_back(); graphics.pop_back();
@@ -879,76 +810,11 @@ void Graphic::removeGraphic(int arg, bool update) {
} }
/*void Graphic::setHistogramData(const QVector<float> & g, int graphic) {
graphics[graphic].polyline.clear();
if (g.isEmpty()) {
return;
}
QVector<float> data = g;
QVector<int> hist;
int ic = max_int, ci;
double md, cd, min, max, range, cx;
qSort(data);
md = DBL_MAX;
min = max = data[0];
for (int i = 1; i < data.size(); ++i) {
if (min > data[i]) min = data[i];
if (max < data[i]) max = data[i];
cd = qAbs<float>(data[i] - data[i - 1]);
if (md > cd && cd != 0.) md = cd;
}
range = max - min;
md = mdm;
//qDebug() << md << range << ic;
if (md != 0.)
ic = qRound(qMax<double>(qMin<double>(double(ic), range / md), double(min_int)));
md = range / ic;
hist.resize(ic);
foreach (const float & i, data) {
ci = qRound((i - min) / range * double(ic - 1));
//if (ci < 0) ci = 0;
//if (ci >= ic) ci = ic - 1;
hist[ci]++;
}
QPolygonF & cpol(graphics[graphic].polyline);
if (hist.size() == 1 || range == 0.) {
cpol << QPointF(min - 0.5, 0.) << QPointF(min - 0.25, 0.);
cpol << QPointF(min - 0.25, hist[0]) << QPointF(min + 0.25, hist[0]);
cpol << QPointF(min + 0.25, 0.) << QPointF(min + 0.5, 0.);
} else {
cpol << QPointF(min, 0.);
for (int i = 0; i < hist.size(); ++i) {
cx = i * range / ic + min;
cpol << QPointF(cx, hist[i]) << QPointF(cx + md, hist[i]);
}
cpol << QPointF(range + min, 0.);
}
updateGraphics();
}*/
void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, double end_y) { void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, double end_y) {
double cx, cy, maxX, minX, maxY, minY, vx; double cx, cy, maxX, minX, maxY, minY, vx;
bool isRangeX = (start_x != end_x), isRangeY = (start_y != end_y); bool isRangeX = (start_x != end_x), isRangeY = (start_y != end_y);
// bool isEmpty = true;
//bool fast = true;
bool can_fast = (start_x == 0 && end_x == 0 && start_y == 0 && end_y == 0); bool can_fast = (start_x == 0 && end_x == 0 && start_y == 0 && end_y == 0);
bool anyVisible = false, isTimeLimit = (visible_time > 0.) && !(isRangeX || isRangeY); bool anyVisible = false, isTimeLimit = (visible_time > 0.) && !(isRangeX || isRangeY);
//bool force_find = (visible_time > 0.) && (history > 0.) && (visible_time < history);
//if (force_find) can_fast = false;
// foreach (const GraphicType & t, graphics) {
// const QPolygonF & pol(pause_ ? t.polyline_pause : t.polyline);
// if (!pol.isEmpty()) {
// isEmpty = false;
// break;
// }
// }
// if (isEmpty) {
// grect = def_rect;
// setRectToLines();
// return;
// }
// can_fast = false;
vx = -DBL_MAX; vx = -DBL_MAX;
minY = minX = DBL_MAX; minY = minX = DBL_MAX;
maxY = maxX = -DBL_MAX; maxY = maxX = -DBL_MAX;
@@ -957,14 +823,12 @@ void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, dou
if (vx < (pause_ ? t.max_x_pause : t.max_x)) vx = (pause_ ? t.max_x_pause : t.max_x); if (vx < (pause_ ? t.max_x_pause : t.max_x)) vx = (pause_ ? t.max_x_pause : t.max_x);
} }
vx -= visible_time; vx -= visible_time;
//qDebug() << "[Graphic]" << "can_fast" << can_fast;
for (int g = 0; g < graphics.size(); g++) { for (int g = 0; g < graphics.size(); g++) {
GraphicType & t(graphics[g]); GraphicType & t(graphics[g]);
if (!t.visible) continue; if (!t.visible) continue;
const QPolygonF & pol(pause_ ? t.polyline_pause : t.polyline); const QPolygonF & pol(pause_ ? t.polyline_pause : t.polyline);
if (pol.isEmpty()) continue; if (pol.isEmpty()) continue;
bool f = true; bool f = true;
//qDebug() << "[Graphic]" << "cvrect:" << t.cvrect << t.cvrect.isNull();
if (t.cvrect.isNull() || !can_fast) { if (t.cvrect.isNull() || !can_fast) {
for (int i = 0; i < pol.size(); i++) { for (int i = 0; i < pol.size(); i++) {
cx = pol[i].x(); cx = pol[i].x();
@@ -981,10 +845,8 @@ void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, dou
if (t.cvrect.right() < cx) t.cvrect.setRight(cx); if (t.cvrect.right() < cx) t.cvrect.setRight(cx);
if (t.cvrect.left() > cx) t.cvrect.setLeft(cx); if (t.cvrect.left() > cx) t.cvrect.setLeft(cx);
} }
//fast = false;
} }
if (f) continue; if (f) continue;
//qDebug() << "[Graphic]" << "2 cvrect:" << t.cvrect;
} }
anyVisible = true; anyVisible = true;
if (maxY < t.cvrect.top()) maxY = t.cvrect.top(); if (maxY < t.cvrect.top()) maxY = t.cvrect.top();
@@ -994,13 +856,10 @@ void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, dou
if (!can_fast) t.cvrect = QRectF(); if (!can_fast) t.cvrect = QRectF();
} }
if (!anyVisible) { if (!anyVisible) {
//qDebug() << "[Graphic]" << "empty autofit";
grect = def_rect; grect = def_rect;
setRectToLines(); setRectToLines();
return; return;
} }
// if (fast) qDebug() << "[Graphic]" << "FAST autofit";
// else qDebug() << "[Graphic]" << "autofit";
if (maxX > limit_.right()) maxX = limit_.right(); if (maxX > limit_.right()) maxX = limit_.right();
if (minX > limit_.right()) minX = limit_.right(); if (minX > limit_.right()) minX = limit_.right();
if (minX < limit_.left()) minX = limit_.left(); if (minX < limit_.left()) minX = limit_.left();
@@ -1027,7 +886,7 @@ void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, dou
else if (isRangeY) selrect.setRect(minX, start_y, maxX - minX, end_y - start_y); else if (isRangeY) selrect.setRect(minX, start_y, maxX - minX, end_y - start_y);
else grect.setRect(minX, minY, maxX - minX, maxY - minY); else grect.setRect(minX, minY, maxX - minX, maxY - minY);
grect = grect.normalized(); grect = grect.normalized();
if (isFit)/* || isRangeX || isRangeY)*/ { if (isFit) {
if (visible_time > 0.) { if (visible_time > 0.) {
if (grect.width() > visible_time) if (grect.width() > visible_time)
grect.setLeft(grect.right() - visible_time); grect.setLeft(grect.right() - visible_time);
@@ -1039,7 +898,6 @@ void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, dou
void Graphic::drawAction() { void Graphic::drawAction() {
//qDebug() << "draw action";
int wid = canvas->width(), hei = canvas->height() - gridborder.y(), sx = startpos.x(), sy = startpos.y(), cx = curpos.x(), cy = curpos.y(); int wid = canvas->width(), hei = canvas->height() - gridborder.y(), sx = startpos.x(), sy = startpos.y(), cx = curpos.x(), cy = curpos.y();
painter->setPen(selpen); painter->setPen(selpen);
painter->setBrush(selbrush); painter->setBrush(selbrush);
@@ -1067,7 +925,7 @@ void Graphic::drawAction() {
void Graphic::drawGrid() { void Graphic::drawGrid() {
int gbx = gridborder.x(), gby = gridborder.y(), cwid = canvas->width(), chei = canvas->height() - legy; int gbx = gridborder.x(), gby = gridborder.y(), cwid = canvas->width(), chei = canvas->height();
double px, py, range, step, start; double px, py, range, step, start;
int wid = cwid - gbx - 5, hei = chei - gby - 5, cx, cy, cnt; int wid = cwid - gbx - 5, hei = chei - gby - 5, cx, cy, cnt;
QRect rect; QRect rect;
@@ -1075,7 +933,7 @@ void Graphic::drawGrid() {
range = selrect.bottom() - selrect.top(); range = selrect.bottom() - selrect.top();
if (grad_y == Graphic::Auto) step = splitRange(range, hei / gridy / font_sz.height() / 1.4); if (grad_y == Graphic::Auto) step = splitRange(range, hei / gridy / font_sz.height() / 1.4);
else step = gridy;//range / hei * gridy; else step = gridy;
start = roundTo(canvas2realY(-hei), step) - step; start = roundTo(canvas2realY(-hei), step) - step;
py = start + step; py = start + step;
cy = 0; cy = 0;
@@ -1132,7 +990,7 @@ void Graphic::drawGrid() {
QString df; QString df;
if (axis_type_x == Graphic::Numeric) { if (axis_type_x == Graphic::Numeric) {
if (grad_x == Graphic::Auto) step = splitRange(range, wid / gridx / font_sz.width() * 1.4); if (grad_x == Graphic::Auto) step = splitRange(range, wid / gridx / font_sz.width() * 1.4);
else step = gridx;//range / wid * gridx; else step = gridx;
start = roundTo(canvas2realX(wid), step) + step; start = roundTo(canvas2realX(wid), step) + step;
px = start + step; px = start + step;
if (step > 0.) { if (step > 0.) {
@@ -1172,21 +1030,15 @@ void Graphic::drawGrid() {
start = roundTo(canvas2realX(wid), step) + step; start = roundTo(canvas2realX(wid), step) + step;
px = start + step; px = start + step;
QDateTime cd = QDateTime::fromMSecsSinceEpoch(px * grid_numbers_x); QDateTime cd = QDateTime::fromMSecsSinceEpoch(px * grid_numbers_x);
//qDebug() << "*** start" << cd << step;
roundDateTime(cd, cur_scl); roundDateTime(cd, cur_scl);
//qDebug() << "*** round" << cd;
addDateTime(cd, cur_scl); addDateTime(cd, cur_scl);
//qDebug() << "*** add" << cd;
//qDebug() << "*** cur" << cur_scl[0] << cur_scl[1] << cur_scl[2] << cur_scl[3] << cur_scl[4] << cur_scl[5] << cur_scl[6];
if (step > 0.) { if (step > 0.) {
cnt = 1000; cnt = 1000;
while (cnt-- > 0) { while (cnt-- > 0) {
addDateTime(cd, cur_scl, -1); addDateTime(cd, cur_scl, -1);
//roundDateTime(cd, cur_scl);
//qDebug() << "next" << cd;
cx = real2canvasX(cd.toMSecsSinceEpoch() / grid_numbers_x); cx = real2canvasX(cd.toMSecsSinceEpoch() / grid_numbers_x);
if (cx > cwid) continue; if (cx > cwid) continue;
if (cx < gbx) {/*qDebug() << cx << "<" << gbx;*/ break;} if (cx < gbx) break;
painter->setPen(grid_pen); painter->setPen(grid_pen);
painter->drawLine(cx, hei + 5, cx, 0); painter->drawLine(cx, hei + 5, cx, 0);
painter->setPen(text_color); painter->setPen(text_color);
@@ -1230,13 +1082,12 @@ void Graphic::drawGraphics() {
if (isHover) if (isHover)
ui->status->setText(tr("Cursor: ") + pointCoords(canvas2real(QPointF(curpos)))); ui->status->setText(tr("Cursor: ") + pointCoords(canvas2real(QPointF(curpos))));
QPointF srp = -selrect.topLeft(); QPointF srp = -selrect.topLeft();
double sclx, scly, wid = canvas->width(), hei = canvas->height() - legy; double sclx, scly, wid = canvas->width(), hei = canvas->height();
sclx = (wid - gridborder.x() - margins_.left() - margins_.width()) / selrect.width(); sclx = (wid - gridborder.x() - margins_.left() - margins_.width()) / selrect.width();
scly = (hei - gridborder.y() - margins_.top() - margins_.height()) / selrect.height(); scly = (hei - gridborder.y() - margins_.top() - margins_.height()) / selrect.height();
painter->setClipping(true); painter->setClipping(true);
painter->setClipRect(QRect(gridborder.x(), 0, wid - gridborder.x(), hei - gridborder.y())); painter->setClipRect(QRect(gridborder.x(), 0, wid - gridborder.x(), hei - gridborder.y()));
painter->translate(gridborder.x() + margins_.left(), hei - gridborder.y() - margins_.top()); painter->translate(gridborder.x() + margins_.left(), hei - gridborder.y() - margins_.top());
//if (isOGL && aalias) pen.setWidthF(1.5f);
painter->scale(sclx, -scly); painter->scale(sclx, -scly);
painter->translate(srp); painter->translate(srp);
QTransform mat = painter->transform(); QTransform mat = painter->transform();
@@ -1257,8 +1108,6 @@ void Graphic::drawGraphics() {
if (t.fill) { if (t.fill) {
cpol = rpol; cpol = rpol;
painter->setBrush(t.fill_color); painter->setBrush(t.fill_color);
//cpol.push_front(QPointF(cpol.front().x(), 0.));
//cpol.push_back(QPointF(cpol.back().x(), 0.));
painter->drawPolygon(mat.map(cpol)); painter->drawPolygon(mat.map(cpol));
} else } else
painter->drawPolyline(mat.map(rpol)); painter->drawPolyline(mat.map(rpol));
@@ -1350,7 +1199,6 @@ double Graphic::splitRange(double range, int count) {
double Graphic::splitRangeDate(double range, int count, QString * format, int step[7]) { double Graphic::splitRangeDate(double range, int count, QString * format, int step[7]) {
double ret = splitRange(range, count); double ret = splitRange(range, count);
//qDebug() << "ret =" << ret << getScaleX();
if (ret < 1000. * 1) {*format = "ss.zzz"; step[0] = ret;} if (ret < 1000. * 1) {*format = "ss.zzz"; step[0] = ret;}
else if (ret < 1000. * 60) {*format = "h:m:ss"; step[1] = qRound(ret / 1000);} else if (ret < 1000. * 60) {*format = "h:m:ss"; step[1] = qRound(ret / 1000);}
else if (ret < 1000. * 60 * 60) {*format = "h:mm"; step[2] = qRound(ret / 1000 / 60);} else if (ret < 1000. * 60 * 60) {*format = "h:mm"; step[2] = qRound(ret / 1000 / 60);}
@@ -1370,7 +1218,6 @@ double Graphic::roundTo(double value, double round_to) {
void Graphic::roundDateTime(QDateTime & dt, int c[7]) { void Graphic::roundDateTime(QDateTime & dt, int c[7]) {
QDate d(dt.date()); QTime t(dt.time()); QDate d(dt.date()); QTime t(dt.time());
//if (c[0] != 0) t.setHMS(t.hour(), t.minute(), t.second(), 0);
if (c[1] != 0) t.setHMS(t.hour(), t.minute(), t.second()); if (c[1] != 0) t.setHMS(t.hour(), t.minute(), t.second());
if (c[2] != 0) t.setHMS(t.hour(), t.minute(), 0); if (c[2] != 0) t.setHMS(t.hour(), t.minute(), 0);
if (c[3] != 0) t.setHMS(t.hour(), 0, 0); if (c[3] != 0) t.setHMS(t.hour(), 0, 0);
@@ -1400,7 +1247,7 @@ double Graphic::canvas2realX(double px) const {
double Graphic::canvas2realY(double py) const { double Graphic::canvas2realY(double py) const {
int gby = gridborder.y() + margins_.top(), chei = lasth - legy, hei = chei - gby - margins_.height(); int gby = gridborder.y() + margins_.top(), chei = lasth, hei = chei - gby - margins_.height();
double cy = chei - py - gby, scly = selrect.height() / (double)hei; double cy = chei - py - gby, scly = selrect.height() / (double)hei;
return cy * scly + selrect.y(); return cy * scly + selrect.y();
} }
@@ -1414,7 +1261,7 @@ double Graphic::real2canvasX(double px) const {
double Graphic::real2canvasY(double py) const { double Graphic::real2canvasY(double py) const {
int gby = gridborder.y() + margins_.top(), chei = lasth - legy, hei = chei - gby - margins_.height(); int gby = gridborder.y() + margins_.top(), chei = lasth, hei = chei - gby - margins_.height();
double scly = selrect.height() / (double)hei; double scly = selrect.height() / (double)hei;
return chei - gby - (py - selrect.y()) / scly; return chei - gby - (py - selrect.y()) / scly;
} }
@@ -1469,7 +1316,6 @@ void Graphic::setCanvasCursor(QCursor cursor) {
void Graphic::swapToBuffer() { void Graphic::swapToBuffer() {
QImage timg; QImage timg;
//qDebug() << "render start";
#ifdef HAS_GL #ifdef HAS_GL
if (isOGL) { if (isOGL) {
timg = canvas_gl->grabFrameBuffer(); timg = canvas_gl->grabFrameBuffer();
@@ -1478,16 +1324,12 @@ void Graphic::swapToBuffer() {
p.end(); p.end();
} }
#endif #endif
//qDebug() << "render finish";
bufferActive = true; bufferActive = true;
} }
void Graphic::setRectToLines() { void Graphic::setRectToLines() {
is_lines_update = true; is_lines_update = true;
//line_x_min.is_auto = line_x_max.is_auto = line_y_min.is_auto = line_y_max.is_auto = true;
//qDebug() << "set to lines" << selrect;
//line_x_min.is_reset = line_x_max.is_reset = line_y_min.is_reset = line_y_max.is_reset = isFit;
if (line_x_min.isVisible() && line_x_max.isVisible() && line_y_min.isVisible() && line_y_max.isVisible()) { if (line_x_min.isVisible() && line_x_max.isVisible() && line_y_min.isVisible() && line_y_max.isVisible()) {
line_x_min.blockSignals(true); line_x_max.blockSignals(true); line_y_min.blockSignals(true); line_y_max.blockSignals(true); line_x_min.blockSignals(true); line_x_max.blockSignals(true); line_y_min.blockSignals(true); line_y_max.blockSignals(true);
if (!line_x_min.hasFocus()) { if (!line_x_min.hasFocus()) {
@@ -1511,12 +1353,7 @@ void Graphic::setRectToLines() {
line_y_min.setDefaultText(QString::number(grect.bottom()).toUpper()); line_y_min.setDefaultText(QString::number(grect.bottom()).toUpper());
line_y_max.setDefaultText(QString::number(grect.top()).toUpper()); line_y_max.setDefaultText(QString::number(grect.top()).toUpper());
line_x_min.blockSignals(false); line_x_max.blockSignals(false); line_y_min.blockSignals(false); line_y_max.blockSignals(false); line_x_min.blockSignals(false); line_x_max.blockSignals(false); line_y_min.blockSignals(false); line_y_max.blockSignals(false);
// if(isFit) {
// line_y_min.setValue(grect.left());
// line_y_max.setValue(grect.left());
// }
} }
//line_x_min.is_auto = line_x_max.is_auto = line_y_min.is_auto = line_y_max.is_auto = false;
is_lines_update = false; is_lines_update = false;
} }
@@ -1529,7 +1366,6 @@ void Graphic::checkLines() {
void Graphic::tick(int index, bool slide, bool update_) { void Graphic::tick(int index, bool slide, bool update_) {
if (slide) { if (slide) {
///mutex.lock();
GraphicType & t(graphics[index]); GraphicType & t(graphics[index]);
if (history > 0.) if (history > 0.)
while (t.polyline.size() > 1) { while (t.polyline.size() > 1) {
@@ -1549,17 +1385,13 @@ void Graphic::tick(int index, bool slide, bool update_) {
} }
if (!update_) { if (!update_) {
if (isFit) findGraphicsRect(); if (isFit) findGraphicsRect();
///mutex.unlock();
return; return;
} }
//polyline.push_back(QPointF(brick->time_, brick->output(port)));
//cout << polyline.size() << endl;
if (isFit) findGraphicsRect(); if (isFit) findGraphicsRect();
if (!slide) { if (!slide) {
if (aupdate) update(); if (aupdate) update();
return; return;
} }
///mutex.unlock();
if (aupdate) update(); if (aupdate) update();
} }
@@ -1650,10 +1482,8 @@ void Graphic::updateLegend(bool es) {
} }
if (!ui->widgetLegend->isVisibleTo(this)) { if (!ui->widgetLegend->isVisibleTo(this)) {
if (es) emit graphicSettingsChanged(); if (es) emit graphicSettingsChanged();
// qDebug() << "skip updateLegend";
return; return;
} }
// qDebug() << "updateLegend" << graphics.size();
leg_update = false; leg_update = false;
int ps = 100; int ps = 100;
for (int r = 0; r < ui->layoutLegend->rowCount(); ++r) for (int r = 0; r < ui->layoutLegend->rowCount(); ++r)
@@ -1669,12 +1499,10 @@ void Graphic::updateLegend(bool es) {
for (int i = 0; i < graphics.size(); i++) { for (int i = 0; i < graphics.size(); i++) {
graphics[i].pb = new QCheckBox(graphics[i].name); graphics[i].pb = new QCheckBox(graphics[i].name);
graphics[i].pb->setIconSize(pix.size()); graphics[i].pb->setIconSize(pix.size());
//graphics[i].pb->setFlat(true);
graphics[i].pb->setIcon(graphics[i].icon); graphics[i].pb->setIcon(graphics[i].icon);
graphics[i].pb->setChecked(graphics[i].visible); graphics[i].pb->setChecked(graphics[i].visible);
graphics[i].pb->setProperty("graphic_num", i); graphics[i].pb->setProperty("graphic_num", i);
graphics[i].pb->setContextMenuPolicy(Qt::ActionsContextMenu); graphics[i].pb->setContextMenuPolicy(Qt::ActionsContextMenu);
//qDebug() << graphics[i].pb->actions();
QAction * act = new QAction(tr("Check all"), 0); QAction * act = new QAction(tr("Check all"), 0);
act->setCheckable(true); act->setCheckable(true);
act->setChecked(true); act->setChecked(true);
@@ -1719,7 +1547,6 @@ void Graphic::graphicVisibleChange(bool checked) {
if (isFit) on_buttonAutofit_clicked(); if (isFit) on_buttonAutofit_clicked();
else update(); else update();
emit graphicSettingsChanged(); emit graphicSettingsChanged();
//update();
} }
@@ -1738,7 +1565,6 @@ void Graphic::graphicAllVisibleChange(bool checked) {
void Graphic::enterFullscreen() { void Graphic::enterFullscreen() {
if (fullscr) return; if (fullscr) return;
//QMessageBox::information(0, "", "enter");
fullscr = true; fullscr = true;
canvas->hide(); canvas->hide();
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
@@ -1750,7 +1576,6 @@ void Graphic::enterFullscreen() {
QPushButton * btn = new QPushButton("Leave fullscreen"); QPushButton * btn = new QPushButton("Leave fullscreen");
dlg.layout()->addWidget(btn); dlg.layout()->addWidget(btn);
connect(btn, SIGNAL(clicked(bool)), this, SLOT(leaveFullscreen())); connect(btn, SIGNAL(clicked(bool)), this, SLOT(leaveFullscreen()));
//connect(fullscr_dialog, SIGNAL(finished(int)), this, SLOT(leaveFullscreen()));
canvas->show(); canvas->show();
dlg.showFullScreen(); dlg.showFullScreen();
dlg.exec(); dlg.exec();
@@ -1771,9 +1596,7 @@ void Graphic::leaveFullscreen() {
if (tm_fscr.elapsed() < 100) return; if (tm_fscr.elapsed() < 100) return;
#endif #endif
if (!fullscr) return; if (!fullscr) return;
//QMessageBox::information(0, "", "leave");
fullscr = false; fullscr = false;
//canvas->hide();
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID
canvas->showNormal(); canvas->showNormal();
canvas->hide(); canvas->hide();
@@ -1817,6 +1640,10 @@ QByteArray Graphic::save() {
cs.add(9, gridPen()).add(10, graduationX()).add(11, graduationY()).add(12, graduationStepX()).add(13, graduationStepY()); cs.add(9, gridPen()).add(10, graduationX()).add(11, graduationY()).add(12, graduationStepX()).add(13, graduationStepY());
cs.add(14, graphics); cs.add(14, graphics);
cs.add(15, isFit).add(16, visualRect()); cs.add(15, isFit).add(16, visualRect());
if (backgroundColor() == palette().color(QPalette::Base) &&
textColor() == palette().color(QPalette::WindowText) &&
gridColor() == palette().color(QPalette::Disabled, QPalette::WindowText))
cs.add(17, true);
return cs.data().prepend('2'); return cs.data().prepend('2');
} }
@@ -1824,12 +1651,12 @@ QByteArray Graphic::save() {
void Graphic::load(QByteArray ba) { void Graphic::load(QByteArray ba) {
if (ba.isEmpty()) return; if (ba.isEmpty()) return;
char ver = ba[0]; char ver = ba[0];
//qDebug() << "load" << (int)ver;
switch(ver) { switch(ver) {
case '2': {// version '2': case '2': {// version '2':
ba.remove(0, 1); ba.remove(0, 1);
QRectF vrect; QRectF vrect;
ChunkStream cs(ba); ChunkStream cs(ba);
bool def_colors = false;
while (!cs.atEnd()) { while (!cs.atEnd()) {
switch (cs.read()) { switch (cs.read()) {
case 1: setAntialiasing(cs.getData<bool>()); break; case 1: setAntialiasing(cs.getData<bool>()); break;
@@ -1837,10 +1664,10 @@ void Graphic::load(QByteArray ba) {
case 3: setBorderInputsVisible(cs.getData<bool>()); break; case 3: setBorderInputsVisible(cs.getData<bool>()); break;
case 4: setStatusVisible(cs.getData<bool>()); break; case 4: setStatusVisible(cs.getData<bool>()); break;
case 5: setLegendVisible(cs.getData<bool>()); break; case 5: setLegendVisible(cs.getData<bool>()); break;
case 6: setBackgroundColor(cs.getData<QColor>()); break; case 6: if (!def_colors) setBackgroundColor(cs.getData<QColor>()); break;
case 7: setTextColor(cs.getData<QColor>()); break; case 7: if (!def_colors) setTextColor(cs.getData<QColor>()); break;
case 8: setMargins(cs.getData<QRect>()); break; case 8: setMargins(cs.getData<QRect>()); break;
case 9: setGridPen(cs.getData<QPen>()); break; case 9: if (!def_colors) setGridPen(cs.getData<QPen>()); break;
case 10: setGraduationX(cs.getData<Graduation>()); break; case 10: setGraduationX(cs.getData<Graduation>()); break;
case 11: setGraduationY(cs.getData<Graduation>()); break; case 11: setGraduationY(cs.getData<Graduation>()); break;
case 12: setGraduationStepX(cs.getData<double>()); break; case 12: setGraduationStepX(cs.getData<double>()); break;
@@ -1848,6 +1675,12 @@ void Graphic::load(QByteArray ba) {
case 14: graphics = cs.getData<QVector<GraphicType> >(); break; case 14: graphics = cs.getData<QVector<GraphicType> >(); break;
case 15: isFit = cs.getData<bool>(); break; case 15: isFit = cs.getData<bool>(); break;
case 16: vrect = cs.getData<QRectF>(); break; case 16: vrect = cs.getData<QRectF>(); break;
case 17: if(cs.getData<bool>()) {
setTextColor(palette().color(QPalette::WindowText));
setGridPen(QPen(palette().color(QPalette::Disabled, QPalette::WindowText), 0., Qt::DotLine));
setBackgroundColor(palette().color(QPalette::Base));
def_colors = true;
} break;
default: break; default: break;
} }
} }

View File

@@ -28,7 +28,7 @@
#include <QDebug> #include <QDebug>
#include <QGridLayout> #include <QGridLayout>
#include <QFileDialog> #include <QFileDialog>
#include <QTime> #include <QElapsedTimer>
#include <QTranslator> #include <QTranslator>
#include <QGestureEvent> #include <QGestureEvent>
#include <qmath.h> #include <qmath.h>
@@ -113,16 +113,12 @@ class QAD_EXPORT Graphic: public QFrame
Q_PROPERTY(double graduationStepY READ graduationStepY WRITE setGraduationStepY) Q_PROPERTY(double graduationStepY READ graduationStepY WRITE setGraduationStepY)
Q_PROPERTY(AxisType axisType READ axisType WRITE setAxisType) Q_PROPERTY(AxisType axisType READ axisType WRITE setAxisType)
Q_PROPERTY(int histogramMinIntervals READ histogramMinIntervals WRITE setHistogramMinIntervals)
Q_PROPERTY(int histogramMaxIntervals READ histogramMaxIntervals WRITE setHistogramMaxIntervals)
Q_PROPERTY(double histogramMinDeltaMultiplier READ histogramMinDeltaMultiplier WRITE setHistogramMinDeltaMultiplier)
Q_PROPERTY(Graphic::GraphicsData graphicsData READ graphicsData WRITE setGraphicsData) Q_PROPERTY(Graphic::GraphicsData graphicsData READ graphicsData WRITE setGraphicsData)
Q_PROPERTY(QByteArray graphicsDataRaw READ graphicsDataRaw WRITE setGraphicsDataRaw) Q_PROPERTY(QByteArray graphicsDataRaw READ graphicsDataRaw WRITE setGraphicsDataRaw)
public: public:
Graphic(QWidget * parent = 0); Graphic(QWidget * parent = 0);
~Graphic(); virtual ~Graphic();
typedef QVector<QVector<QPointF> > GraphicsData; typedef QVector<QVector<QPointF> > GraphicsData;
enum GraphicAction {gaNone, gaZoomInRect, gaZoomRangeX, gaZoomRangeY, gaMove}; enum GraphicAction {gaNone, gaZoomInRect, gaZoomRangeX, gaZoomRangeY, gaMove};
@@ -196,9 +192,6 @@ public:
QRectF limit() const {return limit_;} QRectF limit() const {return limit_;}
QRect margins() const {return margins_;} QRect margins() const {return margins_;}
int minimumRepaintInterval() const {return min_repaint_int;} int minimumRepaintInterval() const {return min_repaint_int;}
int histogramMinIntervals() const {return min_int;}
int histogramMaxIntervals() const {return max_int;}
double histogramMinDeltaMultiplier() const {return mdm;}
double gridNumbersMultiplierX() const {return grid_numbers_x;} double gridNumbersMultiplierX() const {return grid_numbers_x;}
double gridNumbersMultiplierY() const {return grid_numbers_y;} double gridNumbersMultiplierY() const {return grid_numbers_y;}
Graduation graduationX() const {return grad_x;} Graduation graduationX() const {return grad_x;}
@@ -212,17 +205,10 @@ public:
QWidget * viewport() const {return canvas;} QWidget * viewport() const {return canvas;}
QByteArray save(); QByteArray save();
void load(QByteArray ba); void load(QByteArray ba);
///void lock() {mutex_.lock();}
///void unlock() {mutex_.unlock();}
///void reset() {mutex.lock(); clear(); mutex.unlock();}
void reset() {clear();}
GraphicType graphic(int arg) {if (arg < 0 || arg >= graphics.size()) return GraphicType(); return graphics[arg];} GraphicType graphic(int arg) {if (arg < 0 || arg >= graphics.size()) return GraphicType(); return graphics[arg];}
const QVector<GraphicType> & allGraphics() const {return graphics;} const QVector<GraphicType> & allGraphics() const {return graphics;}
void setAllGraphics(const QVector<GraphicType> & g, bool update = true) {graphics = g; if (update) updateLegend();} void setAllGraphics(const QVector<GraphicType> & g, bool update = true) {graphics = g; if (update) updateLegend();}
// void setHistogramData(const QVector<float> & g, int graphic);
// void setHistogramData(const QVector<float> & g) {setHistogramData(g, curGraphic);}
double canvas2realX(double px) const; double canvas2realX(double px) const;
double canvas2realY(double py) const; double canvas2realY(double py) const;
@@ -248,7 +234,8 @@ public slots:
void setGraphicColor(const QColor & color) {setGraphicColor(color, curGraphic);} void setGraphicColor(const QColor & color) {setGraphicColor(color, curGraphic);}
void setGridColor(const QColor & color) {grid_pen.setColor(color); if (aupdate) update();} void setGridColor(const QColor & color) {grid_pen.setColor(color); if (aupdate) update();}
void setSelectionColor(const QColor & color) {selpen.setColor(color);} void setSelectionColor(const QColor & color) {selpen.setColor(color);}
void setGraphicStyle(const Qt::PenStyle & style) {graphics[curGraphic].pen.setStyle(style); updateLegend(); if (aupdate) update();} void setGraphicStyle(const Qt::PenStyle & style, int index) {graphics[index].pen.setStyle(style); updateLegend(); if (aupdate) update();}
void setGraphicStyle(const Qt::PenStyle & style) {setGraphicStyle(style, curGraphic);}
void setGridStyle(const Qt::PenStyle & style) {grid_pen.setStyle(style); if (aupdate) update();} void setGridStyle(const Qt::PenStyle & style) {grid_pen.setStyle(style); if (aupdate) update();}
void setSelectionStyle(const Qt::PenStyle & style) {selpen.setStyle(style);} void setSelectionStyle(const Qt::PenStyle & style) {selpen.setStyle(style);}
void setGraphicVisible(bool visible, int index) {graphics[index].visible = visible; updateLegendChecks(); if (aupdate) update();} void setGraphicVisible(bool visible, int index) {graphics[index].visible = visible; updateLegendChecks(); if (aupdate) update();}
@@ -295,9 +282,6 @@ public slots:
void setOnlyExpandY(bool yes); void setOnlyExpandY(bool yes);
void setOnlyExpandX(bool yes); void setOnlyExpandX(bool yes);
void setGesturesNavigation(bool yes); void setGesturesNavigation(bool yes);
void setHistogramMinIntervals(int value) {min_int = value; updateGraphics();}
void setHistogramMaxIntervals(int value) {max_int = value; updateGraphics();}
void setHistogramMinDeltaMultiplier(double value) {mdm = value; updateGraphics();}
void setGraphicsData(const GraphicsData & gd); void setGraphicsData(const GraphicsData & gd);
void setGraphicsDataRaw(const QByteArray & ba); void setGraphicsDataRaw(const QByteArray & ba);
@@ -376,8 +360,6 @@ protected:
Ui::Graphic * ui; Ui::Graphic * ui;
UGLWidget * canvas_gl; UGLWidget * canvas_gl;
///QMutex mutex, mutex_;
QDialog * fullscr_dialog;
QWidget * canvas; QWidget * canvas;
QImage * buffer; QImage * buffer;
QPainter * painter; QPainter * painter;
@@ -387,7 +369,7 @@ protected:
QVector<GraphicType> graphics; QVector<GraphicType> graphics;
int curGraphic; int curGraphic;
GraphicAction curaction, prevaction; GraphicAction curaction, prevaction;
QRectF grect, rrect, selrect, limit_, def_rect; QRectF grect, selrect, limit_, def_rect;
QRect margins_; QRect margins_;
QSize font_sz; QSize font_sz;
QPoint startpos, curpos, prevpos, gridborder; QPoint startpos, curpos, prevpos, gridborder;
@@ -397,15 +379,18 @@ protected:
Graphic::Alignment align; Graphic::Alignment align;
GraphicConf * conf; GraphicConf * conf;
EvalSpinBox line_x_min, line_x_max, line_y_min, line_y_max; EvalSpinBox line_x_min, line_x_max, line_y_min, line_y_max;
QTime tm, tm_fscr; QElapsedTimer tm;
#ifdef Q_OS_ANDROID
QElapsedTimer tm_fscr;
#endif
QIcon icon_exp_x, icon_exp_y, icon_exp_sx, icon_exp_sy; QIcon icon_exp_x, icon_exp_y, icon_exp_sx, icon_exp_sy;
QImage icon_pause_b, icon_pause_f; QImage icon_pause_b, icon_pause_f;
Graduation grad_x, grad_y; Graduation grad_x, grad_y;
AxisType axis_type_x; AxisType axis_type_x;
double gridx, gridy, history, visible_time, inc_x, mdm, grid_numbers_x, grid_numbers_y, LN2, LN5, LN10; double gridx, gridy, history, visible_time, inc_x, grid_numbers_x, grid_numbers_y, LN10;
double eminx, eminy, emaxx, emaxy, pause_phase, gesture_angle; double eminx, eminy, emaxx, emaxy, pause_phase, gesture_angle;
int legy, lastw, lasth, min_repaint_int, min_int, max_int, timer_pause, thick; int lastw, lasth, min_repaint_int, timer_pause, thick;
bool aalias, aupdate, mupdate, grid, guides, isFit, isEmpty, isOGL, isHover, bufferActive, cancel, pause_, isPrinting, gestures; bool aalias, aupdate, grid, guides, isFit, isOGL, isHover, bufferActive, cancel, pause_, gestures;
bool hasLblX, hasLblY, navigation, only_expand_y, only_expand_x, is_lines_update, leg_update, visible_update, fullscr, need_mouse_pan; bool hasLblX, hasLblY, navigation, only_expand_y, only_expand_x, is_lines_update, leg_update, visible_update, fullscr, need_mouse_pan;
protected slots: protected slots:
@@ -424,7 +409,7 @@ protected slots:
void lineYMinChanged(double value) {selrect.setBottom(value); checkLines();} void lineYMinChanged(double value) {selrect.setBottom(value); checkLines();}
void lineYMaxChanged(double value) {selrect.setTop(value); checkLines();} void lineYMaxChanged(double value) {selrect.setTop(value); checkLines();}
void on_buttonClose_clicked() {emit closeRequest(this);} void on_buttonClose_clicked() {emit closeRequest(this);}
void on_buttonClear_clicked() {reset(); emit cleared();} void on_buttonClear_clicked() {clear(); emit cleared();}
void on_buttonAutofit_clicked(); void on_buttonAutofit_clicked();
void on_buttonConfigure_clicked(); void on_buttonConfigure_clicked();
void on_buttonFullscreen_clicked() {fullscreen();} void on_buttonFullscreen_clicked() {fullscreen();}

View File

@@ -129,7 +129,7 @@ void MainWindow::saving(QPIConfig & conf) {
vc = treeGraphics->topLevelItemCount(); vc = treeGraphics->topLevelItemCount();
for (int i = 0; i < vc; ++i) { for (int i = 0; i < vc; ++i) {
QTreeWidgetItem * ti = treeGraphics->topLevelItem(i); QTreeWidgetItem * ti = treeGraphics->topLevelItem(i);
vars << QString::number(ti->backgroundColor(1).rgb()) << ti->text(2); vars << QString::number(ti->background(1).color().rgb()) << ti->text(2);
} }
QByteArray ba; QDataStream s(&ba, QIODevice::WriteOnly); QByteArray ba; QDataStream s(&ba, QIODevice::WriteOnly);
s << graphic->allGraphics(); s << graphic->allGraphics();

BIN
qad/icons/logview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

BIN
qad/icons/select-all.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
qad/icons/select-none.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -3,7 +3,7 @@
#include <QtCore/QtGlobal> #include <QtCore/QtGlobal>
#if defined(QAD_STATIC_DEFINE) || defined(Q_CC_GNU) || defined(DOXYGEN) #if defined(QAD_STATIC_DEFINE) || defined(DOXYGEN)
# define QAD_EXPORT # define QAD_EXPORT
#else #else
# ifdef QAD_SHARED_DEFINE # ifdef QAD_SHARED_DEFINE

View File

@@ -1,6 +1,7 @@
#include "iconedlabel.h" #include "iconedlabel.h"
#include "qad_types.h" #include "qad_types.h"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QStyle>
#include <QEvent> #include <QEvent>
@@ -8,13 +9,23 @@ IconedLabel::IconedLabel(QWidget * parent): QFrame(parent) {
label_.setAlignment(Qt::AlignCenter); label_.setAlignment(Qt::AlignCenter);
icon_.setAlignment(Qt::AlignCenter); icon_.setAlignment(Qt::AlignCenter);
icon_.setScaledContents(true); icon_.setScaledContents(true);
icon_.setHidden(true);
setIconSize(QSize()); setIconSize(QSize());
setDirection(RightToLeft); setDirection(RightToLeft);
} }
QString IconedLabel::text() const {
return label_.text();
}
QIcon IconedLabel::icon() const { QIcon IconedLabel::icon() const {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
return icon_.pixmap(Qt::ReturnByValue).isNull() ? QIcon() : QIcon(icon_.pixmap(Qt::ReturnByValue));
#else
return icon_.pixmap() == 0 ? QIcon() : QIcon(*icon_.pixmap()); return icon_.pixmap() == 0 ? QIcon() : QIcon(*icon_.pixmap());
#endif
} }
@@ -25,14 +36,36 @@ bool IconedLabel::event(QEvent * e) {
} }
void IconedLabel::checkSpacing() {
label_.setHidden(label_.text().isEmpty());
if (!layout()) return;
if (label_.isHidden() || icon_.isHidden()) {
layout()->setSpacing(0);
} else {
QStyle * s = style();
if (s)
layout()->setSpacing(s->layoutSpacing(QSizePolicy::Label, QSizePolicy::Label,
dir_ <= Direction::RightToLeft ? Qt::Horizontal : Qt::Vertical));
}
}
QSize IconedLabel::realIconSize() const { QSize IconedLabel::realIconSize() const {
return size_.isValid() ? size_ : preferredIconSize(1.f, this); return size_.isValid() ? size_ : preferredIconSize(1.f, this);
} }
void IconedLabel::setText(const QString & t) {
label_.setText(t);
checkSpacing();
}
void IconedLabel::setIcon(const QIcon & i) { void IconedLabel::setIcon(const QIcon & i) {
sicon_ = i; sicon_ = i;
setIconSize(iconSize()); setIconSize(iconSize());
icon_.setHidden(icon().isNull());
checkSpacing();
} }
@@ -55,5 +88,6 @@ void IconedLabel::setDirection(IconedLabel::Direction d) {
lay->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding)); lay->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding));
lay->setContentsMargins(0, 0, 0, 0); lay->setContentsMargins(0, 0, 0, 0);
setLayout(lay); setLayout(lay);
checkSpacing();
update(); update();
} }

View File

@@ -38,13 +38,16 @@ public:
explicit IconedLabel(QWidget * parent = 0); explicit IconedLabel(QWidget * parent = 0);
QString text() const {return label_.text();} QString text() const;
QIcon icon() const; QIcon icon() const;
QSize iconSize() const {return size_;} QSize iconSize() const {return size_;}
Direction direction() const {return dir_;} Direction direction() const {return dir_;}
QLabel * textLabel() {return &label_;}
protected: protected:
virtual bool event(QEvent * e); virtual bool event(QEvent * e);
void checkSpacing();
QSize realIconSize() const; QSize realIconSize() const;
QLabel label_, icon_; QLabel label_, icon_;
@@ -53,7 +56,7 @@ protected:
Direction dir_; Direction dir_;
public slots: public slots:
void setText(const QString & t) {label_.setText(t);} void setText(const QString & t);
void setIcon(const QIcon & i); void setIcon(const QIcon & i);
void setIconSize(const QSize & s); void setIconSize(const QSize & s);
void setDirection(Direction d); void setDirection(Direction d);

View File

@@ -6,6 +6,9 @@
MatrixEdit::MatrixEdit(QWidget * parent): QWidget(parent) { MatrixEdit::MatrixEdit(QWidget * parent): QWidget(parent) {
ui = new Ui::MatrixEdit(); ui = new Ui::MatrixEdit();
ui->setupUi(this); ui->setupUi(this);
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
ui->table->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
#endif
connect(ui->table, SIGNAL(cellChanged(int,int)), this, SIGNAL(changed())); connect(ui->table, SIGNAL(cellChanged(int,int)), this, SIGNAL(changed()));
ro = false; ro = false;
} }

View File

@@ -10,6 +10,12 @@
<height>264</height> <height>264</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>

View File

@@ -302,6 +302,7 @@ protected:
uint qHash(const PIString & v, uint seed = 0) {return piHash(v);} uint qHash(const PIString & v, uint seed = 0) {return piHash(v);}
#include "logview.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
QApplication a(argc, argv); QApplication a(argc, argv);
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
@@ -342,6 +343,28 @@ int main(int argc, char *argv[]) {
return 0;*/ return 0;*/
//################################ //################################
//1245hghgfhfdgshrgnhdsgfhjshdszdgsdgnjedghrbnlcvleabjmbassfdggfhbnsjkgnfdvfdsdfojbwasv213443gr2t4sfth
/*LogView lw;
lw.setLogFont(QFont("dejavu sans mono", 9));
lw.registerCategory("Warning", "Warning", QImage(":/icons/flame.png"), Qt::darkYellow);
lw.registerCategory("Error", "Error", QImage(":/icons/dialog-cancel.png"), Qt::darkRed, true);
//lw.setLinesLimit(12);
lw.show();
piForTimes(100)
lw.addText(QString("row %1").arg(_i100));
lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/scene_tree.h");
lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/scene_tree.h");
lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/view_editor.h");
lw.addText("-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/material_map_editor.h\n"
"-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/materials_editor\n"
"-- Up-to-date: C:/sdk/MinGW/x32/i686-w64-mingw32/include/qglengine/object_editor.h");
lw.addText("[Warning] sdfkjhdfgj");
lw.addText("[Error] gbflknwed");
QLineEdit * le = new QLineEdit();
QObject::connect(le, &QLineEdit::returnPressed, [&](){lw.addText(le->text());});
le->show();
return a.exec();*/
CDPultWindow w; CDPultWindow w;
w.show(); w.show();
if (a.arguments().size() > 1) if (a.arguments().size() > 1)

View File

@@ -1,6 +1,6 @@
/* /*
QGLView QGLView
Copyright (C) 2020 Ivan Pelipenko peri4ko@yandex.ru Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by it under the terms of the GNU Lesser General Public License as published by

View File

@@ -1,14 +1,18 @@
if (DESIGNER_PLUGINS) if (DESIGNER_PLUGINS)
project(qglengine_plugin) if (NOT Qt5)
include_directories("..") message(WARNING "Building ${PROJECT_NAME} available only on Qt5!")
add_definitions(-DQT_PLUGIN) else()
add_definitions(-DQT_NO_DEBUG) project(qglengine_plugin)
add_definitions(-DQT_SHARED) include_directories("..")
add_definitions(-DQDESIGNER_EXPORT_WIDGETS) add_definitions(-DQT_PLUGIN)
find_qt(${QtVersions} Core Designer Gui Widgets OpenGL) add_definitions(-DQT_NO_DEBUG)
qt_sources(SRC) add_definitions(-DQT_SHARED)
qt_wrap(${SRC} CPPS out_CPP QMS out_QM) add_definitions(-DQDESIGNER_EXPORT_WIDGETS)
qt_add_library(${PROJECT_NAME} SHARED out_CPP) find_qt(Qt5 Core Designer Gui Widgets OpenGL)
qt_target_link_libraries(${PROJECT_NAME} qglengine) qt_sources(SRC)
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtPlugins/designer) qt_wrap(${SRC} CPPS out_CPP QMS out_QM)
qt_add_library(${PROJECT_NAME} SHARED out_CPP)
qt_target_link_libraries(${PROJECT_NAME} qglengine)
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtPlugins/designer)
endif()
endif() endif()

View File

@@ -17,50 +17,54 @@ endif()
find_package(QAD REQUIRED) find_package(QAD REQUIRED)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
include_directories(${QAD_INCLUDES}) include_directories(${QAD_INCLUDES})
find_qt(${QtVersions} Core Gui OpenGL Xml) find_qt(Qt5 Core Gui OpenGL Xml)
qt_sources(SRC) if (NOT Qt5)
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM) message(WARNING "Building ${PROJECT_NAME} available only on Qt5!")
qt_add_library(${PROJECT_NAME} SHARED out_CPP)
qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets ${OPENGL_LIBRARIES})
qt_target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "Building ${PROJECT_NAME}")
if (LIBPROJECT)
sdk_install("qad" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}")
else() else()
if (LIB) qt_sources(SRC)
if (WIN32) qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
qt_install(FILES ${H} DESTINATION ${MINGW_INCLUDE}/qad) qt_add_library(${PROJECT_NAME} SHARED out_CPP)
qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${MINGW_LIB}) qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets ${OPENGL_LIBRARIES})
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${MINGW_BIN}) qt_target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtBin) message(STATUS "Building ${PROJECT_NAME}")
else() if (LIBPROJECT)
qt_install(FILES ${H} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qad) sdk_install("qad" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}")
qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
endif()
message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"")
else() else()
if(WIN32) if (LIB)
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) if (WIN32)
qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib) qt_install(FILES ${H} DESTINATION ${MINGW_INCLUDE}/qad)
qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${MINGW_LIB})
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${MINGW_BIN})
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtBin)
else()
qt_install(FILES ${H} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qad)
qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
endif()
message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"")
else() else()
qt_install(TARGETS ${PROJECT_NAME} DESTINATION lib) if(WIN32)
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib)
else()
qt_install(TARGETS ${PROJECT_NAME} DESTINATION lib)
endif()
qt_install(FILES ${H} DESTINATION include/qad)
message(STATUS "Install ${PROJECT_NAME} to local \"bin\", \"lib\" and \"include\"")
endif() endif()
qt_install(FILES ${H} DESTINATION include/qad)
message(STATUS "Install ${PROJECT_NAME} to local \"bin\", \"lib\" and \"include\"")
endif() endif()
endif() foreach(_v ${_QT_VERSIONS_})
foreach(_v ${_QT_VERSIONS_}) set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v})
set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v}) set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE) endforeach()
endforeach() list(APPEND QT_MULTILIB_LIST qglview)
list(APPEND QT_MULTILIB_LIST qglview) if (NOT DEFINED ANDROID_PLATFORM)
if (NOT DEFINED ANDROID_PLATFORM) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin")
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin") add_subdirectory(plugin)
add_subdirectory(plugin) endif()
endif() endif()
endif()
qt_sources(test_SRC DIR "qglview_test") qt_sources(test_SRC DIR "qglview_test")
qt_wrap(${test_SRC} CPPS test_CPP) qt_wrap(${test_SRC} CPPS test_CPP)
qt_add_executable(qglview_test test_CPP) qt_add_executable(qglview_test test_CPP)
qt_target_link_libraries(qglview_test ${PROJECT_NAME}) qt_target_link_libraries(qglview_test ${PROJECT_NAME})
endif()

View File

@@ -1,14 +1,18 @@
if (DESIGNER_PLUGINS) if (DESIGNER_PLUGINS)
project(qglview_plugin) if (NOT Qt5)
include_directories("..") message(WARNING "Building ${PROJECT_NAME} available only on Qt5!")
add_definitions(-DQT_PLUGIN) else()
add_definitions(-DQT_NO_DEBUG) project(qglview_plugin)
add_definitions(-DQT_SHARED) include_directories("..")
add_definitions(-DQDESIGNER_EXPORT_WIDGETS) add_definitions(-DQT_PLUGIN)
find_qt(${QtVersions} Core Designer Gui Widgets OpenGL) add_definitions(-DQT_NO_DEBUG)
qt_sources(SRC) add_definitions(-DQT_SHARED)
qt_wrap(${SRC} CPPS out_CPP QMS out_QM) add_definitions(-DQDESIGNER_EXPORT_WIDGETS)
qt_add_library(${PROJECT_NAME} SHARED out_CPP) find_qt(Qt5 Core Designer Gui Widgets OpenGL)
qt_target_link_libraries(${PROJECT_NAME} qglview) qt_sources(SRC)
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtPlugins/designer) qt_wrap(${SRC} CPPS out_CPP QMS out_QM)
qt_add_library(${PROJECT_NAME} SHARED out_CPP)
qt_target_link_libraries(${PROJECT_NAME} qglview)
qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtPlugins/designer)
endif()
endif() endif()