OSDN Git Service

[UI][Qt][ABOUT_DIALOG] Print OpenGL version within dialog.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 27 Oct 2019 11:36:30 +0000 (20:36 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 27 Oct 2019 11:36:30 +0000 (20:36 +0900)
[UI][Qt][ABOUT_DIALOG] Maybe improve credit displaying.

source/src/qt/gui/display_about.cpp
source/src/qt/gui/display_about.h
source/src/qt/gui/menu_main.cpp
source/src/qt/gui/qt_gldraw.cpp
source/src/qt/gui/qt_gldraw.h
source/src/qt/gui/qt_glutil.cpp
source/src/res/credits.html

index 769ac3d..4ec8104 100644 (file)
@@ -18,7 +18,7 @@
 
 //extern USING_FLAGS *using_flags;
 
-Dlg_AboutCSP::Dlg_AboutCSP(USING_FLAGS *p, QWidget *parent) : QWidget(NULL)
+Dlg_AboutCSP::Dlg_AboutCSP(USING_FLAGS *p, QString rendererString, QWidget *parent) : QWidget(NULL)
 {
        QByteArray tmps;
        QFile f_credits(":/credits.html");
@@ -33,7 +33,9 @@ Dlg_AboutCSP::Dlg_AboutCSP(USING_FLAGS *p, QWidget *parent) : QWidget(NULL)
        using_flags = p;
        // Credits
        credits.clear();
-       printf("%x\n",parent_widget);
+       renderer = rendererString;
+       
+//     printf("%x\n",parent_widget);
        if(f_credits.open(QIODevice::ReadOnly | QIODevice::Text)) {
                tmps = f_credits.readAll();
                if(!tmps.isEmpty()) {
@@ -55,6 +57,11 @@ Dlg_AboutCSP::Dlg_AboutCSP(USING_FLAGS *p, QWidget *parent) : QWidget(NULL)
                        if(ni >= 0) {
                                ns.replace(ni, reps.length(), bs);
                        }
+                       reps = QString::fromUtf8("@@RendererType@@");
+                       ni = ns.indexOf(reps);
+                       if(ni >= 0) {
+                               ns.replace(ni, reps.length(), renderer);
+                       }
                        
                        credits = ns;
                }
index a8bc1fc..45f7156 100644 (file)
@@ -13,6 +13,7 @@
 #include <QVBoxLayout>
 #include <QHBoxLayout>
 #include <QGroupBox>
+#include <QString>
 
 #include "common.h"
 
@@ -34,8 +35,9 @@ protected:
        QLabel *revarea;
        QWidget *BoxTitle;
        QVBoxLayout *VBox;
+       QString renderer;
 public:
-       Dlg_AboutCSP(USING_FLAGS *p, QWidget *parent = 0);
+       Dlg_AboutCSP(USING_FLAGS *p, QString rendererString = QString::fromUtf8(""), QWidget *parent = 0);
        ~Dlg_AboutCSP();
        
 };
index ffa29ea..0bcceb8 100644 (file)
@@ -171,7 +171,11 @@ void Ui_MainWindowBase::do_set_window_focus_type(bool flag)
 
 void Ui_MainWindowBase::do_show_about(void)
 {
-       Dlg_AboutCSP *dlg = new Dlg_AboutCSP(using_flags, static_cast<QWidget *>(this));
+       QString renderStr;
+       if(graphicsView != NULL) {
+               renderStr = graphicsView->getRenderString();
+       }
+       Dlg_AboutCSP *dlg = new Dlg_AboutCSP(using_flags, renderStr, static_cast<QWidget *>(this));
        dlg->show();
 }
 
index eef9217..a4476d0 100644 (file)
@@ -90,7 +90,6 @@ void GLDrawClass::paintGL(void)
                        extfunc->resizeGL(draw_width, draw_height);
                        delay_update = false;
                }
-               //extfunc->paintGL();
        }
        emit sig_draw_timing();
        SaveToPixmap(); // If save requested, then Save to Pixmap.
@@ -243,3 +242,31 @@ const bool GLDrawClass::is_ready_to_map_vram_texture(void)
        if(extfunc == NULL) return false;
        return extfunc->is_ready_to_map_vram_texture();
 }
+
+QString GLDrawClass::getRenderString()
+{
+       QString s;
+       QString _head;
+       QOpenGLContext *ctx;
+       ctx = context();
+       if(ctx != NULL) {
+               QSurfaceFormat fmt = ctx->format();
+               int major = fmt.majorVersion();
+               int minor = fmt.minorVersion();
+               if(ctx->isOpenGLES()) {
+                       _head = QString::fromUtf8("OpenGL ES v");
+               } else {
+                       if(fmt.profile() == QSurfaceFormat::CoreProfile) {
+                               _head = QString::fromUtf8("OpenGL (Core) v");
+                       } else {
+                               _head = QString::fromUtf8("OpenGL (Main) v");
+                       }                               
+               }
+               s = QString::fromUtf8("Host:&nbsp;");
+               s = s + _head + QString::number(major) +
+                       QString::fromUtf8(".")  + QString::number(minor) + QString::fromUtf8("<BR>");
+       } else {
+               s = QString::fromUtf8("Host: NOT OpenGL <BR>");
+       }
+       return s + render_string;
+}
index 217172d..74b2111 100644 (file)
@@ -19,6 +19,7 @@
 #include <QColor>
 #include <QPixmap>
 #include <QString>
+#include <QPair>
 
 class EMU;
 class QEvent;
@@ -53,10 +54,11 @@ class DLL_PREFIX GLDrawClass: public QOpenGLWidget
        int draw_height;
        
        bool delay_update;
-
+       
  protected:
        bool run_vm;
-
+       QString render_string;
+       
        void keyReleaseEvent(QKeyEvent *event);
        void keyPressEvent(QKeyEvent *event);
        void initializeGL();
@@ -112,6 +114,8 @@ public:
        GLuint get_mapped_buffer_num(int region);
 
        scrntype_t* get_screen_buffer(int y);
+
+       virtual QString getRenderString();
 public slots:
        void initKeyCode(void);
        void releaseKeyCode(void);
index c2f6bd2..9b4ea86 100644 (file)
@@ -299,6 +299,7 @@ void GLDrawClass::InitFBO(void)
                                if(_glversion.second >= 1) {
                                        extfunc = new GLDraw_ES_2(this, using_flags, csp_logger);
                                        if(extfunc != NULL) {
+                                               _major_version = 3;
                                                csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL, "Use OpenGL ES(v3.1) Renderer");
                                                goto _nr_end;
                                        }
@@ -310,6 +311,8 @@ void GLDrawClass::InitFBO(void)
                   (_major_version >= 2)){
                        extfunc = new GLDraw_ES_2(this, using_flags, csp_logger);
                        if(extfunc != NULL) {
+                               _major_version = 2;
+                               _minor_version = 0;
                                csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL, "Use OpenGL ES(v2.0) Renderer");
                                goto _nr_end;
                        }
@@ -322,6 +325,9 @@ void GLDrawClass::InitFBO(void)
                  ((_major_version >= 5) || ((_major_version == 4) && (_minor_version >= 3)))){
                        extfunc = new GLDraw_4_5(this, using_flags, csp_logger); // ToDo
                        if(extfunc != NULL) {
+                               _major_version = 4;
+                               _minor_version = 5;
+                               render_type = CONFIG_RENDER_PLATFORM_OPENGL_CORE;
                                csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL, "Use OpenGL v4.5(CORE) Renderer");
                                goto _nr_end;
                        }
@@ -333,7 +339,10 @@ void GLDrawClass::InitFBO(void)
                   (_major_version >= 3)){
                        extfunc = new GLDraw_3_0(this, using_flags, csp_logger);
                        if(extfunc != NULL) {
+                               _major_version = 3;
+                               _minor_version = 0;
                                csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL, "Use OpenGL v3.0 Renderer");
+                               render_type = CONFIG_RENDER_PLATFORM_OPENGL_MAIN;
                                goto _nr_end;
                        }
                }
@@ -343,13 +352,32 @@ void GLDrawClass::InitFBO(void)
                        }                               
                        extfunc = new GLDraw_2_0(this, using_flags, csp_logger);
                        if(extfunc != NULL) {
+                               _major_version = 2;
+                               _minor_version = 0;
                                csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL, "Use OpenGL v2.0 Renderer");
+                               render_type = CONFIG_RENDER_PLATFORM_OPENGL_MAIN;
                                goto _nr_end;
                        }
                }
        }
 _nr_end:
        if(extfunc != NULL) {
+               if((render_type != CONFIG_RENDER_PLATFORM_OPENGL_MAIN) &&
+                  (render_type != CONFIG_RENDER_PLATFORM_OPENGL_CORE) &&
+                  (render_type != CONFIG_RENDER_PLATFORM_OPENGL_ES)) {
+                       render_string = QString::fromUtf8("Emu:  Not OpenGL");
+               } else {
+                       QString _head;
+                       if(render_type == CONFIG_RENDER_PLATFORM_OPENGL_ES) {
+                               _head = QString::fromUtf8("OpenGL ES v");
+                       } else if(render_type == CONFIG_RENDER_PLATFORM_OPENGL_CORE) {
+                               _head = QString::fromUtf8("OpenGL (Core) v");
+                       } else {
+                               _head = QString::fromUtf8("OpenGL (Main) v");
+                       }                               
+                       render_string = QString::fromUtf8("Emu:&nbsp;&nbsp;") + _head + QString::number(_major_version) +
+                               QString::fromUtf8(".") + QString::number(_minor_version) + QString::fromUtf8("<BR>");
+               }
                extfunc->initGLObjects();
                extfunc->initFBO();
                extfunc->initLocalGLObjects();
index 18b0940..f4421fe 100644 (file)
 
 <body>
 <h1>Common Source Code Project</h1>
-<DIV ALIGN=RIGHT><FONT SIZE=3>
+
+<DIV ALIGN=LEFT><FONT SIZE=5>
+<h3>Renderer Type:</h3>
+</DIV>
+<DIV ALIGN=RIGHT><h3>
+@@RendererType@@
+</h3>
+</DIV>
+</FONT>
+
+<DIV ALIGN=RIGHT><FONT SIZE=4>
 Upstream Version: 2019-04-30<BR>
 Qt Port and FM7 series 2019-10-15<BR>
 FFMPEG 4.2 + liblame 3.100 + libx264-158<BR>
 @@RevisionString@@
 </FONT></DIV>
 <BR>
-<DIV ALIGN=RIGHT><FONT SIZE=3>
-<h2>Upstream Author:</h2>
-2006,2015 ©TAKEDA Toshiya<BR>
-<B>HP:</B><BR> <A HREF="http://takeda-toshiya.my.coocan.jp/common/index.html">http://takeda-toshiya.my.coocan.jp/common/index.html</A><BR>
 
-<h2>Porting to Qt:</h2>
-2015 ©Kyuma Ohta<BR>
-<B>HP1:</B><BR> <A HREF="https://github.com/Artanejp/common_source_project-fm7">https://github.com/Artanejp/common_source_project-fm7</A><BR>
-<B>HP2:</B><BR> <A HREF="https://osdn.jp/projects/csp-qt/">https://osdn.jp/projects/csp-qt/</A><BR>
+<FONT SIZE=4>
+<DIV ALIGN=LEFT>
+<h2>Upstream Author:<BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2006,2015,2019 ©TAKEDA Toshiya</h2>
+</DIV>
+<DIV ALIGN=LEFT>
+<B>HP:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
+<A HREF="http://takeda-toshiya.my.coocan.jp/common/index.html">http://takeda-toshiya.my.coocan.jp/common/index.html</A><BR>
+</DIV>
+<DIV ALIGN=LEFT>
+<h2>Porting to Qt: <BR>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2015-2019 ©Kyuma Ohta</h2>
+</DIV>
+</DIV>
+
+<DIV ALIGN=LEFT>
+<B>HP1:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
+<A HREF="https://github.com/Artanejp/common_source_project-fm7">https://github.com/Artanejp/common_source_project-fm7</A>
+</DIV>
+<DIV ALIGN=LEFT>
+<B>HP2:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
+<A HREF="https://osdn.jp/projects/csp-qt/">https://osdn.jp/projects/csp-qt/</A><BR>
 <I>E-Mail: whatisthis.sowhat _at_ gmail.com </I><BR>
 <I>Twitter: @Artanejp</I><BR>
-<BR>
+</DIV>
+
+<DIV ALIGN=LEFT>
 <H2>Thanks to:</h2>
-Ryu Takegami for FM-7/8/77/AV/40/EX<BR>
-<B>HP:</B><BR> <A HREF="http://xm7.la.coocan.jp/xm7/">http://xm7.la.coocan.jp/xm7/</A><BR>
-はせりん for FM-7/8/77/AV/40/EX<BR>
-<B>HP:</B><BR> <A HREF="http://www.mindspring.com/~thasegaw/rpcg/index.html">http://www.mindspring.com/~thasegaw/rpcg/index.html</A><BR>
+</DIV>
 
+<DIV ALIGN=LEFT>
+<H3>
+- Ryu Takegami for FM-7/8/77/AV/40/EX<BR>
+</H3>
+</DIV>
+<DIV ALIGN=LEFT>
+<B>HP:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
+<A HREF="http://xm7.la.coocan.jp/xm7/">http://xm7.la.coocan.jp/xm7/</A>
+<BR><BR>
+</DIV>
+<DIV ALIGN=LEFT>
+<H3>
+- はせりん for FM-7/8/77/AV/40/EX
+</H3>
+</DIV>
+<DIV ALIGN=LEFT>
+<B>HP:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
+<A HREF="http://www.mindspring.com/~thasegaw/rpcg/index.html">http://www.mindspring.com/~thasegaw/rpcg/index.html</A>
+</DIV>
 
-<h2>PC-6001 Series , SEGA Master System/Game Gear, MSX1 and MSX2:</h2>
-2015 ©tanam<BR>
-<B>HP:</B><BR> <A HREF="http://www.geocities.jp/parallel_computer_inc/android.html">http://www.geocities.jp/parallel_computer_inc/android.html</A><BR>
+<DIV ALIGN=LEFT>
+<h3>PC-6001 Series , SEGA Master System/Game Gear, MSX1 and MSX2:</h3>
+</DIV>
+<DIV ALIGN=LEFT>
+<h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2015 ©tanam</h3>
+</DIV>
+<B>HP:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
+<A HREF="http://www.geocities.jp/parallel_computer_inc/android.html">http://www.geocities.jp/parallel_computer_inc/android.html</A>
+</DIV>
 
-<h2>MSX1 and MSX2:</h2>
-2015 ©umaiboux<BR>
-<B>HP:</B><BR> <A HREF="http://umaiboux.k-free.net/">http://umaiboux.k-free.net/</A><BR>
+<DIV ALIGN=LEFT>
+<h3>MSX1 and MSX2: <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2015 ©umaiboux</h3>
+</DIV>
+<DIV ALIGN=LEFT>
+<B>HP:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
+<A HREF="http://umaiboux.k-free.net/">http://umaiboux.k-free.net/</A>
+</DIV>
 
-<h2>MZ-80A:</h2>
-2014,2015 ©hideki suga<BR>
-<B>HP:</B><BR> <A HREF="http://www.ne.jp/asahi/suga/junkyard/">http://www.ne.jp/asahi/suga/junkyard/</A><BR>
+<DIV ALIGN=LEFT>
+<h3>MZ-80A: <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2014,2015 ©hideki suga</h3>
+</DIV>
+<DIV ALIGN=LEFT>
+<B>HP:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
+<A HREF="http://www.ne.jp/asahi/suga/junkyard/">http://www.ne.jp/asahi/suga/junkyard/</A>
+</DIV>
 
-<h2>Z80 TV Game:</h2>
-2014,2015 ©Isizu<BR>
-<B>HP:</B><BR> <A HREF="http://w01.tp1.jp/~a571632211/index.html">http://w01.tp1.jp/~a571632211/index.html</A><BR>
-<A HREF="http://w01.tp1.jp/~a571632211/z80tvgame/index.html">http://w01.tp1.jp/~a571632211/z80tvgame/index.html</A><BR>
+<DIV ALIGN=LEFT>
+<h3>Z80 TV Game: <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2014,2015 ©Isizu</h3>
+</DIV>
+<DIV ALIGN=LEFT>
+<B>HP:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
+<A HREF="http://w01.tp1.jp/~a571632211/index.html">http://w01.tp1.jp/~a571632211/index.html</A><BR>
+<A HREF="http://w01.tp1.jp/~a571632211/z80tvgame/index.html">http://w01.tp1.jp/~a571632211/z80tvgame/index.html</A>
+</DIV>
 
-<h2>FM-7/8/77/AV Series:</h2>
-2015 ©Kyuma Ohta<BR>
-<B>HP:</B><BR>
+<DIV ALIGN=LEFT>
+<h3>FM-7/8/77/AV Series: <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2015 ©Kyuma Ohta</h3>
+</DIV>
+<DIV ALIGN=LEFT>
+<B>HP:</B>
+</DIV>
+<DIV ALIGN=RIGHT>
 <A HREF="https://osdn.jp/projects/csp-qt/">https://osdn.jp/projects/csp-qt/</A><BR>
+</DIV>
+<DIV ALIGN=LEFT>
 <B>Secondary:</B><BR>
+</DIV>
+<DIV ALIGN=RIGHT>
+
 <A HREF="https://github.com/Artanejp/common_source_project-fm7">https://github.com/Artanejp/common_source_project-fm7</A><BR>
 <BR>
+<I>E-Mail: whatisthis.sowhat _at_ gmail.com </I>
+</DIV>
 <BR>
-<I>E-Mail: whatisthis.sowhat _at_ gmail.com </I><BR>
-<BR>
-<BR>
+<DIV ALIGN=LEFT>
 <B>All of distributing are published under Gnu Public License version 2.<BR>
 You must publish sourcecodes to users of binaries, you must publish changes of source codes to users.<BR>
 <BR>
 See also:<BR>
-<A HREF="https://www.gnu.org/licenses/gpl-2.0.html">https://www.gnu.org/licenses/gpl-2.0.html</A> .<BR>
+<DIV ALIGN=RIGHT>
+<A HREF="https://www.gnu.org/licenses/gpl-2.0.html">https://www.gnu.org/licenses/gpl-2.0.html</A> .
+</DIV>
+<BR>
 </B>
 </FONT>
 <hr>
+</DIV>
+<DIV ALIGN=RIGHT>
 <address></address>
 <!-- hhmts start -->Last modified: @@BuildDateAt@@<!-- hhmts end -->
+</DIV>
 </body> </html>