-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a search book function in the library
- Loading branch information
Showing
8 changed files
with
93 additions
and
21 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,14 +1,33 @@ | ||
#include "contentmanagerview.h" | ||
#include <QFile> | ||
#include "kiwixapp.h" | ||
#include <QLineEdit> | ||
#include "ui_contentmanagerview.h" | ||
|
||
ContentManagerView::ContentManagerView(QWidget *parent) | ||
: QTreeView(parent) | ||
: QWidget(parent), mp_ui(new Ui::contentmanagerview) | ||
{ | ||
setSortingEnabled(true); | ||
mp_ui->setupUi(this); | ||
mp_ui->m_view->setSortingEnabled(true); | ||
QFile file(QString::fromUtf8(":/css/_contentManager.css")); | ||
file.open(QFile::ReadOnly); | ||
QString styleSheet = QString(file.readAll()); | ||
setStyleSheet(styleSheet); | ||
setContextMenuPolicy(Qt::CustomContextMenu); | ||
mp_ui->m_view->setStyleSheet(styleSheet); | ||
mp_ui->m_view->setContextMenuPolicy(Qt::CustomContextMenu); | ||
|
||
auto searcher = mp_ui->searcher; | ||
searcher->setPlaceholderText(gt("search-files")); | ||
searcher->setStyleSheet(styleSheet); | ||
|
||
QIcon searchIcon = QIcon(":/icons/search.svg"); | ||
searcher->addAction(searchIcon, QLineEdit::LeadingPosition); | ||
|
||
connect(searcher, &QLineEdit::textChanged, [searcher](){ | ||
KiwixApp::instance()->getContentManager()->setSearch(searcher->text()); | ||
}); | ||
} | ||
|
||
ContentManagerView::~ContentManagerView() | ||
{ | ||
|
||
} |
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 |
---|---|---|
@@ -1,16 +1,25 @@ | ||
#ifndef CONTENTMANAGERVIEW_H | ||
#define CONTENTMANAGERVIEW_H | ||
|
||
#include <QWebEngineView> | ||
#include <QTreeView> | ||
#include <QWidget> | ||
#include "ui_contentmanagerview.h" | ||
|
||
class ContentManagerView : public QTreeView | ||
namespace Ui { | ||
class contentmanagerview; | ||
} | ||
|
||
class ContentManagerView : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
ContentManagerView(QWidget *parent = Q_NULLPTR); | ||
explicit ContentManagerView(QWidget *parent = nullptr); | ||
~ContentManagerView(); | ||
QTreeView* getView() { return mp_ui->m_view; } | ||
QLineEdit* &getSearcher() { return mp_ui->searcher; } | ||
|
||
private: | ||
QTreeView m_view; | ||
Ui::contentmanagerview *mp_ui; | ||
}; | ||
|
||
#endif // CONTENTMANAGERVIEW_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,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>contentmanagerview</class> | ||
<widget class="QWidget" name="contentmanagerview"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QLineEdit" name="searcher"/> | ||
</item> | ||
<item> | ||
<widget class="QTreeView" name="m_view"/> | ||
</item> | ||
</layout> | ||
</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