mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 12:40:06 +00:00 
			
		
		
		
	Edit line dialog in-work
This commit is contained in:
		
							parent
							
								
									7254fc71fb
								
							
						
					
					
						commit
						eda7751eb9
					
				
					 4 changed files with 683 additions and 6 deletions
				
			
		|  | @ -240,8 +240,8 @@ set(HDR_UI source/scwx/qt/ui/about_dialog.hpp | ||||||
|            source/scwx/qt/ui/animation_dock_widget.hpp |            source/scwx/qt/ui/animation_dock_widget.hpp | ||||||
|            source/scwx/qt/ui/collapsible_group.hpp |            source/scwx/qt/ui/collapsible_group.hpp | ||||||
|            source/scwx/qt/ui/county_dialog.hpp |            source/scwx/qt/ui/county_dialog.hpp | ||||||
|            source/scwx/qt/ui/wfo_dialog.hpp |  | ||||||
|            source/scwx/qt/ui/download_dialog.hpp |            source/scwx/qt/ui/download_dialog.hpp | ||||||
|  |            source/scwx/qt/ui/edit_line_dialog.hpp | ||||||
|            source/scwx/qt/ui/flow_layout.hpp |            source/scwx/qt/ui/flow_layout.hpp | ||||||
|            source/scwx/qt/ui/gps_info_dialog.hpp |            source/scwx/qt/ui/gps_info_dialog.hpp | ||||||
|            source/scwx/qt/ui/hotkey_edit.hpp |            source/scwx/qt/ui/hotkey_edit.hpp | ||||||
|  | @ -260,15 +260,16 @@ set(HDR_UI source/scwx/qt/ui/about_dialog.hpp | ||||||
|            source/scwx/qt/ui/radar_site_dialog.hpp |            source/scwx/qt/ui/radar_site_dialog.hpp | ||||||
|            source/scwx/qt/ui/serial_port_dialog.hpp |            source/scwx/qt/ui/serial_port_dialog.hpp | ||||||
|            source/scwx/qt/ui/settings_dialog.hpp |            source/scwx/qt/ui/settings_dialog.hpp | ||||||
|            source/scwx/qt/ui/update_dialog.hpp) |            source/scwx/qt/ui/update_dialog.hpp | ||||||
|  |            source/scwx/qt/ui/wfo_dialog.hpp) | ||||||
| set(SRC_UI source/scwx/qt/ui/about_dialog.cpp | set(SRC_UI source/scwx/qt/ui/about_dialog.cpp | ||||||
|            source/scwx/qt/ui/alert_dialog.cpp |            source/scwx/qt/ui/alert_dialog.cpp | ||||||
|            source/scwx/qt/ui/alert_dock_widget.cpp |            source/scwx/qt/ui/alert_dock_widget.cpp | ||||||
|            source/scwx/qt/ui/animation_dock_widget.cpp |            source/scwx/qt/ui/animation_dock_widget.cpp | ||||||
|            source/scwx/qt/ui/collapsible_group.cpp |            source/scwx/qt/ui/collapsible_group.cpp | ||||||
|            source/scwx/qt/ui/county_dialog.cpp |            source/scwx/qt/ui/county_dialog.cpp | ||||||
|            source/scwx/qt/ui/wfo_dialog.cpp |  | ||||||
|            source/scwx/qt/ui/download_dialog.cpp |            source/scwx/qt/ui/download_dialog.cpp | ||||||
|  |            source/scwx/qt/ui/edit_line_dialog.cpp | ||||||
|            source/scwx/qt/ui/flow_layout.cpp |            source/scwx/qt/ui/flow_layout.cpp | ||||||
|            source/scwx/qt/ui/gps_info_dialog.cpp |            source/scwx/qt/ui/gps_info_dialog.cpp | ||||||
|            source/scwx/qt/ui/hotkey_edit.cpp |            source/scwx/qt/ui/hotkey_edit.cpp | ||||||
|  | @ -287,14 +288,15 @@ set(SRC_UI source/scwx/qt/ui/about_dialog.cpp | ||||||
|            source/scwx/qt/ui/radar_site_dialog.cpp |            source/scwx/qt/ui/radar_site_dialog.cpp | ||||||
|            source/scwx/qt/ui/settings_dialog.cpp |            source/scwx/qt/ui/settings_dialog.cpp | ||||||
|            source/scwx/qt/ui/serial_port_dialog.cpp |            source/scwx/qt/ui/serial_port_dialog.cpp | ||||||
|            source/scwx/qt/ui/update_dialog.cpp) |            source/scwx/qt/ui/update_dialog.cpp | ||||||
|  |            source/scwx/qt/ui/wfo_dialog.cpp) | ||||||
| set(UI_UI  source/scwx/qt/ui/about_dialog.ui | set(UI_UI  source/scwx/qt/ui/about_dialog.ui | ||||||
|            source/scwx/qt/ui/alert_dialog.ui |            source/scwx/qt/ui/alert_dialog.ui | ||||||
|            source/scwx/qt/ui/alert_dock_widget.ui |            source/scwx/qt/ui/alert_dock_widget.ui | ||||||
|            source/scwx/qt/ui/animation_dock_widget.ui |            source/scwx/qt/ui/animation_dock_widget.ui | ||||||
|            source/scwx/qt/ui/collapsible_group.ui |            source/scwx/qt/ui/collapsible_group.ui | ||||||
|            source/scwx/qt/ui/county_dialog.ui |            source/scwx/qt/ui/county_dialog.ui | ||||||
|            source/scwx/qt/ui/wfo_dialog.ui |            source/scwx/qt/ui/edit_line_dialog.ui | ||||||
|            source/scwx/qt/ui/gps_info_dialog.ui |            source/scwx/qt/ui/gps_info_dialog.ui | ||||||
|            source/scwx/qt/ui/imgui_debug_dialog.ui |            source/scwx/qt/ui/imgui_debug_dialog.ui | ||||||
|            source/scwx/qt/ui/layer_dialog.ui |            source/scwx/qt/ui/layer_dialog.ui | ||||||
|  | @ -305,7 +307,8 @@ set(UI_UI  source/scwx/qt/ui/about_dialog.ui | ||||||
|            source/scwx/qt/ui/radar_site_dialog.ui |            source/scwx/qt/ui/radar_site_dialog.ui | ||||||
|            source/scwx/qt/ui/settings_dialog.ui |            source/scwx/qt/ui/settings_dialog.ui | ||||||
|            source/scwx/qt/ui/serial_port_dialog.ui |            source/scwx/qt/ui/serial_port_dialog.ui | ||||||
|            source/scwx/qt/ui/update_dialog.ui) |            source/scwx/qt/ui/update_dialog.ui | ||||||
|  |            source/scwx/qt/ui/wfo_dialog.ui) | ||||||
| set(HDR_UI_SETTINGS source/scwx/qt/ui/settings/hotkey_settings_widget.hpp | set(HDR_UI_SETTINGS source/scwx/qt/ui/settings/hotkey_settings_widget.hpp | ||||||
|                     source/scwx/qt/ui/settings/settings_page_widget.hpp |                     source/scwx/qt/ui/settings/settings_page_widget.hpp | ||||||
|                     source/scwx/qt/ui/settings/unit_settings_widget.hpp) |                     source/scwx/qt/ui/settings/unit_settings_widget.hpp) | ||||||
|  |  | ||||||
							
								
								
									
										309
									
								
								scwx-qt/source/scwx/qt/ui/edit_line_dialog.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										309
									
								
								scwx-qt/source/scwx/qt/ui/edit_line_dialog.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,309 @@ | ||||||
|  | #include "edit_line_dialog.hpp" | ||||||
|  | #include "ui_edit_line_dialog.h" | ||||||
|  | 
 | ||||||
|  | #include <scwx/qt/ui/line_label.hpp> | ||||||
|  | #include <scwx/qt/util/color.hpp> | ||||||
|  | #include <scwx/util/logger.hpp> | ||||||
|  | 
 | ||||||
|  | #include <fmt/format.h> | ||||||
|  | #include <QColorDialog> | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace qt | ||||||
|  | { | ||||||
|  | namespace ui | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | static const std::string logPrefix_ = "scwx::qt::ui::edit_line_dialog"; | ||||||
|  | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
|  | 
 | ||||||
|  | class EditLineDialog::Impl | ||||||
|  | { | ||||||
|  | public: | ||||||
|  |    struct EditComponent | ||||||
|  |    { | ||||||
|  |       void ConnectSignals(EditLineDialog* self) | ||||||
|  |       { | ||||||
|  |          QObject::connect(colorLineEdit_, | ||||||
|  |                           &QLineEdit::textEdited, | ||||||
|  |                           self, | ||||||
|  |                           [=, this](const QString& text) | ||||||
|  |                           { | ||||||
|  |                              boost::gil::rgba8_pixel_t color = | ||||||
|  |                                 util::color::ToRgba8PixelT(text.toStdString()); | ||||||
|  |                              self->p->set_color(*this, color); | ||||||
|  |                           }); | ||||||
|  | 
 | ||||||
|  |          QObject::connect(colorButton_, | ||||||
|  |                           &QAbstractButton::clicked, | ||||||
|  |                           self, | ||||||
|  |                           [=, this]() { self->p->ShowColorDialog(*this); }); | ||||||
|  | 
 | ||||||
|  |          QObject::connect(widthSpinBox_, | ||||||
|  |                           &QSpinBox::valueChanged, | ||||||
|  |                           self, | ||||||
|  |                           [=, this](int width) | ||||||
|  |                           { self->p->set_width(*this, width); }); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       boost::gil::rgba8_pixel_t color_; | ||||||
|  |       std::size_t               width_; | ||||||
|  |       QFrame*                   colorFrame_ {nullptr}; | ||||||
|  |       QLineEdit*                colorLineEdit_ {nullptr}; | ||||||
|  |       QToolButton*              colorButton_ {nullptr}; | ||||||
|  |       QSpinBox*                 widthSpinBox_ {nullptr}; | ||||||
|  |    }; | ||||||
|  | 
 | ||||||
|  |    explicit Impl(EditLineDialog* self) : | ||||||
|  |        self_ {self}, lineLabel_ {new LineLabel(self)} | ||||||
|  |    { | ||||||
|  |    } | ||||||
|  |    ~Impl() = default; | ||||||
|  | 
 | ||||||
|  |    void SetDefaults(); | ||||||
|  |    void ShowColorDialog(EditComponent& component); | ||||||
|  |    void UpdateLineLabel(); | ||||||
|  | 
 | ||||||
|  |    void set_color(EditComponent& component, boost::gil::rgba8_pixel_t color); | ||||||
|  |    void set_width(EditComponent& component, std::size_t width); | ||||||
|  | 
 | ||||||
|  |    static void SetBackgroundColor(const std::string& value, QFrame* frame); | ||||||
|  | 
 | ||||||
|  |    EditLineDialog* self_; | ||||||
|  | 
 | ||||||
|  |    LineLabel* lineLabel_; | ||||||
|  | 
 | ||||||
|  |    boost::gil::rgba8_pixel_t defaultBorderColor_ {0, 0, 0, 255}; | ||||||
|  |    boost::gil::rgba8_pixel_t defaultHighlightColor_ {0, 0, 0, 0}; | ||||||
|  |    boost::gil::rgba8_pixel_t defaultLineColor_ {255, 255, 255, 255}; | ||||||
|  | 
 | ||||||
|  |    std::size_t defaultBorderWidth_ {1u}; | ||||||
|  |    std::size_t defaultHighlightWidth_ {0u}; | ||||||
|  |    std::size_t defaultLineWidth_ {3u}; | ||||||
|  | 
 | ||||||
|  |    EditComponent borderComponent_ {}; | ||||||
|  |    EditComponent highlightComponent_ {}; | ||||||
|  |    EditComponent lineComponent_ {}; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | EditLineDialog::EditLineDialog(QWidget* parent) : | ||||||
|  |     QDialog(parent), | ||||||
|  |     p {std::make_unique<Impl>(this)}, | ||||||
|  |     ui(new Ui::EditLineDialog) | ||||||
|  | { | ||||||
|  |    ui->setupUi(this); | ||||||
|  | 
 | ||||||
|  |    p->borderComponent_.colorFrame_    = ui->borderColorFrame; | ||||||
|  |    p->borderComponent_.colorLineEdit_ = ui->borderColorLineEdit; | ||||||
|  |    p->borderComponent_.colorButton_   = ui->borderColorButton; | ||||||
|  |    p->borderComponent_.widthSpinBox_  = ui->borderWidthSpinBox; | ||||||
|  | 
 | ||||||
|  |    p->highlightComponent_.colorFrame_    = ui->highlightColorFrame; | ||||||
|  |    p->highlightComponent_.colorLineEdit_ = ui->highlightColorLineEdit; | ||||||
|  |    p->highlightComponent_.colorButton_   = ui->highlightColorButton; | ||||||
|  |    p->highlightComponent_.widthSpinBox_  = ui->highlightWidthSpinBox; | ||||||
|  | 
 | ||||||
|  |    p->lineComponent_.colorFrame_    = ui->lineColorFrame; | ||||||
|  |    p->lineComponent_.colorLineEdit_ = ui->lineColorLineEdit; | ||||||
|  |    p->lineComponent_.colorButton_   = ui->lineColorButton; | ||||||
|  |    p->lineComponent_.widthSpinBox_  = ui->lineWidthSpinBox; | ||||||
|  | 
 | ||||||
|  |    p->SetDefaults(); | ||||||
|  | 
 | ||||||
|  |    p->lineLabel_->setMinimumWidth(72); | ||||||
|  | 
 | ||||||
|  |    QHBoxLayout* lineLabelContainerLayout = | ||||||
|  |       static_cast<QHBoxLayout*>(ui->lineLabelContainer->layout()); | ||||||
|  |    lineLabelContainerLayout->insertWidget(1, p->lineLabel_); | ||||||
|  | 
 | ||||||
|  |    p->borderComponent_.ConnectSignals(this); | ||||||
|  |    p->highlightComponent_.ConnectSignals(this); | ||||||
|  |    p->lineComponent_.ConnectSignals(this); | ||||||
|  | 
 | ||||||
|  |    QObject::connect(ui->buttonBox, | ||||||
|  |                     &QDialogButtonBox::clicked, | ||||||
|  |                     this, | ||||||
|  |                     [this](QAbstractButton* button) | ||||||
|  |                     { | ||||||
|  |                        QDialogButtonBox::ButtonRole role = | ||||||
|  |                           ui->buttonBox->buttonRole(button); | ||||||
|  | 
 | ||||||
|  |                        switch (role) | ||||||
|  |                        { | ||||||
|  |                        case QDialogButtonBox::ButtonRole::ResetRole: // Reset
 | ||||||
|  |                           p->SetDefaults(); | ||||||
|  |                           break; | ||||||
|  | 
 | ||||||
|  |                        default: | ||||||
|  |                           break; | ||||||
|  |                        } | ||||||
|  |                     }); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | EditLineDialog::~EditLineDialog() | ||||||
|  | { | ||||||
|  |    delete ui; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | boost::gil::rgba8_pixel_t EditLineDialog::border_color() const | ||||||
|  | { | ||||||
|  |    return p->borderComponent_.color_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | boost::gil::rgba8_pixel_t EditLineDialog::highlight_color() const | ||||||
|  | { | ||||||
|  |    return p->highlightComponent_.color_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | boost::gil::rgba8_pixel_t EditLineDialog::line_color() const | ||||||
|  | { | ||||||
|  |    return p->lineComponent_.color_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | std::size_t EditLineDialog::border_width() const | ||||||
|  | { | ||||||
|  |    return p->borderComponent_.width_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | std::size_t EditLineDialog::highlight_width() const | ||||||
|  | { | ||||||
|  |    return p->highlightComponent_.width_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | std::size_t EditLineDialog::line_width() const | ||||||
|  | { | ||||||
|  |    return p->lineComponent_.width_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::set_border_color(boost::gil::rgba8_pixel_t color) | ||||||
|  | { | ||||||
|  |    p->set_color(p->borderComponent_, color); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::set_highlight_color(boost::gil::rgba8_pixel_t color) | ||||||
|  | { | ||||||
|  |    p->set_color(p->highlightComponent_, color); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::set_line_color(boost::gil::rgba8_pixel_t color) | ||||||
|  | { | ||||||
|  |    p->set_color(p->lineComponent_, color); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::set_border_width(std::size_t width) | ||||||
|  | { | ||||||
|  |    p->set_width(p->borderComponent_, width); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::set_highlight_width(std::size_t width) | ||||||
|  | { | ||||||
|  |    p->set_width(p->highlightComponent_, width); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::set_line_width(std::size_t width) | ||||||
|  | { | ||||||
|  |    p->set_width(p->lineComponent_, width); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::Impl::set_color(EditComponent&            component, | ||||||
|  |                                      boost::gil::rgba8_pixel_t color) | ||||||
|  | { | ||||||
|  |    const std::string argbString {util::color::ToArgbString(color)}; | ||||||
|  | 
 | ||||||
|  |    component.color_ = color; | ||||||
|  |    component.colorLineEdit_->setText(QString::fromStdString(argbString)); | ||||||
|  |    SetBackgroundColor(argbString, component.colorFrame_); | ||||||
|  | 
 | ||||||
|  |    UpdateLineLabel(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::Impl::set_width(EditComponent& component, | ||||||
|  |                                      std::size_t    width) | ||||||
|  | { | ||||||
|  |    component.width_ = width; | ||||||
|  |    component.widthSpinBox_->setValue(static_cast<int>(width)); | ||||||
|  | 
 | ||||||
|  |    UpdateLineLabel(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::Impl::UpdateLineLabel() | ||||||
|  | { | ||||||
|  |    lineLabel_->set_border_color(borderComponent_.color_); | ||||||
|  |    lineLabel_->set_highlight_color(highlightComponent_.color_); | ||||||
|  |    lineLabel_->set_line_color(lineComponent_.color_); | ||||||
|  | 
 | ||||||
|  |    lineLabel_->set_border_width(borderComponent_.width_); | ||||||
|  |    lineLabel_->set_highlight_width(highlightComponent_.width_); | ||||||
|  |    lineLabel_->set_line_width(lineComponent_.width_); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::Initialize(boost::gil::rgba8_pixel_t borderColor, | ||||||
|  |                                 boost::gil::rgba8_pixel_t highlightColor, | ||||||
|  |                                 boost::gil::rgba8_pixel_t lineColor, | ||||||
|  |                                 std::size_t               borderWidth, | ||||||
|  |                                 std::size_t               highlightWidth, | ||||||
|  |                                 std::size_t               lineWidth) | ||||||
|  | { | ||||||
|  |    p->defaultBorderColor_    = borderColor; | ||||||
|  |    p->defaultHighlightColor_ = highlightColor; | ||||||
|  |    p->defaultLineColor_      = lineColor; | ||||||
|  | 
 | ||||||
|  |    p->defaultBorderWidth_    = borderWidth; | ||||||
|  |    p->defaultHighlightWidth_ = highlightWidth; | ||||||
|  |    p->defaultLineWidth_      = lineWidth; | ||||||
|  | 
 | ||||||
|  |    p->SetDefaults(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::Impl::SetDefaults() | ||||||
|  | { | ||||||
|  |    self_->set_border_color(defaultBorderColor_); | ||||||
|  |    self_->set_highlight_color(defaultHighlightColor_); | ||||||
|  |    self_->set_line_color(defaultLineColor_); | ||||||
|  | 
 | ||||||
|  |    self_->set_border_width(defaultBorderWidth_); | ||||||
|  |    self_->set_highlight_width(defaultHighlightWidth_); | ||||||
|  |    self_->set_line_width(defaultLineWidth_); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::Impl::ShowColorDialog(EditComponent& component) | ||||||
|  | { | ||||||
|  |    QColorDialog* dialog = new QColorDialog(self_); | ||||||
|  | 
 | ||||||
|  |    dialog->setAttribute(Qt::WA_DeleteOnClose); | ||||||
|  |    dialog->setOption(QColorDialog::ColorDialogOption::ShowAlphaChannel); | ||||||
|  | 
 | ||||||
|  |    QColor initialColor(component.colorLineEdit_->text()); | ||||||
|  |    if (initialColor.isValid()) | ||||||
|  |    { | ||||||
|  |       dialog->setCurrentColor(initialColor); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    QObject::connect( | ||||||
|  |       dialog, | ||||||
|  |       &QColorDialog::colorSelected, | ||||||
|  |       self_, | ||||||
|  |       [this, &component](const QColor& qColor) | ||||||
|  |       { | ||||||
|  |          QString colorName = qColor.name(QColor::NameFormat::HexArgb); | ||||||
|  |          boost::gil::rgba8_pixel_t color = | ||||||
|  |             util::color::ToRgba8PixelT(colorName.toStdString()); | ||||||
|  | 
 | ||||||
|  |          logger_->info("Selected color: {}", colorName.toStdString()); | ||||||
|  |          set_color(component, color); | ||||||
|  |       }); | ||||||
|  | 
 | ||||||
|  |    dialog->open(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void EditLineDialog::Impl::SetBackgroundColor(const std::string& value, | ||||||
|  |                                               QFrame*            frame) | ||||||
|  | { | ||||||
|  |    frame->setStyleSheet( | ||||||
|  |       QString::fromStdString(fmt::format("background-color: {}", value))); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | } // namespace ui
 | ||||||
|  | } // namespace qt
 | ||||||
|  | } // namespace scwx
 | ||||||
							
								
								
									
										59
									
								
								scwx-qt/source/scwx/qt/ui/edit_line_dialog.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								scwx-qt/source/scwx/qt/ui/edit_line_dialog.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,59 @@ | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include <QDialog> | ||||||
|  | 
 | ||||||
|  | #include <boost/gil/typedefs.hpp> | ||||||
|  | 
 | ||||||
|  | namespace Ui | ||||||
|  | { | ||||||
|  | class EditLineDialog; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace qt | ||||||
|  | { | ||||||
|  | namespace ui | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | class EditLineDialog : public QDialog | ||||||
|  | { | ||||||
|  |    Q_OBJECT | ||||||
|  |    Q_DISABLE_COPY_MOVE(EditLineDialog) | ||||||
|  | 
 | ||||||
|  | public: | ||||||
|  |    explicit EditLineDialog(QWidget* parent = nullptr); | ||||||
|  |    ~EditLineDialog(); | ||||||
|  | 
 | ||||||
|  |    boost::gil::rgba8_pixel_t border_color() const; | ||||||
|  |    boost::gil::rgba8_pixel_t highlight_color() const; | ||||||
|  |    boost::gil::rgba8_pixel_t line_color() const; | ||||||
|  | 
 | ||||||
|  |    std::size_t border_width() const; | ||||||
|  |    std::size_t highlight_width() const; | ||||||
|  |    std::size_t line_width() const; | ||||||
|  | 
 | ||||||
|  |    void set_border_color(boost::gil::rgba8_pixel_t color); | ||||||
|  |    void set_highlight_color(boost::gil::rgba8_pixel_t color); | ||||||
|  |    void set_line_color(boost::gil::rgba8_pixel_t color); | ||||||
|  | 
 | ||||||
|  |    void set_border_width(std::size_t width); | ||||||
|  |    void set_highlight_width(std::size_t width); | ||||||
|  |    void set_line_width(std::size_t width); | ||||||
|  | 
 | ||||||
|  |    void Initialize(boost::gil::rgba8_pixel_t borderColor, | ||||||
|  |                    boost::gil::rgba8_pixel_t highlightColor, | ||||||
|  |                    boost::gil::rgba8_pixel_t lineColor, | ||||||
|  |                    std::size_t               borderWidth, | ||||||
|  |                    std::size_t               highlightWidth, | ||||||
|  |                    std::size_t               lineWidth); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |    class Impl; | ||||||
|  |    std::unique_ptr<Impl> p; | ||||||
|  |    Ui::EditLineDialog*   ui; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | } // namespace ui
 | ||||||
|  | } // namespace qt
 | ||||||
|  | } // namespace scwx
 | ||||||
							
								
								
									
										306
									
								
								scwx-qt/source/scwx/qt/ui/edit_line_dialog.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										306
									
								
								scwx-qt/source/scwx/qt/ui/edit_line_dialog.ui
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,306 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <ui version="4.0"> | ||||||
|  |  <class>EditLineDialog</class> | ||||||
|  |  <widget class="QDialog" name="EditLineDialog"> | ||||||
|  |   <property name="geometry"> | ||||||
|  |    <rect> | ||||||
|  |     <x>0</x> | ||||||
|  |     <y>0</y> | ||||||
|  |     <width>350</width> | ||||||
|  |     <height>225</height> | ||||||
|  |    </rect> | ||||||
|  |   </property> | ||||||
|  |   <property name="windowTitle"> | ||||||
|  |    <string>Edit Line</string> | ||||||
|  |   </property> | ||||||
|  |   <layout class="QGridLayout" name="gridLayout"> | ||||||
|  |    <item row="0" column="0"> | ||||||
|  |     <widget class="QLabel" name="componentLabel"> | ||||||
|  |      <property name="font"> | ||||||
|  |       <font> | ||||||
|  |        <bold>true</bold> | ||||||
|  |       </font> | ||||||
|  |      </property> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>Component</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="2" column="2"> | ||||||
|  |     <widget class="QLineEdit" name="highlightColorLineEdit"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>#ff000000</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="3" column="4"> | ||||||
|  |     <widget class="QSpinBox" name="borderWidthSpinBox"> | ||||||
|  |      <property name="minimum"> | ||||||
|  |       <number>0</number> | ||||||
|  |      </property> | ||||||
|  |      <property name="maximum"> | ||||||
|  |       <number>9</number> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="1" column="3"> | ||||||
|  |     <widget class="QToolButton" name="lineColorButton"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>...</string> | ||||||
|  |      </property> | ||||||
|  |      <property name="icon"> | ||||||
|  |       <iconset resource="../../../../scwx-qt.qrc"> | ||||||
|  |        <normaloff>:/res/icons/font-awesome-6/palette-solid.svg</normaloff>:/res/icons/font-awesome-6/palette-solid.svg</iconset> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="3" column="3"> | ||||||
|  |     <widget class="QToolButton" name="borderColorButton"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>...</string> | ||||||
|  |      </property> | ||||||
|  |      <property name="icon"> | ||||||
|  |       <iconset resource="../../../../scwx-qt.qrc"> | ||||||
|  |        <normaloff>:/res/icons/font-awesome-6/palette-solid.svg</normaloff>:/res/icons/font-awesome-6/palette-solid.svg</iconset> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="3" column="0"> | ||||||
|  |     <widget class="QLabel" name="borderLabel"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>Border</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="1" column="2"> | ||||||
|  |     <widget class="QLineEdit" name="lineColorLineEdit"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>#ff000000</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="1" column="0"> | ||||||
|  |     <widget class="QLabel" name="lineLabel"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>Line</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="6" column="0" colspan="5"> | ||||||
|  |     <widget class="QDialogButtonBox" name="buttonBox"> | ||||||
|  |      <property name="orientation"> | ||||||
|  |       <enum>Qt::Orientation::Horizontal</enum> | ||||||
|  |      </property> | ||||||
|  |      <property name="standardButtons"> | ||||||
|  |       <set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok|QDialogButtonBox::StandardButton::Reset</set> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="1" column="1"> | ||||||
|  |     <widget class="QFrame" name="lineColorFrame"> | ||||||
|  |      <property name="minimumSize"> | ||||||
|  |       <size> | ||||||
|  |        <width>24</width> | ||||||
|  |        <height>24</height> | ||||||
|  |       </size> | ||||||
|  |      </property> | ||||||
|  |      <property name="frameShape"> | ||||||
|  |       <enum>QFrame::Shape::Box</enum> | ||||||
|  |      </property> | ||||||
|  |      <property name="frameShadow"> | ||||||
|  |       <enum>QFrame::Shadow::Plain</enum> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="2" column="4"> | ||||||
|  |     <widget class="QSpinBox" name="highlightWidthSpinBox"> | ||||||
|  |      <property name="minimum"> | ||||||
|  |       <number>0</number> | ||||||
|  |      </property> | ||||||
|  |      <property name="maximum"> | ||||||
|  |       <number>9</number> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="5" column="0"> | ||||||
|  |     <spacer name="verticalSpacer"> | ||||||
|  |      <property name="orientation"> | ||||||
|  |       <enum>Qt::Orientation::Vertical</enum> | ||||||
|  |      </property> | ||||||
|  |      <property name="sizeHint" stdset="0"> | ||||||
|  |       <size> | ||||||
|  |        <width>20</width> | ||||||
|  |        <height>40</height> | ||||||
|  |       </size> | ||||||
|  |      </property> | ||||||
|  |     </spacer> | ||||||
|  |    </item> | ||||||
|  |    <item row="2" column="1"> | ||||||
|  |     <widget class="QFrame" name="highlightColorFrame"> | ||||||
|  |      <property name="minimumSize"> | ||||||
|  |       <size> | ||||||
|  |        <width>24</width> | ||||||
|  |        <height>24</height> | ||||||
|  |       </size> | ||||||
|  |      </property> | ||||||
|  |      <property name="frameShape"> | ||||||
|  |       <enum>QFrame::Shape::Box</enum> | ||||||
|  |      </property> | ||||||
|  |      <property name="frameShadow"> | ||||||
|  |       <enum>QFrame::Shadow::Plain</enum> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="0" column="1" colspan="3"> | ||||||
|  |     <widget class="QLabel" name="colorLabel"> | ||||||
|  |      <property name="font"> | ||||||
|  |       <font> | ||||||
|  |        <bold>true</bold> | ||||||
|  |       </font> | ||||||
|  |      </property> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>Color</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="3" column="2"> | ||||||
|  |     <widget class="QLineEdit" name="borderColorLineEdit"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>#ff000000</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="3" column="1"> | ||||||
|  |     <widget class="QFrame" name="borderColorFrame"> | ||||||
|  |      <property name="minimumSize"> | ||||||
|  |       <size> | ||||||
|  |        <width>24</width> | ||||||
|  |        <height>24</height> | ||||||
|  |       </size> | ||||||
|  |      </property> | ||||||
|  |      <property name="frameShape"> | ||||||
|  |       <enum>QFrame::Shape::Box</enum> | ||||||
|  |      </property> | ||||||
|  |      <property name="frameShadow"> | ||||||
|  |       <enum>QFrame::Shadow::Plain</enum> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="0" column="4"> | ||||||
|  |     <widget class="QLabel" name="widthLabel"> | ||||||
|  |      <property name="font"> | ||||||
|  |       <font> | ||||||
|  |        <bold>true</bold> | ||||||
|  |       </font> | ||||||
|  |      </property> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>Width</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="1" column="4"> | ||||||
|  |     <widget class="QSpinBox" name="lineWidthSpinBox"> | ||||||
|  |      <property name="minimum"> | ||||||
|  |       <number>1</number> | ||||||
|  |      </property> | ||||||
|  |      <property name="maximum"> | ||||||
|  |       <number>9</number> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="2" column="0"> | ||||||
|  |     <widget class="QLabel" name="highlightLabel"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>Highlight</string> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="2" column="3"> | ||||||
|  |     <widget class="QToolButton" name="highlightColorButton"> | ||||||
|  |      <property name="text"> | ||||||
|  |       <string>...</string> | ||||||
|  |      </property> | ||||||
|  |      <property name="icon"> | ||||||
|  |       <iconset resource="../../../../scwx-qt.qrc"> | ||||||
|  |        <normaloff>:/res/icons/font-awesome-6/palette-solid.svg</normaloff>:/res/icons/font-awesome-6/palette-solid.svg</iconset> | ||||||
|  |      </property> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |    <item row="4" column="0" colspan="5"> | ||||||
|  |     <widget class="QWidget" name="lineLabelContainer" native="true"> | ||||||
|  |      <property name="minimumSize"> | ||||||
|  |       <size> | ||||||
|  |        <width>0</width> | ||||||
|  |        <height>45</height> | ||||||
|  |       </size> | ||||||
|  |      </property> | ||||||
|  |      <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> | ||||||
|  |       <property name="bottomMargin"> | ||||||
|  |        <number>0</number> | ||||||
|  |       </property> | ||||||
|  |       <item> | ||||||
|  |        <spacer name="horizontalSpacer"> | ||||||
|  |         <property name="orientation"> | ||||||
|  |          <enum>Qt::Orientation::Horizontal</enum> | ||||||
|  |         </property> | ||||||
|  |        </spacer> | ||||||
|  |       </item> | ||||||
|  |       <item> | ||||||
|  |        <spacer name="horizontalSpacer_2"> | ||||||
|  |         <property name="orientation"> | ||||||
|  |          <enum>Qt::Orientation::Horizontal</enum> | ||||||
|  |         </property> | ||||||
|  |        </spacer> | ||||||
|  |       </item> | ||||||
|  |      </layout> | ||||||
|  |     </widget> | ||||||
|  |    </item> | ||||||
|  |   </layout> | ||||||
|  |  </widget> | ||||||
|  |  <resources> | ||||||
|  |   <include location="../../../../scwx-qt.qrc"/> | ||||||
|  |  </resources> | ||||||
|  |  <connections> | ||||||
|  |   <connection> | ||||||
|  |    <sender>buttonBox</sender> | ||||||
|  |    <signal>accepted()</signal> | ||||||
|  |    <receiver>EditLineDialog</receiver> | ||||||
|  |    <slot>accept()</slot> | ||||||
|  |    <hints> | ||||||
|  |     <hint type="sourcelabel"> | ||||||
|  |      <x>248</x> | ||||||
|  |      <y>254</y> | ||||||
|  |     </hint> | ||||||
|  |     <hint type="destinationlabel"> | ||||||
|  |      <x>157</x> | ||||||
|  |      <y>274</y> | ||||||
|  |     </hint> | ||||||
|  |    </hints> | ||||||
|  |   </connection> | ||||||
|  |   <connection> | ||||||
|  |    <sender>buttonBox</sender> | ||||||
|  |    <signal>rejected()</signal> | ||||||
|  |    <receiver>EditLineDialog</receiver> | ||||||
|  |    <slot>reject()</slot> | ||||||
|  |    <hints> | ||||||
|  |     <hint type="sourcelabel"> | ||||||
|  |      <x>316</x> | ||||||
|  |      <y>260</y> | ||||||
|  |     </hint> | ||||||
|  |     <hint type="destinationlabel"> | ||||||
|  |      <x>286</x> | ||||||
|  |      <y>274</y> | ||||||
|  |     </hint> | ||||||
|  |    </hints> | ||||||
|  |   </connection> | ||||||
|  |  </connections> | ||||||
|  | </ui> | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat