Skip to content

Commit db36bbc

Browse files
committed
can now load json and display stuff
0 parents  commit db36bbc

28 files changed

+3372
-0
lines changed

.gitignore

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This file is used to ignore files which are generated
2+
# ----------------------------------------------------------------------------
3+
4+
*~
5+
*.autosave
6+
*.a
7+
*.core
8+
*.moc
9+
*.o
10+
*.obj
11+
*.orig
12+
*.rej
13+
*.so
14+
*.so.*
15+
*_pch.h.cpp
16+
*_resource.rc
17+
*.qm
18+
.#*
19+
*.*#
20+
core
21+
!core/
22+
tags
23+
.DS_Store
24+
.directory
25+
*.debug
26+
Makefile*
27+
*.prl
28+
*.app
29+
moc_*.cpp
30+
ui_*.h
31+
qrc_*.cpp
32+
Thumbs.db
33+
*.res
34+
*.rc
35+
/.qmake.cache
36+
/.qmake.stash
37+
38+
# qtcreator generated files
39+
*.pro.user*
40+
41+
# xemacs temporary files
42+
*.flc
43+
44+
# Vim temporary files
45+
.*.swp
46+
47+
# Visual Studio generated files
48+
*.ib_pdb_index
49+
*.idb
50+
*.ilk
51+
*.pdb
52+
*.sln
53+
*.suo
54+
*.vcproj
55+
*vcproj.*.*.user
56+
*.ncb
57+
*.sdf
58+
*.opensdf
59+
*.vcxproj
60+
*vcxproj.*
61+
62+
# MinGW generated files
63+
*.Debug
64+
*.Release
65+
66+
# Python byte code
67+
*.pyc
68+
69+
# Binaries
70+
# --------
71+
*.dll
72+
*.exe
73+
74+
build
75+
*.user

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "3rdParty/libmodplug"]
2+
path = 3rdParty/libmodplug
3+
url = https://github.com/Konstanty/libmodplug.git
4+
[submodule "3rdParty/jsonxx"]
5+
path = 3rdParty/jsonxx
6+
url = https://github.com/hjiang/jsonxx.git

3rdParty/jsonxx

Submodule jsonxx added at 1a3738d

3rdParty/libmodplug

Submodule libmodplug added at d7ba5ef

CMakeLists.txt

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
3+
project(qt-editor LANGUAGES CXX)
4+
5+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
6+
7+
set(CMAKE_AUTOUIC ON)
8+
set(CMAKE_AUTOMOC ON)
9+
set(CMAKE_AUTORCC ON)
10+
11+
set(CMAKE_CXX_STANDARD 17)
12+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
13+
14+
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
15+
# Check https://doc.qt.io/qt/deployment-android.html for more information.
16+
# They need to be set before the find_package( ...) calls below.
17+
18+
#if(ANDROID)
19+
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
20+
# if (ANDROID_ABI STREQUAL "armeabi-v7a")
21+
# set(ANDROID_EXTRA_LIBS
22+
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
23+
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
24+
# endif()
25+
#endif()
26+
27+
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Multimedia LinguistTools REQUIRED)
28+
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Multimedia LinguistTools REQUIRED)
29+
30+
#set(TS_FILES qt-editor_en_GB.ts)
31+
32+
add_subdirectory(3rdParty/libmodplug)
33+
34+
include_directories(3rdParty/libmodplug/src)
35+
include_directories(3rdParty/jsonxx)
36+
37+
add_library(jsonxx 3rdParty/jsonxx/jsonxx.cc)
38+
target_include_directories(jsonxx PUBLIC
39+
$<BUILD_INTERFACE:
40+
${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/jsonxx)
41+
export(TARGETS jsonxx FILE jsonxx.cmake)
42+
set_property(TARGET jsonxx PROPERTY FOLDER "3rdParty")
43+
44+
set(PROJECT_SOURCES
45+
main.cpp
46+
aboutdialog.ui
47+
editormainwindow.ui
48+
editortab.ui
49+
editormainwindow.cpp
50+
editormainwindow.hpp
51+
editortab.cpp
52+
editortab.hpp
53+
firewidget.cpp
54+
firewidget.hpp
55+
aboutdialog.cpp
56+
aboutdialog.hpp
57+
modthread.cpp
58+
modthread.hpp
59+
model.cpp
60+
model.hpp
61+
resizeablearrowitem.cpp
62+
resizeablearrowitem.hpp
63+
resizeablerectitem.cpp
64+
resizeablerectitem.hpp
65+
resources.qrc
66+
${TS_FILES}
67+
)
68+
69+
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
70+
qt_add_executable(qt-editor
71+
${PROJECT_SOURCES}
72+
)
73+
74+
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
75+
else()
76+
if(ANDROID)
77+
add_library(qt-editor SHARED
78+
${PROJECT_SOURCES}
79+
)
80+
else()
81+
add_executable(qt-editor
82+
${PROJECT_SOURCES}
83+
)
84+
endif()
85+
86+
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
87+
endif()
88+
89+
target_link_libraries(qt-editor PUBLIC Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia modplug jsonxx)

aboutdialog.cpp

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#include "aboutdialog.hpp"
2+
#include "ui_aboutdialog.h"
3+
#include "firewidget.hpp"
4+
#include <QLayout>
5+
#include <QTimer>
6+
7+
AboutDialog::AboutDialog(QWidget *parent) :
8+
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
9+
ui(new Ui::AboutDialog),
10+
mThread( nullptr )
11+
{
12+
ui->setupUi(this);
13+
14+
15+
FireWidget* f = new FireWidget( this );
16+
this->layout()->addWidget( f );
17+
18+
this->startMusic();
19+
20+
this->setMaximumSize( this->size() );
21+
this->setMinimumSize( this->size() );
22+
}
23+
24+
AboutDialog::~AboutDialog()
25+
{
26+
stopMusic();
27+
delete ui;
28+
}
29+
30+
void AboutDialog::stopMusic()
31+
{
32+
if ( mThread )
33+
{
34+
mThread->StopPlay();
35+
mThread->exit( 0 );
36+
mThread->wait( );
37+
delete mThread;
38+
mThread = NULL;
39+
}
40+
}
41+
42+
void AboutDialog::startMusic()
43+
{
44+
if ( !mThread )
45+
{
46+
mThread = new ModThread( ":/about/rsc/about/tune.xm" );
47+
mThread->start();
48+
}
49+
}

aboutdialog.hpp

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
3+
#include <QDialog>
4+
#include "modthread.hpp"
5+
6+
namespace Ui
7+
{
8+
class AboutDialog;
9+
}
10+
11+
class AboutDialog final : public QDialog
12+
{
13+
Q_OBJECT
14+
public:
15+
explicit AboutDialog(QWidget *parent = nullptr);
16+
~AboutDialog();
17+
private:
18+
void stopMusic();
19+
void startMusic();
20+
private:
21+
Ui::AboutDialog *ui;
22+
ModThread* mThread = nullptr;
23+
};

aboutdialog.ui

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>AboutDialog</class>
4+
<widget class="QDialog" name="AboutDialog">
5+
<property name="windowModality">
6+
<enum>Qt::ApplicationModal</enum>
7+
</property>
8+
<property name="geometry">
9+
<rect>
10+
<x>0</x>
11+
<y>0</y>
12+
<width>473</width>
13+
<height>267</height>
14+
</rect>
15+
</property>
16+
<property name="windowTitle">
17+
<string>About</string>
18+
</property>
19+
<property name="autoFillBackground">
20+
<bool>false</bool>
21+
</property>
22+
<property name="styleSheet">
23+
<string notr="true">background-color: black;</string>
24+
</property>
25+
<layout class="QVBoxLayout" name="verticalLayout">
26+
<property name="spacing">
27+
<number>0</number>
28+
</property>
29+
<property name="leftMargin">
30+
<number>0</number>
31+
</property>
32+
<property name="topMargin">
33+
<number>0</number>
34+
</property>
35+
<property name="rightMargin">
36+
<number>0</number>
37+
</property>
38+
<property name="bottomMargin">
39+
<number>0</number>
40+
</property>
41+
<item>
42+
<layout class="QVBoxLayout" name="verticalLayout_2">
43+
<item>
44+
<widget class="QLabel" name="label">
45+
<property name="text">
46+
<string/>
47+
</property>
48+
<property name="pixmap">
49+
<pixmap resource="resources.qrc">:/about/rsc/about/site.png</pixmap>
50+
</property>
51+
<property name="alignment">
52+
<set>Qt::AlignCenter</set>
53+
</property>
54+
</widget>
55+
</item>
56+
<item>
57+
<widget class="QLabel" name="label_2">
58+
<property name="autoFillBackground">
59+
<bool>false</bool>
60+
</property>
61+
<property name="text">
62+
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
63+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
64+
p, li { white-space: pre-wrap; }
65+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
66+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; color:#ffffff;&quot;&gt;Exoddus/Oddysee level editor version 0.7 by Paul (10 years later edition)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
67+
</property>
68+
<property name="textFormat">
69+
<enum>Qt::RichText</enum>
70+
</property>
71+
<property name="alignment">
72+
<set>Qt::AlignCenter</set>
73+
</property>
74+
</widget>
75+
</item>
76+
</layout>
77+
</item>
78+
</layout>
79+
</widget>
80+
<resources>
81+
<include location="resources.qrc"/>
82+
</resources>
83+
<connections/>
84+
</ui>

0 commit comments

Comments
 (0)