mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
first working version of the new search engine. TODO: add search modifiers
This commit is contained in:
parent
bf87eacaf8
commit
2dca61c4e3
@ -118,7 +118,8 @@ HEADERS += comic_flow.h \
|
|||||||
../common/exit_check.h \
|
../common/exit_check.h \
|
||||||
comics_view.h \
|
comics_view.h \
|
||||||
classic_comics_view.h \
|
classic_comics_view.h \
|
||||||
empty_folder_widget.h
|
empty_folder_widget.h \
|
||||||
|
no_search_results_widget.h
|
||||||
|
|
||||||
|
|
||||||
SOURCES += comic_flow.cpp \
|
SOURCES += comic_flow.cpp \
|
||||||
@ -165,7 +166,8 @@ SOURCES += comic_flow.cpp \
|
|||||||
../common/exit_check.cpp \
|
../common/exit_check.cpp \
|
||||||
comics_view.cpp \
|
comics_view.cpp \
|
||||||
classic_comics_view.cpp \
|
classic_comics_view.cpp \
|
||||||
empty_folder_widget.cpp
|
empty_folder_widget.cpp \
|
||||||
|
no_search_results_widget.cpp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
|
|
||||||
ClassicComicsView::ClassicComicsView(QWidget *parent)
|
ClassicComicsView::ClassicComicsView(QWidget *parent)
|
||||||
:ComicsView(parent)
|
:ComicsView(parent),searching(false)
|
||||||
{
|
{
|
||||||
QHBoxLayout * layout = new QHBoxLayout;
|
QHBoxLayout * layout = new QHBoxLayout;
|
||||||
|
|
||||||
@ -74,7 +74,9 @@ ClassicComicsView::ClassicComicsView(QWidget *parent)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(settings->contains(COMICS_VIEW_FLOW_SPLITTER_STATUS))
|
if(settings->contains(COMICS_VIEW_FLOW_SPLITTER_STATUS))
|
||||||
sVertical->restoreState(settings->value(COMICS_VIEW_FLOW_SPLITTER_STATUS).toByteArray());
|
sVertical->restoreState(settings->value(COMICS_VIEW_FLOW_SPLITTER_STATUS).toByteArray());
|
||||||
|
|
||||||
|
setupSearchingIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassicComicsView::setToolBar(QToolBar *toolBar)
|
void ClassicComicsView::setToolBar(QToolBar *toolBar)
|
||||||
@ -192,6 +194,29 @@ void ClassicComicsView::setViewActions(const QList<QAction *> &actions)
|
|||||||
comicFlow->addActions(actions);
|
comicFlow->addActions(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClassicComicsView::enableFilterMode(bool enabled)
|
||||||
|
{
|
||||||
|
if(enabled)
|
||||||
|
{
|
||||||
|
comicFlow->clear();
|
||||||
|
comicFlow->setMinimumHeight(150);
|
||||||
|
if(previousSplitterStatus.isEmpty())
|
||||||
|
previousSplitterStatus = sVertical->saveState();
|
||||||
|
sVertical->setSizes(QList<int> () << 150 << 10000000);
|
||||||
|
showSearchingIcon();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
searchingIcon->setHidden(true);
|
||||||
|
comicFlow->setMinimumHeight(0);
|
||||||
|
|
||||||
|
sVertical->restoreState(previousSplitterStatus);
|
||||||
|
previousSplitterStatus.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//sVertical->setCollapsible(0,!enabled);
|
||||||
|
searching = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void ClassicComicsView::selectAll()
|
void ClassicComicsView::selectAll()
|
||||||
{
|
{
|
||||||
tableView->selectAll();
|
tableView->selectAll();
|
||||||
@ -222,7 +247,8 @@ void ClassicComicsView::saveTableHeadersStatus()
|
|||||||
|
|
||||||
void ClassicComicsView::saveSplitterStatus()
|
void ClassicComicsView::saveSplitterStatus()
|
||||||
{
|
{
|
||||||
settings->setValue(COMICS_VIEW_FLOW_SPLITTER_STATUS, sVertical->saveState());
|
if(!searching)
|
||||||
|
settings->setValue(COMICS_VIEW_FLOW_SPLITTER_STATUS, sVertical->saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassicComicsView::applyModelChanges(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
|
void ClassicComicsView::applyModelChanges(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
|
||||||
@ -250,3 +276,28 @@ void ClassicComicsView::closeEvent(QCloseEvent *event)
|
|||||||
ComicsView::closeEvent(event);
|
ComicsView::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClassicComicsView::setupSearchingIcon()
|
||||||
|
{
|
||||||
|
searchingIcon = new QWidget(comicFlow);
|
||||||
|
|
||||||
|
QPixmap p(":/images/searching_icon.png");
|
||||||
|
QLabel * l = new QLabel(searchingIcon);
|
||||||
|
l->setPixmap(p);
|
||||||
|
|
||||||
|
searchingIcon->setFixedSize(p.size());
|
||||||
|
|
||||||
|
hideSearchingIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClassicComicsView::showSearchingIcon()
|
||||||
|
{
|
||||||
|
searchingIcon->move((comicFlow->width()-searchingIcon->width())/2,(comicFlow->height()-searchingIcon->height())/2);
|
||||||
|
|
||||||
|
searchingIcon->setHidden(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClassicComicsView::hideSearchingIcon()
|
||||||
|
{
|
||||||
|
searchingIcon->setHidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
void setItemActions(const QList<QAction *> & actions);
|
void setItemActions(const QList<QAction *> & actions);
|
||||||
void setViewActions(const QList<QAction *> & actions);
|
void setViewActions(const QList<QAction *> & actions);
|
||||||
|
void enableFilterMode(bool enabled);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void centerComicFlow(const QModelIndex & mi);
|
void centerComicFlow(const QModelIndex & mi);
|
||||||
@ -47,6 +48,13 @@ private:
|
|||||||
ComicFlowWidget * comicFlow;
|
ComicFlowWidget * comicFlow;
|
||||||
QSettings * settings;
|
QSettings * settings;
|
||||||
void closeEvent ( QCloseEvent * event );
|
void closeEvent ( QCloseEvent * event );
|
||||||
|
|
||||||
|
QByteArray previousSplitterStatus;
|
||||||
|
QWidget * searchingIcon;
|
||||||
|
bool searching;
|
||||||
|
void setupSearchingIcon();
|
||||||
|
void showSearchingIcon();
|
||||||
|
void hideSearchingIcon();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLASSIC_COMICS_VIEW_H
|
#endif // CLASSIC_COMICS_VIEW_H
|
||||||
|
@ -7,5 +7,5 @@ ComicsView::ComicsView(QWidget *parent) :
|
|||||||
|
|
||||||
void ComicsView::setModel(TableModel *m)
|
void ComicsView::setModel(TableModel *m)
|
||||||
{
|
{
|
||||||
model = m;
|
model = m;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ public:
|
|||||||
virtual void setItemActions(const QList<QAction *> & actions) = 0;
|
virtual void setItemActions(const QList<QAction *> & actions) = 0;
|
||||||
//actions for visual-oriented views
|
//actions for visual-oriented views
|
||||||
virtual void setViewActions(const QList<QAction *> & actions) = 0;
|
virtual void setViewActions(const QList<QAction *> & actions) = 0;
|
||||||
|
virtual void enableFilterMode(bool enabled) = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selected(unsigned int);
|
void selected(unsigned int);
|
||||||
|
@ -346,8 +346,7 @@ void TableModel::setupModelData(const QString &filter, const QString &databasePa
|
|||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
if(_data.length()==0)
|
emit searchNumResults(_data.length());
|
||||||
emit isEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TableModel::getComicPath(QModelIndex mi)
|
QString TableModel::getComicPath(QModelIndex mi)
|
||||||
|
@ -116,6 +116,7 @@ signals:
|
|||||||
void beforeReset();
|
void beforeReset();
|
||||||
void reset();
|
void reset();
|
||||||
void isEmpty();
|
void isEmpty();
|
||||||
|
void searchNumResults(int);
|
||||||
};
|
};
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
|
@ -168,6 +168,11 @@ void GridComicsView::setViewActions(const QList<QAction *> &actions)
|
|||||||
QLOG_ERROR() << "setViewActions invoked with the wrong number of actions";
|
QLOG_ERROR() << "setViewActions invoked with the wrong number of actions";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridComicsView::enableFilterMode(bool enabled)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void GridComicsView::selectAll()
|
void GridComicsView::selectAll()
|
||||||
{
|
{
|
||||||
QLOG_INFO() << "selectAll";
|
QLOG_INFO() << "selectAll";
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
void setItemActions(const QList<QAction *> & actions);
|
void setItemActions(const QList<QAction *> & actions);
|
||||||
void setViewActions(const QList<QAction *> & actions);
|
void setViewActions(const QList<QAction *> & actions);
|
||||||
|
void enableFilterMode(bool enabled);
|
||||||
|
|
||||||
QSize sizeHint();
|
QSize sizeHint();
|
||||||
signals:
|
signals:
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
<file>../images/shortcuts_group_page.png</file>
|
<file>../images/shortcuts_group_page.png</file>
|
||||||
<file>../images/shortcuts_group_reading.png</file>
|
<file>../images/shortcuts_group_reading.png</file>
|
||||||
<file>../images/shortcuts_group_visualization.png</file>
|
<file>../images/shortcuts_group_visualization.png</file>
|
||||||
|
<file>../images/searching_icon.png</file>
|
||||||
<!--<file>../images/busy_background.png</file>-->
|
<!--<file>../images/busy_background.png</file>-->
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
<file alias="images/flow_to_grid.gif">../images/flow_to_grid.gif</file>
|
<file alias="images/flow_to_grid.gif">../images/flow_to_grid.gif</file>
|
||||||
<file alias="images/grid_to_flow.gif">../images/grid_to_flow.gif</file>
|
<file alias="images/grid_to_flow.gif">../images/grid_to_flow.gif</file>
|
||||||
<file alias="images/empty_folder.png">../images/empty_folder.png</file>
|
<file alias="images/empty_folder.png">../images/empty_folder.png</file>
|
||||||
|
<file alias="images/empty_search.png">../images/empty_search.png</file>
|
||||||
<file>../images/iconSearch.png</files>
|
<file>../images/iconSearch.png</files>
|
||||||
<file>../images/clearSearch.png</file>
|
<file>../images/clearSearch.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
<file>../images/flow_to_grid.gif</file>
|
<file>../images/flow_to_grid.gif</file>
|
||||||
<file>../images/grid_to_flow.gif</file>
|
<file>../images/grid_to_flow.gif</file>
|
||||||
<file>../images/empty_folder.png</file>
|
<file>../images/empty_folder.png</file>
|
||||||
|
<file>../images/empty_search.png</file>
|
||||||
<file alias="images/iconSearch.png">../images/iconSearchNew.png</file>
|
<file alias="images/iconSearch.png">../images/iconSearchNew.png</file>
|
||||||
<file alias="images/clearSearch.png">../images/clearSearchNew.png</file>
|
<file alias="images/clearSearch.png">../images/clearSearchNew.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
@ -68,6 +68,8 @@
|
|||||||
#include "edit_shortcuts_dialog.h"
|
#include "edit_shortcuts_dialog.h"
|
||||||
#include "shortcuts_manager.h"
|
#include "shortcuts_manager.h"
|
||||||
|
|
||||||
|
#include "no_search_results_widget.h"
|
||||||
|
|
||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -175,7 +177,7 @@ void LibraryWindow::doLayout()
|
|||||||
|
|
||||||
//FOLDERS FILTER-------------------------------------------------------------
|
//FOLDERS FILTER-------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
foldersFilter = new YACReaderSearchLineEdit();
|
searchEdit = new YACReaderSearchLineEdit();
|
||||||
|
|
||||||
//SIDEBAR--------------------------------------------------------------------
|
//SIDEBAR--------------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -214,6 +216,7 @@ void LibraryWindow::doLayout()
|
|||||||
comicsView->setToolBar(editInfoToolBar);
|
comicsView->setToolBar(editInfoToolBar);
|
||||||
comicsViewStack->addWidget(comicsViewTransition = new ComicsViewTransition());
|
comicsViewStack->addWidget(comicsViewTransition = new ComicsViewTransition());
|
||||||
comicsViewStack->addWidget(emptyFolderWidget = new EmptyFolderWidget());
|
comicsViewStack->addWidget(emptyFolderWidget = new EmptyFolderWidget());
|
||||||
|
comicsViewStack->addWidget(noSearchResultsWidget = new NoSearchResultsWidget());
|
||||||
comicsViewStack->addWidget(comicsView);
|
comicsViewStack->addWidget(comicsView);
|
||||||
|
|
||||||
comicsViewStack->setCurrentWidget(comicsView);
|
comicsViewStack->setCurrentWidget(comicsView);
|
||||||
@ -767,7 +770,7 @@ void LibraryWindow::createToolBars()
|
|||||||
libraryToolBar->helpButton->setDefaultAction(helpAboutAction);
|
libraryToolBar->helpButton->setDefaultAction(helpAboutAction);
|
||||||
libraryToolBar->toggleComicsViewButton->setDefaultAction(toggleComicsViewAction);
|
libraryToolBar->toggleComicsViewButton->setDefaultAction(toggleComicsViewAction);
|
||||||
libraryToolBar->fullscreenButton->setDefaultAction(toggleFullScreenAction);
|
libraryToolBar->fullscreenButton->setDefaultAction(toggleFullScreenAction);
|
||||||
libraryToolBar->setSearchWidget(foldersFilter);
|
libraryToolBar->setSearchWidget(searchEdit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
editInfoToolBar->setIconSize(QSize(18,18));
|
editInfoToolBar->setIconSize(QSize(18,18));
|
||||||
@ -1000,7 +1003,7 @@ void LibraryWindow::createConnections()
|
|||||||
|
|
||||||
//Folders filter
|
//Folders filter
|
||||||
//connect(clearFoldersFilter,SIGNAL(clicked()),foldersFilter,SLOT(clear()));
|
//connect(clearFoldersFilter,SIGNAL(clicked()),foldersFilter,SLOT(clear()));
|
||||||
connect(foldersFilter,SIGNAL(textChanged(QString)),this,SLOT(setSearchFilter(QString)));
|
connect(searchEdit,SIGNAL(textChanged(QString)),this,SLOT(setSearchFilter(QString)));
|
||||||
//connect(includeComicsCheckBox,SIGNAL(stateChanged(int)),this,SLOT(searchInFiles(int)));
|
//connect(includeComicsCheckBox,SIGNAL(stateChanged(int)),this,SLOT(searchInFiles(int)));
|
||||||
|
|
||||||
//ContextMenus
|
//ContextMenus
|
||||||
@ -1029,6 +1032,7 @@ void LibraryWindow::createConnections()
|
|||||||
connect(comicsViewTransition,SIGNAL(transitionFinished()),this,SLOT(showComicsView()));
|
connect(comicsViewTransition,SIGNAL(transitionFinished()),this,SLOT(showComicsView()));
|
||||||
|
|
||||||
connect(comicsModel,SIGNAL(isEmpty()),this,SLOT(showEmptyFolderView()));
|
connect(comicsModel,SIGNAL(isEmpty()),this,SLOT(showEmptyFolderView()));
|
||||||
|
connect(comicsModel,SIGNAL(searchNumResults(int)),this,SLOT(checkSearchNumResults(int)));
|
||||||
connect(emptyFolderWidget,SIGNAL(subfolderSelected(QModelIndex,int)),this,SLOT(selectSubfolder(QModelIndex,int)));
|
connect(emptyFolderWidget,SIGNAL(subfolderSelected(QModelIndex,int)),this,SLOT(selectSubfolder(QModelIndex,int)));
|
||||||
|
|
||||||
connect(showEditShortcutsAction,SIGNAL(triggered()),editShortcutsDialog,SLOT(show()));
|
connect(showEditShortcutsAction,SIGNAL(triggered()),editShortcutsDialog,SLOT(show()));
|
||||||
@ -1107,7 +1111,7 @@ void LibraryWindow::loadLibrary(const QString & name)
|
|||||||
//TODO encontrar el bug que provoca que no se carguen adecuadamente las carátulas en root.
|
//TODO encontrar el bug que provoca que no se carguen adecuadamente las carátulas en root.
|
||||||
setRootIndex();
|
setRootIndex();
|
||||||
|
|
||||||
foldersFilter->clear();
|
searchEdit->clear();
|
||||||
}
|
}
|
||||||
else if(comparation > 0)
|
else if(comparation > 0)
|
||||||
{
|
{
|
||||||
@ -1197,14 +1201,14 @@ void LibraryWindow::loadCovers(const QModelIndex & mi)
|
|||||||
|
|
||||||
|
|
||||||
//cambiado de orden, ya que al llamar a foldersFilter->clear() se invalidan los model index
|
//cambiado de orden, ya que al llamar a foldersFilter->clear() se invalidan los model index
|
||||||
if(foldersFilter->text()!="")
|
if(searchEdit->text()!="")
|
||||||
{
|
{
|
||||||
//setFoldersFilter("");
|
//setFoldersFilter("");
|
||||||
if(mi.isValid())
|
if(mi.isValid())
|
||||||
{
|
{
|
||||||
index = static_cast<TreeItem *>(mi.internalPointer())->originalItem;
|
index = static_cast<TreeItem *>(mi.internalPointer())->originalItem;
|
||||||
column = mi.column();
|
column = mi.column();
|
||||||
foldersFilter->clear();
|
searchEdit->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1229,6 +1233,16 @@ void LibraryWindow::loadCovers(const QModelIndex & mi)
|
|||||||
emptyFolderWidget->setSubfolders(mi,foldersModel->getSubfoldersNames(mi));
|
emptyFolderWidget->setSubfolders(mi,foldersModel->getSubfoldersNames(mi));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::loadCoversFromCurrentModel()
|
||||||
|
{
|
||||||
|
comicsView->setModel(comicsModel);
|
||||||
|
QStringList paths = comicsModel->getPaths(currentPath());
|
||||||
|
|
||||||
|
if(paths.size()>0) {
|
||||||
|
comicsView->setCurrentIndex(comicsModel->index(0,0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LibraryWindow::selectSubfolder(const QModelIndex &mi, int child)
|
void LibraryWindow::selectSubfolder(const QModelIndex &mi, int child)
|
||||||
{
|
{
|
||||||
QModelIndex dest = foldersModel->index(child,0,mi);
|
QModelIndex dest = foldersModel->index(child,0,mi);
|
||||||
@ -1259,6 +1273,13 @@ void LibraryWindow::checkEmptyFolder(QStringList * paths)
|
|||||||
|
|
||||||
void LibraryWindow::reloadCovers()
|
void LibraryWindow::reloadCovers()
|
||||||
{
|
{
|
||||||
|
//comics view switch when filter/search is enabled
|
||||||
|
if(!searchEdit->text().isEmpty())
|
||||||
|
{
|
||||||
|
loadCoversFromCurrentModel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(foldersView->selectionModel()->selectedRows().length()>0)
|
if(foldersView->selectionModel()->selectedRows().length()>0)
|
||||||
loadCovers(foldersView->currentIndex());
|
loadCovers(foldersView->currentIndex());
|
||||||
else
|
else
|
||||||
@ -1585,6 +1606,7 @@ void LibraryWindow::setSearchFilter(QString filter)
|
|||||||
if(filter.isEmpty() && foldersModel->isFilterEnabled())
|
if(filter.isEmpty() && foldersModel->isFilterEnabled())
|
||||||
{
|
{
|
||||||
foldersModel->resetFilter();
|
foldersModel->resetFilter();
|
||||||
|
comicsView->enableFilterMode(false);
|
||||||
//foldersView->collapseAll();
|
//foldersView->collapseAll();
|
||||||
if(index != 0)
|
if(index != 0)
|
||||||
{
|
{
|
||||||
@ -1603,6 +1625,7 @@ void LibraryWindow::setSearchFilter(QString filter)
|
|||||||
{
|
{
|
||||||
foldersModel->setFilter(filter, true);//includeComicsCheckBox->isChecked());
|
foldersModel->setFilter(filter, true);//includeComicsCheckBox->isChecked());
|
||||||
comicsModel->setupModelData(filter, foldersModel->getDatabase());
|
comicsModel->setupModelData(filter, foldersModel->getDatabase());
|
||||||
|
comicsView->enableFilterMode(true);
|
||||||
foldersView->expandAll();
|
foldersView->expandAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1720,6 +1743,11 @@ void LibraryWindow::showEmptyFolderView()
|
|||||||
comicsViewStack->setCurrentWidget(emptyFolderWidget);
|
comicsViewStack->setCurrentWidget(emptyFolderWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::showNoSearchResultsView()
|
||||||
|
{
|
||||||
|
comicsViewStack->setCurrentWidget(noSearchResultsWidget);
|
||||||
|
}
|
||||||
|
|
||||||
//TODO recover the current comics selection and restore it in the destination
|
//TODO recover the current comics selection and restore it in the destination
|
||||||
void LibraryWindow::toggleComicsView()
|
void LibraryWindow::toggleComicsView()
|
||||||
{
|
{
|
||||||
@ -1730,6 +1758,14 @@ void LibraryWindow::toggleComicsView()
|
|||||||
toggleComicsView_delayed();
|
toggleComicsView_delayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::checkSearchNumResults(int numResults)
|
||||||
|
{
|
||||||
|
if(numResults == 0)
|
||||||
|
showNoSearchResultsView();
|
||||||
|
else
|
||||||
|
showComicsView();
|
||||||
|
}
|
||||||
|
|
||||||
void LibraryWindow::asignNumbers()
|
void LibraryWindow::asignNumbers()
|
||||||
{
|
{
|
||||||
QModelIndexList indexList = getSelectedComics();
|
QModelIndexList indexList = getSelectedComics();
|
||||||
@ -1888,14 +1924,14 @@ void LibraryWindow::closeEvent ( QCloseEvent * event )
|
|||||||
void LibraryWindow::showNoLibrariesWidget()
|
void LibraryWindow::showNoLibrariesWidget()
|
||||||
{
|
{
|
||||||
disableAllActions();
|
disableAllActions();
|
||||||
foldersFilter->setDisabled(true);
|
searchEdit->setDisabled(true);
|
||||||
mainWidget->setCurrentIndex(1);
|
mainWidget->setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::showRootWidget()
|
void LibraryWindow::showRootWidget()
|
||||||
{
|
{
|
||||||
libraryToolBar->setDisabled(false);
|
libraryToolBar->setDisabled(false);
|
||||||
foldersFilter->setEnabled(true);
|
searchEdit->setEnabled(true);
|
||||||
mainWidget->setCurrentIndex(0);
|
mainWidget->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1904,7 +1940,7 @@ void LibraryWindow::showImportingWidget()
|
|||||||
disableAllActions();
|
disableAllActions();
|
||||||
importWidget->clear();
|
importWidget->clear();
|
||||||
libraryToolBar->setDisabled(true);
|
libraryToolBar->setDisabled(true);
|
||||||
foldersFilter->setDisabled(true);
|
searchEdit->setDisabled(true);
|
||||||
mainWidget->setCurrentIndex(2);
|
mainWidget->setCurrentIndex(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ class ClassicComicsView;
|
|||||||
class GridComicsView;
|
class GridComicsView;
|
||||||
class ComicsViewTransition;
|
class ComicsViewTransition;
|
||||||
class EmptyFolderWidget;
|
class EmptyFolderWidget;
|
||||||
|
class NoSearchResultsWidget;
|
||||||
class EditShortcutsDialog;
|
class EditShortcutsDialog;
|
||||||
|
|
||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
@ -90,11 +91,10 @@ private:
|
|||||||
QSize slideSizeW;
|
QSize slideSizeW;
|
||||||
QSize slideSizeF;
|
QSize slideSizeF;
|
||||||
//search filter
|
//search filter
|
||||||
YACReaderSearchLineEdit * foldersFilter;
|
YACReaderSearchLineEdit * searchEdit;
|
||||||
TreeItem * index; //index al que hay que hacer scroll despu<70>s de pulsar sobre un folder filtrado
|
TreeItem * index; //index al que hay que hacer scroll despu<70>s de pulsar sobre un folder filtrado
|
||||||
int column;
|
int column;
|
||||||
QString previousFilter;
|
QString previousFilter;
|
||||||
QPushButton * clearFoldersFilter;
|
|
||||||
QCheckBox * includeComicsCheckBox;
|
QCheckBox * includeComicsCheckBox;
|
||||||
//-------------
|
//-------------
|
||||||
|
|
||||||
@ -104,6 +104,7 @@ private:
|
|||||||
QStackedWidget * comicsViewStack;
|
QStackedWidget * comicsViewStack;
|
||||||
ComicsViewTransition * comicsViewTransition;
|
ComicsViewTransition * comicsViewTransition;
|
||||||
EmptyFolderWidget * emptyFolderWidget;
|
EmptyFolderWidget * emptyFolderWidget;
|
||||||
|
NoSearchResultsWidget * noSearchResultsWidget;
|
||||||
|
|
||||||
YACReaderTreeView * foldersView;
|
YACReaderTreeView * foldersView;
|
||||||
YACReaderLibraryListWidget * selectedLibrary;
|
YACReaderLibraryListWidget * selectedLibrary;
|
||||||
@ -314,7 +315,10 @@ public slots:
|
|||||||
void toggleComicsView_delayed();//used in orther to avoid flickering;
|
void toggleComicsView_delayed();//used in orther to avoid flickering;
|
||||||
void showComicsView();
|
void showComicsView();
|
||||||
void showEmptyFolderView();
|
void showEmptyFolderView();
|
||||||
|
void showNoSearchResultsView();
|
||||||
void toggleComicsView();
|
void toggleComicsView();
|
||||||
|
void checkSearchNumResults(int numResults);
|
||||||
|
void loadCoversFromCurrentModel();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
40
YACReaderLibrary/no_search_results_widget.cpp
Normal file
40
YACReaderLibrary/no_search_results_widget.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include "no_search_results_widget.h"
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
|
NoSearchResultsWidget::NoSearchResultsWidget(QWidget *parent) :
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
QVBoxLayout * layout = new QVBoxLayout;
|
||||||
|
|
||||||
|
iconLabel = new QLabel();
|
||||||
|
iconLabel->setPixmap(QPixmap(":/images/empty_search.png"));
|
||||||
|
iconLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
|
titleLabel = new QLabel("No results");
|
||||||
|
titleLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
titleLabel->setStyleSheet("QLabel {color:#CCCCCC; font-size:24px;font-family:Arial;font-weight:bold;}");
|
||||||
|
|
||||||
|
layout->addSpacing(100);
|
||||||
|
layout->addWidget(iconLabel);
|
||||||
|
layout->addSpacing(30);
|
||||||
|
layout->addWidget(titleLabel);
|
||||||
|
layout->addStretch();
|
||||||
|
layout->setMargin(0);
|
||||||
|
layout->setSpacing(0);
|
||||||
|
|
||||||
|
setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
|
setStyleSheet("QWidget {background:#2A2A2A}");
|
||||||
|
|
||||||
|
setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding );
|
||||||
|
setLayout(layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoSearchResultsWidget::paintEvent(QPaintEvent *)
|
||||||
|
{
|
||||||
|
QPainter painter (this);
|
||||||
|
painter.fillRect(0,0,width(),height(),QColor("#2A2A2A"));
|
||||||
|
}
|
25
YACReaderLibrary/no_search_results_widget.h
Normal file
25
YACReaderLibrary/no_search_results_widget.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef NO_SEARCH_RESULTS_WIDGET_H
|
||||||
|
#define NO_SEARCH_RESULTS_WIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
|
class NoSearchResultsWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit NoSearchResultsWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QLabel * iconLabel;
|
||||||
|
QLabel * titleLabel;
|
||||||
|
void paintEvent(QPaintEvent *);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NO_SEARCH_RESULTS_WIDGET_H
|
@ -27,7 +27,7 @@ YACReaderSearchLineEdit::YACReaderSearchLineEdit(QWidget *parent)
|
|||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
setStyleSheet(QString("QLineEdit {border-top:1px solid #9F9F9F; border-bottom:1px solid #ACACAC; border-right:1px solid #ACACAC; border-left:1px solid #ACACAC; border-radius: 10px; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CACACA, stop: 0.15 #FFFFFF); padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-bottom: 1px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6).arg(clearButton->sizeHint().width() + frameWidth + 2));
|
setStyleSheet(QString("QLineEdit {border-top:1px solid #9F9F9F; border-bottom:1px solid #ACACAC; border-right:1px solid #ACACAC; border-left:1px solid #ACACAC; border-radius: 10px; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CACACA, stop: 0.15 #FFFFFF); padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-bottom: 1px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6).arg(clearButton->sizeHint().width() + frameWidth + 2));
|
||||||
#else
|
#else
|
||||||
setStyleSheet(QString("QLineEdit {color: #ABABAB; border:none; border-radius: 5px; background-color:#404040; padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-right: 9px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6 + 5).arg(clearButton->sizeHint().width() + frameWidth + 2));
|
setStyleSheet(QString("QLineEdit {color: #ABABAB; border:none; border-radius: 4px; background-color:#404040; padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-right: 9px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 6 + 5).arg(clearButton->sizeHint().width() + frameWidth + 2));
|
||||||
#endif
|
#endif
|
||||||
QSize msz = minimumSizeHint();
|
QSize msz = minimumSizeHint();
|
||||||
setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
|
setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
|
||||||
|
BIN
images/empty_search.png
Normal file
BIN
images/empty_search.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
images/searching_icon.png
Normal file
BIN
images/searching_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Loading…
x
Reference in New Issue
Block a user