Compare commits
4 Commits
04d9cf6edf
...
ebebcd11ce
| Author | SHA1 | Date | |
|---|---|---|---|
| ebebcd11ce | |||
| 32da3d029d | |||
| 681a79a672 | |||
| 88bcc7f2e9 |
@@ -2315,12 +2315,29 @@ void Graphic::on_graphic_buttonAutofit_clicked() {
|
|||||||
|
|
||||||
void Graphic::on_graphic_buttonConfigure_clicked() {
|
void Graphic::on_graphic_buttonConfigure_clicked() {
|
||||||
conf->graphicItems.clear();
|
conf->graphicItems.clear();
|
||||||
for (int i = 0; i < graphics.size(); i++) {
|
int all_checks[2] = {-1, -1};
|
||||||
|
auto addAllChecks = [](int & out, bool is_vis) {
|
||||||
|
if (out < 0)
|
||||||
|
out = is_vis ? Qt::Checked : Qt::Unchecked;
|
||||||
|
else {
|
||||||
|
if (is_vis && out == Qt::Unchecked) out = Qt::PartiallyChecked;
|
||||||
|
if (!is_vis && out == Qt::Checked) out = Qt::PartiallyChecked;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
for (const auto & g: graphics) {
|
||||||
GraphicConf::GraphicItem item;
|
GraphicConf::GraphicItem item;
|
||||||
item.icon = graphics[i].icon;
|
item.icon = g.icon;
|
||||||
item.name = graphics[i].name;
|
item.name = g.name;
|
||||||
conf->graphicItems.append(item);
|
conf->graphicItems.append(item);
|
||||||
|
addAllChecks(all_checks[0], g.lines);
|
||||||
|
addAllChecks(all_checks[1], g.points);
|
||||||
}
|
}
|
||||||
|
conf->ui->checkLinesAll->blockSignals(true);
|
||||||
|
conf->ui->checkPointsAll->blockSignals(true);
|
||||||
|
conf->ui->checkLinesAll->setCheckState((Qt::CheckState)all_checks[0]);
|
||||||
|
conf->ui->checkPointsAll->setCheckState((Qt::CheckState)all_checks[1]);
|
||||||
|
conf->ui->checkLinesAll->blockSignals(false);
|
||||||
|
conf->ui->checkPointsAll->blockSignals(false);
|
||||||
conf->ui->colorGrid->setColor(grid_pen.color());
|
conf->ui->colorGrid->setColor(grid_pen.color());
|
||||||
conf->ui->comboStyleGrid->setCurrentIndex((int)grid_pen.style());
|
conf->ui->comboStyleGrid->setCurrentIndex((int)grid_pen.style());
|
||||||
conf->ui->spinWidthGrid->setValue(grid_pen.widthF());
|
conf->ui->spinWidthGrid->setValue(grid_pen.widthF());
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ void GraphicAnalysis::updateGraphic(int index) {
|
|||||||
void GraphicAnalysis::updateAllGraphic() {
|
void GraphicAnalysis::updateAllGraphic() {
|
||||||
for (int i = 0; i < graphicsCount(); ++i)
|
for (int i = 0; i < graphicsCount(); ++i)
|
||||||
updateGraphic(i);
|
updateGraphic(i);
|
||||||
|
updateGraphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -261,11 +262,13 @@ void GraphicAnalysis::addPoint(const QPointF & p, int graphic, bool update_) {
|
|||||||
|
|
||||||
void GraphicAnalysis::setGraphicTransformFunction(std::function<QPolygonF(const QPolygonF &)> f) {
|
void GraphicAnalysis::setGraphicTransformFunction(std::function<QPolygonF(const QPolygonF &)> f) {
|
||||||
tf_gr = f;
|
tf_gr = f;
|
||||||
|
updateAllGraphic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicAnalysis::setSpectrumTransformFunction(std::function<QPolygonF(const QPolygonF &)> f) {
|
void GraphicAnalysis::setSpectrumTransformFunction(std::function<QPolygonF(const QPolygonF &)> f) {
|
||||||
tf_fft = f;
|
tf_fft = f;
|
||||||
|
updateAllGraphic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
MapViewTileProvider_OSM::MapViewTileProvider_OSM() {
|
MapViewTileProvider_OSM::MapViewTileProvider_OSM() {
|
||||||
nam = new QNetworkAccessManager();
|
nam = new QNetworkAccessManager();
|
||||||
PIValueTree p;
|
PIValueTree p;
|
||||||
p.addChild(PIValueTree("url", "http://tile.openstreetmap.org"));
|
p.addChild(PIValueTree("url", "https://tile.openstreetmap.org"));
|
||||||
initParameters(p);
|
initParameters(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ void PIValueTreeEdit::applyVariantEdit(PIVariantEdit * ve, const PIValueTree & v
|
|||||||
ve->setAttributes(attributesWithRO(vt.attributes()));
|
ve->setAttributes(attributesWithRO(vt.attributes()));
|
||||||
ve->setValue(vt.value());
|
ve->setValue(vt.value());
|
||||||
ve->setFullEditMode(is_full_edit);
|
ve->setFullEditMode(is_full_edit);
|
||||||
ve->setToolTip(PI2QString(vt.attribute(PIValueTree::Attribute::toolTip).toString()));
|
ve->setToolTip(PIVariantEditorBase::vtTr(vt.attribute(PIValueTree::Attribute::toolTip).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
|
#include <QMimeData>
|
||||||
#include <pifile.h>
|
#include <pifile.h>
|
||||||
#include <pijson.h>
|
#include <pijson.h>
|
||||||
#include <pivaluetree.h>
|
#include <pivaluetree.h>
|
||||||
@@ -14,6 +15,8 @@
|
|||||||
|
|
||||||
MainWindow::MainWindow(QWidget * parent): EMainWindow(parent), Ui::MainWindow() {
|
MainWindow::MainWindow(QWidget * parent): EMainWindow(parent), Ui::MainWindow() {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
setRecentMenu(menuOpen_recent);
|
||||||
|
setAcceptDrops(true);
|
||||||
session.setFile(QAD::userPath(QAD::ltConfig, "session_valuetreeeditor"));
|
session.setFile(QAD::userPath(QAD::ltConfig, "session_valuetreeeditor"));
|
||||||
session.addEntry(this);
|
session.addEntry(this);
|
||||||
session.load();
|
session.load();
|
||||||
@@ -91,6 +94,34 @@ void MainWindow::changeEvent(QEvent * e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::dragEnterEvent(QDragEnterEvent * e) {
|
||||||
|
if (!e->mimeData()) return;
|
||||||
|
QString str = e->mimeData()->text();
|
||||||
|
if (str.isEmpty()) return;
|
||||||
|
static QStringList exts({"conf", "ini", "json", "bin"});
|
||||||
|
if (exts.contains(QFileInfo(str).suffix().toLower().trimmed())) {
|
||||||
|
e->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::dropEvent(QDropEvent * e) {
|
||||||
|
if (!e->mimeData()) return;
|
||||||
|
auto path = QUrl(e->mimeData()->text()).toLocalFile();
|
||||||
|
if (load(path)) addToRecent(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::loadingSession(QPIConfig & conf) {
|
||||||
|
setRecentFiles(conf.getValue("recent files").toStringList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::savingSession(QPIConfig & conf) {
|
||||||
|
conf.setValue("recent files", recentFiles());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString MainWindow::loadFilter() {
|
QString MainWindow::loadFilter() {
|
||||||
return "All types(*.conf *.ini *.json *.bin);;INI format(*.conf *.ini);;JSON(*.json);;Binary(*.bin)";
|
return "All types(*.conf *.ini *.json *.bin);;INI format(*.conf *.ini);;JSON(*.json);;Binary(*.bin)";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent * e) override;
|
void changeEvent(QEvent * e) override;
|
||||||
|
void dragEnterEvent(QDragEnterEvent * e) override;
|
||||||
|
void dropEvent(QDropEvent * e) override;
|
||||||
|
|
||||||
|
void loadingSession(QPIConfig & conf) override;
|
||||||
|
void savingSession(QPIConfig & conf) override;
|
||||||
QString loadFilter() override;
|
QString loadFilter() override;
|
||||||
QString saveFilter() override { return loadFilter(); }
|
QString saveFilter() override { return loadFilter(); }
|
||||||
|
|
||||||
|
|||||||
@@ -44,12 +44,12 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>780</width>
|
<width>780</width>
|
||||||
<height>444</height>
|
<height>437</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="PIValueTreeEdit" name="widget" native="true"/>
|
<widget class="PIValueTreeEdit" name="widget"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
@@ -91,15 +91,25 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>780</width>
|
<width>780</width>
|
||||||
<height>31</height>
|
<height>29</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>File</string>
|
<string>File</string>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QMenu" name="menuOpen_recent">
|
||||||
|
<property name="title">
|
||||||
|
<string>Open recent</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../libs/widgets/qad_widgets.qrc">
|
||||||
|
<normaloff>:/icons/document-open-recent.png</normaloff>:/icons/document-open-recent.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<addaction name="actionNew"/>
|
<addaction name="actionNew"/>
|
||||||
<addaction name="actionOpen"/>
|
<addaction name="actionOpen"/>
|
||||||
|
<addaction name="menuOpen_recent"/>
|
||||||
<addaction name="actionSave"/>
|
<addaction name="actionSave"/>
|
||||||
<addaction name="actionSaveAs"/>
|
<addaction name="actionSaveAs"/>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -152,7 +162,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionNew">
|
<action name="actionNew">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../libs/widgets/qad_widgets.qrc">
|
<iconset resource="../../libs/qglview/qglview.qrc">
|
||||||
<normaloff>:/icons/document-new.png</normaloff>:/icons/document-new.png</iconset>
|
<normaloff>:/icons/document-new.png</normaloff>:/icons/document-new.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -164,7 +174,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionAbout">
|
<action name="actionAbout">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../../cd/utils/pult/cdpult.qrc">
|
<iconset resource="../../libs/graphic_analysis/qad_graphic_analysis.qrc">
|
||||||
<normaloff>:/icons/dialog-information.png</normaloff>:/icons/dialog-information.png</iconset>
|
<normaloff>:/icons/dialog-information.png</normaloff>:/icons/dialog-information.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -201,8 +211,9 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../cd/utils/pult/cdpult.qrc"/>
|
|
||||||
<include location="../../libs/blockview/qad_blockview.qrc"/>
|
<include location="../../libs/blockview/qad_blockview.qrc"/>
|
||||||
|
<include location="../../libs/graphic_analysis/qad_graphic_analysis.qrc"/>
|
||||||
|
<include location="../../libs/qglview/qglview.qrc"/>
|
||||||
<include location="../../libs/widgets/qad_widgets.qrc"/>
|
<include location="../../libs/widgets/qad_widgets.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
|
|||||||
Reference in New Issue
Block a user