This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create widget for search settings
- Loading branch information
Showing
10 changed files
with
368 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#include "searchsettingsform.h" | ||
#include "ui_searchsettingsform.h" | ||
#include "src/widget/style.h" | ||
|
||
SearchSettingsForm::SearchSettingsForm(QWidget *parent) : | ||
QWidget(parent), | ||
ui(new Ui::SearchSettingsForm) | ||
{ | ||
ui->setupUi(this); | ||
|
||
ui->choiceDateButton->setEnabled(false); | ||
ui->startDateLabel->setEnabled(false); | ||
|
||
ui->choiceDateButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); | ||
ui->choiceDateButton->setObjectName("choiceDateButton"); | ||
ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css"))); | ||
|
||
ui->startDateLabel->setStyleSheet("QLabel{color: #ddd;}"); | ||
|
||
connect(ui->startSearchComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), | ||
this, &SearchSettingsForm::onStartSearchSelected); | ||
connect(ui->registerCheckBox, &QCheckBox::clicked, this, &SearchSettingsForm::onRegisterClicked); | ||
connect(ui->wordsOnlyCheckBox, &QCheckBox::clicked, this, &SearchSettingsForm::onWordsOnlyClicked); | ||
connect(ui->regularCheckBox, &QCheckBox::clicked, this, &SearchSettingsForm::onRegularClicked); | ||
} | ||
|
||
SearchSettingsForm::~SearchSettingsForm() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void SearchSettingsForm::onStartSearchSelected(const int index) | ||
{ | ||
if (index > 1) { | ||
ui->choiceDateButton->setEnabled(true); | ||
ui->startDateLabel->setEnabled(true); | ||
|
||
ui->choiceDateButton->setProperty("state", "green"); | ||
ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css"))); | ||
|
||
ui->startDateLabel->setStyleSheet("QLabel{color: #000;}"); | ||
} else { | ||
ui->choiceDateButton->setEnabled(false); | ||
ui->startDateLabel->setEnabled(false); | ||
|
||
ui->choiceDateButton->setProperty("state", ""); | ||
ui->choiceDateButton->setStyleSheet(Style::getStylesheet(QStringLiteral(":/ui/chatForm/buttons.css"))); | ||
|
||
ui->startDateLabel->setStyleSheet("QLabel{color: #ddd;}"); | ||
} | ||
} | ||
|
||
void SearchSettingsForm::onRegisterClicked(const bool checked) | ||
{ | ||
if (checked) { | ||
ui->regularCheckBox->setChecked(false); | ||
} | ||
} | ||
|
||
void SearchSettingsForm::onWordsOnlyClicked(const bool checked) | ||
{ | ||
if (checked) { | ||
ui->regularCheckBox->setChecked(false); | ||
} | ||
} | ||
|
||
void SearchSettingsForm::onRegularClicked(const bool checked) | ||
{ | ||
if (checked) { | ||
ui->registerCheckBox->setChecked(false); | ||
ui->wordsOnlyCheckBox->setChecked(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef SEARCHSETTINGSFORM_H | ||
#define SEARCHSETTINGSFORM_H | ||
|
||
#include <QWidget> | ||
|
||
namespace Ui { | ||
class SearchSettingsForm; | ||
} | ||
|
||
class SearchSettingsForm : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit SearchSettingsForm(QWidget *parent = nullptr); | ||
~SearchSettingsForm(); | ||
|
||
private: | ||
Ui::SearchSettingsForm *ui; | ||
|
||
private slots: | ||
void onStartSearchSelected(const int index); | ||
void onRegisterClicked(const bool checked); | ||
void onWordsOnlyClicked(const bool checked); | ||
void onRegularClicked(const bool checked); | ||
}; | ||
|
||
#endif // SEARCHSETTINGSFORM_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>SearchSettingsForm</class> | ||
<widget class="QWidget" name="SearchSettingsForm"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>473</width> | ||
<height>78</height> | ||
</rect> | ||
</property> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item row="0" column="0"> | ||
<widget class="Line" name="line_2"> | ||
<property name="frameShadow"> | ||
<enum>QFrame::Plain</enum> | ||
</property> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="0"> | ||
<layout class="QHBoxLayout" name="horizontalLayout_2"> | ||
<item> | ||
<widget class="QLabel" name="label"> | ||
<property name="text"> | ||
<string>Start searching:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QComboBox" name="startSearchComboBox"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> | ||
<horstretch>1</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<item> | ||
<property name="text"> | ||
<string>with the end</string> | ||
</property> | ||
</item> | ||
<item> | ||
<property name="text"> | ||
<string>with the first</string> | ||
</property> | ||
</item> | ||
<item> | ||
<property name="text"> | ||
<string>after date</string> | ||
</property> | ||
</item> | ||
<item> | ||
<property name="text"> | ||
<string>before date</string> | ||
</property> | ||
</item> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="startDateLabel"> | ||
<property name="text"> | ||
<string>00.00.0000</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="choiceDateButton"> | ||
<property name="text"> | ||
<string>Choice</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item row="2" column="0"> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<widget class="QCheckBox" name="registerCheckBox"> | ||
<property name="text"> | ||
<string>Case sensitive</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QCheckBox" name="wordsOnlyCheckBox"> | ||
<property name="text"> | ||
<string>Whole words only</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QCheckBox" name="regularCheckBox"> | ||
<property name="text"> | ||
<string>Use regular expressions</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<spacer name="horizontalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
</layout> | ||
</item> | ||
<item row="3" column="0"> | ||
<widget class="Line" name="line"> | ||
<property name="frameShadow"> | ||
<enum>QFrame::Plain</enum> | ||
</property> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.