A?adido di?logo de selecci?n del flow (en el primer arranque).

A?adida la comprobaci?n de que OpenGL est? disponible en el sistema.
This commit is contained in:
Luis Ángel San Martín 2012-10-11 22:39:16 +02:00
parent b4669c5b8b
commit 46a769e53e
12 changed files with 103 additions and 11 deletions

View File

@ -32,7 +32,8 @@ HEADERS += comic.h \
../common/check_new_version.h \
../common/qnaturalsorting.h \
../common/yacreader_flow_gl.h \
../common/yacreader_global.h
../common/yacreader_global.h \
../common/onstart_flow_selection_dialog.h
SOURCES += comic.cpp \
configuration.cpp \
@ -54,7 +55,8 @@ SOURCES += comic.cpp \
../common/custom_widgets.cpp \
../common/check_new_version.cpp \
../common/qnaturalsorting.cpp \
../common/yacreader_flow_gl.cpp
../common/yacreader_flow_gl.cpp \
../common/onstart_flow_selection_dialog.cpp
RESOURCES += images.qrc \
files.qrc

View File

@ -63,6 +63,9 @@
<file>../images/helpImages/keyboard.png</file>
<file>../images/helpImages/mouse.png</file>
<file>../images/helpImages/speaker.png</file>
<file>../images/defaultCover.png</file>
<file>../images/defaultCover.png</file>
<file>../images/onStartFlowSelection.png</file>
<file>../images/useNewFlowButton.png</file>
<file>../images/useOldFlowButton.png</file>
</qresource>
</RCC>

View File

@ -8,6 +8,7 @@
#include "render.h"
#include "goto_dialog.h"
#include "translator.h"
#include "onstart_flow_selection_dialog.h"
#include <QWebView>
#include <QFile>
@ -69,7 +70,20 @@ drag(false)
QSettings * settings = new QSettings("YACReader.ini",QSettings::IniFormat);
//CONFIG GOTO_FLOW--------------------------------------------------------
if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toBool() == true)
if(QGLFormat::hasOpenGL() && !settings->contains(USE_OPEN_GL))
{
OnStartFlowSelectionDialog * flowSelDialog = new OnStartFlowSelectionDialog();
flowSelDialog->exec();
if(flowSelDialog->result() == QDialog::Accepted)
settings->setValue(USE_OPEN_GL,2);
else
settings->setValue(USE_OPEN_GL,0);
delete flowSelDialog;
}
if(QGLFormat::hasOpenGL() && (settings->value(USE_OPEN_GL).toBool() == true))
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
else
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());

View File

@ -45,7 +45,8 @@ HEADERS += comic_flow.h \
../common/custom_widgets.h \
../common/qnaturalsorting.h \
../common/yacreader_flow_gl.h \
../common/yacreader_global.h
../common/yacreader_global.h \
../common/onstart_flow_selection_dialog.h
SOURCES += comic_flow.cpp \
create_library_dialog.cpp \
@ -77,7 +78,8 @@ SOURCES += comic_flow.cpp \
../common/pictureflow.cpp \
../common/custom_widgets.cpp \
../common/qnaturalsorting.cpp \
../common/yacreader_flow_gl.cpp
../common/yacreader_flow_gl.cpp \
../common/onstart_flow_selection_dialog.cpp
include(./server/server.pri)

View File

@ -41,5 +41,8 @@
<file>../images/server.png</file>
<file>../images/iphoneConfig.png</file>
<file>../images/qrMessage.png</file>
<file>../images/onStartFlowSelection.png</file>
<file>../images/useNewFlowButton.png</file>
<file>../images/useOldFlowButton.png</file>
</qresource>
</RCC>

View File

@ -19,6 +19,7 @@
#include "data_base_management.h"
#include "yacreader_global.h"
#include "onstart_flow_selection_dialog.h"
//
@ -38,8 +39,8 @@ void LibraryWindow::setupUI()
settings->beginGroup("libraryConfig");
doModels();
doDialogs();
doLayout();
doDialogs();
createActions();
createToolBars();
createMenus();
@ -54,7 +55,21 @@ void LibraryWindow::doLayout()
QSplitter * sHorizontal = new QSplitter(Qt::Horizontal); //spliter principal
//TODO: flowType is a global variable
//CONFIG COMIC_FLOW--------------------------------------------------------
if(settings->contains(USE_OPEN_GL) && settings->value(USE_OPEN_GL).toBool() == true)
if(QGLFormat::hasOpenGL() && !settings->contains(USE_OPEN_GL))
{
OnStartFlowSelectionDialog * flowSelDialog = new OnStartFlowSelectionDialog();
flowSelDialog->exec();
if(flowSelDialog->result() == QDialog::Accepted)
settings->setValue(USE_OPEN_GL,2);
else
settings->setValue(USE_OPEN_GL,0);
delete flowSelDialog;
}
if(QGLFormat::hasOpenGL() && (settings->value(USE_OPEN_GL).toBool() == true))
comicFlow = new ComicFlowWidgetGL(0);
else
comicFlow = new ComicFlowWidgetSW(0);

View File

@ -0,0 +1,40 @@
#include "onstart_flow_selection_dialog.h"
#include <QPushButton>
#include <QHBoxLayout>
OnStartFlowSelectionDialog::OnStartFlowSelectionDialog(QWidget * parent)
:QDialog(parent)
{
setModal(true);
QPushButton * acceptHW = new QPushButton(this);
connect(acceptHW,SIGNAL(clicked()),this,SLOT(accept()));
QPushButton * rejectHW = new QPushButton(this); //and use SW flow
connect(rejectHW,SIGNAL(clicked()),this,SLOT(reject()));
acceptHW->setGeometry(90,165,110,118);
acceptHW->setFlat(true);
acceptHW->setAutoFillBackground(true);
rejectHW->setGeometry(464,165,110,118);
rejectHW->setFlat(true);
rejectHW->setAutoFillBackground(true);
QPalette paletteHW;
paletteHW.setBrush(acceptHW->backgroundRole(), QBrush(QImage(":/images/useNewFlowButton.png")));
acceptHW->setPalette(paletteHW);
QPalette paletteSW;
paletteSW.setBrush(rejectHW->backgroundRole(), QBrush(QImage(":/images/useOldFlowButton.png")));
rejectHW->setPalette(paletteSW);
//QHBoxLayout * layout = new QHBoxLayout;
//layout->addWidget(acceptHW);
//layout->addWidget(rejectHW);
QPalette palette;
palette.setBrush(this->backgroundRole(), QBrush(QImage(":/images/onStartFlowSelection.png")));
setPalette(palette);
//setLayout(layout);
resize(664,371);
}

View File

@ -0,0 +1,13 @@
#ifndef ONSTART_FLOW_SELECTION_DIALOG_H
#define ONSTART_FLOW_SELECTION_DIALOG_H
#include <QDialog>
class OnStartFlowSelectionDialog : public QDialog
{
Q_OBJECT
public:
OnStartFlowSelectionDialog(QWidget * parent = 0);
};
#endif

View File

@ -270,7 +270,7 @@ void YACReaderFlowGL::initializeGL()
markTexture = bindTexture(QImage(":/images/setRead.png"),GL_TEXTURE_2D,GL_RGBA,QGLContext::LinearFilteringBindOption | QGLContext::MipmapBindOption);
if(lazyPopulateObjects!=-1)
populate(lazyPopulateObjects); //TODO esto es responsabilidad del usuario de la clase
populate(lazyPopulateObjects);
}
void YACReaderFlowGL::paintGL()
@ -1158,8 +1158,8 @@ void YACReaderPageFlowGL::updateImageData()
void YACReaderPageFlowGL::populate(int n)
{
worker->reset();
if(lazyPopulateObjects!=-1)
YACReaderFlowGL::populate(n);
//if(lazyPopulateObjects!=-1)
//YACReaderFlowGL::populate(n);
lazyPopulateObjects = n;
imagesReady = QVector<bool> (n,false);
rawImages = QVector<QByteArray> (n);

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
images/useNewFlowButton.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/useOldFlowButton.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB