diff --git a/src/config/buttonlistview.cpp b/src/config/buttonlistview.cpp index 025892e1..398c395b 100644 --- a/src/config/buttonlistview.cpp +++ b/src/config/buttonlistview.cpp @@ -61,7 +61,12 @@ void ButtonListView::updateActiveButtons(QListWidgetItem *item) { CaptureButton::ButtonType bType = m_buttonTypeByName[item->text()]; if (item->checkState() == Qt::Checked) { m_listButtons.append(bType); - std::sort(m_listButtons.begin(), m_listButtons.end()); + // TODO refactor so we don't need external sorts + using bt = CaptureButton::ButtonType; + std::sort(m_listButtons.begin(), m_listButtons.end(), [](bt a, bt b){ + return CaptureButton::getPriorityByButton(a) < + CaptureButton::getPriorityByButton(b); + }); } else { m_listButtons.remove(m_listButtons.indexOf(bType)); } diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index 32a099a3..d42a1a66 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -37,8 +37,31 @@ QVector ConfigHandler::getButtons() { } buttons = fromIntToButton(buttonsInt); } else { - buttons = CaptureButton::getIterableButtonTypes(); + // Default tools + buttons << CaptureButton::TYPE_PENCIL + << CaptureButton::TYPE_DRAWER + << CaptureButton::TYPE_ARROW + << CaptureButton::TYPE_SELECTION + << CaptureButton::TYPE_RECTANGLE + << CaptureButton::TYPE_CIRCLE + << CaptureButton::TYPE_MARKER + << CaptureButton::TYPE_BLUR + << CaptureButton::TYPE_SELECTIONINDICATOR + << CaptureButton::TYPE_MOVESELECTION + << CaptureButton::TYPE_UNDO + << CaptureButton::TYPE_REDO + << CaptureButton::TYPE_COPY + << CaptureButton::TYPE_SAVE + << CaptureButton::TYPE_EXIT + << CaptureButton::TYPE_IMAGEUPLOADER + << CaptureButton::TYPE_OPEN_APP; } + + using bt = CaptureButton::ButtonType; + std::sort(buttons.begin(), buttons.end(), [](bt a, bt b){ + return CaptureButton::getPriorityByButton(a) < + CaptureButton::getPriorityByButton(b); + }); return buttons; } @@ -268,10 +291,6 @@ bool ConfigHandler::normalizeButtons(QVector &buttons) { hasChanged = true; } } - std::sort(buttons.begin(), buttons.end(), [](int a, int b){ - return CaptureButton::getPriorityByButton((CaptureButton::ButtonType)a) < - CaptureButton::getPriorityByButton((CaptureButton::ButtonType)b); - }); return hasChanged; }