|
|
|
@ -20,13 +20,16 @@
@@ -20,13 +20,16 @@
|
|
|
|
|
#include "searchform.h" |
|
|
|
|
#include "form/searchsettingsform.h" |
|
|
|
|
#include "src/widget/style.h" |
|
|
|
|
|
|
|
|
|
#include <QVBoxLayout> |
|
|
|
|
#include <QHBoxLayout> |
|
|
|
|
#include <QPushButton> |
|
|
|
|
#include <QLabel> |
|
|
|
|
#include <QKeyEvent> |
|
|
|
|
|
|
|
|
|
const QString STATE_NAME[] = { |
|
|
|
|
#include <array> |
|
|
|
|
|
|
|
|
|
static std::array<QString, 3> STATE_NAME = { |
|
|
|
|
QString{}, |
|
|
|
|
QStringLiteral("green"), |
|
|
|
|
QStringLiteral("red"), |
|
|
|
@ -151,7 +154,7 @@ ParameterSearch SearchForm::getAndCheckParametrSearch()
@@ -151,7 +154,7 @@ ParameterSearch SearchForm::getAndCheckParametrSearch()
|
|
|
|
|
|
|
|
|
|
void SearchForm::setStateName(QPushButton *btn, ToolButtonState state) |
|
|
|
|
{ |
|
|
|
|
const int index = static_cast<int>(state); |
|
|
|
|
const auto index = static_cast<unsigned long>(state); |
|
|
|
|
btn->setProperty("state", STATE_NAME[index]); |
|
|
|
|
btn->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css"))); |
|
|
|
|
btn->setEnabled(index != 0); |
|
|
|
@ -162,6 +165,7 @@ void SearchForm::useBeginState()
@@ -162,6 +165,7 @@ void SearchForm::useBeginState()
|
|
|
|
|
setStateName(upButton, ToolButtonState::Common); |
|
|
|
|
setStateName(downButton, ToolButtonState::Common); |
|
|
|
|
messageLabel->setVisible(false); |
|
|
|
|
isPrevSearch = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SearchForm::changedSearchPhrase(const QString& text) |
|
|
|
@ -192,8 +196,13 @@ void SearchForm::changedSearchPhrase(const QString& text)
@@ -192,8 +196,13 @@ void SearchForm::changedSearchPhrase(const QString& text)
|
|
|
|
|
|
|
|
|
|
void SearchForm::clickedUp() |
|
|
|
|
{ |
|
|
|
|
setStateName(downButton, ToolButtonState::Common); |
|
|
|
|
messageLabel->setVisible(false); |
|
|
|
|
if (downButton->isEnabled()) { |
|
|
|
|
isPrevSearch = false; |
|
|
|
|
} else { |
|
|
|
|
isPrevSearch = true; |
|
|
|
|
setStateName(downButton, ToolButtonState::Common); |
|
|
|
|
messageLabel->setVisible(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (startButton->isHidden()) { |
|
|
|
|
isSearchInBegin = false; |
|
|
|
@ -205,8 +214,13 @@ void SearchForm::clickedUp()
@@ -205,8 +214,13 @@ void SearchForm::clickedUp()
|
|
|
|
|
|
|
|
|
|
void SearchForm::clickedDown() |
|
|
|
|
{ |
|
|
|
|
setStateName(upButton, ToolButtonState::Common); |
|
|
|
|
messageLabel->setVisible(false); |
|
|
|
|
if (upButton->isEnabled()) { |
|
|
|
|
isPrevSearch = false; |
|
|
|
|
} else { |
|
|
|
|
isPrevSearch = true; |
|
|
|
|
setStateName(upButton, ToolButtonState::Common); |
|
|
|
|
messageLabel->setVisible(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (startButton->isHidden()) { |
|
|
|
|
isSearchInBegin = false; |
|
|
|
@ -243,7 +257,7 @@ void SearchForm::clickedSearch()
@@ -243,7 +257,7 @@ void SearchForm::clickedSearch()
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SearchForm::changedState(const bool isUpdate) |
|
|
|
|
void SearchForm::changedState(bool isUpdate) |
|
|
|
|
{ |
|
|
|
|
if (isUpdate) { |
|
|
|
|
startButton->setHidden(false); |
|
|
|
@ -258,12 +272,21 @@ void SearchForm::changedState(const bool isUpdate)
@@ -258,12 +272,21 @@ void SearchForm::changedState(const bool isUpdate)
|
|
|
|
|
useBeginState(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SearchForm::showMessageNotFound(const bool searchUp) |
|
|
|
|
void SearchForm::showMessageNotFound(SearchDirection direction) |
|
|
|
|
{ |
|
|
|
|
if (isSearchInBegin) { |
|
|
|
|
if (parameter.period == PeriodSearch::AfterDate) { |
|
|
|
|
setStateName(downButton, ToolButtonState::Disabled); |
|
|
|
|
} else if (parameter.period == PeriodSearch::BeforeDate) { |
|
|
|
|
setStateName(upButton, ToolButtonState::Disabled); |
|
|
|
|
} else { |
|
|
|
|
setStateName(upButton, ToolButtonState::Disabled); |
|
|
|
|
setStateName(downButton, ToolButtonState::Disabled); |
|
|
|
|
} |
|
|
|
|
} else if (isPrevSearch) { |
|
|
|
|
setStateName(upButton, ToolButtonState::Disabled); |
|
|
|
|
setStateName(downButton, ToolButtonState::Disabled); |
|
|
|
|
} else if (searchUp) { |
|
|
|
|
} else if (direction == SearchDirection::Up) { |
|
|
|
|
setStateName(upButton, ToolButtonState::Disabled); |
|
|
|
|
} else { |
|
|
|
|
setStateName(downButton, ToolButtonState::Disabled); |
|
|
|
|