Add search button in Reader framework

This commit is contained in:
Nicolas Mailloux 2021-07-06 20:06:40 -04:00
parent b0b5f9cdaa
commit a961d95290
3 changed files with 73 additions and 24 deletions

View file

@ -50,6 +50,7 @@ reader::reader(QWidget *parent) :
ui->previousDefinitionBtn->setProperty("type", "borderless"); ui->previousDefinitionBtn->setProperty("type", "borderless");
ui->nextDefinitionBtn->setProperty("type", "borderless"); ui->nextDefinitionBtn->setProperty("type", "borderless");
ui->nightModeBtn->setProperty("type", "borderless"); ui->nightModeBtn->setProperty("type", "borderless");
ui->searchBtn->setProperty("type", "borderless");
ui->gotoBtn->setProperty("type", "borderless"); ui->gotoBtn->setProperty("type", "borderless");
// Icons // Icons
@ -77,6 +78,8 @@ reader::reader(QWidget *parent) :
ui->homeBtn->setIcon(QIcon(":/resources/home.png")); ui->homeBtn->setIcon(QIcon(":/resources/home.png"));
ui->aboutBtn->setText(""); ui->aboutBtn->setText("");
ui->aboutBtn->setIcon(QIcon(":/resources/info.png")); ui->aboutBtn->setIcon(QIcon(":/resources/info.png"));
ui->searchBtn->setText("");
ui->searchBtn->setIcon(QIcon(":/resources/search.png"));
// Style misc. // Style misc.
ui->bookInfoLabel->setStyleSheet("font-style: italic"); ui->bookInfoLabel->setStyleSheet("font-style: italic");
@ -1575,3 +1578,29 @@ void reader::gotoPage(int pageNumber) {
setupPageWidget(); setupPageWidget();
refreshScreen(); refreshScreen();
} }
void reader::on_searchBtn_clicked()
{
global::forbidOpenSearchDialog = false;
setupSearchDialog();
}
void reader::setupSearchDialog() {
if(global::forbidOpenSearchDialog == false) {
global::keyboard::keyboardDialog = true;
global::keyboard::searchDialog = true;
global::keyboard::keyboardText = "";
generalDialogWindow = new generalDialog();
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
connect(generalDialogWindow, SIGNAL(refreshScreen()), SLOT(searchRefreshScreen()));
connect(generalDialogWindow, SIGNAL(destroyed(QObject*)), SLOT(setupSearchDialog()));
generalDialogWindow->show();
}
else {
;
}
}
void reader::searchRefreshScreen() {
this->repaint();
}

View file

@ -124,6 +124,9 @@ private slots:
void on_nightModeBtn_clicked(); void on_nightModeBtn_clicked();
void on_gotoBtn_clicked(); void on_gotoBtn_clicked();
void gotoPage(int pageNumber); void gotoPage(int pageNumber);
void on_searchBtn_clicked();
void searchRefreshScreen();
void setupSearchDialog();
private: private:
Ui::reader *ui; Ui::reader *ui;

View file

@ -558,10 +558,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="11">
<widget class="QPushButton" name="homeBtn"> <widget class="QLabel" name="batteryIconLabel">
<property name="text"> <property name="text">
<string> Home </string> <string>Battery Icon</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -572,7 +572,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="7"> <item row="0" column="8">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -585,7 +585,41 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="9"> <item row="0" column="3">
<widget class="Line" name="line_7">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="aboutBtn">
<property name="text">
<string> About </string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="homeBtn">
<property name="text">
<string> Home </string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QPushButton" name="searchBtn">
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QLabel" name="batteryLabel"> <widget class="QLabel" name="batteryLabel">
<property name="font"> <property name="font">
<font> <font>
@ -598,28 +632,11 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="10"> <item row="0" column="5">
<widget class="QLabel" name="batteryIconLabel"> <widget class="Line" name="line_17">
<property name="text">
<string>Battery Icon</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="aboutBtn">
<property name="text">
<string> About </string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="Line" name="line_7">
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Plain</enum> <enum>QFrame::Plain</enum>
</property> </property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>