Update to v106r38 release.

byuu says:

Changelog:

  - hiro: added Qt5 support
  - hiro: added GTK3 support (currently runs very poorly)
  - bsnes: number of recent games and quick state slots can be changed
    programmatically now
      - I may expose this as a configuration file setting, but probably
        not within the GUI
  - nall: use -Wno-everything when compiling with Clang
      - sorry, Clang's meaningless warning messages are just endless ...
This commit is contained in:
Tim Allen
2018-06-10 18:06:02 +10:00
parent 173a5d67bc
commit 15b67922b3
30 changed files with 1132 additions and 719 deletions

View File

@@ -32,21 +32,30 @@ auto pApplication::quit() -> void {
//obviously, it is used as sparingly as possible
auto pApplication::syncX() -> void {
for(auto n : range(8)) {
#if HIRO_QT==4
QApplication::syncX();
#elif HIRO_QT==5
QApplication::sync();
#endif
Application::processEvents();
usleep(2000);
}
}
auto pApplication::initialize() -> void {
#if HIRO_QT==5 && defined(PLATFORM_BSD)
setenv("QTCOMPOSE", "/usr/local/lib/X11/locale/", 0);
#endif
display = XOpenDisplay(0);
auto name = Application::state.name ? Application::state.name : string{"hiro"};
int argc = 1;
char* argv[] = {name.get(), nullptr};
char** argvp = argv;
//QApplication stores references to argc;
//and will access them after pApplication::initialize() returns
static int argc = 1;
static char* argv[] = {name.get(), nullptr};
static char** argvp = argv;
qtApplication = new QApplication(argc, argvp);
pKeyboard::initialize();

View File

@@ -1,5 +1,8 @@
#include <QApplication>
#include <QtGui>
#if HIRO_QT==5
#include <QtWidgets>
#endif
#include <nall/xorg/guard.hpp>
#define XK_MISCELLANY
#define XK_LATIN1
@@ -12,5 +15,7 @@
//Qt 4.8.0 and earlier improperly define the QLOCATION macro
//in C++11, it is detected as a malformed user-defined literal
//below is a workaround to fix compilation errors caused by this
#undef QLOCATION
#define QLOCATION "\0" __FILE__ ":" QTOSTRING(__LINE__)
#if HIRO_QT==4
#undef QLOCATION
#define QLOCATION "\0" __FILE__ ":" QTOSTRING(__LINE__)
#endif

View File

@@ -1,4 +1,4 @@
//moc-qt4 -i -o qt.moc qt.hpp
//$(moc) -i -o qt.moc qt.hpp
/*
Qt requires moc in order to bind callbacks, which causes many complications.

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,11 @@ namespace hiro {
Settings::Settings() {
string path = {Path::userData(), "hiro/"};
auto document = BML::unserialize(file::read({path, "qt.bml"}));
#if HIRO_QT==4
auto document = BML::unserialize(file::read({path, "qt4.bml"}));
#elif HIRO_QT==5
auto document = BML::unserialize(file::read({path, "qt5.bml"}));
#endif
auto get = [&](string_view name) {
return document[name];
@@ -32,7 +36,11 @@ Settings::~Settings() {
set("Geometry/MenuHeight", geometry.menuHeight);
set("Geometry/StatusHeight", geometry.statusHeight);
file::write({path, "qt.bml"}, BML::serialize(document));
#if HIRO_QT==4
file::write({path, "qt4.bml"}, BML::serialize(document));
#elif HIRO_QT==5
file::write({path, "qt5.bml"}, BML::serialize(document));
#endif
}
}

View File

@@ -78,10 +78,18 @@ auto pTableViewColumn::_parent() -> maybe<pTableViewHeader&> {
auto pTableViewColumn::_setState() -> void {
if(auto header = _parent()) {
if(auto parent = header->_parent()) {
#if HIRO_QT==4
parent->qtTableView->header()->setResizeMode(self().offset(), state().resizable ? QHeaderView::Interactive : QHeaderView::Fixed);
#elif HIRO_QT==5
parent->qtTableView->header()->setSectionResizeMode(self().offset(), state().resizable ? QHeaderView::Interactive : QHeaderView::Fixed);
#endif
bool clickable = false;
for(auto& column : header->state().columns) clickable |= column->state.sortable;
#if HIRO_QT==4
parent->qtTableView->header()->setClickable(clickable);
#elif HIRO_QT==5
parent->qtTableView->header()->setSectionsClickable(clickable);
#endif
parent->qtTableView->headerItem()->setText(self().offset(), QString::fromUtf8(state().text));
parent->qtTableView->setColumnHidden(self().offset(), !self().visible());

View File

@@ -8,7 +8,11 @@ auto pTableView::construct() -> void {
qtTableView->setContextMenuPolicy(Qt::CustomContextMenu);
qtTableView->setRootIsDecorated(false);
qtTableView->setHeaderHidden(true);
#if HIRO_QT==4
qtTableView->header()->setMovable(false);
#elif HIRO_QT==5
qtTableView->header()->setSectionsMovable(false);
#endif
qtTableViewDelegate = new QtTableViewDelegate(*this);
qtTableView->setItemDelegate(qtTableViewDelegate);

View File

@@ -135,7 +135,11 @@ auto pWindow::setFullScreen(bool fullScreen) -> void {
auto pWindow::setGeometry(Geometry geometry) -> void {
lock();
Application::processEvents();
#if HIRO_QT==4
QApplication::syncX();
#elif HIRO_QT==5
QApplication::sync();
#endif
setResizable(state().resizable);
qtWindow->move(geometry.x() - frameMargin().x(), geometry.y() - frameMargin().y());