feat(editor): added version string to client and editor

This commit is contained in:
maelstrom 2025-07-19 04:47:57 +02:00
parent 4b6fa1d3ff
commit d79d4e3b4a
4 changed files with 43 additions and 7 deletions

View file

@ -3,6 +3,7 @@
#include "objects/part/part.h"
#include "rendering/renderer.h"
#include "common.h"
#include "version.h"
void errorCatcher(int id, const char* str);
@ -22,12 +23,14 @@ int main() {
glfwSetErrorCallback(errorCatcher);
std::string title = std::string() + "Openblocks Client " + BUILD_VERSION;
glfwInit();
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE); // Valid only in OpenGL 3.2+, see: https://stackoverflow.com/a/70519392/16255372
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
GLFWwindow *window = glfwCreateWindow(1200, 900, "OpenBlocks Client ALPHA", NULL, NULL);
GLFWwindow *window = glfwCreateWindow(1200, 900, title.c_str(), NULL, NULL);
glfwSetKeyCallback(window, keyCallback);
glfwSetMouseButtonCallback(window, mouseButtonCallback);
glfwSetCursorPosCallback(window, mouseCallback);

View file

@ -1,5 +1,6 @@
#include "aboutdialog.h"
#include "./ui_aboutdialog.h"
#include "version.h"
#include <qdialogbuttonbox.h>
#include <qnamespace.h>
#include <qplaintextedit.h>
@ -40,6 +41,9 @@ AboutDialog::AboutDialog(QWidget *parent)
{
ui->setupUi(this);
ui->titleString->setText(QString() + "Openblocks Engine " + BUILD_VERSION);
ui->versionString->setText(BUILD_VERSION_LONG);
connect(ui->viewLicense, &QLabel::linkActivated, [this]() {
(new LicenseDialog(this))->open();
});

View file

@ -7,19 +7,19 @@
<x>0</x>
<y>0</y>
<width>582</width>
<height>162</height>
<height>200</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>582</width>
<height>162</height>
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>582</width>
<height>162</height>
<height>200</height>
</size>
</property>
<property name="windowTitle">
@ -29,7 +29,7 @@
<property name="geometry">
<rect>
<x>220</x>
<y>110</y>
<y>140</y>
<width>341</width>
<height>32</height>
</rect>
@ -57,7 +57,7 @@
<pixmap resource="editor.qrc">:/placeholder-logo.png</pixmap>
</property>
</widget>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="titleString">
<property name="geometry">
<rect>
<x>110</x>
@ -67,7 +67,7 @@
</rect>
</property>
<property name="text">
<string>Openblocks Engine ALPHA SNAPSHOT</string>
<string>Openblocks Engine</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
@ -96,6 +96,32 @@
<string>&lt;a href=&quot;/license&quot;&gt;View license...&lt;/a&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>20</x>
<y>110</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Version:</string>
</property>
</widget>
<widget class="QLabel" name="versionString">
<property name="geometry">
<rect>
<x>110</x>
<y>110</y>
<width>451</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>unknown</string>
</property>
</widget>
</widget>
<resources>
<include location="editor.qrc"/>

View file

@ -10,6 +10,7 @@
#include "placedocument.h"
#include "script/scriptdocument.h"
#include "undohistory.h"
#include "version.h"
#include <memory>
#include <qclipboard.h>
#include <qevent.h>
@ -73,6 +74,8 @@ MainWindow::MainWindow(QWidget *parent)
ui->setupUi(this);
setMouseTracking(true);
setWindowTitle(QString() + "Openblocks Editor " + BUILD_VERSION);
ui->actionRedo->setShortcuts({QKeySequence("Ctrl+Shift+Z"), QKeySequence("Ctrl+Y")});
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() + QStringList { "./assets/icons" });