forked from qt-creator/qt-creator
ScxmlEditor: inline .ui files
colorpicker.ui colorsettings.ui colorthemedialog.ui magnifier.ui navigatorslider.ui search.ui shapestoolbox.ui stateview.ui statistics.ui statisticsdialog.ui Change-Id: Idab9db2102d4d9dbafb60d2025386165c536d894 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -2,30 +2,30 @@ add_qtc_plugin(ScxmlEditor
|
||||
INCLUDES common plugin_interface outputpane
|
||||
PLUGIN_DEPENDS Core ProjectExplorer QtSupport TextEditor
|
||||
SOURCES
|
||||
common/colorpicker.cpp common/colorpicker.h common/colorpicker.ui
|
||||
common/colorsettings.cpp common/colorsettings.h common/colorsettings.ui
|
||||
common/colorthemedialog.cpp common/colorthemedialog.h common/colorthemedialog.ui
|
||||
common/colorpicker.cpp common/colorpicker.h
|
||||
common/colorsettings.cpp common/colorsettings.h
|
||||
common/colorthemedialog.cpp common/colorthemedialog.h
|
||||
common/colorthemes.cpp common/colorthemes.h
|
||||
common/colorthemeview.cpp common/colorthemeview.h
|
||||
common/colortoolbutton.cpp common/colortoolbutton.h
|
||||
common/common.qrc
|
||||
common/dragshapebutton.cpp common/dragshapebutton.h
|
||||
common/graphicsview.cpp common/graphicsview.h
|
||||
common/magnifier.cpp common/magnifier.h common/magnifier.ui
|
||||
common/magnifier.cpp common/magnifier.h
|
||||
common/mainwidget.cpp common/mainwidget.h
|
||||
common/movableframe.cpp common/movableframe.h
|
||||
common/navigator.cpp common/navigator.h
|
||||
common/navigatorgraphicsview.cpp common/navigatorgraphicsview.h
|
||||
common/navigatorslider.cpp common/navigatorslider.h common/navigatorslider.ui
|
||||
common/search.cpp common/search.h common/search.ui
|
||||
common/navigatorslider.cpp common/navigatorslider.h
|
||||
common/search.cpp common/search.h
|
||||
common/searchmodel.cpp common/searchmodel.h
|
||||
common/shapegroupwidget.cpp common/shapegroupwidget.h
|
||||
common/shapestoolbox.cpp common/shapestoolbox.h common/shapestoolbox.ui
|
||||
common/shapestoolbox.cpp common/shapestoolbox.h
|
||||
common/sizegrip.cpp common/sizegrip.h
|
||||
common/stateproperties.cpp common/stateproperties.h
|
||||
common/stateview.cpp common/stateview.h common/stateview.ui
|
||||
common/statistics.cpp common/statistics.h common/statistics.ui
|
||||
common/statisticsdialog.cpp common/statisticsdialog.h common/statisticsdialog.ui
|
||||
common/stateview.cpp common/stateview.h
|
||||
common/statistics.cpp common/statistics.h
|
||||
common/statisticsdialog.cpp common/statisticsdialog.h
|
||||
common/structure.cpp common/structure.h
|
||||
common/structuremodel.cpp common/structuremodel.h
|
||||
common/treeview.cpp common/treeview.h
|
||||
|
@@ -4,20 +4,22 @@
|
||||
#include "colorpicker.h"
|
||||
#include "scxmleditorconstants.h"
|
||||
|
||||
#include <QToolButton>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QToolButton>
|
||||
|
||||
using namespace ScxmlEditor::Common;
|
||||
|
||||
const char C_SETTINGS_COLORPICKER_LASTUSEDCOLORS[] = "ScxmlEditor/ColorPickerLastUsedColors_%1";
|
||||
constexpr int C_BUTTON_COLUMNS_COUNT = 5;
|
||||
|
||||
ColorPicker::ColorPicker(const QString &key, QWidget *parent)
|
||||
: QFrame(parent)
|
||||
, m_key(key)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
const QVector<QRgb> colors = {
|
||||
qRgb(0xed, 0xf7, 0xf2), qRgb(0xdf, 0xd3, 0xb6), qRgb(0x89, 0x72, 0x5b), qRgb(0xff, 0xd3, 0x93), qRgb(0xff, 0x97, 0x4f),
|
||||
qRgb(0xff, 0x85, 0x0d), qRgb(0xf7, 0xe9, 0x67), qRgb(0xef, 0xc9, 0x4c), qRgb(0xff, 0xe1, 0x1a), qRgb(0xc2, 0xe0, 0x78),
|
||||
@@ -25,26 +27,31 @@ ColorPicker::ColorPicker(const QString &key, QWidget *parent)
|
||||
qRgb(0xc5, 0xba, 0xfc), qRgb(0xb6, 0x65, 0xfc), qRgb(0xa5, 0x08, 0xd0), qRgb(0xcc, 0x56, 0x64), qRgb(0x96, 0x2d, 0x3e)
|
||||
};
|
||||
|
||||
auto vBoxLayout = new QVBoxLayout;
|
||||
vBoxLayout->setContentsMargins(0, 0, 0, 0);
|
||||
vBoxLayout->setSpacing(0);
|
||||
auto basicColorContentFrame = new QWidget;
|
||||
auto lastUsedColorContainer = new QWidget;
|
||||
|
||||
const int buttonRowsCount = 4;
|
||||
const int buttonColumnsCount = 5;
|
||||
m_lastUsedColorContainer = new QHBoxLayout(lastUsedColorContainer);
|
||||
m_lastUsedColorContainer->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
for (int r = 0; r < buttonRowsCount; ++r) {
|
||||
auto hBoxLayout = new QHBoxLayout;
|
||||
hBoxLayout->setContentsMargins(0, 0, 0, 0);
|
||||
hBoxLayout->setSpacing(0);
|
||||
|
||||
for (int c = 0; c < buttonColumnsCount; ++c)
|
||||
hBoxLayout->addWidget(createButton(colors[r * buttonColumnsCount + c]));
|
||||
|
||||
hBoxLayout->addStretch();
|
||||
vBoxLayout->addLayout(hBoxLayout);
|
||||
using namespace Utils::Layouting;
|
||||
Grid colorGrid;
|
||||
for (int i = 0; i < colors.count(); ++i) {
|
||||
QWidget *button = createButton(colors[i]);
|
||||
colorGrid.addItem(button);
|
||||
if ((i + 1) % C_BUTTON_COLUMNS_COUNT == 0)
|
||||
colorGrid.addItem(br);
|
||||
if (i == 0)
|
||||
m_lastUsedColorContainer->addSpacerItem(new QSpacerItem(0, button->sizeHint().height(),
|
||||
QSizePolicy::MinimumExpanding,
|
||||
QSizePolicy::Preferred));
|
||||
}
|
||||
|
||||
m_ui.basicColorContentFrame->setLayout(vBoxLayout);
|
||||
colorGrid.attachTo(basicColorContentFrame, WithoutMargins);
|
||||
Column {
|
||||
tr("Basic Colors"),
|
||||
basicColorContentFrame,
|
||||
tr("Last used colors"),
|
||||
lastUsedColorContainer,
|
||||
}.attachTo(this);
|
||||
|
||||
const QStringList lastColors = Core::ICore::settings()->value(
|
||||
QString::fromLatin1(C_SETTINGS_COLORPICKER_LASTUSEDCOLORS).arg(m_key), QStringList()).toStringList();
|
||||
@@ -69,12 +76,12 @@ void ColorPicker::setLastUsedColor(const QString &colorName)
|
||||
m_lastUsedColorNames.insert(0, colorName);
|
||||
m_lastUsedColorButtons.insert(0, createButton(colorName));
|
||||
|
||||
while (m_lastUsedColorButtons.count() > 5) {
|
||||
while (m_lastUsedColorButtons.count() > C_BUTTON_COLUMNS_COUNT) {
|
||||
m_lastUsedColorButtons.takeLast()->deleteLater();
|
||||
m_lastUsedColorNames.takeLast();
|
||||
}
|
||||
|
||||
m_ui.lastUsedColorLayout->insertWidget(0, m_lastUsedColorButtons.first());
|
||||
m_lastUsedColorContainer->insertWidget(0, m_lastUsedColorButtons.first());
|
||||
}
|
||||
|
||||
QToolButton *ColorPicker::createButton(const QColor &color)
|
||||
|
@@ -3,10 +3,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_colorpicker.h"
|
||||
#include <QFrame>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QToolButton)
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QHBoxLayout;
|
||||
class QToolButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ScxmlEditor {
|
||||
|
||||
@@ -31,7 +33,8 @@ private:
|
||||
QStringList m_lastUsedColorNames;
|
||||
QVector<QToolButton*> m_lastUsedColorButtons;
|
||||
QString m_key;
|
||||
Ui::ColorPicker m_ui;
|
||||
|
||||
QHBoxLayout *m_lastUsedColorContainer;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,175 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::ColorPicker</class>
|
||||
<widget class="QFrame" name="ScxmlEditor::Common::ColorPicker">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>79</width>
|
||||
<height>183</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<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="QFrame" name="basicColorFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</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="QLabel" name="basicColorTitle">
|
||||
<property name="text">
|
||||
<string>Basic Colors</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="basicColorContentFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="lastUsedColorFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<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="QLabel" name="lastUsedColorTitle">
|
||||
<property name="text">
|
||||
<string>Last used colors</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="lastUsedColorContentFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="lastUsedColorLayout">
|
||||
<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>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -2,63 +2,80 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "colorsettings.h"
|
||||
#include "colorthemeview.h"
|
||||
#include "scxmleditorconstants.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QToolButton>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
using namespace ScxmlEditor::Common;
|
||||
|
||||
ColorSettings::ColorSettings(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
m_ui.m_colorThemeView->setEnabled(false);
|
||||
|
||||
m_colorThemeView = new ColorThemeView;
|
||||
m_colorThemeView->setEnabled(false);
|
||||
m_comboColorThemes = new QComboBox;
|
||||
auto addTheme = new QToolButton;
|
||||
addTheme->setIcon(Utils::Icons::PLUS.icon());
|
||||
addTheme->setAutoRaise(true);
|
||||
auto removeTheme = new QToolButton;
|
||||
removeTheme->setIcon(Utils::Icons::MINUS.icon());
|
||||
removeTheme->setAutoRaise(true);
|
||||
const QSettings *s = Core::ICore::settings();
|
||||
|
||||
m_colorThemes = s->value(Constants::C_SETTINGS_COLORSETTINGS_COLORTHEMES).toMap();
|
||||
m_comboColorThemes->addItems(m_colorThemes.keys());
|
||||
m_comboColorThemes->setCurrentText(
|
||||
s->value(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME).toString());
|
||||
selectTheme(m_comboColorThemes->currentIndex());
|
||||
|
||||
m_ui.m_comboColorThemes->clear();
|
||||
for (auto it = m_colorThemes.cbegin(); it != m_colorThemes.cend(); ++it)
|
||||
m_ui.m_comboColorThemes->addItem(it.key());
|
||||
m_ui.m_comboColorThemes->setCurrentText(s->value(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME).toString());
|
||||
using namespace Utils::Layouting;
|
||||
Column {
|
||||
Row {
|
||||
m_comboColorThemes,
|
||||
addTheme,
|
||||
removeTheme,
|
||||
},
|
||||
m_colorThemeView,
|
||||
}.attachTo(this, WithoutMargins);
|
||||
|
||||
connect(m_ui.m_comboColorThemes,
|
||||
&QComboBox::currentIndexChanged,
|
||||
this,
|
||||
&ColorSettings::selectTheme);
|
||||
connect(m_ui.m_colorThemeView, &ColorThemeView::colorChanged, this, &ColorSettings::updateCurrentColors);
|
||||
connect(m_ui.m_addColorTheme, &QToolButton::clicked, this, &ColorSettings::createTheme);
|
||||
connect(m_ui.m_removeColorTheme, &QToolButton::clicked, this, &ColorSettings::removeTheme);
|
||||
connect(m_comboColorThemes, &QComboBox::currentIndexChanged,
|
||||
this, &ColorSettings::selectTheme);
|
||||
connect(m_colorThemeView, &ColorThemeView::colorChanged,
|
||||
this, &ColorSettings::updateCurrentColors);
|
||||
connect(addTheme, &QToolButton::clicked, this, &ColorSettings::createTheme);
|
||||
connect(removeTheme, &QToolButton::clicked, this, &ColorSettings::removeTheme);
|
||||
}
|
||||
|
||||
void ColorSettings::save()
|
||||
{
|
||||
QSettings *s = Core::ICore::settings();
|
||||
s->setValue(Constants::C_SETTINGS_COLORSETTINGS_COLORTHEMES, m_colorThemes);
|
||||
s->setValue(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME, m_ui.m_comboColorThemes->currentText());
|
||||
s->setValue(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME, m_comboColorThemes->currentText());
|
||||
}
|
||||
|
||||
void ColorSettings::updateCurrentColors()
|
||||
{
|
||||
m_colorThemes[m_ui.m_comboColorThemes->currentText()] = m_ui.m_colorThemeView->colorData();
|
||||
m_colorThemes[m_comboColorThemes->currentText()] = m_colorThemeView->colorData();
|
||||
}
|
||||
|
||||
void ColorSettings::selectTheme(int index)
|
||||
{
|
||||
const QString name = m_ui.m_comboColorThemes->itemText(index);
|
||||
m_ui.m_colorThemeView->reset();
|
||||
const QString name = m_comboColorThemes->itemText(index);
|
||||
m_colorThemeView->reset();
|
||||
if (!name.isEmpty() && m_colorThemes.contains(name)) {
|
||||
m_ui.m_colorThemeView->setEnabled(true);
|
||||
m_colorThemeView->setEnabled(true);
|
||||
const QVariantMap colordata = m_colorThemes[name].toMap();
|
||||
for (auto it = colordata.cbegin(); it != colordata.cend(); ++it)
|
||||
m_ui.m_colorThemeView->setColor(it.key().toInt(), QColor(it.value().toString()));
|
||||
m_colorThemeView->setColor(it.key().toInt(), QColor(it.value().toString()));
|
||||
} else {
|
||||
m_ui.m_colorThemeView->setEnabled(false);
|
||||
m_colorThemeView->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,25 +86,25 @@ void ColorSettings::createTheme()
|
||||
if (m_colorThemes.contains(name)) {
|
||||
QMessageBox::warning(this, tr("Cannot Create Theme"), tr("Theme %1 is already available.").arg(name));
|
||||
} else {
|
||||
m_ui.m_colorThemeView->reset();
|
||||
m_colorThemeView->reset();
|
||||
m_colorThemes[name] = QVariantMap();
|
||||
m_ui.m_comboColorThemes->addItem(name);
|
||||
m_ui.m_comboColorThemes->setCurrentText(name);
|
||||
m_comboColorThemes->addItem(name);
|
||||
m_comboColorThemes->setCurrentText(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ColorSettings::removeTheme()
|
||||
{
|
||||
const QString name = m_ui.m_comboColorThemes->currentText();
|
||||
const QString name = m_comboColorThemes->currentText();
|
||||
const QMessageBox::StandardButton result = QMessageBox::question(this, tr("Remove Color Theme"),
|
||||
tr("Are you sure you want to delete color theme %1?").arg(name),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
if (result == QMessageBox::Yes) {
|
||||
m_ui.m_comboColorThemes->removeItem(m_ui.m_comboColorThemes->currentIndex());
|
||||
m_comboColorThemes->removeItem(m_comboColorThemes->currentIndex());
|
||||
m_colorThemes.remove(name);
|
||||
m_ui.m_comboColorThemes->setCurrentIndex(0);
|
||||
m_comboColorThemes->setCurrentIndex(0);
|
||||
if (m_colorThemes.isEmpty())
|
||||
m_ui.m_colorThemeView->setEnabled(false);
|
||||
m_colorThemeView->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
@@ -3,12 +3,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_colorsettings.h"
|
||||
#include <QFrame>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ScxmlEditor {
|
||||
namespace Common {
|
||||
|
||||
class ColorThemeView;
|
||||
|
||||
class ColorSettings : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -25,7 +30,8 @@ private:
|
||||
void selectTheme(int);
|
||||
|
||||
QVariantMap m_colorThemes;
|
||||
Ui::ColorSettings m_ui;
|
||||
ColorThemeView *m_colorThemeView;
|
||||
QComboBox *m_comboColorThemes;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::ColorSettings</class>
|
||||
<widget class="QWidget" name="ScxmlEditor::Common::ColorSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>330</width>
|
||||
<height>306</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_comboColorThemes"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_addColorTheme">
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_removeColorTheme">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ScxmlEditor::Common::ColorThemeView" name="m_colorThemeView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ColorThemeView</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>colorthemeview.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -2,20 +2,40 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "colorthemedialog.h"
|
||||
#include "colorsettings.h"
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
using namespace ScxmlEditor::Common;
|
||||
|
||||
ColorThemeDialog::ColorThemeDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
resize(400, 440);
|
||||
|
||||
connect(m_ui.m_btnOk, &QPushButton::clicked, this, &ColorThemeDialog::accept);
|
||||
connect(m_ui.m_btnCancel, &QPushButton::clicked, this, &ColorThemeDialog::reject);
|
||||
connect(m_ui.m_btnApply, &QPushButton::clicked, this, &ColorThemeDialog::save);
|
||||
m_colorSettings = new ColorSettings;
|
||||
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
|
||||
QDialogButtonBox::Cancel |
|
||||
QDialogButtonBox::Apply);
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Column {
|
||||
m_colorSettings,
|
||||
buttonBox,
|
||||
}.attachTo(this);
|
||||
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &ColorThemeDialog::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &ColorThemeDialog::reject);
|
||||
connect(buttonBox, &QDialogButtonBox::clicked, this, [buttonBox, this](QAbstractButton *btn) {
|
||||
if (buttonBox->standardButton(btn) == QDialogButtonBox::Apply)
|
||||
save();
|
||||
});
|
||||
}
|
||||
|
||||
void ColorThemeDialog::save()
|
||||
{
|
||||
m_ui.m_colorSettings->save();
|
||||
m_colorSettings->save();
|
||||
}
|
||||
|
@@ -3,13 +3,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_colorthemedialog.h"
|
||||
#include <QDialog>
|
||||
|
||||
namespace ScxmlEditor {
|
||||
|
||||
namespace Common {
|
||||
|
||||
class ColorSettings;
|
||||
|
||||
class ColorThemeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -20,7 +21,7 @@ public:
|
||||
void save();
|
||||
|
||||
private:
|
||||
Ui::ColorThemeDialog m_ui;
|
||||
ColorSettings *m_colorSettings;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,83 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::ColorThemeDialog</class>
|
||||
<widget class="QDialog" name="ScxmlEditor::Common::ColorThemeDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="ScxmlEditor::Common::ColorSettings" name="m_colorSettings">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_btnOk">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_btnCancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_btnApply">
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ColorSettings</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>colorsettings.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -12,6 +12,7 @@
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QMenu>
|
||||
#include <QToolButton>
|
||||
|
||||
using namespace ScxmlEditor::Common;
|
||||
|
||||
|
@@ -31,6 +31,7 @@ GraphicsView::GraphicsView(QWidget *parent)
|
||||
setRubberBandSelectionMode(Qt::ContainsItemShape);
|
||||
setBackgroundBrush(QBrush(QColor(0xef, 0xef, 0xef)));
|
||||
setAcceptDrops(true);
|
||||
setFrameShape(QFrame::NoFrame);
|
||||
|
||||
connect(horizontalScrollBar(), &QScrollBar::valueChanged, this, &GraphicsView::updateView);
|
||||
connect(verticalScrollBar(), &QScrollBar::valueChanged, this, &GraphicsView::updateView);
|
||||
|
@@ -6,15 +6,21 @@
|
||||
#include "graphicsview.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
using namespace ScxmlEditor::Common;
|
||||
|
||||
Magnifier::Magnifier(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
setMouseTracking(true);
|
||||
m_ui.m_graphicsView->setEnabled(false);
|
||||
m_graphicsView = new QGraphicsView(this);
|
||||
m_graphicsView->setInteractive(false);
|
||||
m_graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_graphicsView->setEnabled(false);
|
||||
auto layout = new QVBoxLayout(this);
|
||||
layout->addWidget(m_graphicsView);
|
||||
}
|
||||
|
||||
void Magnifier::setTopLeft(const QPoint &topLeft)
|
||||
@@ -34,7 +40,7 @@ void Magnifier::resizeEvent(QResizeEvent *e)
|
||||
m_gradientBrush.setColorAt(0.0, QColor(0, 0, 0, 255));
|
||||
|
||||
int cap = radius * 0.1;
|
||||
m_ui.m_graphicsView->setMask(QRegion(rect().adjusted(cap, cap, -cap, -cap), QRegion::Ellipse));
|
||||
m_graphicsView->setMask(QRegion(rect().adjusted(cap, cap, -cap, -cap), QRegion::Ellipse));
|
||||
}
|
||||
|
||||
void Magnifier::showEvent(QShowEvent *e)
|
||||
@@ -53,8 +59,8 @@ void Magnifier::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
QWidget::mousePressEvent(e);
|
||||
if (m_mainView)
|
||||
m_mainView->magnifierClicked(m_ui.m_graphicsView->transform().m11(),
|
||||
m_ui.m_graphicsView->mapToScene(e->pos() - m_topLeft + rect().center()));
|
||||
m_mainView->magnifierClicked(m_graphicsView->transform().m11(),
|
||||
m_graphicsView->mapToScene(e->pos() - m_topLeft + rect().center()));
|
||||
}
|
||||
|
||||
void Magnifier::mouseMoveEvent(QMouseEvent *e)
|
||||
@@ -68,12 +74,12 @@ void Magnifier::wheelEvent(QWheelEvent *e)
|
||||
QWidget::wheelEvent(e);
|
||||
|
||||
if (e->angleDelta().y() > 0)
|
||||
m_ui.m_graphicsView->scale(1.1, 1.1);
|
||||
m_graphicsView->scale(1.1, 1.1);
|
||||
else
|
||||
m_ui.m_graphicsView->scale(1.0 / 1.1, 1.0 / 1.1);
|
||||
m_graphicsView->scale(1.0 / 1.1, 1.0 / 1.1);
|
||||
|
||||
if (m_mainView)
|
||||
m_ui.m_graphicsView->centerOn(m_mainView->mapToScene(pos() - m_topLeft + rect().center()));
|
||||
m_graphicsView->centerOn(m_mainView->mapToScene(pos() - m_topLeft + rect().center()));
|
||||
}
|
||||
|
||||
void Magnifier::moveEvent(QMoveEvent *e)
|
||||
@@ -81,7 +87,7 @@ void Magnifier::moveEvent(QMoveEvent *e)
|
||||
QWidget::moveEvent(e);
|
||||
|
||||
if (m_mainView)
|
||||
m_ui.m_graphicsView->centerOn(m_mainView->mapToScene(e->pos() - m_topLeft + rect().center()));
|
||||
m_graphicsView->centerOn(m_mainView->mapToScene(e->pos() - m_topLeft + rect().center()));
|
||||
}
|
||||
|
||||
void Magnifier::setCurrentView(GraphicsView *view)
|
||||
@@ -91,7 +97,7 @@ void Magnifier::setCurrentView(GraphicsView *view)
|
||||
|
||||
void Magnifier::setCurrentScene(ScxmlEditor::PluginInterface::GraphicsScene *scene)
|
||||
{
|
||||
m_ui.m_graphicsView->setScene(scene);
|
||||
m_graphicsView->setScene(scene);
|
||||
}
|
||||
|
||||
void Magnifier::paintEvent(QPaintEvent *e)
|
||||
|
@@ -6,9 +6,10 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QPointer>
|
||||
|
||||
#include "ui_magnifier.h"
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QMouseEvent)
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QGraphicsView;
|
||||
class QMouseEvent;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ScxmlEditor {
|
||||
|
||||
@@ -46,7 +47,7 @@ private:
|
||||
QPoint m_topLeft;
|
||||
QPointer<GraphicsView> m_mainView;
|
||||
QRadialGradient m_gradientBrush;
|
||||
Ui::Magnifier m_ui;
|
||||
QGraphicsView *m_graphicsView;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::Magnifier</class>
|
||||
<widget class="QWidget" name="ScxmlEditor::Common::Magnifier">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</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="QGraphicsView" name="m_graphicsView">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="interactive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -8,6 +8,7 @@
|
||||
#include "colortoolbutton.h"
|
||||
#include "errorwidget.h"
|
||||
#include "graphicsscene.h"
|
||||
#include "graphicsview.h"
|
||||
#include "magnifier.h"
|
||||
#include "navigator.h"
|
||||
#include "outputtabwidget.h"
|
||||
@@ -38,6 +39,7 @@
|
||||
#include <QImage>
|
||||
#include <QImageWriter>
|
||||
#include <QItemEditorFactory>
|
||||
#include <QLayout>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QMimeData>
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <QResizeEvent>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
using namespace ScxmlEditor::Common;
|
||||
|
||||
|
@@ -3,32 +3,64 @@
|
||||
|
||||
#include "navigatorslider.h"
|
||||
|
||||
#include <QSlider>
|
||||
#include <QToolButton>
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
using namespace ScxmlEditor::Common;
|
||||
|
||||
NavigatorSlider::NavigatorSlider(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_slider = new QSlider(Qt::Horizontal);
|
||||
m_slider->setMinimum(0);
|
||||
m_slider->setMaximum(100);
|
||||
|
||||
connect(m_ui.m_zoomOut, &QToolButton::clicked, this, &NavigatorSlider::zoomOut);
|
||||
connect(m_ui.m_zoomIn, &QToolButton::clicked, this, &NavigatorSlider::zoomIn);
|
||||
connect(m_ui.m_slider, &QSlider::valueChanged, this, [=](int newValue){
|
||||
auto zoomIn = new QToolButton;
|
||||
zoomIn->setIcon(Utils::Icons::PLUS.icon());
|
||||
auto zoomOut = new QToolButton;
|
||||
zoomOut->setIcon(Utils::Icons::MINUS.icon());
|
||||
for (auto btn : {zoomIn, zoomOut}) {
|
||||
btn->setAutoRaise(true);
|
||||
btn->setAutoRepeat(true);
|
||||
btn->setAutoRepeatDelay(200);
|
||||
btn->setAutoRepeatInterval(10);
|
||||
}
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Row {
|
||||
zoomOut,
|
||||
m_slider,
|
||||
zoomIn,
|
||||
Space(20),
|
||||
}.setSpacing(0).attachTo(this, WithoutMargins);
|
||||
|
||||
connect(zoomOut, &QToolButton::clicked, this, &NavigatorSlider::zoomOut);
|
||||
connect(zoomIn, &QToolButton::clicked, this, &NavigatorSlider::zoomIn);
|
||||
connect(m_slider, &QSlider::valueChanged, this, [=](int newValue){
|
||||
emit valueChanged(newValue);
|
||||
});
|
||||
}
|
||||
|
||||
void NavigatorSlider::zoomIn()
|
||||
{
|
||||
m_ui.m_slider->setValue(m_ui.m_slider->value() + 1);
|
||||
m_slider->setValue(m_slider->value() + 1);
|
||||
}
|
||||
|
||||
void NavigatorSlider::zoomOut()
|
||||
{
|
||||
m_ui.m_slider->setValue(m_ui.m_slider->value() - 1);
|
||||
m_slider->setValue(m_slider->value() - 1);
|
||||
}
|
||||
|
||||
int NavigatorSlider::value() const
|
||||
{
|
||||
return m_slider->value();
|
||||
}
|
||||
|
||||
void NavigatorSlider::setSliderValue(int val)
|
||||
{
|
||||
QSignalBlocker blocker(m_ui.m_slider);
|
||||
m_ui.m_slider->setValue(val);
|
||||
QSignalBlocker blocker(m_slider);
|
||||
m_slider->setValue(val);
|
||||
}
|
||||
|
@@ -3,10 +3,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_navigatorslider.h"
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSlider;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ScxmlEditor {
|
||||
|
||||
namespace Common {
|
||||
@@ -18,11 +20,7 @@ class NavigatorSlider : public QFrame
|
||||
public:
|
||||
explicit NavigatorSlider(QWidget *parent = nullptr);
|
||||
|
||||
int value() const
|
||||
{
|
||||
return m_ui.m_slider->value();
|
||||
}
|
||||
|
||||
int value() const;
|
||||
void setSliderValue(int val);
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
@@ -31,7 +29,7 @@ signals:
|
||||
void valueChanged(int);
|
||||
|
||||
private:
|
||||
Ui::NavigatorSlider m_ui;
|
||||
QSlider *m_slider;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::NavigatorSlider</class>
|
||||
<widget class="QFrame" name="ScxmlEditor::Common::NavigatorSlider">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>240</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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="QFrame" name="m_innerFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<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="QToolButton" name="m_zoomOut">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/scxmleditor/images/minus.png</normaloff>:/scxmleditor/images/minus.png</iconset>
|
||||
</property>
|
||||
<property name="autoRepeat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRepeatDelay">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="autoRepeatInterval">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextOnly</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="m_slider">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="sliderPosition">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_zoomIn">
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/scxmleditor/images/plus.png</normaloff>:/scxmleditor/images/plus.png</iconset>
|
||||
</property>
|
||||
<property name="autoRepeat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRepeatDelay">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="autoRepeatInterval">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextOnly</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -5,17 +5,23 @@
|
||||
#include "graphicsscene.h"
|
||||
#include "scxmldocument.h"
|
||||
#include "searchmodel.h"
|
||||
#include "tableview.h"
|
||||
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QHeaderView>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
using namespace ScxmlEditor::PluginInterface;
|
||||
using namespace ScxmlEditor::Common;
|
||||
using namespace ScxmlEditor::OutputPane;
|
||||
|
||||
constexpr char FILTER_WILDCARD[] = "xxxxxxxx";
|
||||
|
||||
Search::Search(QWidget *parent)
|
||||
: OutputPane(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
m_model = new SearchModel(this);
|
||||
m_proxyModel = new QSortFilterProxyModel(this);
|
||||
|
||||
@@ -24,24 +30,41 @@ Search::Search(QWidget *parent)
|
||||
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
m_proxyModel->setDynamicSortFilter(false);
|
||||
m_proxyModel->setFilterWildcard("xxxxxxxx");
|
||||
m_proxyModel->setFilterWildcard(FILTER_WILDCARD);
|
||||
|
||||
m_ui.m_searchView->setModel(m_proxyModel);
|
||||
m_searchEdit = new Utils::FancyLineEdit;
|
||||
m_searchEdit->setFiltering(true);
|
||||
|
||||
connect(m_ui.m_searchEdit, &QLineEdit::textChanged, this, &Search::setSearchText);
|
||||
connect(m_ui.m_searchView, &ScxmlEditor::OutputPane::TableView::pressed, this, &Search::rowActivated);
|
||||
connect(m_ui.m_searchView, &ScxmlEditor::OutputPane::TableView::entered, this, &Search::rowEntered);
|
||||
m_searchView = new TableView;
|
||||
m_searchView->setAlternatingRowColors(true);
|
||||
m_searchView->setShowGrid(false);
|
||||
m_searchView->setSortingEnabled(true);
|
||||
m_searchView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_searchView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_searchView->horizontalHeader()->setStretchLastSection(true);
|
||||
m_searchView->setModel(m_proxyModel);
|
||||
m_searchView->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Column {
|
||||
m_searchEdit,
|
||||
m_searchView,
|
||||
}.setSpacing(0).attachTo(this, WithoutMargins);
|
||||
|
||||
connect(m_searchEdit, &Utils::FancyLineEdit::textChanged, this, &Search::setSearchText);
|
||||
connect(m_searchView, &TableView::pressed, this, &Search::rowActivated);
|
||||
connect(m_searchView, &TableView::entered, this, &Search::rowEntered);
|
||||
}
|
||||
|
||||
void Search::setPaneFocus()
|
||||
{
|
||||
m_ui.m_searchEdit->setFocus();
|
||||
m_searchEdit->setFocus();
|
||||
}
|
||||
|
||||
void Search::setSearchText(const QString &text)
|
||||
{
|
||||
m_model->setFilter(text);
|
||||
m_proxyModel->setFilterWildcard(text.isEmpty() ? "xxxxxxxx" : text);
|
||||
m_proxyModel->setFilterWildcard(text.isEmpty() ? FILTER_WILDCARD : text);
|
||||
}
|
||||
|
||||
void Search::setDocument(ScxmlDocument *document)
|
||||
@@ -53,7 +76,7 @@ void Search::setDocument(ScxmlDocument *document)
|
||||
void Search::setGraphicsScene(GraphicsScene *scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
connect(m_ui.m_searchView, &ScxmlEditor::OutputPane::TableView::mouseExited, m_scene.data(), &GraphicsScene::unhighlightAll);
|
||||
connect(m_searchView, &TableView::mouseExited, m_scene.data(), &GraphicsScene::unhighlightAll);
|
||||
}
|
||||
|
||||
void Search::rowEntered(const QModelIndex &index)
|
||||
|
@@ -4,7 +4,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "outputpane.h"
|
||||
#include "ui_search.h"
|
||||
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -13,6 +12,8 @@
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QSortFilterProxyModel)
|
||||
|
||||
namespace Utils { class FancyLineEdit; }
|
||||
|
||||
namespace ScxmlEditor {
|
||||
|
||||
namespace PluginInterface {
|
||||
@@ -20,6 +21,8 @@ class GraphicsScene;
|
||||
class ScxmlDocument;
|
||||
} // namespace PluginInterface
|
||||
|
||||
namespace OutputPane { class TableView; }
|
||||
|
||||
namespace Common {
|
||||
|
||||
class SearchModel;
|
||||
@@ -57,7 +60,9 @@ private:
|
||||
SearchModel *m_model;
|
||||
QSortFilterProxyModel *m_proxyModel;
|
||||
QPointer<PluginInterface::ScxmlDocument> m_document;
|
||||
Ui::Search m_ui;
|
||||
|
||||
Utils::FancyLineEdit *m_searchEdit;
|
||||
ScxmlEditor::OutputPane::TableView *m_searchView;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,210 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::Search</class>
|
||||
<widget class="QWidget" name="ScxmlEditor::Common::Search">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</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="QFrame" name="m_subTitleFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_searchEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter search term</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="m_paneInnerFrame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<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="ScxmlEditor::OutputPane::TableView" name="m_searchView">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="gridStyle">
|
||||
<enum>Qt::NoPen</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>80</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderMinimumSectionSize">
|
||||
<number>50</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderDefaultSectionSize">
|
||||
<number>19</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderMinimumSectionSize">
|
||||
<number>19</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>TableView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>tableview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -6,12 +6,11 @@
|
||||
#include "scxmluifactory.h"
|
||||
#include "shapegroupwidget.h"
|
||||
#include "shapeprovider.h"
|
||||
#include "ui_shapestoolbox.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QResizeEvent>
|
||||
#include <QShowEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ScxmlEditor::Common;
|
||||
@@ -19,7 +18,21 @@ using namespace ScxmlEditor::Common;
|
||||
ShapesToolbox::ShapesToolbox(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
auto scrollArea = new QScrollArea;
|
||||
scrollArea->setFrameShape(NoFrame);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
|
||||
auto shapeGroupsContainer = new QWidget;
|
||||
scrollArea->setWidget(shapeGroupsContainer);
|
||||
|
||||
m_shapeGroupsLayout = new QVBoxLayout(shapeGroupsContainer);
|
||||
m_shapeGroupsLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_shapeGroupsLayout->setSpacing(0);
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Column {
|
||||
scrollArea,
|
||||
}.setSpacing(0).attachTo(this, WithoutMargins);
|
||||
}
|
||||
|
||||
void ShapesToolbox::setUIFactory(ScxmlEditor::PluginInterface::ScxmlUiFactory *factory)
|
||||
@@ -42,10 +55,11 @@ void ShapesToolbox::initView()
|
||||
for (int i = 0; i < m_shapeProvider->groupCount(); ++i) {
|
||||
auto widget = new ShapeGroupWidget(m_shapeProvider, i);
|
||||
m_widgets << widget;
|
||||
m_ui.m_shapeGrouplayout->addWidget(widget);
|
||||
m_shapeGroupsLayout->addWidget(widget);
|
||||
}
|
||||
}
|
||||
|
||||
m_ui.m_shapeGrouplayout->update();
|
||||
m_shapeGroupsLayout->addStretch(1);
|
||||
m_shapeGroupsLayout->update();
|
||||
update();
|
||||
}
|
||||
|
@@ -3,11 +3,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_shapestoolbox.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QPointer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QVBoxLayout;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ScxmlEditor {
|
||||
|
||||
namespace PluginInterface {
|
||||
@@ -33,7 +35,7 @@ public:
|
||||
private:
|
||||
QPointer<PluginInterface::ShapeProvider> m_shapeProvider;
|
||||
QList<QWidget*> m_widgets;
|
||||
Ui::ShapesToolbox m_ui;
|
||||
QVBoxLayout *m_shapeGroupsLayout;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::ShapesToolbox</class>
|
||||
<widget class="QFrame" name="ScxmlEditor::Common::ShapesToolbox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>321</width>
|
||||
<height>665</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</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="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>321</width>
|
||||
<height>665</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,1">
|
||||
<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>
|
||||
<layout class="QVBoxLayout" name="m_shapeGrouplayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -3,10 +3,15 @@
|
||||
|
||||
#include "stateview.h"
|
||||
#include "graphicsscene.h"
|
||||
#include "graphicsview.h"
|
||||
#include "scxmldocument.h"
|
||||
#include "scxmluifactory.h"
|
||||
#include "stateitem.h"
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
using namespace ScxmlEditor::PluginInterface;
|
||||
using namespace ScxmlEditor::Common;
|
||||
|
||||
@@ -14,14 +19,27 @@ StateView::StateView(StateItem *state, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_parentState(state)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
m_isMainView = !m_parentState;
|
||||
|
||||
connect(m_ui.m_btnClose, &QPushButton::clicked, this, &StateView::closeView);
|
||||
auto titleBar = new QWidget;
|
||||
titleBar->setVisible(!m_isMainView);
|
||||
auto stateNameLabel = new QLabel;
|
||||
stateNameLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
stateNameLabel->setAlignment(Qt::AlignCenter);
|
||||
if (!m_isMainView)
|
||||
m_ui.m_stateName->setText(m_parentState->itemId());
|
||||
m_ui.m_titleFrame->setVisible(!m_isMainView);
|
||||
stateNameLabel->setText(m_parentState->itemId());
|
||||
|
||||
m_graphicsView = new GraphicsView;
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Row {
|
||||
PushButton{ text("Back"), onClicked([this] { closeView(); }, this) },
|
||||
stateNameLabel,
|
||||
}.attachTo(titleBar, WithoutMargins);
|
||||
|
||||
Column {
|
||||
titleBar, m_graphicsView
|
||||
}.setSpacing(0).attachTo(this, WithoutMargins);
|
||||
|
||||
initScene();
|
||||
}
|
||||
@@ -47,7 +65,7 @@ void StateView::initScene()
|
||||
{
|
||||
// Init scene
|
||||
m_scene = new GraphicsScene(this);
|
||||
m_ui.m_graphicsView->setGraphicsScene(m_scene);
|
||||
m_graphicsView->setGraphicsScene(m_scene);
|
||||
}
|
||||
|
||||
void StateView::closeView()
|
||||
@@ -58,14 +76,14 @@ void StateView::closeView()
|
||||
void StateView::setUiFactory(ScxmlUiFactory *factory)
|
||||
{
|
||||
m_scene->setUiFactory(factory);
|
||||
m_ui.m_graphicsView->setUiFactory(factory);
|
||||
m_graphicsView->setUiFactory(factory);
|
||||
}
|
||||
|
||||
void StateView::setDocument(ScxmlDocument *doc)
|
||||
{
|
||||
// Set document to scene
|
||||
m_scene->setDocument(doc);
|
||||
m_ui.m_graphicsView->setDocument(doc);
|
||||
m_graphicsView->setDocument(doc);
|
||||
if (doc)
|
||||
connect(doc, &ScxmlDocument::colorThemeChanged, m_scene, [this] { m_scene->invalidate(); });
|
||||
}
|
||||
@@ -82,5 +100,5 @@ GraphicsScene *StateView::scene() const
|
||||
|
||||
GraphicsView *StateView::view() const
|
||||
{
|
||||
return m_ui.m_graphicsView;
|
||||
return m_graphicsView;
|
||||
}
|
||||
|
@@ -3,8 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_stateview.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace ScxmlEditor {
|
||||
@@ -18,6 +16,8 @@ class ScxmlUiFactory;
|
||||
|
||||
namespace Common {
|
||||
|
||||
class GraphicsView;
|
||||
|
||||
class StateView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
PluginInterface::StateItem *m_parentState = nullptr;
|
||||
PluginInterface::GraphicsScene *m_scene = nullptr;
|
||||
bool m_isMainView;
|
||||
Ui::StateView m_ui;
|
||||
GraphicsView *m_graphicsView;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,99 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::StateView</class>
|
||||
<widget class="QWidget" name="ScxmlEditor::Common::StateView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</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="QFrame" name="m_titleFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
<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="QPushButton" name="m_btnClose">
|
||||
<property name="text">
|
||||
<string>Back</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/scxmleditor/images/icon-undo.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_stateName">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ScxmlEditor::Common::GraphicsView" name="m_graphicsView">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>GraphicsView</class>
|
||||
<extends>QGraphicsView</extends>
|
||||
<header>graphicsview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -6,7 +6,11 @@
|
||||
#include "statistics.h"
|
||||
#include "warningmodel.h"
|
||||
|
||||
#include <utils/itemviews.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QLabel>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
using namespace ScxmlEditor::PluginInterface;
|
||||
@@ -112,24 +116,38 @@ QVariant StatisticsModel::data(const QModelIndex &index, int role) const
|
||||
Statistics::Statistics(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
m_model = new StatisticsModel(this);
|
||||
|
||||
m_fileNameLabel = new QLabel;
|
||||
m_fileNameLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
m_levels = new QLabel;
|
||||
|
||||
m_timeLabel = new QLabel;
|
||||
m_timeLabel->setText(QDateTime::currentDateTime().toString(tr("yyyy/MM/dd hh:mm:ss")));
|
||||
|
||||
m_proxyModel = new QSortFilterProxyModel(this);
|
||||
m_proxyModel->setFilterKeyColumn(-1);
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
|
||||
m_ui.m_statisticsView->setModel(m_proxyModel);
|
||||
m_ui.m_timeLabel->setText(QDateTime::currentDateTime().toString(tr("yyyy/MM/dd hh:mm:ss")));
|
||||
m_statisticsView = new Utils::TreeView;
|
||||
m_statisticsView->setModel(m_proxyModel);
|
||||
m_statisticsView->setAlternatingRowColors(true);
|
||||
m_statisticsView->setSortingEnabled(true);
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Grid {
|
||||
tr("File"), m_fileNameLabel, br,
|
||||
tr("Time"), m_timeLabel, br,
|
||||
tr("Max. levels"), m_levels, br,
|
||||
Span(2, m_statisticsView), br
|
||||
}.attachTo(this, WithoutMargins);
|
||||
}
|
||||
|
||||
void Statistics::setDocument(ScxmlDocument *doc)
|
||||
{
|
||||
m_ui.m_fileNameLabel->setText(doc->fileName());
|
||||
m_fileNameLabel->setText(doc->fileName());
|
||||
m_model->setDocument(doc);
|
||||
m_proxyModel->invalidate();
|
||||
m_proxyModel->sort(1, Qt::DescendingOrder);
|
||||
m_ui.m_statisticsView->resizeColumnsToContents();
|
||||
m_ui.m_levels->setText(QString::fromLatin1("%1").arg(m_model->levels()));
|
||||
m_levels->setText(QString::fromLatin1("%1").arg(m_model->levels()));
|
||||
}
|
||||
|
@@ -3,12 +3,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_statistics.h"
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QFrame>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QSortFilterProxyModel)
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
class QSortFilterProxyModel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class TreeView; }
|
||||
|
||||
namespace ScxmlEditor {
|
||||
|
||||
@@ -53,7 +56,10 @@ public:
|
||||
private:
|
||||
StatisticsModel *m_model;
|
||||
QSortFilterProxyModel *m_proxyModel;
|
||||
Ui::Statistics m_ui;
|
||||
QLabel *m_fileNameLabel;
|
||||
QLabel *m_levels;
|
||||
QLabel *m_timeLabel;
|
||||
Utils::TreeView *m_statisticsView;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::Statistics</class>
|
||||
<widget class="QWidget" name="ScxmlEditor::Common::Statistics">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>375</width>
|
||||
<height>258</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<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>
|
||||
<property name="horizontalSpacing">
|
||||
<number>15</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="m_timeLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="m_levels">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="m_fileNameLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QTableView" name="m_statisticsView">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Max. levels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -2,19 +2,34 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "scxmldocument.h"
|
||||
#include "statistics.h"
|
||||
#include "statisticsdialog.h"
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
using namespace ScxmlEditor::Common;
|
||||
|
||||
StatisticsDialog::StatisticsDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
resize(400, 300);
|
||||
setWindowTitle(tr("Document Statistics"));
|
||||
connect(m_ui.m_okButton, &QPushButton::clicked, this, &StatisticsDialog::accept);
|
||||
|
||||
m_statistics = new Statistics;
|
||||
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
Column {
|
||||
m_statistics,
|
||||
buttonBox,
|
||||
}.attachTo(this);
|
||||
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &StatisticsDialog::accept);
|
||||
}
|
||||
|
||||
void StatisticsDialog::setDocument(ScxmlEditor::PluginInterface::ScxmlDocument *doc)
|
||||
{
|
||||
m_ui.m_statistics->setDocument(doc);
|
||||
m_statistics->setDocument(doc);
|
||||
}
|
||||
|
@@ -3,8 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_statisticsdialog.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace ScxmlEditor {
|
||||
@@ -13,6 +11,8 @@ namespace PluginInterface { class ScxmlDocument; }
|
||||
|
||||
namespace Common {
|
||||
|
||||
class Statistics;
|
||||
|
||||
class StatisticsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
void setDocument(PluginInterface::ScxmlDocument *doc);
|
||||
|
||||
private:
|
||||
Ui::StatisticsDialog m_ui;
|
||||
Statistics *m_statistics;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
@@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScxmlEditor::Common::StatisticsDialog</class>
|
||||
<widget class="QDialog" name="ScxmlEditor::Common::StatisticsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="ScxmlEditor::Common::Statistics" name="m_statistics">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_okButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Statistics</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>statistics.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -64,17 +64,6 @@ QtcPlugin {
|
||||
"treeview.h", "treeview.cpp",
|
||||
|
||||
"common.qrc",
|
||||
|
||||
"magnifier.ui",
|
||||
"colorpicker.ui",
|
||||
"colorsettings.ui",
|
||||
"colorthemedialog.ui",
|
||||
"navigatorslider.ui",
|
||||
"search.ui",
|
||||
"shapestoolbox.ui",
|
||||
"stateview.ui",
|
||||
"statistics.ui",
|
||||
"statisticsdialog.ui",
|
||||
]
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user