removed current cover indicator from 'flow'

enabled volume search in comic vine dialog
This commit is contained in:
Luis Ángel San Martín 2013-10-06 18:13:27 +02:00
parent e8a97230f5
commit b88715e26e
6 changed files with 176 additions and 30 deletions

View File

@ -26,10 +26,16 @@ void ComicVineDialog::doLayout()
QString dialogButtonsStyleSheet = "QPushButton {border: 1px solid #242424; background: #2e2e2e; color:white; padding: 5px 26px 5px 26px; font-size:12px;font-family:Arial; font-weight:bold;}"; QString dialogButtonsStyleSheet = "QPushButton {border: 1px solid #242424; background: #2e2e2e; color:white; padding: 5px 26px 5px 26px; font-size:12px;font-family:Arial; font-weight:bold;}";
skipButton = new QPushButton(tr("skip"));
backButton = new QPushButton(tr("back"));
nextButton = new QPushButton(tr("next")); nextButton = new QPushButton(tr("next"));
searchButton = new QPushButton(tr("search"));
closeButton = new QPushButton(tr("close")); closeButton = new QPushButton(tr("close"));
skipButton->setStyleSheet(dialogButtonsStyleSheet);
backButton->setStyleSheet(dialogButtonsStyleSheet);
nextButton->setStyleSheet(dialogButtonsStyleSheet); nextButton->setStyleSheet(dialogButtonsStyleSheet);
searchButton->setStyleSheet(dialogButtonsStyleSheet);
closeButton->setStyleSheet(dialogButtonsStyleSheet); closeButton->setStyleSheet(dialogButtonsStyleSheet);
content = new QStackedWidget(this); content = new QStackedWidget(this);
@ -39,7 +45,10 @@ void ComicVineDialog::doLayout()
QHBoxLayout * buttonLayout = new QHBoxLayout; QHBoxLayout * buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(); buttonLayout->addStretch();
buttonLayout->addWidget(skipButton);
buttonLayout->addWidget(backButton);
buttonLayout->addWidget(nextButton); buttonLayout->addWidget(nextButton);
buttonLayout->addWidget(searchButton);
buttonLayout->addWidget(closeButton); buttonLayout->addWidget(closeButton);
buttonLayout->setContentsMargins(0,0,0,0); buttonLayout->setContentsMargins(0,0,0,0);
@ -60,13 +69,13 @@ void ComicVineDialog::doStackedWidgets()
content->addWidget(seriesQuestion = new SeriesQuestion); content->addWidget(seriesQuestion = new SeriesQuestion);
content->addWidget(searchSingleComic = new SearchSingleComic); content->addWidget(searchSingleComic = new SearchSingleComic);
content->addWidget(searchVolume = new SearchVolume); content->addWidget(searchVolume = new SearchVolume);
} }
void ComicVineDialog::doConnections() void ComicVineDialog::doConnections()
{ {
connect(closeButton,SIGNAL(pressed()),this,SLOT(close())); connect(closeButton,SIGNAL(clicked()),this,SLOT(close()));
connect(nextButton,SIGNAL(pressed()),this,SLOT(goNext())); connect(nextButton,SIGNAL(clicked()),this,SLOT(goNext()));
connect(searchButton,SIGNAL(clicked()),this,SLOT(search()));
connect(comicVineClient,SIGNAL(searchResult(QString)),this,SLOT(debugClientResults(QString))); connect(comicVineClient,SIGNAL(searchResult(QString)),this,SLOT(debugClientResults(QString)));
} }
@ -78,14 +87,28 @@ void ComicVineDialog::goNext()
{ {
if(seriesQuestion->getYes()) if(seriesQuestion->getYes())
{ {
content->setCurrentWidget(searchVolume); QString volumeSearchString = comics[0].getParentFolderName();
if(volumeSearchString.isEmpty())
showSearchVolume();
else
{
showLoading();
comicVineClient->search(volumeSearchString);
}
status = Volume;
} }
else else
{ {
ComicDB comic = comics[currentIndex]; ComicDB comic = comics[currentIndex];
QString title = comic.getTitleOrPath(); QString title = comic.getTitleOrPath();
titleHeader->setSubTitle(tr("comic %1 of %2 - %3").arg(currentIndex+1).arg(comics.length()).arg(title)); titleHeader->setSubTitle(tr("comic %1 of %2 - %3").arg(currentIndex+1).arg(comics.length()).arg(title));
content->setCurrentWidget(searchSingleComic); showLoading();
comicVineClient->search(title);
status = SingleComicInSeries;
} }
} }
else if (content->currentWidget() == searchSingleComic) { else if (content->currentWidget() == searchSingleComic) {
@ -109,13 +132,15 @@ void ComicVineDialog::show()
ComicDB singleComic = comics[0]; ComicDB singleComic = comics[0];
QString title = singleComic.getTitleOrPath(); QString title = singleComic.getTitleOrPath();
titleHeader->setSubTitle(title); titleHeader->setSubTitle(title);
content->setCurrentIndex(0); showLoading();
comicVineClient->search(title); comicVineClient->search(title);
status = SingleComic;
}else if(comics.length()>1) }else if(comics.length()>1)
{ {
titleHeader->setSubTitle(tr("%1 comics selected").arg(comics.length())); titleHeader->setSubTitle(tr("%1 comics selected").arg(comics.length()));
content->setCurrentWidget(seriesQuestion); showSeriesQuestion();
} }
} }
@ -139,9 +164,76 @@ void ComicVineDialog::doLoading()
void ComicVineDialog::debugClientResults(const QString & string) void ComicVineDialog::debugClientResults(const QString & string)
{ {
content->setCurrentWidget(searchSingleComic); switch(status)
QMessageBox::information(0,"-Response-", string); {
case SingleComic:
showSearchSingleComic();
break;
case Volume:
showSearchVolume();
break;
case SingleComicInSeries:
showSearchSingleComic();
break;
}
QMessageBox::information(0,"-Response-", string);
}
void ComicVineDialog::showSeriesQuestion()
{
content->setCurrentWidget(seriesQuestion);
backButton->setHidden(true);
skipButton->setHidden(true);
nextButton->setVisible(true);
searchButton->setHidden(true);
closeButton->setVisible(true);
}
void ComicVineDialog::showSearchSingleComic()
{
content->setCurrentWidget(searchSingleComic);
backButton->setHidden(true);
skipButton->setHidden(true);
nextButton->setHidden(true);
searchButton->setVisible(true);
closeButton->setVisible(true);
}
void ComicVineDialog::showSearchVolume()
{
content->setCurrentWidget(searchVolume);
backButton->setHidden(true);
nextButton->setHidden(true);
searchButton->setVisible(true);
closeButton->setVisible(true);
if (status == SingleComicInSeries)
skipButton->setVisible(true);
else
skipButton->setHidden(true);
}
void ComicVineDialog::showLoading()
{
content->setCurrentIndex(0);
backButton->setHidden(true);
skipButton->setHidden(true);
nextButton->setHidden(true);
searchButton->setHidden(true);
closeButton->setVisible(true);
}
void ComicVineDialog::search()
{
switch (status) {
case Volume:
showLoading();
comicVineClient->search(searchVolume->getVolumeInfo());
break;
default:
break;
}
} }
//--------------------------------------- //---------------------------------------
@ -308,3 +400,21 @@ SearchVolume::SearchVolume(QWidget * parent)
setLayout(l); setLayout(l);
setContentsMargins(0,0,0,0); setContentsMargins(0,0,0,0);
} }
//---------------------------------------
//SelectVolume
//---------------------------------------
SelectVolume::SelectVolume(QWidget *parent)
:QWidget(parent)
{}
SelectVolume::~SelectVolume() {}
//---------------------------------------
//SelectComic
//---------------------------------------
SelectComic::SelectComic(QWidget *parent)
:QWidget(parent)
{}
SelectComic::~SelectComic() {}

View File

@ -62,16 +62,36 @@ private:
ScrapperLineEdit * volumeEdit; ScrapperLineEdit * volumeEdit;
}; };
//---------------------------------------- //---------------------------------------
class SearchVolume : public QWidget class SearchVolume : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
SearchVolume(QWidget * parent = 0); SearchVolume(QWidget * parent = 0);
public slots:
QString getVolumeInfo() {return volumeEdit->text();}
private: private:
ScrapperLineEdit * volumeEdit; ScrapperLineEdit * volumeEdit;
}; };
//---------------------------------------
class SelectComic : public QWidget
{
Q_OBJECT
public:
SelectComic(QWidget * parent = 0);
virtual ~SelectComic();
};
//---------------------------------------
class SelectVolume : public QWidget
{
Q_OBJECT
public:
SelectVolume(QWidget * parent = 0);
virtual ~SelectVolume();
};
//---------------------------------------- //----------------------------------------
class ComicVineDialog : public QDialog class ComicVineDialog : public QDialog
{ {
@ -88,13 +108,33 @@ public slots:
protected slots: protected slots:
void goNext(); void goNext();
void debugClientResults(const QString & string); void debugClientResults(const QString & string);
//show widget methods
void showSeriesQuestion();
void showSearchSingleComic();
void showSearchVolume();
void showLoading();
void search();
private: private:
enum ScrapperStatus
{
SingleComic,
Volume,
SingleComicInSeries
};
ScrapperStatus status;
ComicVineClient * comicVineClient; ComicVineClient * comicVineClient;
int currentIndex; int currentIndex;
TitleHeader * titleHeader; TitleHeader * titleHeader;
QPushButton * skipButton;
QPushButton * backButton;
QPushButton * nextButton; QPushButton * nextButton;
QPushButton * searchButton;
QPushButton * closeButton; QPushButton * closeButton;
//stacked widgets //stacked widgets

View File

@ -116,6 +116,15 @@ QString ComicDB::getTitleOrPath()
return QFileInfo(path).fileName(); return QFileInfo(path).fileName();
} }
QString ComicDB::getParentFolderName()
{
QStringList paths = path.split('/');
if(paths.length()<2)
return "";
else
return paths[paths.length()-2];
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//COMIC_INFO------------------------------------------------------------------- //COMIC_INFO-------------------------------------------------------------------
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -135,6 +135,9 @@ public:
//returns comic title if it isn't null or empty, in other case returns fileName //returns comic title if it isn't null or empty, in other case returns fileName
QString getTitleOrPath(); QString getTitleOrPath();
//returns parent folder name
QString getParentFolderName();
QString toTXT(); QString toTXT();
ComicInfo info; ComicInfo info;

View File

@ -934,17 +934,8 @@ void PictureFlowSoftwareRenderer::render()
renderSlides(); renderSlides();
if(state->slideImages.size()>0) if(state->slideImages.size()>0)
{ {
int x = buffer.width()/2; int size = buffer.width() * 0.015;
int size = buffer.width() * 0.021;
int start = buffer.width() * 0.010; int start = buffer.width() * 0.010;
for(int j = start; j<size;j++)
{
buffer.setPixel(QPoint(x,j),QColor(255,255,255).rgb()-state->backgroundColor);
for(int i = 0; i<size-j;i++){
buffer.setPixel(QPoint(x-i,j),QColor(255,255,255).rgb()-state->backgroundColor);
buffer.setPixel(QPoint(x+i,j),QColor(255,255,255).rgb()-state->backgroundColor);
}
}
QPainter painter(&buffer); QPainter painter(&buffer);
painter.setPen(QColor(255,255,255).rgb()-state->backgroundColor); painter.setPen(QColor(255,255,255).rgb()-state->backgroundColor);

View File

@ -306,7 +306,7 @@ void YACReaderFlowGL::paintGL()
void YACReaderFlowGL::resizeGL(int width, int height) void YACReaderFlowGL::resizeGL(int width, int height)
{ {
fontSize = width * 0.02; fontSize = width * 0.015;
//int side = qMin(width, height); //int side = qMin(width, height);
udpatePerspective(width,height); udpatePerspective(width,height);
@ -529,14 +529,7 @@ void YACReaderFlowGL::draw()
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
glBegin( GL_TRIANGLES );
glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
glVertex2f( -0.03f, 0.98f);
glVertex2f( 0.03f, 0.98f);
glVertex2f( 0.f, 0.949f);
glEnd();
renderText(10, fontSize + 10,QString("%1/%2").arg(currentSelected+1).arg(numObjects),QFont("Arial", fontSize)); renderText(10, fontSize + 10,QString("%1/%2").arg(currentSelected+1).arg(numObjects),QFont("Arial", fontSize));