-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate studio to qt5
- Loading branch information
Showing
223 changed files
with
1,161 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: build studio | ||
|
||
on: | ||
push: | ||
branches: [ "core4", "feature/*" ] | ||
pull_request: | ||
branches: [ "core4" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set reusable strings | ||
id: strings | ||
shell: bash | ||
run: | | ||
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | ||
- name: Dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install --yes software-properties-common | ||
sudo apt update | ||
sudo apt install --yes \ | ||
cmake build-essential ninja-build ccache \ | ||
bison autoconf automake \ | ||
libpng-dev \ | ||
libjpeg-dev \ | ||
libgif-dev libfreetype6-dev \ | ||
freeglut3-dev \ | ||
liblua5.2-dev libluabind-dev libcpptest-dev \ | ||
libogg-dev libvorbis-dev libopenal-dev \ | ||
libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev \ | ||
libmysqlclient-dev \ | ||
libxml2-dev \ | ||
libcurl4-openssl-dev libssl-dev \ | ||
libsquish-dev \ | ||
liblzma-dev \ | ||
libgsf-1-dev \ | ||
qtbase5-dev qttools5-dev qttools5-dev-tools libqtpropertybrowser-dev | ||
- name: Configure CMake | ||
run: > | ||
cmake -B ${{ steps.strings.outputs.build-output-dir }} | ||
-G "Ninja" | ||
-DWITH_QT5=ON | ||
-DWITH_STUDIO=ON | ||
-DWITH_RYZOM=OFF | ||
-DWITH_NEL_TOOLS=OFF | ||
-DWITH_NEL_SAMPLES=OFF | ||
-DWITH_NEL_TESTS=OFF | ||
-S ${{ github.workspace }} | ||
- name: Build | ||
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target studio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Locate QtPropertyBrowser library | ||
# This module defines | ||
# QtPropertyBrowser_FOUND, if false, do not try to link to QtPropertyBrowser | ||
# QtPropertyBrowser_LIBRARY | ||
# QtPropertyBrowser_INCLUDE_DIR, where to find qtpropertybrowser.h | ||
# QtPropertyBrowser_DIR - Can be set to QtPropertyBrowser install path or Windows build path | ||
|
||
find_path(QtPropertyBrowser_INCLUDE_DIR qtpropertybrowser.h | ||
HINTS ${QTPROPERTYBROWSER_DIR} | ||
PATH_SUFFIXES include QtPropertyBrowser qtpropertybrowser | ||
PATHS | ||
~/Library/Frameworks | ||
/Library/Frameworks | ||
/usr/local | ||
/usr | ||
/sw # Fink | ||
/opt/local # DarwinPorts | ||
/opt/csw # Blastwave | ||
/opt | ||
) | ||
|
||
find_library(QtPropertyBrowser_LIBRARY | ||
NAMES QtPropertyBrowser qtpropertybrowser | ||
HINTS ${QTPROPERTYBROWSER_DIR} | ||
PATH_SUFFIXES lib64 lib | ||
PATHS | ||
~/Library/Frameworks | ||
/Library/Frameworks | ||
/usr/local | ||
/usr | ||
/sw | ||
/opt/local | ||
/opt/csw | ||
/opt | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
# handle the QUIETLY and REQUIRED arguments and set QtPropertyBrowser_FOUND to TRUE if | ||
# all listed variables are TRUE | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(QtPropertyBrowser DEFAULT_MSG QtPropertyBrowser_LIBRARY QtPropertyBrowser_INCLUDE_DIR) | ||
|
||
mark_as_advanced(QtPropertyBrowser_INCLUDE_DIR QtPropertyBrowser_LIBRARY) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
also see: | ||
https://github.com/greenjava/QtPropertyBrowser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FIND_PACKAGE(QtPropertyBrowser REQUIRED) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
set(CMAKE_AUTOMOC ON) | ||
|
||
set(SRC | ||
libqtpropertybrowser-text/QtTextEditorFactory.cpp | ||
libqtpropertybrowser-text/QtTextEditWidget.cpp | ||
libqtpropertybrowser-text/QtTextPropertyManager.cpp | ||
) | ||
|
||
SOURCE_GROUP("" FILES ${SRC}) | ||
|
||
ADD_LIBRARY(QtPropertyBrowserText ${SRC}) | ||
|
||
ADD_LIBRARY(QtPropertyBrowser::Text ALIAS QtPropertyBrowserText) | ||
|
||
TARGET_LINK_LIBRARIES(QtPropertyBrowserText ${QT_LIBRARIES} ${QtPropertyBrowser_LIBRARY}) | ||
|
||
INCLUDE_DIRECTORIES( | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
${QT_INCLUDES} | ||
${QtPropertyBrowser_INCLUDE_DIR} | ||
) | ||
|
||
TARGET_INCLUDE_DIRECTORIES(QtPropertyBrowserText | ||
INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:include> | ||
) |
126 changes: 126 additions & 0 deletions
126
studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
#include <QDialog> | ||
#include <QDialogButtonBox> | ||
#include <QHBoxLayout> | ||
#include <QPlainTextEdit> | ||
#include <QToolButton> | ||
|
||
#include <libqtpropertybrowser-text/QtTextEditWidget.h> | ||
|
||
#if defined(Q_CC_MSVC) | ||
# pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */ | ||
#endif | ||
|
||
#if QT_VERSION >= 0x040400 | ||
QT_BEGIN_NAMESPACE | ||
#endif | ||
|
||
|
||
QtTextEditWidget::QtTextEditWidget(QWidget *parent) : | ||
QWidget(parent), | ||
m_lineEdit(new QLineEdit), | ||
m_defaultButton(new QToolButton), | ||
m_button(new QToolButton) | ||
{ | ||
QHBoxLayout *lt = new QHBoxLayout(this); | ||
lt->setContentsMargins(0, 0, 0, 0); | ||
lt->setSpacing(0); | ||
lt->addWidget(m_lineEdit); | ||
m_lineEdit->setReadOnly(true); | ||
|
||
m_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); | ||
m_button->setFixedWidth(20); | ||
m_button->setText(tr("...")); | ||
m_button->installEventFilter(this); | ||
|
||
setFocusProxy(m_button); | ||
setFocusPolicy(m_button->focusPolicy()); | ||
|
||
m_defaultButton->setIcon(QIcon(":/trolltech/qtpropertybrowser/images/resetproperty.png")); | ||
m_defaultButton->setMaximumWidth(16); | ||
|
||
connect(m_button, SIGNAL(clicked()), this, SLOT(buttonClicked())); | ||
connect(m_defaultButton, SIGNAL(clicked()), this, SIGNAL(resetProperty())); | ||
lt->addWidget(m_button); | ||
lt->addWidget(m_defaultButton); | ||
m_defaultButton->setEnabled(false); | ||
} | ||
|
||
void QtTextEditWidget::setValue(const QString &value) | ||
{ | ||
if (m_lineEdit->text() != value) | ||
m_lineEdit->setText(value); | ||
} | ||
|
||
void QtTextEditWidget::setStateResetButton(bool enabled) | ||
{ | ||
m_defaultButton->setEnabled(enabled); | ||
} | ||
|
||
void QtTextEditWidget::buttonClicked() | ||
{ | ||
QGridLayout *gridLayout; | ||
QPlainTextEdit *plainTextEdit; | ||
QDialogButtonBox *buttonBox; | ||
QDialog *dialog; | ||
|
||
dialog = new QDialog(this); | ||
dialog->resize(400, 300); | ||
gridLayout = new QGridLayout(dialog); | ||
plainTextEdit = new QPlainTextEdit(dialog); | ||
|
||
gridLayout->addWidget(plainTextEdit, 0, 0, 1, 1); | ||
|
||
buttonBox = new QDialogButtonBox(dialog); | ||
buttonBox->setOrientation(Qt::Horizontal); | ||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); | ||
|
||
gridLayout->addWidget(buttonBox, 1, 0, 1, 1); | ||
|
||
QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); | ||
QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); | ||
|
||
plainTextEdit->textCursor().insertText(m_lineEdit->text()); | ||
|
||
dialog->setModal(true); | ||
dialog->show(); | ||
int result = dialog->exec(); | ||
|
||
if (result == QDialog::Accepted) | ||
{ | ||
QString newText = plainTextEdit->document()->toPlainText(); | ||
|
||
setValue(newText); | ||
if (plainTextEdit->document()->isModified()) | ||
Q_EMIT valueChanged(newText); | ||
} | ||
|
||
delete dialog; | ||
} | ||
|
||
bool QtTextEditWidget::eventFilter(QObject *obj, QEvent *ev) | ||
{ | ||
if (obj == m_button) { | ||
switch (ev->type()) { | ||
case QEvent::KeyPress: | ||
case QEvent::KeyRelease: { // Prevent the QToolButton from handling Enter/Escape meant control the delegate | ||
switch (static_cast<const QKeyEvent*>(ev)->key()) { | ||
case Qt::Key_Escape: | ||
case Qt::Key_Enter: | ||
case Qt::Key_Return: | ||
ev->ignore(); | ||
return true; | ||
default: | ||
break; | ||
} | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
return QWidget::eventFilter(obj, ev); | ||
} | ||
|
||
#if QT_VERSION >= 0x040400 | ||
QT_END_NAMESPACE | ||
#endif |
42 changes: 42 additions & 0 deletions
42
studio/src/libqtpropertybrowser-text/libqtpropertybrowser-text/QtTextEditWidget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef LIBQTPROPERTYMANAGER_TEXT_EDIT_WIDGET_H | ||
#define LIBQTPROPERTYMANAGER_TEXT_EDIT_WIDGET_H | ||
|
||
#include <QWidget> | ||
#include <QLineEdit> | ||
#include <QToolButton> | ||
|
||
#if QT_VERSION >= 0x040400 | ||
QT_BEGIN_NAMESPACE | ||
#endif | ||
|
||
class QtTextEditWidget : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
QtTextEditWidget(QWidget *parent); | ||
|
||
bool eventFilter(QObject *obj, QEvent *ev); | ||
|
||
public Q_SLOTS: | ||
void setValue(const QString &value); | ||
void setStateResetButton(bool enabled); | ||
|
||
private Q_SLOTS: | ||
void buttonClicked(); | ||
|
||
Q_SIGNALS: | ||
void valueChanged(const QString &value); | ||
void resetProperty(); | ||
|
||
private: | ||
QLineEdit *m_lineEdit; | ||
QToolButton *m_defaultButton; | ||
QToolButton *m_button; | ||
}; | ||
|
||
#if QT_VERSION >= 0x040400 | ||
QT_END_NAMESPACE | ||
#endif | ||
|
||
#endif // LIBQTPROPERTYMANAGER_TEXT_EDIT_WIDGET_H |
Oops, something went wrong.