diff --git a/languages/capturer_en_US.ts b/languages/capturer_en_US.ts index 9dc1e14..d67c34e 100644 --- a/languages/capturer_en_US.ts +++ b/languages/capturer_en_US.ts @@ -234,61 +234,61 @@ - + Language - + Auto - + Dark - + Light - + Theme - + Screenshot - - - + + + Border Width - - - + + + Border Color - - - + + + Line Type - - - + + + Mask Color @@ -298,56 +298,56 @@ - - - + + + Appearance: - - + + Show Region - - + + Params: - - + + Framerate - + Encoder - - + + High - - + + Medium - - + + Low - - + + Quality @@ -362,17 +362,17 @@ - + Microphones - + Speakers - + Cameras @@ -382,22 +382,22 @@ - + Paste - + Hide/Show All Images - + Video Recording - + Gif Recording @@ -407,22 +407,22 @@ - + Version - + Copyright © 2018 - 2023 ffiirree. All rights reserved - + Run on Startup - + Settings File diff --git a/languages/capturer_zh_CN.ts b/languages/capturer_zh_CN.ts index 840a5c2..ec07721 100644 --- a/languages/capturer_zh_CN.ts +++ b/languages/capturer_zh_CN.ts @@ -234,60 +234,60 @@ 通用 - + Language 语言 - + Dark 暗色 - + Light 亮色 - + Theme 主题 - + Screenshot 截图 - - + + Params: 参数: - - + + Framerate 帧率 - + Microphones 麦克风 - + Speakers 扬声器 - + Cameras 摄像头 - + Encoder 编码器 @@ -297,82 +297,82 @@ 录屏 - + Run on Startup 开机启动 - + Settings File 设置文件 - + Auto 跟随系统 - - - + + + Border Width 边框宽度 - - - + + + Border Color 边框颜色 - - - + + + Line Type 线条类型 - - - + + + Mask Color 遮罩颜色 - - - + + + Appearance: 界面: - - + + Show Region 显示区域 - - + + High - - + + Medium - - + + Low - - + + Quality 质量 @@ -392,22 +392,22 @@ 快捷键 - + Paste 粘贴 - + Hide/Show All Images 隐藏/显示全部贴图 - + Video Recording 录制视频 - + Gif Recording 录制GIF @@ -417,12 +417,12 @@ 关于 - + Version 版本 - + Copyright © 2018 - 2023 ffiirree. All rights reserved diff --git a/src/capturer-dark.qss b/src/capturer-dark.qss index e73fdbb..c7b5f68 100644 --- a/src/capturer-dark.qss +++ b/src/capturer-dark.qss @@ -1,3 +1,8 @@ +/*///////////////////////////////////////////////////////////////*/ +QCheckBox::indicator { + image: url(:/icon/res/checkbox-unchecked-light); +} + /*///////////////////////////////////////////////////////////////*/ QComboBox { border: 1px solid #323232; @@ -23,7 +28,6 @@ QComboBox:on { } QComboBox QAbstractItemView { - outline: 0px; border: 1px solid #e4e7ed; } @@ -77,7 +81,7 @@ QSpinBox:focus { QSpinBox::down-button, QSpinBox::up-button { - background-color: #292929; + background-color: #2b2b2b; } QSpinBox::up-button:hover, @@ -87,6 +91,14 @@ QSpinBox::down-button:pressed { background-color: #262626; } +QSpinBox::up-arrow { + image: url(:/icon/res/arrow_up-light); +} + +QSpinBox::down-arrow { + image: url(:/icon/res/arrow_down-light); +} + /*///////////////////////////////////////////////////////////////*/ QMenu { background-color: #232323; diff --git a/src/capturer-light.qss b/src/capturer-light.qss index dde3e85..1aa2efe 100644 --- a/src/capturer-light.qss +++ b/src/capturer-light.qss @@ -1,3 +1,8 @@ +/*///////////////////////////////////////////////////////////////*/ +QCheckBox::indicator { + image: url(:/icon/res/checkbox-unchecked-dark); +} + /*///////////////////////////////////////////////////////////////*/ QComboBox { border: 1px solid #e9e8e7; @@ -24,7 +29,6 @@ QComboBox:on { } QComboBox QAbstractItemView { - outline: 0px; border: 1px solid #e4e7ed; } @@ -96,6 +100,14 @@ QSpinBox::down-button:pressed { background-color: #e0e0e0; } +QSpinBox::up-arrow { + image: url(:/icon/res/arrow_up); +} + +QSpinBox::down-arrow { + image: url(:/icon/res/arrow_down); +} + /*///////////////////////////////////////////////////////////////*/ QMenu { background-color: #f9f9f9; diff --git a/src/capturer.qrc b/src/capturer.qrc index 1bb4e1d..7b9274b 100644 --- a/src/capturer.qrc +++ b/src/capturer.qrc @@ -51,8 +51,6 @@ res/arrow_up.png res/arrow_down-light.png res/arrow_up-light.png - res/spin_down.png - res/spin_up.png res/pause-dark.png res/play-dark.png res/microphone-dark.png @@ -79,6 +77,34 @@ res/camera-fill-dark.png res/camera-light.png res/camera-fill-light.png + res/dot-1-light.png + res/dot-2-light.png + res/dot-3-light.png + res/dot-4-light.png + res/dot-5-light.png + res/dot-6-light.png + res/dot-7-light.png + res/dot-8-light.png + res/dot-1-dark.png + res/dot-2-dark.png + res/dot-3-dark.png + res/dot-4-dark.png + res/dot-5-dark.png + res/dot-6-dark.png + res/dot-7-dark.png + res/dot-8-dark.png + res/dot-1.png + res/dot-2.png + res/dot-3.png + res/dot-4.png + res/dot-5.png + res/dot-6.png + res/dot-7.png + res/dot-8.png + res/checkbox-checked.png + res/checkbox-unchecked-dark.png + res/checkbox-unchecked-hover.png + res/checkbox-unchecked-light.png menu/menu.qss diff --git a/src/capturer.qss b/src/capturer.qss index f2f397a..c8577ea 100644 --- a/src/capturer.qss +++ b/src/capturer.qss @@ -3,6 +3,23 @@ QWidget { font-family: "Microsoft YaHei"; } +QCheckBox { + spacing: 0px; +} + +QCheckBox::indicator { + height: 1.5em; + width: 1.5em; +} + +QCheckBox::indicator:checked { + image: url(:/icon/res/checkbox-checked); +} + +QCheckBox::indicator:unchecked:hover { + image: url(:/icon/res/checkbox-unchecked-hover); +} + /*///////////////////////////////////////////////////////////////*/ QComboBox { border-radius: 5px; @@ -14,7 +31,7 @@ QComboBox { QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: center right; - width: 24px; + width: 2em; padding: 4px 0; border-top-right-radius: 3px; @@ -22,7 +39,8 @@ QComboBox::drop-down { } QComboBox::down-arrow { - width: 24px; + width: 1.25em; + height: 1.25em; } QComboBox QAbstractItemView { @@ -59,39 +77,31 @@ QSpinBox { } QSpinBox::up-button { - subcontrol-origin: border; + subcontrol-origin: padding; subcontrol-position: top right; border: none; - border-radius: 5px; + border-top-right-radius: 5px; - width: 20px; - margin-right: 2px; - margin-top: 2px; - margin-bottom: 1px; + width: 2em; } QSpinBox::up-arrow { - image: url(:/icon/res/spin_up.png); - width: 20px; + width: 2em; } QSpinBox::down-button { - subcontrol-origin: border; + subcontrol-origin: padding; subcontrol-position: bottom right; border: none; - border-radius: 5px; + border-bottom-right-radius: 5px; - width: 20px; - margin-right: 2px; - margin-bottom: 2px; - margin-top: 1px; + width: 2em; } QSpinBox::down-arrow { - image: url(:/icon/res/spin_down.png); - width: 20px; + width: 2em; } /*///////////////////////////////////////////////////////////////*/ diff --git a/src/menu/menu-dark.qss b/src/menu/menu-dark.qss index 397c440..ed57cbd 100644 --- a/src/menu/menu-dark.qss +++ b/src/menu/menu-dark.qss @@ -127,14 +127,42 @@ ImageEditMenu QCheckBox#save-btn::indicator { /*///////////////////////////////// Style Menu //////////////////////////////*/ -StyleMenu QCheckBox#fill-btn::indicator { - image: url(:/icon/res/fill-light) -} - StyleMenu QCheckBox#width-btn:unchecked:hover { background-color: #323232; } -StyleMenu QCheckBox#width-btn::indicator:unchecked { - background-color: #e6e6e6; +StyleMenu QCheckBox#width-btn[width="1"]::indicator { + image: url(:/icon/res/dot-1-light); +} + +StyleMenu QCheckBox#width-btn[width="2"]::indicator { + image: url(:/icon/res/dot-2-light); +} + +StyleMenu QCheckBox#width-btn[width="3"]::indicator { + image: url(:/icon/res/dot-3-light); +} + +StyleMenu QCheckBox#width-btn[width="4"]::indicator { + image: url(:/icon/res/dot-4-light); +} + +StyleMenu QCheckBox#width-btn[width="5"]::indicator { + image: url(:/icon/res/dot-5-light); +} + +StyleMenu QCheckBox#width-btn[width="6"]::indicator { + image: url(:/icon/res/dot-6-light); +} + +StyleMenu QCheckBox#width-btn[width="7"]::indicator { + image: url(:/icon/res/dot-7-light); +} + +StyleMenu QCheckBox#width-btn[width="8"]::indicator { + image: url(:/icon/res/dot-8-light); +} + +StyleMenu QCheckBox#fill-btn::indicator { + image: url(:/icon/res/fill-light) } \ No newline at end of file diff --git a/src/menu/menu-light.qss b/src/menu/menu-light.qss index 1f9f307..6ee0a65 100644 --- a/src/menu/menu-light.qss +++ b/src/menu/menu-light.qss @@ -127,10 +127,6 @@ ImageEditMenu QCheckBox#save-btn::indicator { /*///////////////////////////////// Style Menu //////////////////////////////*/ -StyleMenu QCheckBox#fill-btn::indicator { - image: url(:/icon/res/fill-dark) -} - StyleMenu QCheckBox#width-btn { background-color: #f9f9f9; } @@ -139,6 +135,38 @@ StyleMenu QCheckBox#width-btn:unchecked:hover { background-color: #e6e6e6; } -StyleMenu QCheckBox#width-btn::indicator:unchecked { - background-color: #2c2c2c; +StyleMenu QCheckBox#width-btn[width="1"]::indicator { + image: url(:/icon/res/dot-1-dark); +} + +StyleMenu QCheckBox#width-btn[width="2"]::indicator { + image: url(:/icon/res/dot-2-dark); +} + +StyleMenu QCheckBox#width-btn[width="3"]::indicator { + image: url(:/icon/res/dot-3-dark); +} + +StyleMenu QCheckBox#width-btn[width="4"]::indicator { + image: url(:/icon/res/dot-4-dark); +} + +StyleMenu QCheckBox#width-btn[width="5"]::indicator { + image: url(:/icon/res/dot-5-dark); +} + +StyleMenu QCheckBox#width-btn[width="6"]::indicator { + image: url(:/icon/res/dot-6-dark); +} + +StyleMenu QCheckBox#width-btn[width="7"]::indicator { + image: url(:/icon/res/dot-7-dark); +} + +StyleMenu QCheckBox#width-btn[width="8"]::indicator { + image: url(:/icon/res/dot-8-dark); +} + +StyleMenu QCheckBox#fill-btn::indicator { + image: url(:/icon/res/fill-dark) } \ No newline at end of file diff --git a/src/menu/menu.qss b/src/menu/menu.qss index 155a28e..6c467ec 100644 --- a/src/menu/menu.qss +++ b/src/menu/menu.qss @@ -4,10 +4,6 @@ RecordMenu QWidget#menu { border-radius: 5px; } -RecordMenu QCheckBox { - spacing: 0px; -} - RecordMenu QCheckBox::indicator { font-size: 9pt; @@ -31,10 +27,6 @@ RecordMenu QCheckBox#stop-btn::indicator { /*///////////////////////////////// Edit Menu //////////////////////////////*/ -ImageEditMenu QCheckBox { - spacing: 0px; -} - ImageEditMenu QCheckBox::indicator { font-size: 9pt; @@ -88,52 +80,64 @@ ImageEditMenu QCheckBox#ok-btn::indicator { } /*///////////////////////////////// Style Menu //////////////////////////////*/ -StyleMenu { - font-size: 9pt; - max-height: 2.5em; -} - StyleMenu QComboBox { font-size: 9pt; max-width: 10em; min-width: 4em; } -StyleMenu QCheckBox { +StyleMenu QCheckBox::indicator { font-size: 9pt; - spacing: 0px; - - max-width: 2.5em; - max-height: 2.5em; } -StyleMenu QCheckBox::indicator { - font-size: 9pt; +StyleMenu QCheckBox#width-btn:checked { + background-color: #409eff; +} +StyleMenu QCheckBox#width-btn::indicator { height: 1.5em; width: 1.5em; padding: 0.5em; + + image: url(:/icon/res/dot-2); } -StyleMenu QCheckBox#width-btn:checked { - background-color: #409eff; +StyleMenu QCheckBox#width-btn[width="1"]::indicator:checked { + image: url(:/icon/res/dot-1); } -StyleMenu QCheckBox#width-btn::indicator { - padding: 0px; - margin: 0px; +StyleMenu QCheckBox#width-btn[width="2"]::indicator:checked { + image: url(:/icon/res/dot-2); +} + +StyleMenu QCheckBox#width-btn[width="3"]::indicator:checked { + image: url(:/icon/res/dot-3); +} + +StyleMenu QCheckBox#width-btn[width="4"]::indicator:checked { + image: url(:/icon/res/dot-4); +} - subcontrol-position: center center; - background-color: white; +StyleMenu QCheckBox#width-btn[width="5"]::indicator:checked { + image: url(:/icon/res/dot-5); +} + +StyleMenu QCheckBox#width-btn[width="6"]::indicator:checked { + image: url(:/icon/res/dot-6); +} + +StyleMenu QCheckBox#width-btn[width="7"]::indicator:checked { + image: url(:/icon/res/dot-7); +} - height: 0.5em; - width: 0.5em; - margin: 1em; - border-radius: 0.25em; +StyleMenu QCheckBox#width-btn[width="8"]::indicator:checked { + image: url(:/icon/res/dot-8); } -StyleMenu QCheckBox#width-btn::indicator:checked { - background-color: white; +StyleMenu QCheckBox#fill-btn::indicator { + height: 1.5em; + width: 1.5em; + padding: 0.5em; } StyleMenu QCheckBox#fill-btn::indicator:checked { diff --git a/src/menu/stylemenu.cpp b/src/menu/stylemenu.cpp index b865fe8..89f3af9 100644 --- a/src/menu/stylemenu.cpp +++ b/src/menu/stylemenu.cpp @@ -11,7 +11,7 @@ StyleMenu::StyleMenu(int buttons, QWidget* parent) auto group = new ButtonGroup(this); if (buttons & WIDTH_BTN) { - width_btn_ = new WidthButton(3, true, this); + width_btn_ = new WidthButton(true, this); width_btn_->setObjectName("width-btn"); width_btn_->setCheckable(true); width_btn_->setChecked(true); diff --git a/src/res/checkbox-checked.png b/src/res/checkbox-checked.png new file mode 100644 index 0000000..bfe149e Binary files /dev/null and b/src/res/checkbox-checked.png differ diff --git a/src/res/checkbox-unchecked-dark.png b/src/res/checkbox-unchecked-dark.png new file mode 100644 index 0000000..b565b94 Binary files /dev/null and b/src/res/checkbox-unchecked-dark.png differ diff --git a/src/res/checkbox-unchecked-hover.png b/src/res/checkbox-unchecked-hover.png new file mode 100644 index 0000000..f8fbfb6 Binary files /dev/null and b/src/res/checkbox-unchecked-hover.png differ diff --git a/src/res/checkbox-unchecked-light.png b/src/res/checkbox-unchecked-light.png new file mode 100644 index 0000000..0852177 Binary files /dev/null and b/src/res/checkbox-unchecked-light.png differ diff --git a/src/res/dot-1-dark.png b/src/res/dot-1-dark.png new file mode 100644 index 0000000..f9722e4 Binary files /dev/null and b/src/res/dot-1-dark.png differ diff --git a/src/res/dot-1-light.png b/src/res/dot-1-light.png new file mode 100644 index 0000000..0a59b66 Binary files /dev/null and b/src/res/dot-1-light.png differ diff --git a/src/res/dot-1.png b/src/res/dot-1.png new file mode 100644 index 0000000..ff4e9fe Binary files /dev/null and b/src/res/dot-1.png differ diff --git a/src/res/dot-2-dark.png b/src/res/dot-2-dark.png new file mode 100644 index 0000000..a4b7ad9 Binary files /dev/null and b/src/res/dot-2-dark.png differ diff --git a/src/res/dot-2-light.png b/src/res/dot-2-light.png new file mode 100644 index 0000000..ba23657 Binary files /dev/null and b/src/res/dot-2-light.png differ diff --git a/src/res/dot-2.png b/src/res/dot-2.png new file mode 100644 index 0000000..3e2ae65 Binary files /dev/null and b/src/res/dot-2.png differ diff --git a/src/res/dot-3-dark.png b/src/res/dot-3-dark.png new file mode 100644 index 0000000..7a06eaa Binary files /dev/null and b/src/res/dot-3-dark.png differ diff --git a/src/res/dot-3-light.png b/src/res/dot-3-light.png new file mode 100644 index 0000000..7fd4a79 Binary files /dev/null and b/src/res/dot-3-light.png differ diff --git a/src/res/dot-3.png b/src/res/dot-3.png new file mode 100644 index 0000000..ead5719 Binary files /dev/null and b/src/res/dot-3.png differ diff --git a/src/res/dot-4-dark.png b/src/res/dot-4-dark.png new file mode 100644 index 0000000..322c663 Binary files /dev/null and b/src/res/dot-4-dark.png differ diff --git a/src/res/dot-4-light.png b/src/res/dot-4-light.png new file mode 100644 index 0000000..3de01af Binary files /dev/null and b/src/res/dot-4-light.png differ diff --git a/src/res/dot-4.png b/src/res/dot-4.png new file mode 100644 index 0000000..21835da Binary files /dev/null and b/src/res/dot-4.png differ diff --git a/src/res/dot-5-dark.png b/src/res/dot-5-dark.png new file mode 100644 index 0000000..900a9df Binary files /dev/null and b/src/res/dot-5-dark.png differ diff --git a/src/res/dot-5-light.png b/src/res/dot-5-light.png new file mode 100644 index 0000000..324287a Binary files /dev/null and b/src/res/dot-5-light.png differ diff --git a/src/res/dot-5.png b/src/res/dot-5.png new file mode 100644 index 0000000..7eee736 Binary files /dev/null and b/src/res/dot-5.png differ diff --git a/src/res/dot-6-dark.png b/src/res/dot-6-dark.png new file mode 100644 index 0000000..1f63f25 Binary files /dev/null and b/src/res/dot-6-dark.png differ diff --git a/src/res/dot-6-light.png b/src/res/dot-6-light.png new file mode 100644 index 0000000..d9706b0 Binary files /dev/null and b/src/res/dot-6-light.png differ diff --git a/src/res/dot-6.png b/src/res/dot-6.png new file mode 100644 index 0000000..d325064 Binary files /dev/null and b/src/res/dot-6.png differ diff --git a/src/res/dot-7-dark.png b/src/res/dot-7-dark.png new file mode 100644 index 0000000..cc164a7 Binary files /dev/null and b/src/res/dot-7-dark.png differ diff --git a/src/res/dot-7-light.png b/src/res/dot-7-light.png new file mode 100644 index 0000000..589fc5c Binary files /dev/null and b/src/res/dot-7-light.png differ diff --git a/src/res/dot-7.png b/src/res/dot-7.png new file mode 100644 index 0000000..44219f0 Binary files /dev/null and b/src/res/dot-7.png differ diff --git a/src/res/dot-8-dark.png b/src/res/dot-8-dark.png new file mode 100644 index 0000000..0e3f8d2 Binary files /dev/null and b/src/res/dot-8-dark.png differ diff --git a/src/res/dot-8-light.png b/src/res/dot-8-light.png new file mode 100644 index 0000000..cb996ee Binary files /dev/null and b/src/res/dot-8-light.png differ diff --git a/src/res/dot-8.png b/src/res/dot-8.png new file mode 100644 index 0000000..27e6eb2 Binary files /dev/null and b/src/res/dot-8.png differ diff --git a/src/res/spin_down.png b/src/res/spin_down.png deleted file mode 100644 index b63da23..0000000 Binary files a/src/res/spin_down.png and /dev/null differ diff --git a/src/res/spin_up.png b/src/res/spin_up.png deleted file mode 100644 index 3bc2ff5..0000000 Binary files a/src/res/spin_up.png and /dev/null differ diff --git a/src/setting/settingdialog.cpp b/src/setting/settingdialog.cpp index b45b25d..0b4d2ba 100644 --- a/src/setting/settingdialog.cpp +++ b/src/setting/settingdialog.cpp @@ -77,13 +77,13 @@ SettingWindow::SettingWindow(QWidget * parent) pages_ = new QStackedWidget(); layout->addWidget(pages_); - setupGeneralWidget(); - setupHotkeyWidget(); - setupSnipWidget(); - setupRecordWidget(); - setupGIFWidget(); - setupDevicesWidget(); - setupAboutWidget(); + pages_->addWidget(setupGeneralWidget()); + pages_->addWidget(setupHotkeyWidget()); + pages_->addWidget(setupSnipWidget()); + pages_->addWidget(setupRecordWidget()); + pages_->addWidget(setupGIFWidget()); + pages_->addWidget(setupDevicesWidget()); + pages_->addWidget(setupAboutWidget()); connect(menu, &QListWidget::currentItemChanged, [=](auto current, auto){ pages_->setCurrentIndex(menu->row(current)); @@ -91,7 +91,7 @@ SettingWindow::SettingWindow(QWidget * parent) menu->setCurrentRow(0); } -void SettingWindow::setupGeneralWidget() +QWidget* SettingWindow::setupGeneralWidget() { auto general_widget = new QWidget(pages_); @@ -99,6 +99,7 @@ void SettingWindow::setupGeneralWidget() layout->setContentsMargins(35, 10, 35, 15); auto _01 = new QCheckBox(); + _01->setObjectName("autorun"); _01->setChecked(config["autorun"].get()); setAutoRun(_01->checkState()); connect(_01, &QCheckBox::stateChanged, this, &SettingWindow::setAutoRun); @@ -141,10 +142,11 @@ void SettingWindow::setupGeneralWidget() layout->setRowStretch(4, 1); general_widget->setLayout(layout); - pages_->addWidget(general_widget); + + return general_widget; } -void SettingWindow::setupSnipWidget() +QWidget* SettingWindow::setupSnipWidget() { auto snip_widget = new QWidget(pages_); @@ -189,10 +191,11 @@ void SettingWindow::setupSnipWidget() layout->setRowStretch(5, 1); snip_widget->setLayout(layout); - pages_->addWidget(snip_widget); + + return snip_widget; } -void SettingWindow::setupRecordWidget() +QWidget* SettingWindow::setupRecordWidget() { auto record_widget = new QWidget(pages_); @@ -292,10 +295,11 @@ void SettingWindow::setupRecordWidget() layout->setRowStretch(11, 1); record_widget->setLayout(layout); - pages_->addWidget(record_widget); + + return record_widget; } -void SettingWindow::setupGIFWidget() +QWidget* SettingWindow::setupGIFWidget() { auto gif_widget = new QWidget(); @@ -375,10 +379,11 @@ void SettingWindow::setupGIFWidget() layout->setRowStretch(10, 1); gif_widget->setLayout(layout); - pages_->addWidget(gif_widget); + + return gif_widget; } -void SettingWindow::setupDevicesWidget() +QWidget* SettingWindow::setupDevicesWidget() { auto devices_widget = new QWidget(pages_); @@ -412,10 +417,11 @@ void SettingWindow::setupDevicesWidget() layout->setRowStretch(5, 1); devices_widget->setLayout(layout); - pages_->addWidget(devices_widget); + + return devices_widget; } -void SettingWindow::setupHotkeyWidget() +QWidget* SettingWindow::setupHotkeyWidget() { auto hotkey_widget = new QWidget(pages_); auto idx_row = 1; @@ -461,10 +467,11 @@ void SettingWindow::setupHotkeyWidget() layout->setRowStretch(idx_row, 1); hotkey_widget->setLayout(layout); - pages_->addWidget(hotkey_widget); + + return hotkey_widget; } -void SettingWindow::setupAboutWidget() +QWidget* SettingWindow::setupAboutWidget() { auto about_widget = new QWidget(pages_); pages_->addWidget(about_widget); @@ -490,6 +497,8 @@ void SettingWindow::setupAboutWidget() copyright_->setObjectName("copyright-label"); copyright_->setAlignment(Qt::AlignCenter); parent_layout->addWidget(copyright_); + + return about_widget; } void SettingWindow::setAutoRun(int statue) diff --git a/src/setting/settingdialog.h b/src/setting/settingdialog.h index c0093a1..e85bb9f 100644 --- a/src/setting/settingdialog.h +++ b/src/setting/settingdialog.h @@ -16,13 +16,13 @@ private slots: void setAutoRun(int); private: - void setupGeneralWidget(); - void setupSnipWidget(); - void setupRecordWidget(); - void setupGIFWidget(); - void setupDevicesWidget(); - void setupHotkeyWidget(); - void setupAboutWidget(); + QWidget* setupGeneralWidget(); + QWidget* setupSnipWidget(); + QWidget* setupRecordWidget(); + QWidget* setupGIFWidget(); + QWidget* setupDevicesWidget(); + QWidget* setupHotkeyWidget(); + QWidget* setupAboutWidget(); Config& config = Config::instance(); diff --git a/src/setting/settingswindow.qss b/src/setting/settingswindow.qss index d5ee262..6f54193 100644 --- a/src/setting/settingswindow.qss +++ b/src/setting/settingswindow.qss @@ -1,13 +1,8 @@ /*///////////////////////////////////////////////////////////////*/ -TitleBar QCheckBox { - spacing: 0px; - margin: 0px; -} - TitleBar QCheckBox#logo { font-size: 11pt; - min-width: 9em; - max-width: 9em; + min-width: 10em; + max-width: 10em; padding-top: 0.15em; } @@ -35,17 +30,17 @@ TitleBar QCheckBox#close-btn::indicator:hover { SettingWindow QListWidget { font-size: 11pt; - min-width: 9em; - max-width: 9em; + min-width: 10em; + max-width: 10em; border: none; } SettingWindow QListWidget::item { - height: 2em; + height: 2.25em; border: none; border-radius: 5px; padding: 0.25em 0em 0.25em 1.5em; - margin: 0.15em 0.35em; + margin: 0.15em 0.5em; } /*///////////////////////////////////////////////////////////////*/ diff --git a/src/widgets/colorpanel.cpp b/src/widgets/colorpanel.cpp index f276355..a721878 100644 --- a/src/widgets/colorpanel.cpp +++ b/src/widgets/colorpanel.cpp @@ -84,7 +84,7 @@ ColorPanel::ColorPanel(QWidget * parent) : QWidget(parent) { auto layout = new QGridLayout(); - layout->setContentsMargins(5, 5, 5, 5); + layout->setContentsMargins(5, 3, 5, 3); layout->setVerticalSpacing(1); layout->setHorizontalSpacing(2); diff --git a/src/widgets/widthbutton.cpp b/src/widgets/widthbutton.cpp index 18a1732..8b26510 100644 --- a/src/widgets/widthbutton.cpp +++ b/src/widgets/widthbutton.cpp @@ -1,20 +1,19 @@ #include "widthbutton.h" #include -#include "fmt/format.h" +#include +#include void WidthButton::setValue(int width) { width_ = std::clamp(width, min_, max_); - const double max_em = 2.5; - double width_em = ((double)width_ / max_) * 1.75; + auto __width = std::lround((width_ / static_cast(max_)) * 8); + if (__attr_width != __width && __width >= 1) { + setProperty("width", QVariant::fromValue(__width)); + style()->polish(this); - std::string style = fmt::format("WidthButton::indicator{{ height: {:2.1f}em; width: {:2.1f}em; margin: {:4.3f}em; border-radius: {:4.3f}em; }}", - width_em, width_em, (static_cast((max_em - width_em) * 49.9)) / 100.0, width_em * 0.485); - - setStyleSheet(QString::fromStdString(style)); - - update(); + emit changed(__width * 2 - 1); + } } void WidthButton::wheelEvent(QWheelEvent* event) @@ -24,6 +23,4 @@ void WidthButton::wheelEvent(QWheelEvent* event) width_ += event->angleDelta().y() / 120; setValue(width_); - - emit changed(width_); } diff --git a/src/widgets/widthbutton.h b/src/widgets/widthbutton.h index 249829c..119924e 100644 --- a/src/widgets/widthbutton.h +++ b/src/widgets/widthbutton.h @@ -6,10 +6,13 @@ class WidthButton : public QCheckBox { Q_OBJECT + + Q_PROPERTY(int width READ __r_attr_width WRITE __w_attr_width) + public: - explicit WidthButton(int width = 1, bool checkable = false, QWidget* parent = nullptr) - : QCheckBox(parent) { - setValue(width); + explicit WidthButton(bool checkable = false, QWidget* parent = nullptr) + : QCheckBox(parent) + { setCheckable(checkable); } @@ -28,10 +31,16 @@ public slots: protected: void wheelEvent(QWheelEvent*) override; + int __r_attr_width() const { return __attr_width; }; + void __w_attr_width(int w) { __attr_width = w; } + private: - int width_{ 2 }; - int max_{ 24 }; + int width_{ 3 }; + + int max_{ 16 }; int min_{ 1 }; + + int __attr_width{ 2 }; }; #endif // !WIDTH_BUTTON_H \ No newline at end of file