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;}";
skipButton = new QPushButton(tr("skip"));
backButton = new QPushButton(tr("back"));
nextButton = new QPushButton(tr("next"));
searchButton = new QPushButton(tr("search"));
closeButton = new QPushButton(tr("close"));
skipButton->setStyleSheet(dialogButtonsStyleSheet);
backButton->setStyleSheet(dialogButtonsStyleSheet);
nextButton->setStyleSheet(dialogButtonsStyleSheet);
searchButton->setStyleSheet(dialogButtonsStyleSheet);
closeButton->setStyleSheet(dialogButtonsStyleSheet);
content = new QStackedWidget(this);
@ -39,7 +45,10 @@ void ComicVineDialog::doLayout()
QHBoxLayout * buttonLayout = new QHBoxLayout;
buttonLayout->addStretch();
buttonLayout->addWidget(skipButton);
buttonLayout->addWidget(backButton);
buttonLayout->addWidget(nextButton);
buttonLayout->addWidget(searchButton);
buttonLayout->addWidget(closeButton);
buttonLayout->setContentsMargins(0,0,0,0);
@ -60,13 +69,13 @@ void ComicVineDialog::doStackedWidgets()
content->addWidget(seriesQuestion = new SeriesQuestion);
content->addWidget(searchSingleComic = new SearchSingleComic);
content->addWidget(searchVolume = new SearchVolume);
}
void ComicVineDialog::doConnections()
{
connect(closeButton,SIGNAL(pressed()),this,SLOT(close()));
connect(nextButton,SIGNAL(pressed()),this,SLOT(goNext()));
connect(closeButton,SIGNAL(clicked()),this,SLOT(close()));
connect(nextButton,SIGNAL(clicked()),this,SLOT(goNext()));
connect(searchButton,SIGNAL(clicked()),this,SLOT(search()));
connect(comicVineClient,SIGNAL(searchResult(QString)),this,SLOT(debugClientResults(QString)));
}
@ -78,14 +87,28 @@ void ComicVineDialog::goNext()
{
if(seriesQuestion->getYes())
{
content->setCurrentWidget(searchVolume);
QString volumeSearchString = comics[0].getParentFolderName();
if(volumeSearchString.isEmpty())
showSearchVolume();
else
{
showLoading();
comicVineClient->search(volumeSearchString);
}
status = Volume;
}
else
{
ComicDB comic = comics[currentIndex];
QString title = comic.getTitleOrPath();
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) {
@ -109,13 +132,15 @@ void ComicVineDialog::show()
ComicDB singleComic = comics[0];
QString title = singleComic.getTitleOrPath();
titleHeader->setSubTitle(title);
content->setCurrentIndex(0);
showLoading();
comicVineClient->search(title);
status = SingleComic;
}else if(comics.length()>1)
{
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)
{
content->setCurrentWidget(searchSingleComic);
QMessageBox::information(0,"-Response-", string);
switch(status)
{
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);
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;
};
//----------------------------------------
//---------------------------------------
class SearchVolume : public QWidget
{
Q_OBJECT
public:
SearchVolume(QWidget * parent = 0);
public slots:
QString getVolumeInfo() {return volumeEdit->text();}
private:
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
{
@ -88,13 +108,33 @@ public slots:
protected slots:
void goNext();
void debugClientResults(const QString & string);
//show widget methods
void showSeriesQuestion();
void showSearchSingleComic();
void showSearchVolume();
void showLoading();
void search();
private:
enum ScrapperStatus
{
SingleComic,
Volume,
SingleComicInSeries
};
ScrapperStatus status;
ComicVineClient * comicVineClient;
int currentIndex;
TitleHeader * titleHeader;
QPushButton * nextButton;
QPushButton * skipButton;
QPushButton * backButton;
QPushButton * nextButton;
QPushButton * searchButton;
QPushButton * closeButton;
//stacked widgets

View File

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

View File

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

View File

@ -934,17 +934,8 @@ void PictureFlowSoftwareRenderer::render()
renderSlides();
if(state->slideImages.size()>0)
{
int x = buffer.width()/2;
int size = buffer.width() * 0.021;
int size = buffer.width() * 0.015;
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);
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)
{
fontSize = width * 0.02;
fontSize = width * 0.015;
//int side = qMin(width, height);
udpatePerspective(width,height);
@ -529,14 +529,7 @@ void YACReaderFlowGL::draw()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glBegin( GL_TRIANGLES );
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));
@ -1453,4 +1446,4 @@ QImage ImageLoaderByteArrayGL::result()
// flow->cfImages[index].width = 0.5;
// flow->cfImages[index].height = 0.5 * (float(image.height())/image.width());
// flow->cfImages[index].img = bindTexture(image, GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
//}
//}