diff --git a/0001-Optimize-toolbar-add-toolbar-function-optimize-line--9c2875ef.patch b/0001-Optimize-toolbar-add-toolbar-function-optimize-line--9c2875ef.patch new file mode 100644 index 0000000..9eaae20 --- /dev/null +++ b/0001-Optimize-toolbar-add-toolbar-function-optimize-line--9c2875ef.patch @@ -0,0 +1,2030 @@ +From 9c2875ef5d315cc8937dce3c28b585c370101c2f Mon Sep 17 00:00:00 2001 +From: pengyulong +Date: Fri, 11 Dec 2020 15:27:10 +0800 +Subject: [PATCH] Optimize toolbar, add toolbar function, optimize line size + and color selection. + +--- + flameshot.pro | 10 +- + flameshot.pro.user | 2 +- + menucontroller.cpp | 3 +- + src/config/buttonlistview.cpp | 2 +- + src/imgur.pri | 4 +- + src/utils/confighandler.cpp | 20 +- + src/utils/filenamehandler.cpp | 6 +- + src/utils/screenshotsaver.cpp | 1 + + src/widgets/capture/capturebutton.cpp | 41 +- + src/widgets/capture/capturebutton.h | 1 + + src/widgets/capture/capturewidget.cpp | 114 ++++-- + src/widgets/capture/capturewidget.h | 7 +- + src/widgets/capture/colorpicker.cpp | 517 ++++-------------------- + src/widgets/capture/colorpicker.h | 27 +- + src/widgets/capture/fontwidget.h | 38 ++ + src/widgets/capture/formtip.cpp | 47 +++ + src/widgets/capture/formtip.h | 23 ++ + src/widgets/capture/thicknesswidget.cpp | 120 ++++++ + src/widgets/capture/thicknesswidget.h | 46 +++ + src/widgets/capture/toowidget.cpp | 139 +++++++ + src/widgets/capture/toowidget.h | 55 +++ + src/widgets/infowindow.cpp | 2 +- + textbutton.h | 13 +- + textbutton.qss | 151 +++++-- + zoomIndicator.cpp | 6 +- + 25 files changed, 838 insertions(+), 557 deletions(-) + create mode 100644 src/widgets/capture/fontwidget.h + create mode 100644 src/widgets/capture/formtip.cpp + create mode 100644 src/widgets/capture/formtip.h + create mode 100644 src/widgets/capture/thicknesswidget.cpp + create mode 100644 src/widgets/capture/thicknesswidget.h + create mode 100644 src/widgets/capture/toowidget.cpp + create mode 100644 src/widgets/capture/toowidget.h + +diff --git a/flameshot.pro b/flameshot.pro +index 7357646..b2ff378 100755 +--- a/flameshot.pro ++++ b/flameshot.pro +@@ -180,7 +180,10 @@ SOURCES += src/main.cpp \ + configsettings.cpp \ + savetips.cpp \ + src/tools/saveoption.cpp \ +- src/utils/win_manager.cpp ++ src/utils/win_manager.cpp \ ++ src/widgets/capture/toowidget.cpp \ ++ src/widgets/capture/thicknesswidget.cpp \ ++ src/widgets/capture/formtip.cpp + + HEADERS += src/widgets/capture/buttonhandler.h \ + src/widgets/infowindow.h \ +@@ -266,7 +269,10 @@ HEADERS += src/widgets/capture/buttonhandler.h \ + textbutton.h \ + src/tools/saveoption.h \ + src/tools/toolbutton.h \ +- src/utils/win_manager.h ++ src/utils/win_manager.h \ ++ src/widgets/capture/toowidget.h \ ++ src/widgets/capture/thicknesswidget.h \ ++ src/widgets/capture/formtip.h + + unix:!macx { + SOURCES += src/core/flameshotdbusadapter.cpp \ +diff --git a/flameshot.pro.user b/flameshot.pro.user +index e18b565..24440cd 100755 +--- a/flameshot.pro.user ++++ b/flameshot.pro.user +@@ -1,6 +1,6 @@ + + +- ++ + + + EnvironmentId +diff --git a/menucontroller.cpp b/menucontroller.cpp +index 1589f49..3b4c350 100755 +--- a/menucontroller.cpp ++++ b/menucontroller.cpp +@@ -39,7 +39,8 @@ MenuController::MenuController(QObject *parent) + "border-radius: 20px; " + "}" + "QMenu::item { background-color: transparent;" +- "padding:3px 20px;" ++ "border-radius: 20px; " ++ "padding:3px 20px 3px 24px;" + "margin:5px 10px;" + "}" + "QMenu::item:selected { background-color: gray; }"; +diff --git a/src/config/buttonlistview.cpp b/src/config/buttonlistview.cpp +index 34eda4b..1d9c47c 100755 +--- a/src/config/buttonlistview.cpp ++++ b/src/config/buttonlistview.cpp +@@ -91,7 +91,7 @@ void ButtonListView::reverseItemCheck(QListWidgetItem *item){ + void ButtonListView::selectAll() { + ConfigHandler().setAllTheButtons(); + for(int i = 0; i < this->count(); ++i) { +- if(i>=9&&i<=17) ++ if((i>=9&&i<=10)||i>15) + continue; + QListWidgetItem* item = this->item(i); + item->setCheckState(Qt::Checked); +diff --git a/src/imgur.pri b/src/imgur.pri +index 0881715..3fc8189 100755 +--- a/src/imgur.pri ++++ b/src/imgur.pri +@@ -11,8 +11,8 @@ HEADERS += \ + $$PWD/tools/colorbutton.h \ + $$PWD/tools/rectbutton.h \ + $$PWD/tools/linebutton.h \ +- $$PWD/utils/win_manager.h ++ $$PWD/utils/win_manager.h \ + + SOURCES += \ + $$PWD/tools/colorbutton.cpp \ +- $$PWD/utils/win_manager.cpp ++ $$PWD/utils/win_manager.cpp \ +diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp +index 6abe8e7..a64dcef 100755 +--- a/src/utils/confighandler.cpp ++++ b/src/utils/confighandler.cpp +@@ -52,10 +52,10 @@ QVector ConfigHandler::getButtons() { + //<< CaptureButton::TYPE_SELECTIONINDICATOR + //<< CaptureButton::TYPE_MOVESELECTION + //<< CaptureButton::TYPE_UNDO +-// << CaptureButton::TYPE_REDO ++ << CaptureButton::TYPE_REDO + // << CaptureButton::TYPE_COPY + << CaptureButton::TYPE_SAVE +-// << CaptureButton::TYPE_EXIT ++ << CaptureButton::TYPE_EXIT + // << CaptureButton::TYPE_IMAGEUPLOADER + // << CaptureButton::TYPE_OPEN_APP + // << CaptureButton::TYPE_PIN +@@ -81,15 +81,15 @@ void ConfigHandler::setButtons(const QVector &buttons + QVector ConfigHandler::getUserColors() { + QVector colors; + const QVector &defaultColors = { +- Qt::darkRed, + Qt::red, +- Qt::yellow, +- Qt::green, +- Qt::darkGreen, +- Qt::cyan, +- Qt::blue, +- Qt::magenta, +- Qt::darkMagenta ++ QColor(250,204,0), ++ //Qt::cyan, ++ QColor(0,255,255), ++ //Qt::blue, ++ Qt::black, ++ Qt::white ++ //Qt::magenta, ++ //Qt::darkMagenta + }; + + if (m_settings.contains(QStringLiteral("userColors"))) { +diff --git a/src/utils/filenamehandler.cpp b/src/utils/filenamehandler.cpp +index 9c65579..cd1e0f7 100755 +--- a/src/utils/filenamehandler.cpp ++++ b/src/utils/filenamehandler.cpp +@@ -21,6 +21,8 @@ + #include + #include + #include ++#include ++#include + + FileNameHandler::FileNameHandler(QObject *parent) : QObject(parent) { + std::locale::global(std::locale("")); +@@ -41,7 +43,9 @@ QString FileNameHandler::parseFilename(const QString &name) { + char data[MAX_CHARACTERS] = {0}; + std::strftime(data, sizeof(data), + tempData, std::localtime(&t)); +- res = QString::fromLocal8Bit(data, (int)strlen(data)); ++ res = QDateTime::currentDateTime().toString("yyyy-MM-dd-hh:mm:ss:zzz"); ++ ++ //res = QString::fromLocal8Bit(data, (int)strlen(data)); + free(tempData); + + // add the parsed pattern in a correct format for the filesystem +diff --git a/src/utils/screenshotsaver.cpp b/src/utils/screenshotsaver.cpp +index ab05a4f..36925d7 100755 +--- a/src/utils/screenshotsaver.cpp ++++ b/src/utils/screenshotsaver.cpp +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + ScreenshotSaver::ScreenshotSaver() { + } +diff --git a/src/widgets/capture/capturebutton.cpp b/src/widgets/capture/capturebutton.cpp +index e5b6858..87cf0b0 100755 +--- a/src/widgets/capture/capturebutton.cpp ++++ b/src/widgets/capture/capturebutton.cpp +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + // Button represents a single button of the capture widget, it can enable + // multiple functionality. +@@ -43,7 +44,7 @@ CaptureButton::CaptureButton(const ButtonType t, QWidget *parent) : QPushButton( + setFont(QFont(f.family(), 7, QFont::Bold)); + } else if (t == TYPE_SAVEOPTION) { + this->setText("选项"); +- this->setFixedSize(50,30); ++ this->setFixedSize(60,30); + QFont f("NotoSansCJKSC-Regular"); + this->setFont(f); + +@@ -184,15 +185,16 @@ static std::map buttonTypeOrder { + { CaptureButton::TYPE_BLUR, 8 }, + //{ CaptureButton::TYPE_SELECTIONINDICATOR, 9 }, + //{ CaptureButton::TYPE_MOVESELECTION, 10 }, +- //{ CaptureButton::TYPE_UNDO, 11 }, +- //{ CaptureButton::TYPE_REDO, 12 }, ++ { CaptureButton::TYPE_UNDO, 11 }, ++ { CaptureButton::TYPE_REDO, 12 }, + // { CaptureButton::TYPE_COPY, 13 }, +- { CaptureButton::TYPE_SAVE, 13 }, +- /* { CaptureButton::TYPE_EXIT, 15 }, +- { CaptureButton::TYPE_IMAGEUPLOADER, 16 }, +- { CaptureButton::TYPE_OPEN_APP, 17 }, +- { CaptureButton::TYPE_PIN, 18 },*/ +- { CaptureButton::TYPE_SAVEOPTION, 19 }, ++ { CaptureButton::TYPE_SAVEOPTION, 13 }, ++ { CaptureButton::TYPE_EXIT, 14 }, ++ { CaptureButton::TYPE_SAVE, 15 }, ++// { CaptureButton::TYPE_IMAGEUPLOADER, 16 }, ++// { CaptureButton::TYPE_OPEN_APP, 17 }, ++// { CaptureButton::TYPE_PIN, 18 }, ++ + }; + + int CaptureButton::getPriorityByButton(CaptureButton::ButtonType b) { +@@ -212,13 +214,20 @@ QVector CaptureButton::iterableButtonTypes = { + CaptureButton::TYPE_BLUR, + //CaptureButton::TYPE_SELECTIONINDICATOR, + //CaptureButton::TYPE_MOVESELECTION, +- //CaptureButton::TYPE_UNDO, +- //CaptureButton::TYPE_REDO, ++ CaptureButton::TYPE_UNDO, ++ CaptureButton::TYPE_REDO, + //CaptureButton::TYPE_COPY, +- CaptureButton::TYPE_SAVE, +- /* CaptureButton::TYPE_EXIT, +- CaptureButton::TYPE_IMAGEUPLOADER, +- CaptureButton::TYPE_OPEN_APP, +- CaptureButton::TYPE_PIN,*/ + CaptureButton::TYPE_SAVEOPTION, ++ CaptureButton::TYPE_EXIT, ++ CaptureButton::TYPE_SAVE, ++// CaptureButton::TYPE_IMAGEUPLOADER, ++// CaptureButton::TYPE_OPEN_APP, ++// CaptureButton::TYPE_PIN,s + }; ++ ++void CaptureButton::getRect() ++{ ++ ++qDebug() << this->geometry().x(); ++qDebug() << this->geometry().y(); ++} +diff --git a/src/widgets/capture/capturebutton.h b/src/widgets/capture/capturebutton.h +index cd4c57c..230bfe9 100755 +--- a/src/widgets/capture/capturebutton.h ++++ b/src/widgets/capture/capturebutton.h +@@ -76,6 +76,7 @@ public: + + void setColor(const QColor &c); + void animatedShow(); ++ void getRect(); + + protected: + virtual void mousePressEvent(QMouseEvent *); +diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp +index 52f4ede..fb6d51a 100755 +--- a/src/widgets/capture/capturewidget.cpp ++++ b/src/widgets/capture/capturewidget.cpp +@@ -57,7 +57,6 @@ + + #include + +- + namespace { + const int RECORD_MIN_SIZE = 10; + const int SPACING = 10; +@@ -66,6 +65,8 @@ const int CURSOR_WIDTH = 8; + const int CURSOR_HEIGHT = 18; + const int INDICATOR_WIDTH = 99; + const qreal RESIZEPOINT_WIDTH = 15; ++const int BAR_WIDTH = 530; ++const int BAR_HEIGHT = 30; + } + + // CaptureWidget is the main component used to capture the screen. It contains an +@@ -91,12 +92,12 @@ CaptureWidget::CaptureWidget(const uint id, const QString &savePath, + m_opacity = m_config.contrastOpacityValue(); + + m_bar = new QWidget(this); +- m_bar->resize(420,30); ++ m_bar->resize(BAR_WIDTH,BAR_HEIGHT); + m_bar->setMouseTracking(true); + m_bar->setStyleSheet("QWidget{border-radius:4px;padding:2px 4px;background-color:white;}"); ++ m_bar->move(-500,-500); + m_bar->hide(); + +- + setMouseTracking(true); + initContext(savePath, fullScreen); + initShortcuts(); +@@ -165,16 +166,21 @@ CaptureWidget::CaptureWidget(const uint id, const QString &savePath, + initOriginUI(); + initSecondUI(); + ++ m_formtip = new FormTip(this); ++ makeChild(m_formtip); ++ m_formtip->move(-500,-500); ++ m_formtip->hide(); ++ + // Init color picker + m_colorPicker = new ColorPicker(m_context.thickness,m_context.color,this); + connect(m_colorPicker, &ColorPicker::colorSelected, + this, &CaptureWidget::setDrawColor); + connect(m_colorPicker, &ColorPicker::thicknessSelected, + this, &CaptureWidget::setDrawThickness); +- connect(m_colorPicker, &ColorPicker::styleSelected, +- this, &CaptureWidget::setDrawRectStyle); +- connect(m_colorPicker, &ColorPicker::lineSelected, +- this, &CaptureWidget::setDrawLineStyle); ++// connect(m_colorPicker, &ColorPicker::styleSelected, ++// this, &CaptureWidget::setDrawRectStyle); ++// connect(m_colorPicker, &ColorPicker::lineSelected, ++// this, &CaptureWidget::setDrawLineStyle); + connect(this,&CaptureWidget::thicknessCh, + m_colorPicker, &ColorPicker::thicknessChanged); + /*QLabel* m_hSeparatorLine = new QLabel(this); +@@ -187,6 +193,7 @@ CaptureWidget::CaptureWidget(const uint id, const QString &savePath, + vLayout->addWidget(m_colorPicker, 0, Qt::AlignVCenter); + setLayout(vLayout);*/ + makeChild(m_colorPicker); ++ m_colorPicker->move(-500,-500); + m_colorPicker->hide(); + + // Init notification widget +@@ -266,7 +273,7 @@ void CaptureWidget::initOriginUI() + void CaptureWidget::initSecondUI() + { + //m_menuController = new MenuController(this); +- ++ return; + /*m_toolBar = new ToolBar(this); + m_toolBar->hide();*/ + } +@@ -317,6 +324,14 @@ void CaptureWidget::updateButtons() { + } + else if(t == CaptureButton::TYPE_SAVEOPTION) + { ++ ++ QLabel* SeparatorLine = new QLabel(); ++ SeparatorLine->setFixedSize(1, 20); ++ SeparatorLine->setStyleSheet("QLabel{border: 1px solid rgb(199,199,199);}"); ++ ++ rectLayout->addSpacing(9); ++ rectLayout->addWidget(SeparatorLine); ++ + m_menuController = new MenuController(this); + QMenu* m_menu = m_menuController->getMenu(); + +@@ -350,6 +365,7 @@ void CaptureWidget::updateButtons() { + + m_bar->setLayout(rectLayout); + m_bar->hide(); ++ makeChild(m_bar); + + m_buttonHandler->setButtons(vectorButtons); + +@@ -379,6 +395,11 @@ void CaptureWidget::deleteToolwidgetOrClose() { + void CaptureWidget::paintEvent(QPaintEvent *) { + QPainter painter(this); + painter.drawPixmap(0, 0, m_context.screenshot); ++ if(m_flag) ++ { ++ //painter.fillPath(path,QBrush(Qt::black)); ++ m_flag = false; ++ } + if (m_activeTool && m_mouseIsClicked) { + painter.save(); + m_activeTool->process(painter, m_context.screenshot); +@@ -455,6 +476,11 @@ void CaptureWidget::mousePressEvent(QMouseEvent *e) { + m_isFirstReleaseButton = true; + } + ++ if(m_selection->geometry().contains(this->mapFromGlobal(QCursor::pos()))) ++ m_inselection = true; ++ else ++ m_inselection = false; ++ + if (e->button() == Qt::RightButton) { + m_rightClick = true; + /*if(m_selection->x() + m_selection->width() > m_context.desktop->screenGeometry().width() - 60) +@@ -469,7 +495,7 @@ void CaptureWidget::mousePressEvent(QMouseEvent *e) { + m_showInitialMsg = false; + m_mouseIsClicked = true; + // Click using a tool +- if (m_activeButton) { ++ if (m_activeButton && m_inselection) { + if (m_activeTool) { + if (m_activeTool->isValid() && m_toolWidget) { + pushToolToStack(); +@@ -491,13 +517,16 @@ void CaptureWidget::mousePressEvent(QMouseEvent *e) { + m_activeTool, &CaptureTool::thicknessChanged); + connect(m_activeTool, &CaptureTool::requestAction, + this, &CaptureWidget::handleButtonSignal); ++ + m_activeTool->drawStart(m_context); + return; + } ++ else if(m_activeButton) ++ return; ++ + if(m_bar->geometry().contains(this->mapFromGlobal(QCursor::pos()))) + return ; + +- + m_dragStartPoint = e->pos(); + m_selection->saveGeometry(); + // New selection +@@ -658,7 +687,7 @@ void CaptureWidget::mouseMoveEvent(QMouseEvent *e) { + m_selection->setGeometry(r.intersected(rect()).normalized()); + update(); + } +- } else if (m_mouseIsClicked && m_activeTool) { ++ } else if (m_mouseIsClicked && m_activeTool && m_inselection) { + + if(e->pos().x() < m_selection->x() && e->pos().y() < m_selection->y()){ + if (m_adjustmentButtonPressed) { +@@ -757,6 +786,7 @@ void CaptureWidget::mouseMoveEvent(QMouseEvent *e) { + void CaptureWidget::mouseReleaseEvent(QMouseEvent *e) { + if (e->button() == Qt::RightButton) { + m_colorPicker->hide(); ++ m_formtip->hide(); + m_rightClick = false; + // when we end the drawing we have to register the last point and + //add the temp modification to the list of modifications +@@ -792,29 +822,29 @@ void CaptureWidget::mouseReleaseEvent(QMouseEvent *e) { + m_context.selection = extendedRect(&newGeometry); + updateSizeIndicator(); + +- if((m_selection->x() + m_selection->width()/2 <= 200 )&& (m_selection->width() <= 400)) ++ if((m_selection->x() + m_selection->width()/2 <= 220 )&& (m_selection->width() <= 440)) + { +- if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100 )&& (m_selection->height() <= 200)) ++ if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100 )&& (m_selection->height() <= 220)) + m_bar->move(m_selection->x(), m_selection->y() - 35); +- else if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100 )&& (m_selection->height() > 200)) ++ else if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100 )&& (m_selection->height() > 220)) + m_bar->move(m_selection->x(), m_selection->y() + m_selection->height() - 35); + else + m_bar->move(m_selection->x() , m_selection->y() + m_selection->height() + 2); + } +- else if((m_selection->x() + m_selection->width()/2 >= m_context.desktop->screenGeometry().width() - 200 )&& (m_selection->width() <= 400)) ++ else if((m_selection->x() + m_selection->width()/2 >= m_context.desktop->screenGeometry().width() - 200 )&& (m_selection->width() <= 440)) + { +- if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100) && (m_selection->height() <= 200)) +- m_bar->move(m_selection->x() + m_selection->width() - 400, m_selection->y() - 35); +- else if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100 )&& (m_selection->height() > 200)) +- m_bar->move(m_selection->x() + m_selection->width() - 400, m_selection->y() + m_selection->height() - 35); ++ if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100) && (m_selection->height() <= 220)) ++ m_bar->move(m_selection->x() + m_selection->width() - 440, m_selection->y() - 35); ++ else if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100 )&& (m_selection->height() > 220)) ++ m_bar->move(m_selection->x() + m_selection->width() - 440, m_selection->y() + m_selection->height() - 35); + else +- m_bar->move(m_selection->x() + m_selection->width() - 400, m_selection->y() + m_selection->height() + 2); ++ m_bar->move(m_selection->x() + m_selection->width() - 440, m_selection->y() + m_selection->height() + 2); + } + else + { +- if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100) && (m_selection->height() <= 200)) ++ if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100) && (m_selection->height() <= 220)) + m_bar->move(m_selection->x() + m_selection->width()/2 - 175, m_selection->y() - 35); +- else if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100 )&& (m_selection->height() > 200)) ++ else if((m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100 )&& (m_selection->height() > 220)) + m_bar->move(m_selection->x() + m_selection->width()/2 - 175, m_selection->y() + m_selection->height() - 35); + else + m_bar->move(m_selection->x() + m_selection->width()/2 - 175 , m_selection->y() + m_selection->height() + 2); +@@ -886,6 +916,7 @@ void CaptureWidget::wheelEvent(QWheelEvent *e) { + update(); + } + emit thicknessChanged(m_context.thickness); ++ emit thicknessCh(m_context.thickness); + } + + void CaptureWidget::resizeEvent(QResizeEvent *e) { +@@ -991,19 +1022,24 @@ void CaptureWidget::setState(CaptureButton *b) { + //m_activeButton->setColor(QColor (87, 250 , 255, 255)); + m_activeButton->setColor(Qt::gray); + // qDebug() << b->tool()->name(); +- updateToolBar(b->tool()->name()); ++ + if(b->tool()->name() == "选项") + { + m_menuController->showMenu(b->pos()); + m_colorPicker->hide(); ++ m_formtip->hide(); ++ } ++ else ++ { ++ updateToolBar(b->tool()->name()); + } + //m_menuController->showMenu(m_selection->getPoint()); + } else if (m_activeButton) { +- + m_panel->clearToolWidget(); + m_activeButton->setColor(m_uiColor); + m_activeButton = nullptr; + m_colorPicker->hide(); ++ m_formtip->hide(); + } + update(); // clear mouse preview + } +@@ -1171,7 +1207,7 @@ void CaptureWidget::initShortcuts() { + new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Down), this, SLOT(downResize())); + new QShortcut(Qt::Key_Space, this, SLOT(togglePanel())); + new QShortcut(Qt::Key_Escape, this, SLOT(deleteToolwidgetOrClose())); +- new QShortcut(Qt::Key_Return, this, SLOT(copyScreenshot())); ++ new QShortcut(Qt::Key_Return, this, SLOT(saveScreenshot())); + new QShortcut(Qt::Key_Enter, this, SLOT(saveScreenshot())); + } + +@@ -1217,7 +1253,7 @@ void CaptureWidget::updateCursor() { + setCursor(Qt::CrossCursor); + } + } else { +- setCursor(Qt::CrossCursor); ++ setCursor(Qt::ArrowCursor); + } + } + +@@ -1266,6 +1302,7 @@ void CaptureWidget::saveScreenshot() { + hide(); + //huoqu xitongcanshu + //QString strDir = QDir::homePath(); ++ + if(m_context.savetip == "desktip") + { + QString strDir = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); +@@ -1355,12 +1392,28 @@ void CaptureWidget::menuHide() + + void CaptureWidget::updateToolBar(QString toolName) + { +- if(m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 200) +- m_colorPicker->move(m_bar->x(),m_bar->y() - m_colorPicker->height() - 1); ++ if(m_selection->y() + m_selection->height() >= m_context.desktop->screenGeometry().height() - 100) ++ { ++ m_colorPicker->move(m_bar->x() + m_activeButton->geometry().x() - 18, m_bar->y() - m_colorPicker->height() - 9); ++ m_formtip->move(m_bar->x(),m_bar->y() - 9); ++ isReverse = true; ++ } + else +- m_colorPicker->move(m_bar->x(),m_bar->y() + m_bar->height() + 1); +- //qDebug() << toolName; ++ { ++ m_colorPicker->move(m_bar->x() + m_activeButton->geometry().x() - 18, m_bar->y() + m_bar->height() + 9); ++ m_formtip->move(m_bar->x(),m_bar->y() + m_bar->height()); ++ isReverse = false; ++ } ++ ++ ++ m_flag = true; ++ //qDebug() << m_activeButton->mapToGlobal(*p); ++ ++ //m_activeButton->getRect(); ++ m_formtip->show(QPoint(m_activeButton->x() + m_activeButton->width()/2,m_activeButton->y()),isReverse); ++ + m_colorPicker->show(toolName); ++ update(); + } + + void CaptureWidget::setDrawRectStyle(const int &s) +@@ -1368,7 +1421,6 @@ void CaptureWidget::setDrawRectStyle(const int &s) + m_context.graphic_style = s; + } + +- + void CaptureWidget::setDrawLineStyle(const int &l) + { + m_context.line_style = l; +diff --git a/src/widgets/capture/capturewidget.h b/src/widgets/capture/capturewidget.h +index 1baa172..2141af7 100755 +--- a/src/widgets/capture/capturewidget.h ++++ b/src/widgets/capture/capturewidget.h +@@ -25,7 +25,7 @@ + + #include "menucontroller.h" + #include "toptips.h" +- ++#include "formtip.h" + #include "zoomIndicator.h" + #include "baseutils.h" + #include "capturewidget.h" +@@ -152,6 +152,7 @@ protected: + bool m_previewEnabled; + bool m_adjustmentButtonPressed; + bool m_inselection = true; ++ bool m_flag = false; + + private: + void initSecondUI(); +@@ -198,6 +199,7 @@ private: + QPixmap m_backgroundPixmap; + + bool m_isFirstReleaseButton; ++ bool isReverse=false; + + MenuController* m_menuController; + +@@ -214,6 +216,9 @@ private: + QLabel *m_toolbar; + + QWidget *toolwidget; ++ QPainterPath path; ++ ++ FormTip *m_formtip; + + // Kwindowmanager *test; + }; +diff --git a/src/widgets/capture/colorpicker.cpp b/src/widgets/capture/colorpicker.cpp +index 845dadc..f50fd58 100755 +--- a/src/widgets/capture/colorpicker.cpp ++++ b/src/widgets/capture/colorpicker.cpp +@@ -25,6 +25,8 @@ + #include "src/tools/colorbutton.h" + #include "src/tools/rectbutton.h" + #include "src/tools/linebutton.h" ++#include "src/widgets/capture/toowidget.h" ++#include "src/widgets/capture/thicknesswidget.h" + + #include + #include +@@ -38,7 +40,7 @@ + #include + + namespace { +- const int TOOLBAR_HEIGHT = 50; ++ const int TOOLBAR_HEIGHT = 30; + const int TOOLBAR_WIDTH = 300; + const int BUTTON_SPACING = 1; + const int COLOR_NUM = 5; +@@ -46,7 +48,7 @@ namespace { + } + + //右键呼出的调色板 +-ColorPicker::ColorPicker(int m_thickness,QColor m_color, QWidget *parent) : QWidget(parent) { ++ColorPicker::ColorPicker(int thickness,QColor m_color, QWidget *parent) : QWidget(parent) { + //this->resize(50,300); + setCursor(Qt::ArrowCursor); + this->setMouseTracking(true); +@@ -59,320 +61,50 @@ ColorPicker::ColorPicker(int m_thickness,QColor m_color, QWidget *parent) : QWid + // save the color values in member variables for faster access + m_uiColor = config.uiMainColorValue(); + m_drawColor = config.drawColorValue(); +- // extraSize represents the extra space needed for the highlight of the +- // selected color. +- /* const int extraSize = 6; +- double radius = (m_colorList.size()*m_colorAreaSize/1.3)/(3.141592); +- resize(radius*2 + m_colorAreaSize + extraSize, +- radius*2 + m_colorAreaSize+ extraSize); +- double degree = 360 / (m_colorList.size()); +- double degreeAcum = degree; +- // this line is the radius of the circle which will be rotated to add +- // the color components. +- QLineF baseLine = QLineF(QPoint(radius+extraSize/2, radius+extraSize/2), +- QPoint(radius*2, radius)); +- +- for (int i = 0; isetMinimumWidth(150); +- /*m_arrowLabel->setMinimumWidth(200); +- m_lineLabel->setMinimumWidth(200);*/ +- m_textLabel->setMinimumWidth(150); +- +- /*m_rectLabel->setMinimumHeight(30); +- m_arrowLabel->setMinimumHeight(30); +- m_lineLabel->setMinimumHeight(30); +- m_textLabel->setMinimumHeight(30);*/ +- +- m_rectLabel->setMouseTracking(true); +- /* m_arrowLabel->setMouseTracking(true); +- m_lineLabel->setMouseTracking(true);*/ +- m_textLabel->setMouseTracking(true); +- m_colorLabel->setMouseTracking(true); +- +- +- /* m_rectLabel->setStyleSheet("QWidget{border-radius:4px;padding:2px 4px;background-color:white;}"); +- m_arrowLabel->setStyleSheet("QWidget{border-radius:4px;padding:2px 4px;background-color:white;}"); +- m_lineLabel->setStyleSheet("QWidget{border-radius:4px;padding:2px 4px;background-color:white;}"); +- m_textLabel->setStyleSheet("QWidget{border-radius:4px;padding:2px 4px;background-color:white;}"); +- m_colorLabel->setStyleSheet("QWidget{border-radius:4px;padding:2px 4px;background-color:white;}");*/ +- +- //initThcikness(m_thickness); +- initRectLabel(m_thickness); +- /* initArrowLabel(m_thickness); +- +- initLineLabel(m_thickness);*/ +- initTextLabel(); +- initColorLabel(m_color); +- +- QLabel* SeparatorLine = new QLabel(); +- SeparatorLine->setFixedSize(1, 20); +- SeparatorLine->setObjectName("VerticalSeparatorLine"); +- +- lastWidget = m_rectLabel; +- m_Layout = new QHBoxLayout(); +- m_Layout->addWidget(m_rectLabel); +- /*m_Layout->addSpacing(8); +- m_Layout->addWidget(SeparatorLine); +- m_Layout->addSpacing(8);*/ +- m_Layout->addWidget(m_colorLabel); +- m_Layout->addStretch(); +- this->setLayout(m_Layout); +- QPalette pal(this->palette()); ++ label = new QLabel(this); ++ label->setFixedSize(222,30); ++ QPalette pal(label->palette()); + pal.setColor(QPalette::Background, Qt::white); +- this->setAutoFillBackground(true); +- +-} +- +-void ColorPicker::initRectLabel(int m_thickness) +-{ +- m_rectLabel->setStyleSheet(getFileContent(":/thicknessbutton.qss")); +- QButtonGroup* rectBtnGroup = new QButtonGroup(); +- rectBtnGroup->setExclusive(true); +- QList btnList; +- //rectangle, oval... +- +- fineLine = new ToolButton(SMALL_SIZE); +- fineLine->setObjectName("FineLine"); +- rectBtnGroup->addButton(fineLine); +- btnList.append(fineLine); +- mediumLine = new ToolButton(MEDIUM_SIZE); +- mediumLine->setObjectName("MediumLine"); +- rectBtnGroup->addButton(mediumLine); +- btnList.append(mediumLine); +- thickLine = new ToolButton(LARGE_SIZE); +- thickLine->setObjectName("ThickLine"); +- //thickLine->setStyleSheet("QPushButton{border-radius:15px;background-color:#000000;}"); +- rectBtnGroup->addButton(thickLine); +- btnList.append(thickLine); +- //separator line... +- QLabel* vSeparatorLine = new QLabel(); +- vSeparatorLine->setFixedSize(1, 20); +- vSeparatorLine->setObjectName("VerticalSeparatorLine"); ++ label->setAutoFillBackground(true); ++ ++ tWidget = new Toowidget(m_drawColor,this); ++ connect(tWidget, &Toowidget::colorSelected, this, &ColorPicker::updateColor); ++ tWidget->setFixedSize(222,30); ++ tWidget->show(); ++ ++ thicknessWidget = new ThicknessWidget(m_thickness,this); ++ connect(thicknessWidget, &ThicknessWidget::thicknessSelected, this, &ColorPicker::updateThickness_tool); ++ connect(this,&ColorPicker::thicknessCh_tool, thicknessWidget, &ThicknessWidget::updateThickness); ++ thicknessWidget->setFixedSize(66,30); ++ //thicknessWidget->setStyleSheet(getFileContent(":/resources/qss/textbutton.qss")); ++ thicknessWidget->hide(); ++ ++ m_textLabel = new QLabel(); ++ m_textLabel->resize(100,30); ++ ++ textButton = new TextButton(m_thickness); ++ textButton->setFixedSize(44,18); ++ textButton->setStyleSheet("QComboBox{border-radius:3px;padding:2px 4px;background-color:#e9e9e9;color: black}"); ++ connect(textButton, &TextButton::updateThickness, ++ this, &ColorPicker::updateThickness_font); ++ //textButton->setStyleSheet(getFileContent(":/textbutton.qss")); + + QHBoxLayout* rectLayout = new QHBoxLayout(); + rectLayout->setMargin(0); +- rectLayout->setSpacing(0); +- rectLayout->addSpacing(1); +- for (int i = 0; i < btnList.length(); i++) { +- //btnList[i]->setFixedSize(30,30); +- btnList[i]->setStyleSheet("border-radius:4px"); +- rectLayout->addWidget(btnList[i]); +- if(m_thickness == btnList[i]->m_thickness) +- btnList[i]->setChecked(true); +- rectLayout->addSpacing(BUTTON_SPACING); +- connect(btnList[i], &ToolButton::updateThickness, +- this, &ColorPicker::updateThickness); +- } +- +- rectLayout->addStretch(); +- m_rectLabel->setLayout(rectLayout); +- //addWidget(m_rectLabel); +- m_rectLabel->show(); +- +-} +- +-/* +-void ColorPicker::initArrowLabel(int m_thickness) +-{ +- //arrow +- QButtonGroup* arrowBtnGroup = new QButtonGroup(); +- arrowBtnGroup->setExclusive(true); +- QList arrowBtnList; +- ToolButton* arrowFineLine = new ToolButton(SMALL_SIZE); +- arrowFineLine->setObjectName("ArrowFine"); +- arrowBtnGroup->addButton(arrowFineLine); +- arrowBtnList.append(arrowFineLine); +- ToolButton* arrowMediumLine = new ToolButton(MEDIUM_SIZE); +- arrowMediumLine->setObjectName("ArrowMedium"); +- arrowBtnGroup->addButton(arrowMediumLine); +- arrowBtnList.append(arrowMediumLine); +- ToolButton* arrowThickLine = new ToolButton(LARGE_SIZE); +- arrowThickLine->setObjectName("ArrowThick"); +- arrowBtnGroup->addButton(arrowThickLine); +- arrowBtnList.append(arrowThickLine); +- //line +- QButtonGroup* lineBtnGroup = new QButtonGroup(); +- lineBtnGroup->setExclusive(true); +- //rectangle, oval... +- ToolButton* fineLine = new ToolButton(5); +- fineLine->setObjectName("ArrowFineLine"); +- lineBtnGroup->addButton(fineLine); +- arrowBtnList.append(fineLine); +- ToolButton* mediumLine = new ToolButton(5); +- mediumLine->setObjectName("ArrowMediumLine"); +- lineBtnGroup->addButton(mediumLine); +- arrowBtnList.append(mediumLine); +- ToolButton* thickLine = new ToolButton(5); +- thickLine->setObjectName("ArrowThickLine"); +- lineBtnGroup->addButton(thickLine); +- arrowBtnList.append(thickLine); +- //separator line... +- QLabel* vSeparatorLine = new QLabel(); +- vSeparatorLine->setFixedSize(1, 20); +- vSeparatorLine->setObjectName("VerticalSeparatorLine"); +- +- QButtonGroup* styleBtnGroup = new QButtonGroup; +- styleBtnGroup->setExclusive(true); +- LineButton* lineBtn = new LineButton(1); +- lineBtn->setObjectName("LineBtn"); +- lineBtn->setChecked(true); +- styleBtnGroup->addButton(lineBtn, 0); +- LineButton* arrowBtn = new LineButton(2); +- arrowBtn->setObjectName("ArrowBtn"); +- //arrowBtn->setChecked(true); +- styleBtnGroup->addButton(arrowBtn, 1); +- connect(lineBtn, &LineButton::updateLine, +- this, &ColorPicker::updateLine); +- connect(arrowBtn, &LineButton::updateLine, +- this, &ColorPicker::updateLine); +- +- QHBoxLayout* arrowLayout = new QHBoxLayout(); +- arrowLayout->setMargin(0); +- arrowLayout->setSpacing(0); +- arrowLayout->addSpacing(1); +- for (int j = 0; j < arrowBtnList.length(); j++) { +- arrowLayout->addWidget(arrowBtnList[j]); +- arrowLayout->addSpacing(BUTTON_SPACING); +- if(m_thickness == arrowBtnList[j]->m_thickness) +- arrowBtnList[j]->setChecked(true); +- arrowLayout->addSpacing(BUTTON_SPACING); +- connect(arrowBtnList[j], &ToolButton::updateThickness, +- this, &ColorPicker::updateThickness); +- } +- arrowLayout->addSpacing(5); +- arrowLayout->addWidget(vSeparatorLine); +- arrowLayout->addSpacing(8); +- arrowLayout->addWidget(lineBtn); +- arrowLayout->addSpacing(BUTTON_SPACING); +- arrowLayout->addWidget(arrowBtn); +- arrowLayout->addStretch(); +- m_arrowLabel->setLayout(arrowLayout); +- +- fineLine->hide(); +- mediumLine->hide(); +- thickLine->hide(); +-} +-*/ +- +-/* +-void ColorPicker::initLineLabel(int m_thickness) +-{ +- //rectangle, oval... +- QButtonGroup* lineBtnGroup = new QButtonGroup(); +- lineBtnGroup->setExclusive(true); +- QList btnList; +- +- ToolButton* fineLine = new ToolButton(SMALL_SIZE); +- fineLine->setObjectName("FineLine"); +- lineBtnGroup->addButton(fineLine); +- btnList.append(fineLine); +- ToolButton* mediumLine = new ToolButton(MEDIUM_SIZE); +- mediumLine->setObjectName("MediumLine"); +- lineBtnGroup->addButton(mediumLine); +- btnList.append(mediumLine); +- ToolButton* thickLine = new ToolButton(LARGE_SIZE); +- thickLine->setObjectName("ThickLine"); +- lineBtnGroup->addButton(thickLine); +- btnList.append(thickLine); +- +- QHBoxLayout* lineLayout = new QHBoxLayout(); +- lineLayout->setMargin(0); +- lineLayout->setSpacing(0); +- lineLayout->addSpacing(1); +- for(int k = 0; k < btnList.length(); k++) { +- lineLayout->addWidget(btnList[k]); +- if(m_thickness == btnList[k]->m_thickness) +- btnList[k]->setChecked(true); +- lineLayout->addSpacing(BUTTON_SPACING); +- connect(btnList[k], &ToolButton::updateThickness, +- this, &ColorPicker::updateThickness); +- } +- +- lineLayout->addStretch(); +- m_lineLabel->setLayout(lineLayout); +-}*/ +- +-void ColorPicker::initTextLabel() +-{ +- m_textLabel->setStyleSheet(getFileContent(":/resources/qss/textbutton.qss")); +- +- textButton = new TextButton(SMALL_SIZE); +- textButton->setFixedSize(60,18); +- textButton->setStyleSheet("QComboBox{border-radius:4px;padding:2px 4px;background-color:#e9e9e9;}"); +- connect(textButton, &TextButton::updateThickness, +- this, &ColorPicker::updateThickness); +- +- //int defaultFontSize = ConfigSettings::instance()->value("text", "fontsize").toInt(); +- +- QHBoxLayout* textLayout = new QHBoxLayout(); +- textLayout->setMargin(0); +- textLayout->setSpacing(0); +- textLayout->addSpacing(2); +- textLayout->addWidget(textButton); +- textLayout->addSpacing(BUTTON_SPACING); +- +- textLayout->addStretch(); +- m_textLabel->setLayout(textLayout); +-} ++ rectLayout->setSpacing(8); ++ rectLayout->addWidget(textButton); ++ //rectLayout->addWidget(m_textLabel); + +-void ColorPicker::initColorLabel(QColor m_color) +-{ +- m_colorLabel->setStyleSheet(getFileContent(":/colorbtn.qss")); +- //m_colorLabel->resize(400,50); +- +- QList colorBtnList; +- QButtonGroup* colorBtnGroup = new QButtonGroup(m_colorLabel); +- colorBtnGroup->setExclusive(true); +- +- for(int i = 0; i < COLOR_NUM; i ++) { +- ColorButton* colorBtn = new ColorButton(colorIndexOf(i)); +- if(colorIndexOf(i) == m_color) +- colorBtn->setChecked(true); +- colorBtn->setObjectName(QString("ColorBtn%1").arg(i+1)); +- colorBtn->setFixedSize(23,23); +- colorBtnList.append(colorBtn); +- colorBtnGroup->addButton(colorBtn); +- } +- +- QHBoxLayout* colorLayout = new QHBoxLayout(); +- colorLayout->setMargin(0); +- colorLayout->setSpacing(5); +- colorLayout->addSpacing(10); +- for(int i = 0; i < colorBtnList.length(); i++) { +- colorLayout->addWidget(colorBtnList[i]); +- colorLayout->addSpacing(10); +- connect(colorBtnList[i], &ColorButton::updatePaintColor, +- this, &ColorPicker::updateColor); +- } +- colorLayout->addSpacing(10); +- colorLayout->addStretch(); +- m_colorLabel->setLayout(colorLayout); +- +- //addWidget(m_colorLabel); +- //m_colorLabel->hide(); ++ rectLayout->addSpacing(8); ++ thicknessWidget->setLayout(rectLayout); + +- //addWidget(m_colorLabel); ++ update(); + } + + void ColorPicker::updateLine(int m_line) +@@ -385,10 +117,19 @@ void ColorPicker::updateStyle(int m_style) + emit styleSelected(m_style); + } + +-void ColorPicker::updateThickness(int thickness) ++void ColorPicker::updateThickness_tool(int thickness) + { +- printf("#######\n"); +- emit thicknessSelected(thickness); ++ m_thickness = thickness; ++ emit thicknessSelected(m_thickness); ++// emit thicknessCh_font(m_thickness); ++ thicknessCh_font(m_thickness); ++} ++ ++void ColorPicker::updateThickness_font(int thickness) ++{ ++ m_thickness = thickness; ++ emit thicknessSelected(m_thickness); ++ emit thicknessCh_tool(m_thickness); + } + + void ColorPicker::updateColor(QColor color) +@@ -404,100 +145,21 @@ QColor ColorPicker::drawColor() { + + void ColorPicker::thicknessChanged(int thickness) + { +- printf("test:%d\n",thickness); +- if(thickness == SMALL_SIZE) +- { +- fineLine->setChecked(true); +- textButton->setCurrentIndex(0); +- } +- else if(thickness == MEDIUM_SIZE) +- { +- mediumLine->setChecked(true); +- textButton->setCurrentIndex(1); +- } +- else if(thickness == LARGE_SIZE) ++ m_thickness = thickness; ++ emit thicknessCh_tool(m_thickness); ++ thicknessCh_font(m_thickness); ++} ++ ++void ColorPicker::show(QString toolName) { ++ if(toolName == "文本") + { +- thickLine->setChecked(true); +- textButton->setCurrentIndex(2); ++ thicknessWidget->hide(); ++ textButton->show(); + } + else + { +- fineLine->setChecked(false); +- mediumLine->setChecked(false); +- thickLine->setChecked(false); +- } +-} +- +-void ColorPicker::show(QString toolName) { +- //grabMouse(); +- int toolNum = 99; +- +- if(toolName == "铅笔" || toolName == "直线" || toolName == "标记") +- //toolNum = 1; +- toolNum = 3; +- else if(toolName == "箭头") +- //toolNum = 3; +- toolNum = 2; +- else if(toolName == "矩形选择" || toolName == "实心矩形" || toolName == "圆环") +- toolNum = 3; +- else if(toolName == "文本") +- toolNum = 4; +- +- if(!m_rectLabel->isHidden()) +- lastWidget = m_rectLabel; +- /*else if(!m_lineLabel->isHidden()) +- lastWidget = m_lineLabel; +- else if(!m_arrowLabel->isHidden()) +- lastWidget = m_arrowLabel;*/ +- else if(!m_textLabel->isHidden()) +- lastWidget = m_textLabel; +- +- switch(toolNum) { +- /* case 1: +- if(lastWidget != m_lineLabel) +- m_Layout->replaceWidget(lastWidget,m_lineLabel); +- m_textLabel->hide(); +- m_rectLabel->hide(); +- m_arrowLabel->hide(); +- m_lineLabel->show(); +- m_colorLabel->show(); +- break;*/ +- /*case 2: +- if(lastWidget != m_arrowLabel) +- m_Layout->replaceWidget(lastWidget,m_arrowLabel); +- m_textLabel->hide(); +- m_rectLabel->hide(); +- m_arrowLabel->show(); +- m_lineLabel->hide(); +- m_colorLabel->show(); +- break;*/ +- case 1: +- case 2: +- case 3: +- if(lastWidget != m_rectLabel) +- m_Layout->replaceWidget(lastWidget,m_rectLabel); +- m_textLabel->hide(); +- m_rectLabel->show(); +- /*m_arrowLabel->hide(); +- m_lineLabel->hide();*/ +- m_colorLabel->show(); +- break; +- case 4: +- if(lastWidget != m_textLabel) +- m_Layout->replaceWidget(lastWidget,m_textLabel); +- m_textLabel->show(); +- m_rectLabel->hide(); +- /* m_arrowLabel->hide(); +- m_lineLabel->hide();*/ +- m_colorLabel->show(); +- break; +- default: +- m_textLabel->hide(); +- m_rectLabel->hide(); +- /*m_arrowLabel->hide(); +- m_lineLabel->hide();*/ +- m_colorLabel->hide(); +- break; ++ thicknessWidget->show(); ++ textButton->hide(); + } + QWidget::show(); + } +@@ -506,49 +168,18 @@ void ColorPicker::hide() { + QWidget::hide(); + } + +-void ColorPicker::paintEvent(QPaintEvent *) { +- /*QPainter painter(this); +- painter.setRenderHint(QPainter::Antialiasing); +- +- QVector rects = handleMask(); +- painter.setPen(QColor(Qt::black)); +- for (int i = 0; i < rects.size(); ++i) { +- // draw the highlight when we have to draw the selected color +- if (m_drawColor == QColor(m_colorList.at(i))) { +- QColor c = QColor(m_uiColor); +- c.setAlpha(155); +- painter.setBrush(c); +- c.setAlpha(100); +- painter.setPen(c); +- QRect highlight = rects.at(i); +- highlight.moveTo(highlight.x() - 3, highlight.y() - 3); +- highlight.setHeight(highlight.height() + 6); +- highlight.setWidth(highlight.width() + 6); +- //painter.drawRect(highlight); +- //painter.drawRoundRect(highlight, 100, 100); +- painter.setPen(QColor(Qt::white)); +- } +- painter.setBrush(QColor(m_colorList.at(i))); +- //painter.drawRoundRect(rects.at(i), 100, 100); +- painter.drawRect(rects.at(i)); +- }*/ +-} +- +-void ColorPicker::mouseMoveEvent(QMouseEvent *e) { +- /*for (int i = 0; i < m_colorList.size(); ++i) { +- if (m_colorAreaList.at(i).contains(e->pos())) { +- m_drawColor = m_colorList.at(i); +- emit colorSelected(m_drawColor); +- update(); +- break; +- } +- }*/ +-} +- +-/*QVector ColorPicker::handleMask() const { +- QVector areas; +- for (const QRect &rect: m_colorAreaList) { +- areas.append(rect); ++void ColorPicker::thicknessCh_font(int thickness) ++{ ++ if(m_thickness == SMALL_SIZE) ++ { ++ textButton->setCurrentIndex(0); ++ } ++ else if(m_thickness == MEDIUM_SIZE) ++ { ++ textButton->setCurrentIndex(1); + } +- return areas; +-}*/ ++ else if(m_thickness == LARGE_SIZE) ++ { ++ textButton->setCurrentIndex(2); ++ } ++} +diff --git a/src/widgets/capture/colorpicker.h b/src/widgets/capture/colorpicker.h +index 797a302..dfdcb62 100755 +--- a/src/widgets/capture/colorpicker.h ++++ b/src/widgets/capture/colorpicker.h +@@ -24,11 +24,13 @@ + #include "src/tools/rectbutton.h" + #include "src/tools/toolbutton.h" + #include "textbutton.h" ++#include "toowidget.h" ++#include "thicknesswidget.h" + + class ColorPicker : public QWidget { + Q_OBJECT + public: +- explicit ColorPicker(int m_thickness, QColor m_color, QWidget *parent = nullptr); ++ explicit ColorPicker(int thickness, QColor m_color, QWidget *parent = nullptr); + + QColor drawColor(); + +@@ -43,7 +45,8 @@ public: + + public slots: + void updateColor(QColor color); +- void updateThickness(int thickness); ++ void updateThickness_tool(int thickness); ++ void updateThickness_font(int thickness); + void updateStyle(int m_style); + void updateLine(int m_line); + void thicknessChanged(int thickness); +@@ -53,12 +56,11 @@ signals: + void thicknessSelected(int thickness); + void styleSelected(int m_style); + void lineSelected(int m_line); ++ void thicknessCh_tool(int thickness); + +-protected: +- void paintEvent(QPaintEvent *); +- void mouseMoveEvent(QMouseEvent *); + +- //QVector handleMask() const; ++protected: ++ void thicknessCh_font(int thickness); + + private: + int m_colorAreaSize; +@@ -66,15 +68,16 @@ private: + QVector m_colorList; + + QColor m_uiColor, m_drawColor; ++ int m_thickness; + + QWidget* m_rectLabel; + QWidget* m_colorLabel; + QWidget* m_thicknessLabel; + + //QLabel* m_rectLabel; +- QWidget* m_arrowLabel; +- QWidget* m_lineLabel; +- QWidget* m_textLabel; ++// QWidget* m_arrowLabel; ++// QWidget* m_lineLabel; ++ //QWidget* m_textLabel; + //QLabel* m_colorLabel; + QWidget* m_saveLabel; + +@@ -88,4 +91,10 @@ private: + ToolButton* mediumLine; + ToolButton* thickLine; + TextButton* textButton; ++ ++ QLabel *label; ++ QLabel *m_textLabel; ++ ++ Toowidget *tWidget; ++ ThicknessWidget *thicknessWidget; + }; +diff --git a/src/widgets/capture/fontwidget.h b/src/widgets/capture/fontwidget.h +new file mode 100644 +index 0000000..b51c087 +--- /dev/null ++++ b/src/widgets/capture/fontwidget.h +@@ -0,0 +1,38 @@ ++#ifndef FONTWIDGET_H ++#define FONTWIDGET_H ++ ++#include "textbutton.h" ++#include ++ ++class FontWidget : public QWidget ++{ ++ Q_OBJECT ++public: ++ explicit FontWidget(int thickness, QWidget *parent = nullptr); ++ ++public slots: ++ void updateThickness(int size); ++ void thicknessChanged(int size); ++ ++signals: ++ void thicknessSelected(int size); ++ ++protected: ++ void initTextLabel(); ++ ++private: ++ int m_colorAreaSize; ++ ++ QVector m_thinknessAreaList; ++ QVector m_thinknessList; ++ ++ int m_thinkness, m_drawThinkness, m_selectThinkness; ++ ++ bool m_inselection = false; ++ ++ QWidget* m_textLabel; ++ ++ TextButton *textButton; ++}; ++ ++#endif // FONTWIDGET_H +diff --git a/src/widgets/capture/formtip.cpp b/src/widgets/capture/formtip.cpp +new file mode 100644 +index 0000000..f3de166 +--- /dev/null ++++ b/src/widgets/capture/formtip.cpp +@@ -0,0 +1,47 @@ ++#include "formtip.h" ++ ++#include ++#include ++ ++FormTip::FormTip(QWidget *parent) : QWidget(parent) ++{ ++ setCursor(Qt::ArrowCursor); ++ this->setMouseTracking(true); ++ this->resize(535,20); ++} ++ ++void FormTip::paintEvent(QPaintEvent *) { ++ QPainter painter(this); ++ painter.setRenderHint(QPainter::Antialiasing); ++ ++ QPainterPath path; ++ if(m_isReverse) ++ { ++ path.moveTo(QPoint(point.x(), point.y() + 6)); ++ path.lineTo(QPoint(point.x() -6, point.y())); ++ path.lineTo(QPoint(point.x() + 6, point.y())); ++ path.lineTo(QPoint(point.x() , point.y() + 6)); ++ } ++ else ++ { ++ path.moveTo(QPoint(point.x(), point.y() + 3)); ++ path.lineTo(QPoint(point.x() -6, point.y() + 9)); ++ path.lineTo(QPoint(point.x() + 6, point.y() + 9)); ++ path.lineTo(QPoint(point.x() , point.y() + 3)); ++ } ++ painter.fillPath(path,QBrush(Qt::white)); ++} ++ ++void FormTip::show(const QPoint p,bool isReverse) ++{ ++ point = p; ++ m_isReverse = isReverse; ++ update(); ++ ++ QWidget::show(); ++} ++ ++void FormTip::hide() ++{ ++ QWidget::hide(); ++} +diff --git a/src/widgets/capture/formtip.h b/src/widgets/capture/formtip.h +new file mode 100644 +index 0000000..393b1aa +--- /dev/null ++++ b/src/widgets/capture/formtip.h +@@ -0,0 +1,23 @@ ++#ifndef FORMTIP_H ++#define FORMTIP_H ++ ++#include ++ ++class FormTip : public QWidget ++{ ++ Q_OBJECT ++public: ++ explicit FormTip(QWidget *parent = nullptr); ++ ++ void show(const QPoint p, bool isReverse); ++ void hide(); ++ ++protected: ++ void paintEvent(QPaintEvent *); ++ ++private: ++ QPoint point; ++ bool m_isReverse = false; ++}; ++ ++#endif // FORMTIP_H +diff --git a/src/widgets/capture/thicknesswidget.cpp b/src/widgets/capture/thicknesswidget.cpp +new file mode 100644 +index 0000000..b6b693d +--- /dev/null ++++ b/src/widgets/capture/thicknesswidget.cpp +@@ -0,0 +1,120 @@ ++#include "thicknesswidget.h" ++#include "src/utils/confighandler.h" ++#include "src/utils/globalvalues.h" ++#include "baseutils.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ThicknessWidget::ThicknessWidget(int thickness,QWidget *parent) : QWidget(parent) ++{ ++ setCursor(Qt::ArrowCursor); ++ this->setMouseTracking(true); ++ ++ ConfigHandler config; ++ m_thinknessList = {SMALL_SIZE,MEDIUM_SIZE,LARGE_SIZE}; ++ //m_colorAreaSize = GlobalValues::buttonBaseSize() * 0.6; ++ m_thinknessAreaList = handleMask(); ++ m_selectThinkness = thickness; ++ m_drawThinkness = thickness; ++ ++ update(); ++} ++ ++void ThicknessWidget::paintEvent(QPaintEvent *) { ++ if(m_ishide) ++ return; ++ QPainter painter(this); ++ painter.setRenderHint(QPainter::Antialiasing); ++ ++ //QVector rects = handleMask(); ++ painter.setPen(Qt::NoPen); ++ for (int i = 0; i < m_thinknessAreaList.size(); ++i) { ++ ++ if (m_drawThinkness == int(m_thinknessList.at(i))) { ++ painter.setBrush(QColor(56,168,255)); ++ painter.drawEllipse(m_thinknessAreaList.at(i)); ++ } ++ else ++ { ++ painter.setBrush(Qt::gray); ++ //painter.drawRoundRect(rects.at(i), 100, 100); ++ painter.drawEllipse(m_thinknessAreaList.at(i)); ++ //draw the highlight when we have to draw the selected color ++ } ++ ++ if(m_selectThinkness == int(m_thinknessList.at(i)) && m_selectThinkness != m_drawThinkness) ++ { ++ painter.setBrush(Qt::blue); ++ painter.drawEllipse(m_thinknessAreaList.at(i)); ++ } ++ } ++} ++ ++void ThicknessWidget::mousePressEvent(QMouseEvent *e) { ++ if(m_ishide) ++ return; ++ if (e->button() == Qt::LeftButton) ++ { ++ for (int i = 0; i < m_thinknessList.size(); ++i) { ++ if (m_thinknessAreaList.at(i).contains(e->pos())) { ++ m_drawThinkness = m_thinknessList.at(i); ++ emit thicknessSelected(m_drawThinkness); ++ update(); ++ break; ++ } ++ } ++ } ++} ++ ++void ThicknessWidget::mouseMoveEvent(QMouseEvent *e) { ++ if(m_ishide) ++ return; ++ for (int i = 0; i < m_thinknessList.size(); ++i) { ++ if (m_thinknessAreaList.at(i).contains(e->pos())) { ++ m_selectThinkness = m_thinknessList.at(i); ++ //emit colorSelected(m_drawColor); ++ update(); ++ break; ++ } ++ m_selectThinkness = 0; ++ update(); ++ } ++} ++ ++QVector ThicknessWidget::handleMask() const { ++ QVector areas; ++ int spacing = 0; ++ for (int i = 0; i < m_thinknessList.size(); ++i) { ++ spacing += i*4; ++ QRect *rect = new QRect(8 + i * 10 + spacing , 13 - i * 2 , (i+1)*4, (i+1)*4); ++ areas.append(*rect); ++ } ++ return areas; ++} ++ ++void ThicknessWidget::updateThickness(int size) ++{ ++ m_drawThinkness = size; ++ update(); ++} ++ ++void ThicknessWidget::hide() ++{ ++ m_ishide = true; ++ update(); ++} ++ ++void ThicknessWidget::show() ++{ ++ m_ishide = false; ++ update(); ++} +diff --git a/src/widgets/capture/thicknesswidget.h b/src/widgets/capture/thicknesswidget.h +new file mode 100644 +index 0000000..b6b3400 +--- /dev/null ++++ b/src/widgets/capture/thicknesswidget.h +@@ -0,0 +1,46 @@ ++#ifndef THICKNESSWIDGET_H ++#define THICKNESSWIDGET_H ++ ++#pragma once ++ ++#include ++#include ++#include ++#include ++ ++class ThicknessWidget : public QWidget ++{ ++ Q_OBJECT ++public: ++ explicit ThicknessWidget(int thickness, QWidget *parent = nullptr); ++ ++public slots: ++ void updateThickness(int size); ++ void hide(); ++ void show(); ++ ++signals: ++ void thicknessSelected(int size); ++ ++protected: ++ void paintEvent(QPaintEvent *); ++ void mousePressEvent(QMouseEvent *); ++ void mouseMoveEvent(QMouseEvent *); ++ ++ QVector handleMask() const; ++ ++private: ++ int m_colorAreaSize; ++ ++ QVector m_thinknessAreaList; ++ QVector m_thinknessList; ++ ++ int m_thinkness, m_drawThinkness, m_selectThinkness; ++ ++ bool m_inselection = false; ++ bool m_ishide = false; ++}; ++ ++#endif // THICKNESSWIDGET_H ++ ++ +diff --git a/src/widgets/capture/toowidget.cpp b/src/widgets/capture/toowidget.cpp +new file mode 100644 +index 0000000..ace1950 +--- /dev/null ++++ b/src/widgets/capture/toowidget.cpp +@@ -0,0 +1,139 @@ ++#include "toowidget.h" ++#include "src/utils/confighandler.h" ++#include "src/utils/globalvalues.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++Toowidget::Toowidget(QColor m_color,QWidget *parent) : QWidget(parent) ++{ ++ setCursor(Qt::ArrowCursor); ++ this->setMouseTracking(true); ++ ++ ConfigHandler config; ++ m_colorList = config.getUserColors(); ++ m_colorAreaSize = GlobalValues::buttonBaseSize() * 0.6; ++ m_colorAreaList = handleMask(); ++ m_selectColor = m_color; ++ m_drawColor = m_color; ++ ++ update(); ++} ++ ++void Toowidget::paintEvent(QPaintEvent *) { ++ QPainter painter(this); ++ painter.setRenderHint(QPainter::Antialiasing); ++ ++ //QVector rects = handleMask(); ++ painter.setPen(Qt::NoPen); ++ ++ painter.setBrush(m_drawColor); ++ painter.drawRect(m_colorAreaList.at(0).x() - 30, m_colorAreaList.at(0).y() - 4, 20, 20); ++ if(m_drawColor == Qt::white) ++ { ++ QPen pen = QPen(); ++ pen.setColor(Qt::black); ++ pen.setWidthF(0.3); ++ painter.setPen(pen); ++ painter.drawRect(m_colorAreaList.at(0).x() - 30, m_colorAreaList.at(0).y() -4, 20, 20); ++ painter.setPen(Qt::NoPen); ++ } ++ ++ for (int i = 0; i < m_colorAreaList.size(); ++i) { ++ painter.setBrush(QColor(m_colorList.at(i))); ++ //painter.drawRoundRect(rects.at(i), 100, 100); ++ painter.drawRect(m_colorAreaList.at(i)); ++ if(QColor(m_colorList.at(i)) == Qt::white) ++ { ++ QPen pen = QPen(); ++ pen.setColor(Qt::black); ++ pen.setWidthF(0.3); ++ painter.setPen(pen); ++ painter.drawRect(m_colorAreaList.at(i)); ++ painter.setPen(Qt::NoPen); ++ ++ } ++ //draw the highlight when we have to draw the selected color ++ if (m_drawColor == QColor(m_colorList.at(i))) { ++ if(m_drawColor == Qt::white) ++ { ++ QPen pen = QPen(); ++ pen.setColor(Qt::black); ++ pen.setWidthF(0.5); ++ painter.setPen(pen); ++ painter.drawRect(m_colorAreaList.at(i).x() + 3, m_colorAreaList.at(i).y() + 3, 6, 6); ++ painter.setPen(Qt::NoPen); ++ } ++ else{ ++ painter.setBrush(Qt::white); ++ painter.drawRect(m_colorAreaList.at(i).x() + 3, m_colorAreaList.at(i).y() + 3, 6, 6); ++ } ++ } ++ if(m_selectColor == QColor(m_colorList.at(i)) && m_selectColor != m_drawColor) ++ { ++ if(m_selectColor == Qt::white) ++ { ++ QPen pen = QPen(); ++ pen.setColor(Qt::black); ++ pen.setWidthF(0.5); ++ painter.setPen(pen); ++ painter.drawRect(m_colorAreaList.at(i).x() + 3, m_colorAreaList.at(i).y() + 3, 6, 6); ++ painter.setPen(Qt::NoPen); ++ } ++ else{ ++ painter.setBrush(Qt::white); ++ painter.drawRect(m_colorAreaList.at(i).x() + 3, m_colorAreaList.at(i).y() + 3, 6, 6); ++ } ++ } ++ } ++} ++ ++void Toowidget::mousePressEvent(QMouseEvent *e) { ++ if (e->button() == Qt::LeftButton) ++ { ++ for (int i = 0; i < m_colorList.size(); ++i) { ++ if (m_colorAreaList.at(i).contains(e->pos())) { ++ m_drawColor = m_colorList.at(i); ++ emit colorSelected(m_drawColor); ++ update(); ++ break; ++ } ++ } ++ } ++} ++ ++void Toowidget::mouseMoveEvent(QMouseEvent *e) { ++ for (int i = 0; i < m_colorList.size(); ++i) { ++ if (m_colorAreaList.at(i).contains(e->pos())) { ++ m_selectColor = m_colorList.at(i); ++ //emit colorSelected(m_drawColor); ++ update(); ++ break; ++ } ++ m_selectColor = Qt::gray; ++ update(); ++ } ++} ++ ++QVector Toowidget::handleMask() const { ++ QVector areas; ++ for (int i = 0; i < m_colorList.size(); ++i) { ++ QRect *rect = new QRect(102 + i * 22, 9, 12, 12); ++ areas.append(*rect); ++ } ++ return areas; ++} ++ ++void Toowidget::updateColor(QColor c) ++{ ++ m_drawColor = c; ++ update(); ++} +diff --git a/src/widgets/capture/toowidget.h b/src/widgets/capture/toowidget.h +new file mode 100644 +index 0000000..694ef96 +--- /dev/null ++++ b/src/widgets/capture/toowidget.h +@@ -0,0 +1,55 @@ ++// Copyright(c) 2017-2019 Alejandro Sirgo Rica & Contributors ++// ++// This file is part of Flameshot. ++// ++// Flameshot is free software: you can redistribute it and/or modify ++// it under the terms of the GNU General Public License as published by ++// the Free Software Foundation, either version 3 of the License, or ++// (at your option) any later version. ++// ++// Flameshot is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++// ++// You should have received a copy of the GNU General Public License ++// along with Flameshot. If not, see . ++ ++#pragma once ++ ++#include ++#include ++#include ++ ++class Toowidget : public QWidget ++{ ++ Q_OBJECT ++public: ++ explicit Toowidget(QColor m_color, QWidget *parent = nullptr); ++ ++public slots: ++ void updateColor(QColor c); ++ ++signals: ++ void colorSelected(QColor c); ++ ++protected: ++ void paintEvent(QPaintEvent *); ++ void mousePressEvent(QMouseEvent *); ++ void mouseMoveEvent(QMouseEvent *); ++ ++ QVector handleMask() const; ++ ++private: ++ int m_colorAreaSize; ++ ++ QVector m_colorAreaList; ++ QVector m_colorList; ++ ++ QColor m_uiColor, m_drawColor, m_selectColor; ++ ++ bool m_inselection = false; ++ ++}; ++ ++ +diff --git a/src/widgets/infowindow.cpp b/src/widgets/infowindow.cpp +index 1e99968..c78a96b 100755 +--- a/src/widgets/infowindow.cpp ++++ b/src/widgets/infowindow.cpp +@@ -133,7 +133,7 @@ void InfoWindow::initLabels() { + QLabel *versionTitleLabel = new QLabel(tr("Version"), this); + versionTitleLabel->setAlignment(Qt::AlignHCenter); + m_layout->addWidget(versionTitleLabel); +- QString versionMsg = "Flameshot " + QStringLiteral(APP_VERSION) + "\nCompiled with Qt " ++ QString versionMsg = "Kiran-Flameshot " + QStringLiteral(APP_VERSION) + "\nCompiled with Qt " + + QT_VERSION_STR; + QLabel *versionLabel = new QLabel(versionMsg, this); + versionLabel->setAlignment(Qt::AlignHCenter); +diff --git a/textbutton.h b/textbutton.h +index 03bbb23..1dd3a48 100755 +--- a/textbutton.h ++++ b/textbutton.h +@@ -35,7 +35,14 @@ public: + addItem(tr("small")); + addItem(tr("medium")); + addItem(tr("large")); +- this->setCurrentIndex(1); ++ ++ if(m_thickness = SMALL_SIZE) ++ this->setCurrentIndex(0); ++ else if(m_thickness = MEDIUM_SIZE) ++ this->setCurrentIndex(1); ++ else if(m_thickness = LARGE_SIZE) ++ this->setCurrentIndex(2); ++ + + setFixedSize(24, 26); + +@@ -62,8 +69,8 @@ public slots: + m_thickness = MEDIUM_SIZE; + else if(this->currentIndex() == 2) + m_thickness = LARGE_SIZE; +- printf("index:%d\n",this->currentIndex()); +- printf("dididi:%d\n",m_thickness); ++// printf("index:%d\n",this->currentIndex()); ++// printf("dididi:%d\n",m_thickness); + emit updateThickness(m_thickness); + } + +diff --git a/textbutton.qss b/textbutton.qss +index 5870df9..86f4bfa 100755 +--- a/textbutton.qss ++++ b/textbutton.qss +@@ -1,33 +1,120 @@ +-QPushButton#TextButton { +- background-color: transparent; +- color: #303030; +- outline: none; +- border: none; +-} +- +-QPushButton#TextButton:hover { +- background-color: rgba(0, 0, 0, 0.05); +- outline: none; +- color: #000000; +- font-size: 12px; +- font-weight: light; +- border: 1px solid transparent; +- border-radius: 4px; +-} +-QPushButton#TextButton:checked:hover { +- background-color: rgba(0, 0, 0, 0.05); +- outline: none; +- color: #2ca7f8; +- font-size: 12px; +- font-weight: light; +- border: 1px solid transparent; +- border-radius: 4px; +-} +- +-QPushButton#TextButton:checked { +- background-color: transparent; +- outline: none; +- color: #2ca7f8; +- font-size: 12px; +- font-weight: light; ++/* 未下拉时,QComboBox的样式 */ ++QComboBox { ++ border: 1px solid gray; /* 边框 */ ++ border-radius: 3px; /* 圆角 */ ++ padding: 1px 18px 1px 3px; /* 字体填衬 */ ++ color: #000; ++ font: normal normal 15px "Microsoft YaHei"; ++ background: transparent; + } ++ ++/* 下拉后,整个下拉窗体样式 */ ++QComboBox QAbstractItemView { ++ outline: 0px solid gray; /* 选定项的虚框 */ ++ border: 1px solid yellow; /* 整个下拉窗体的边框 */ ++ color: green; ++ background-color: red; /* 整个下拉窗体的背景色 */ ++ selection-background-color: lightgreen; /* 整个下拉窗体被选中项的背景色 */ ++} ++ ++/* 下拉后,整个下拉窗体每项的样式 */ ++QComboBox QAbstractItemView::item { ++ height: 50px; /* 项的高度(设置pComboBox->setView(new QListView());后,该项才起作用) */ ++} ++ ++/* 下拉后,整个下拉窗体越过每项的样式 */ ++QComboBox QAbstractItemView::item:hover { ++ color: #FFFFFF; ++ background-color: lightgreen; /* 整个下拉窗体越过每项的背景色 */ ++} ++ ++/* 下拉后,整个下拉窗体被选择的每项的样式 */ ++QComboBox QAbstractItemView::item:selected { ++ color: #FFFFFF; ++ background-color: lightgreen; ++} ++ ++/* QComboBox中的垂直滚动条 */ ++QComboBox QAbstractScrollArea QScrollBar:vertical { ++ width: 10px; ++ background-color: #d0d2d4; /* 空白区域的背景色 灰色green */ ++} ++ ++QComboBox QAbstractScrollArea QScrollBar::handle:vertical { ++ border-radius: 5px; /* 圆角 */ ++ background: rgb(160,160,160); /* 小方块的背景色深灰lightblue */ ++} ++ ++QComboBox QAbstractScrollArea QScrollBar::handle:vertical:hover { ++ background: rgb(90, 91, 93); /* 越过小方块的背景色yellow */ ++} ++ ++/* 设置为可编辑(setEditable(true))editable时,编辑区域的样式 */ ++QComboBox:editable { ++ background: green; ++} ++ ++/* 设置为非编辑(setEditable(false))!editable时,整个QComboBox的样式 */ ++QComboBox:!editable { ++ background: blue; ++} ++ ++/* 设置为可编辑editable时,点击整个QComboBox的样式 */ ++QComboBox:editable:on { ++ background: green; ++} ++ ++/* 设置为非编辑!editable时,点击整个QComboBox的样式 */ ++QComboBox:!editable:on { ++ background: blue; ++} ++ ++/* 设置为可编辑editable时,下拉框的样式 */ ++QComboBox::drop-down:editable { ++ background: lightblue; ++} ++ ++/* 设置为可编辑editable时,点击下拉框的样式 */ ++QComboBox::drop-down:editable:on { ++ background: lightgreen; ++} ++ ++/* 设置为非编辑!editable时,下拉框的样式 */ ++QComboBox::drop-down:!editable { ++ background: lightblue; ++} ++ ++/* 设置为非编辑!editable时,点击下拉框的样式 */ ++QComboBox::drop-down:!editable:on { ++ background: lightgreen; ++} ++ ++/* 点击QComboBox */ ++QComboBox:on { ++} ++ ++/* 下拉框样式 */ ++QComboBox::drop-down { ++ subcontrol-origin: padding; /* 子控件在父元素中的原点矩形。如果未指定此属性,则默认为padding。 */ ++ subcontrol-position: top right; /* 下拉框的位置(右上) */ ++ width: 15px; /* 下拉框的宽度 */ ++ ++ border-left-width: 1px; /* 下拉框的左边界线宽度 */ ++ border-left-color: darkgray; /* 下拉框的左边界线颜色 */ ++ border-left-style: solid; /* 下拉框的左边界线为实线 */ ++ border-top-right-radius: 3px; /* 下拉框的右上边界线的圆角半径(应和整个QComboBox右上边界线的圆角半径一致) */ ++ border-bottom-right-radius: 3px; /* 同上 */ ++} ++ /* 越过下拉框样式 */ ++ ++ QComboBox::drop-down:hover { ++ ++   background: yellow; ++ ++ } ++/* 下拉箭头样式 */ QComboBox::down-arrow { width: 15px; /* 下拉箭头的宽度(建议与下拉框drop-down的宽度一致) */ background: transparent; /* 下拉箭头的的背景色 */ padding: 0px 0px 0px 0px; /* 上内边距、右内边距、下内边距、左内边距 */ image: url(:/images/combobox_arrow_down.png); } /* 点击下拉箭头 */ QComboBox::down-arrow:on { image: url(:/images/combobox_arrow_up.png); /* 显示下拉箭头 */ } ++注意: ++ ++QComboBox* pComboBox = new QComboBox(this); ++ ++pComboBox->setView(new QListView()); //下拉列表项高才能生效 +diff --git a/zoomIndicator.cpp b/zoomIndicator.cpp +index a4a5cb2..434d35b 100755 +--- a/zoomIndicator.cpp ++++ b/zoomIndicator.cpp +@@ -34,10 +34,10 @@ + #include + + namespace { +-const QSize BACKGROUND_SIZE = QSize(120, 120); ++const QSize BACKGROUND_SIZE = QSize(99, 99); + const int SCALE_VALUE = 4; +-const int IMG_WIDTH = 55; +-const int INDICATOR_WIDTH = 110; ++const int IMG_WIDTH = 46; ++const int INDICATOR_WIDTH = 89; + const int CENTER_RECT_WIDTH = 12; + const int BOTTOM_RECT_HEIGHT = 14; + } +-- +2.27.0 + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 2e9def0..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# kiran-flameshot - -#### Description -Powerful and simple to use screenshot software with built-in editor with advanced features. - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index aa5bdc9..0000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# kiran-flameshot - -#### 介绍 -Powerful and simple to use screenshot software with built-in editor with advanced features. - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/kiran-flameshot-0.6.0.tar.gz b/kiran-flameshot-0.6.0.tar.gz new file mode 100644 index 0000000..4fca11e Binary files /dev/null and b/kiran-flameshot-0.6.0.tar.gz differ diff --git a/kiran-flameshot.spec b/kiran-flameshot.spec new file mode 100644 index 0000000..372c180 --- /dev/null +++ b/kiran-flameshot.spec @@ -0,0 +1,81 @@ +Name: kiran-flameshot +Version: 0.6.0 +Release: 4%{?dist}.kb9 + +# Main code: GPLv3 +# Logo: Free Art License v1.3 +# Button icons: Apache License 2.0 +# capture/capturewidget.cpp and capture/capturewidget.h: GPLv2 +# regiongrabber.cpp: LGPL +# Qt-Color-Widgets: LGPL/GPL +# More information: https://github.com/lupoDharkael/flameshot#license +License: GPLv3+ and ASL 2.0 and GPLv2 and LGPLv3 and Free Art +Summary: Powerful and simple to use screenshot software + +URL: https://github.com/lupoDharkael/flameshot +Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz + +#Kylin +Patch01: 0001-Optimize-toolbar-add-toolbar-function-optimize-line--9c2875ef.patch +#endkylin + +BuildRequires: pkgconfig(Qt5Widgets) +BuildRequires: pkgconfig(Qt5Network) +BuildRequires: pkgconfig(Qt5Multimedia) +BuildRequires: pkgconfig(Qt5Concurrent) +BuildRequires: pkgconfig(Qt5DBus) +BuildRequires: qt5-qtsvg-devel + +BuildRequires: desktop-file-utils +BuildRequires: libappstream-glib +BuildRequires: qt5-linguist +BuildRequires: gcc-c++ +BuildRequires: gcc + +Requires: hicolor-icon-theme +Requires: qt5-qtsvg%{?_isa} + +#Requires: marco >= 1.22.2-1.ky3.kb5 +#Requires: fcitx-qt5 + +%description +Powerful and simple to use screenshot software with built-in +editor with advanced features. + + +%prep +%autosetup -p1 +mkdir %{_target_platform} + +%build +pushd %{_target_platform} + %qmake_qt5 PREFIX=%{_prefix} CONFIG+=packaging .. +popd + +%make_build -C %{_target_platform} + +%install +%make_install INSTALL_ROOT=%{buildroot} -C %{_target_platform} +%find_lang Internationalization --with-qt + +%check +appstream-util validate-relax --nonet "%{buildroot}%{_datadir}/metainfo/%{name}.appdata.xml" +desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop + +%files -f Internationalization.lang +%doc README.md +%license LICENSE img/app/flameshotLogoLicense.txt +%dir %{_datadir}/%{name} +%dir %{_datadir}/%{name}/translations +%{_bindir}/%{name} +%{_datadir}/applications/*.desktop +%{_datadir}/metainfo/%{name}.appdata.xml +%{_datadir}/bash-completion/completions/%{name} +%{_datadir}/dbus-1/interfaces/*.xml +%{_datadir}/dbus-1/services/*.service +%{_datadir}/icons/hicolor/*/apps/*.* + +%changelog +* Fri Dec 11 2020 pengyulong - 0.6.0-4 +* Inition for kiran-flameshot +