diff --git a/YACReaderLibrary/images.qrc b/YACReaderLibrary/images.qrc
index f285426d..84b28ad0 100644
--- a/YACReaderLibrary/images.qrc
+++ b/YACReaderLibrary/images.qrc
@@ -65,5 +65,7 @@
../images/importTopCoversDecoration.png
../images/importBottomCoversDecoration.png
../images/glowLine.png
+ ../images/clearSearch.png
+ ../images/iconSearch.png
\ No newline at end of file
diff --git a/YACReaderLibrary/import_widget.cpp b/YACReaderLibrary/import_widget.cpp
index 90945479..1b27c1f5 100644
--- a/YACReaderLibrary/import_widget.cpp
+++ b/YACReaderLibrary/import_widget.cpp
@@ -335,7 +335,7 @@ void ImportWidget::setImportLook()
{
iconLabel->setPixmap(QPixmap(":/images/importingIcon.png"));
text->setText(""+tr("Importing comics")+"");
- textDescription->setText(""+tr("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")+"");
+ textDescription->setText(""+tr("Create a library could take several minutes. You can stop the process and update the library later for completing the task.")+"");
}
void ImportWidget::setUpdateLook()
diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp
index 72e1f39b..8394f7cc 100644
--- a/YACReaderLibrary/library_window.cpp
+++ b/YACReaderLibrary/library_window.cpp
@@ -181,16 +181,17 @@ void LibraryWindow::doLayout()
QVBoxLayout * searchLayout = new QVBoxLayout;
QHBoxLayout * filter = new QHBoxLayout;
- filter->addWidget(foldersFilter = new QLineEdit());
+ filter->addWidget(foldersFilter = new YACReaderLineEdit());
+ foldersFilter->setPlaceholderText(tr("Search folders and comics"));
previousFilter = "";
- filter->addWidget(clearFoldersFilter = new QPushButton(tr("Clear")));
+ //filter->addWidget(clearFoldersFilter = new QPushButton(tr("Clear")));
- searchLayout->addWidget(new QLabel(tr("Search folders/comics"),this));
+ //searchLayout->addWidget(new QLabel(tr("Search folders/comics"),this));
searchLayout->addLayout(filter);
- includeComicsCheckBox = new QCheckBox(tr("Include files (slower)"),this);
- includeComicsCheckBox->setChecked(true);
- searchLayout->addWidget(includeComicsCheckBox);
+ //includeComicsCheckBox = new QCheckBox(tr("Include files (slower)"),this);
+ //includeComicsCheckBox->setChecked(true);
+ //searchLayout->addWidget(includeComicsCheckBox);
l->addLayout(searchLayout);
l->setSpacing(1);
@@ -506,7 +507,7 @@ void LibraryWindow::enableLibraryActions()
deleteLibraryAction->setEnabled(true);
removeLibraryAction->setEnabled(true);
foldersFilter->setEnabled(true);
- clearFoldersFilter->setEnabled(true);
+ //clearFoldersFilter->setEnabled(true);
}
void LibraryWindow::createToolBars()
@@ -682,9 +683,9 @@ void LibraryWindow::createConnections()
connect(comicFlow,SIGNAL(selected(unsigned int)),this,SLOT(openComic()));
connect(comicView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(openComic()));
//Folders filter
- connect(clearFoldersFilter,SIGNAL(clicked()),foldersFilter,SLOT(clear()));
+ //connect(clearFoldersFilter,SIGNAL(clicked()),foldersFilter,SLOT(clear()));
connect(foldersFilter,SIGNAL(textChanged(QString)),this,SLOT(setFoldersFilter(QString)));
- connect(includeComicsCheckBox,SIGNAL(stateChanged(int)),this,SLOT(searchInFiles(int)));
+ //connect(includeComicsCheckBox,SIGNAL(stateChanged(int)),this,SLOT(searchInFiles(int)));
//ContextMenus
connect(openContainingFolderComicAction,SIGNAL(triggered()),this,SLOT(openContainingFolderComic()));
@@ -759,7 +760,6 @@ void LibraryWindow::loadLibrary(const QString & name)
//TODO encontrar el bug que provoca que no se carguen adecuadamente las carátulas en root.
setRootIndex();
- //includeComicsCheckBox->setCheckState(Qt::Unchecked);
foldersFilter->clear();
}
else if(comparation > 0)
@@ -1291,7 +1291,7 @@ void LibraryWindow::setFoldersFilter(QString filter)
{
if(!filter.isEmpty())
{
- dm->setFilter(filter, includeComicsCheckBox->isChecked());
+ dm->setFilter(filter, true);//includeComicsCheckBox->isChecked());
foldersView->expandAll();
}
}
diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h
index 513d8fb8..5a4bfe1a 100644
--- a/YACReaderLibrary/library_window.h
+++ b/YACReaderLibrary/library_window.h
@@ -64,7 +64,7 @@ private:
QSize slideSizeW;
QSize slideSizeF;
//search filter
- QLineEdit * foldersFilter;
+ YACReaderLineEdit * foldersFilter;
TreeItem * index; //index al que hay que hacer scroll después de pulsar sobre un folder filtrado
int column;
QString previousFilter;
diff --git a/common/custom_widgets.cpp b/common/custom_widgets.cpp
index 7e75d668..7906f63f 100644
--- a/common/custom_widgets.cpp
+++ b/common/custom_widgets.cpp
@@ -1245,4 +1245,51 @@ YACReaderFlowConfigWidget::YACReaderFlowConfigWidget(QWidget * parent )
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+#include
+#include
+#include
+
+YACReaderLineEdit::YACReaderLineEdit(QWidget *parent)
+ : QLineEdit(parent)
+{
+ clearButton = new QToolButton(this);
+ searchLabel = new QLabel(this);
+
+ QPixmap pixmap(":/images/clearSearch.png");
+ QPixmap pixmapIcon(":/images/iconSearch.png");
+
+ searchLabel->setStyleSheet("QLabel { border: none; padding: 0px; }");
+ searchLabel->setPixmap(pixmapIcon);
+
+ clearButton->setIcon(QIcon(pixmap));
+ clearButton->setIconSize(pixmap.size());
+ clearButton->setCursor(Qt::ArrowCursor);
+ clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
+ clearButton->hide();
+ connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
+ connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&)));
+ int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
+ setStyleSheet(QString("QLineEdit { padding-left: %1px; padding-right: %2px; padding-bottom: 1px; margin-bottom: 1px;} ").arg(searchLabel->sizeHint().width() + frameWidth + 2).arg(clearButton->sizeHint().width() + frameWidth + 2));
+ QSize msz = minimumSizeHint();
+ setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
+ qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));
+}
+
+void YACReaderLineEdit::resizeEvent(QResizeEvent *)
+{
+ QSize sz = clearButton->sizeHint();
+ int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
+ clearButton->move(rect().right() - frameWidth - sz.width(),
+ (rect().bottom() + 1 - sz.height())/2);
+
+ QSize szl = searchLabel->sizeHint();
+ searchLabel->move(3,(rect().bottom() + 1 - szl.height())/2);
+}
+
+void YACReaderLineEdit::updateCloseButton(const QString& text)
+{
+ clearButton->setVisible(!text.isEmpty());
}
\ No newline at end of file
diff --git a/common/custom_widgets.h b/common/custom_widgets.h
index 0e13fd2c..f1b4b8a7 100644
--- a/common/custom_widgets.h
+++ b/common/custom_widgets.h
@@ -379,6 +379,28 @@ signals:
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
+#include
+
+class QToolButton;
+class QLabel;
+
+class YACReaderLineEdit : public QLineEdit
+{
+ Q_OBJECT
+
+public:
+ YACReaderLineEdit(QWidget *parent = 0);
+
+protected:
+ void resizeEvent(QResizeEvent *);
+
+private slots:
+ void updateCloseButton(const QString &text);
+
+private:
+ QToolButton *clearButton;
+ QLabel * searchLabel;
+};
#endif
diff --git a/images/clearSearch.png b/images/clearSearch.png
new file mode 100644
index 00000000..d898e9b4
Binary files /dev/null and b/images/clearSearch.png differ