Update to v106r56 release.

byuu says:

I fixed all outstanding bugs that I'm aware of, including all of the
errata I listed yesterday.

And now it's time for lots of regression testing.

After that, I need to add Talarubi's XAudio2 DRC code, and then get a
new public bsnes WIP out for final testing.

New errata: when setting an icon (nall::image) larger than a Canvas on
Windows, it's not centering the image, so you end up seeing the overscan
area in the state manager previews, and the bottom of the image gets cut
off. I also need to forcefully disable the Xlib screensaver disable
support. I think I'll remove the GUI option to bypass it as well, and
just force screensaver disable always on with Windows. I'll improve it
in the future to toggle the effect between emulator pauses.
This commit is contained in:
Tim Allen
2018-08-06 17:46:00 +10:00
parent b2b51d544f
commit 3b4e8b6d75
29 changed files with 318 additions and 267 deletions

View File

@@ -184,6 +184,16 @@ public slots:
};
#endif
#if defined(Hiro_Label)
struct QtLabel : public QWidget {
Q_OBJECT
public:
QtLabel(pLabel& p) : p(p) {}
auto paintEvent(QPaintEvent*) -> void;
pLabel& p;
};
#endif
#if defined(Hiro_LineEdit)
struct QtLineEdit : public QLineEdit {
Q_OBJECT

View File

@@ -954,6 +954,67 @@ int hiro::QtHorizontalSlider::qt_metacall(QMetaObject::Call _c, int _id, void **
}
return _id;
}
static const uint qt_meta_data_hiro__QtLabel[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char qt_meta_stringdata_hiro__QtLabel[] = {
"hiro::QtLabel\0"
};
void hiro::QtLabel::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
const QMetaObjectExtraData hiro::QtLabel::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject hiro::QtLabel::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_hiro__QtLabel,
qt_meta_data_hiro__QtLabel, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &hiro::QtLabel::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *hiro::QtLabel::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *hiro::QtLabel::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtLabel))
return static_cast<void*>(const_cast< QtLabel*>(this));
return QWidget::qt_metacast(_clname);
}
int hiro::QtLabel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
static const uint qt_meta_data_hiro__QtLineEdit[] = {
// content:

View File

@@ -3,13 +3,10 @@
namespace hiro {
auto pLabel::construct() -> void {
qtWidget = qtLabel = new QLabel;
qtWidget = qtLabel = new QtLabel(*this);
pWidget::construct();
setAlignment(state().alignment);
setBackgroundColor(state().backgroundColor);
setForegroundColor(state().foregroundColor);
setText(state().text);
qtLabel->update();
}
auto pLabel::destruct() -> void {
@@ -23,29 +20,40 @@ auto pLabel::minimumSize() const -> Size {
}
auto pLabel::setAlignment(Alignment alignment) -> void {
if(!alignment) alignment = {0.0, 0.5};
qtLabel->setAlignment((Qt::Alignment)CalculateAlignment(alignment));
qtLabel->update();
}
auto pLabel::setBackgroundColor(Color color) -> void {
static auto defaultColor = qtLabel->palette().color(QPalette::Base);
qtLabel->update();
}
auto palette = qtLabel->palette();
palette.setColor(QPalette::Base, CreateColor(color, defaultColor));
qtLabel->setPalette(palette);
qtLabel->setAutoFillBackground((bool)color);
auto pLabel::setFont(const Font& font) -> void {
pWidget::setFont(font);
qtLabel->update();
}
auto pLabel::setForegroundColor(Color color) -> void {
static auto defaultColor = qtLabel->palette().color(QPalette::Text);
auto palette = qtLabel->palette();
palette.setColor(QPalette::Text, CreateColor(color, defaultColor));
qtLabel->setPalette(palette);
qtLabel->update();
}
auto pLabel::setText(const string& text) -> void {
qtLabel->setText(QString::fromUtf8(text));
qtLabel->update();
}
//QLabel ignores QPalette ... so we have to implement our own Label class atop QWidget ...
auto QtLabel::paintEvent(QPaintEvent* event) -> void {
QPainter painter(p.qtLabel);
if(auto& color = p.state().backgroundColor) {
painter.fillRect(event->rect(), CreateColor(color));
}
if(auto& text = p.state().text) {
if(auto& color = p.state().foregroundColor) {
QPen pen(CreateColor(color));
painter.setPen(pen);
}
auto alignment = p.state().alignment ? p.state().alignment : Alignment{0.0, 0.5};
painter.drawText(event->rect(), CalculateAlignment(alignment), QString::fromUtf8(text));
}
}
}

View File

@@ -8,10 +8,11 @@ struct pLabel : pWidget {
auto minimumSize() const -> Size override;
auto setAlignment(Alignment alignment) -> void;
auto setBackgroundColor(Color color) -> void;
auto setFont(const Font& font) -> void override;
auto setForegroundColor(Color color) -> void;
auto setText(const string& text) -> void;
QLabel* qtLabel = nullptr;
QtLabel* qtLabel = nullptr;
};
}

View File

@@ -54,9 +54,6 @@ auto pWidget::setFont(const Font& font) -> void {
auto pWidget::setGeometry(Geometry geometry) -> void {
if(!qtWidget) return;
// Position displacement = GetDisplacement(&widget);
// geometry.x -= displacement.x;
// geometry.y -= displacement.y;
qtWidget->setGeometry(geometry.x(), geometry.y(), geometry.width(), geometry.height());
self().doSize();
}
@@ -66,12 +63,6 @@ auto pWidget::setVisible(bool visible) -> void {
qtWidget->setVisible(visible);
}
//pWidget::constructor() called before p{Derived}::constructor(); ergo qtWidget is not yet valid
//pWidget::synchronizeState() is called to finish construction of p{Derived}::constructor()
//void pWidget::synchronizeState() {
// setFont(widget.font());
//}
}
#endif

View File

@@ -168,6 +168,7 @@ auto pWindow::setMaximized(bool maximized) -> void {
auto pWindow::setMaximumSize(Size size) -> void {
static auto maximumSize = qtWindow->maximumSize();
if(!state().resizable) size = state().geometry.size();
if(size) {
qtWindow->setMaximumSize(size.width(), size.height() + _menuHeight() + _statusHeight());
} else {
@@ -180,6 +181,7 @@ auto pWindow::setMinimized(bool minimized) -> void {
}
auto pWindow::setMinimumSize(Size size) -> void {
if(!state().resizable) size = state().geometry.size();
qtWindow->setMinimumSize(size.width(), size.height() + _menuHeight() + _statusHeight());
}
@@ -204,12 +206,15 @@ auto pWindow::setModal(bool modal) -> void {
auto pWindow::setResizable(bool resizable) -> void {
if(resizable) {
qtLayout->setSizeConstraint(QLayout::SetDefaultConstraint);
qtContainer->setMinimumSize(state().geometry.width(), state().geometry.height());
//qtContainer->setMinimumSize(state().geometry.width(), state().geometry.height());
} else {
qtLayout->setSizeConstraint(QLayout::SetFixedSize);
qtContainer->setFixedSize(state().geometry.width(), state().geometry.height());
//qtContainer->setFixedSize(state().geometry.width(), state().geometry.height());
}
qtStatusBar->setSizeGripEnabled(resizable);
setMaximumSize(state().maximumSize);
setMinimumSize(state().minimumSize);
}
auto pWindow::setTitle(const string& text) -> void {