diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro index 2130a416..34d5a48a 100644 --- a/YACReader/YACReader.pro +++ b/YACReader/YACReader.pro @@ -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 diff --git a/YACReader/images.qrc b/YACReader/images.qrc index 26a9d978..56e23db9 100644 --- a/YACReader/images.qrc +++ b/YACReader/images.qrc @@ -63,6 +63,9 @@ ../images/helpImages/keyboard.png ../images/helpImages/mouse.png ../images/helpImages/speaker.png - ../images/defaultCover.png + ../images/defaultCover.png + ../images/onStartFlowSelection.png + ../images/useNewFlowButton.png + ../images/useOldFlowButton.png diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 4702bc62..cb55892c 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -8,6 +8,7 @@ #include "render.h" #include "goto_dialog.h" #include "translator.h" +#include "onstart_flow_selection_dialog.h" #include #include @@ -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()); diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index 2dd88146..16e133db 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -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) diff --git a/YACReaderLibrary/images.qrc b/YACReaderLibrary/images.qrc index 6ce0c2f7..70ad9bef 100644 --- a/YACReaderLibrary/images.qrc +++ b/YACReaderLibrary/images.qrc @@ -41,5 +41,8 @@ ../images/server.png ../images/iphoneConfig.png ../images/qrMessage.png + ../images/onStartFlowSelection.png + ../images/useNewFlowButton.png + ../images/useOldFlowButton.png \ No newline at end of file diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index df0b8cd0..6dc525bc 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -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); diff --git a/common/onstart_flow_selection_dialog.cpp b/common/onstart_flow_selection_dialog.cpp new file mode 100644 index 00000000..b37c9b31 --- /dev/null +++ b/common/onstart_flow_selection_dialog.cpp @@ -0,0 +1,40 @@ +#include "onstart_flow_selection_dialog.h" + +#include +#include + +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); +} diff --git a/common/onstart_flow_selection_dialog.h b/common/onstart_flow_selection_dialog.h new file mode 100644 index 00000000..c333b48b --- /dev/null +++ b/common/onstart_flow_selection_dialog.h @@ -0,0 +1,13 @@ +#ifndef ONSTART_FLOW_SELECTION_DIALOG_H +#define ONSTART_FLOW_SELECTION_DIALOG_H + +#include + +class OnStartFlowSelectionDialog : public QDialog +{ + Q_OBJECT +public: + OnStartFlowSelectionDialog(QWidget * parent = 0); +}; + +#endif \ No newline at end of file diff --git a/common/yacreader_flow_gl.cpp b/common/yacreader_flow_gl.cpp index c34e5325..950ae267 100644 --- a/common/yacreader_flow_gl.cpp +++ b/common/yacreader_flow_gl.cpp @@ -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 (n,false); rawImages = QVector (n); diff --git a/images/onStartFlowSelection.png b/images/onStartFlowSelection.png new file mode 100644 index 00000000..5f69ea2a Binary files /dev/null and b/images/onStartFlowSelection.png differ diff --git a/images/useNewFlowButton.png b/images/useNewFlowButton.png new file mode 100644 index 00000000..bd224861 Binary files /dev/null and b/images/useNewFlowButton.png differ diff --git a/images/useOldFlowButton.png b/images/useOldFlowButton.png new file mode 100644 index 00000000..ee6ac75e Binary files /dev/null and b/images/useOldFlowButton.png differ