Update to v094r41 release (open beta).

byuu says:

Changelog (since the last open beta):
- icarus is now included. icarus is used to import game files/archives
  into game paks (folders)
- SNES: mid-scanline BGMODE changes now emulated correctly (used only by
  atx2.smc Anthrox Demo)
- GBA: fixed a CPU bug that was causing dozens of games to have
  distorted audio
- GBA: fixed default FlashROM ID; should allow much higher compatibility
- GBA: now using Cydrak's new, much improved, GBA color emulation filter
  (still a work-in-progress)
- re-added command-line loading support for game paks (not for game
  files/archives, sorry!)
- Qt port now compiles and runs again (may be a little buggy;
  Windows/GTK+ ports preferred)
- SNES performance profile now compiles and runs again
- much more
This commit is contained in:
Tim Allen
2015-08-21 20:56:39 +10:00
parent 4344b916b6
commit 213879771e
62 changed files with 499 additions and 515 deletions

View File

@@ -9,53 +9,15 @@ auto pAction::destruct() -> void {
}
auto pAction::setEnabled(bool enabled) -> void {
/*
if(dynamic_cast<Menu*>(&action)) {
((Menu&)action).p.qtMenu->setEnabled(enabled);
} else if(dynamic_cast<Separator*>(&action)) {
((Separator&)action).p.qtAction->setEnabled(enabled);
} else if(dynamic_cast<Item*>(&action)) {
((Item&)action).p.qtAction->setEnabled(enabled);
} else if(dynamic_cast<CheckItem*>(&action)) {
((CheckItem&)action).p.qtAction->setEnabled(enabled);
} else if(dynamic_cast<RadioItem*>(&action)) {
((RadioItem&)action).p.qtAction->setEnabled(enabled);
}
*/
_setState();
}
auto pAction::setFont(const string& font) -> void {
/*
QFont qtFont = pFont::create(font);
if(dynamic_cast<Menu*>(&action)) {
((Menu&)action).p.setFont(font);
} else if(dynamic_cast<Separator*>(&action)) {
((Separator&)action).p.qtAction->setFont(qtFont);
} else if(dynamic_cast<Item*>(&action)) {
((Item&)action).p.qtAction->setFont(qtFont);
} else if(dynamic_cast<CheckItem*>(&action)) {
((CheckItem&)action).p.qtAction->setFont(qtFont);
} else if(dynamic_cast<RadioItem*>(&action)) {
((RadioItem&)action).p.qtAction->setFont(qtFont);
}
*/
_setState();
}
auto pAction::setVisible(bool visible) -> void {
/*
if(dynamic_cast<Menu*>(&action)) {
((Menu&)action).p.qtMenu->menuAction()->setVisible(visible);
} else if(dynamic_cast<Separator*>(&action)) {
((Separator&)action).p.qtAction->setVisible(visible);
} else if(dynamic_cast<Item*>(&action)) {
((Item&)action).p.qtAction->setVisible(visible);
} else if(dynamic_cast<CheckItem*>(&action)) {
((CheckItem&)action).p.qtAction->setVisible(visible);
} else if(dynamic_cast<RadioItem*>(&action)) {
((RadioItem&)action).p.qtAction->setVisible(visible);
}
*/
_setState();
}
auto pAction::_parentMenu() -> maybe<pMenu&> {

View File

@@ -33,10 +33,6 @@ auto pMenu::append(sAction action) -> void {
auto pMenu::remove(sAction action) -> void {
}
auto pMenu::setFont(const string& font) -> void {
_setState();
}
auto pMenu::setIcon(const image& icon) -> void {
_setState();
}
@@ -46,9 +42,11 @@ auto pMenu::setText(const string& text) -> void {
}
auto pMenu::_setState() -> void {
qtMenu->setEnabled(self().enabled());
qtMenu->setFont(pFont::create(self().font(true)));
qtMenu->setIcon(CreateIcon(state().icon));
qtMenu->setTitle(QString::fromUtf8(state().text));
qtMenu->menuAction()->setVisible(self().visible());
for(auto& action : state().actions) {
if(auto self = action->self()) self->setFont(action->font(true));

View File

@@ -7,7 +7,6 @@ struct pMenu : public pAction {
auto append(sAction action) -> void;
auto remove(sAction action) -> void;
auto setFont(const string& font) -> void override;
auto setIcon(const image& icon) -> void;
auto setText(const string& text) -> void;

View File

@@ -49,7 +49,7 @@ auto pFont::size(const QFont& qtFont, const string& text) -> Size {
QFontMetrics metrics(qtFont);
lstring lines;
lines.split("\n", text ? text : " ");
lines.split(text ? text : " ", "\n");
unsigned maxWidth = 0;
for(auto& line : lines) {

View File

@@ -43,7 +43,7 @@
#include "widget/console.cpp"
#include "widget/frame.cpp"
#include "widget/hex-edit.cpp"
#include "widget/horizontal-scroller.cpp"
#include "widget/horizontal-scroll-bar.cpp"
#include "widget/horizontal-slider.cpp"
#include "widget/icon-view.cpp"
#include "widget/label.cpp"
@@ -59,7 +59,7 @@
#include "widget/tab-frame.cpp"
#include "widget/tab-frame-item.cpp"
#include "widget/text-edit.cpp"
#include "widget/vertical-scroller.cpp"
#include "widget/vertical-scroll-bar.cpp"
#include "widget/vertical-slider.cpp"
#include "widget/viewport.cpp"

View File

@@ -45,7 +45,7 @@
#include "widget/combo-button-item.hpp"
#include "widget/frame.hpp"
#include "widget/hex-edit.hpp"
#include "widget/horizontal-scroller.hpp"
#include "widget/horizontal-scroll-bar.hpp"
#include "widget/horizontal-slider.hpp"
#include "widget/label.hpp"
#include "widget/line-edit.hpp"
@@ -60,7 +60,7 @@
#include "widget/tab-frame.hpp"
#include "widget/tab-frame-item.hpp"
#include "widget/text-edit.hpp"
#include "widget/vertical-scroller.hpp"
#include "widget/vertical-scroll-bar.hpp"
#include "widget/vertical-slider.hpp"
#include "widget/viewport.hpp"

View File

@@ -134,7 +134,7 @@ public:
QtComboButton(pComboButton& p) : p(p) {}
pComboButton& p;
public slots:
void onChange();
void onChange(int offset);
};
#endif
@@ -160,12 +160,12 @@ public slots:
};
#endif
#if defined(Hiro_HorizontalScroller)
struct QtHorizontalScroller : public QScrollBar {
#if defined(Hiro_HorizontalScrollBar)
struct QtHorizontalScrollBar : public QScrollBar {
Q_OBJECT
public:
QtHorizontalScroller(pHorizontalScroller& p) : QScrollBar(Qt::Horizontal), p(p) {}
pHorizontalScroller& p;
QtHorizontalScrollBar(pHorizontalScrollBar& p) : QScrollBar(Qt::Horizontal), p(p) {}
pHorizontalScrollBar& p;
public slots:
void onChange();
};
@@ -208,7 +208,7 @@ public slots:
void onChange();
void onContext();
void onSort(int column);
void onToggle(QTreeWidgetItem* item);
void onToggle(QTreeWidgetItem* item, int column);
};
struct QtListViewDelegate : public QStyledItemDelegate {
@@ -263,12 +263,12 @@ public slots:
};
#endif
#if defined(Hiro_VerticalScroller)
struct QtVerticalScroller : public QScrollBar {
#if defined(Hiro_VerticalScrollBar)
struct QtVerticalScrollBar : public QScrollBar {
Q_OBJECT
public:
QtVerticalScroller(pVerticalScroller& p) : QScrollBar(Qt::Vertical), p(p) {}
pVerticalScroller& p;
QtVerticalScrollBar(pVerticalScrollBar& p) : QScrollBar(Qt::Vertical), p(p) {}
pVerticalScrollBar& p;
public slots:
void onChange();
};

View File

@@ -608,13 +608,14 @@ static const uint qt_meta_data_hiro__QtComboButton[] = {
0, // signalCount
// slots: signature, parameters, type, tag, flags
20, 31, 31, 31, 0x0a,
20, 34, 41, 41, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_hiro__QtComboButton[] = {
"hiro::QtComboButton\0onChange()\0\0"
"hiro::QtComboButton\0onChange(int)\0"
"offset\0\0"
};
void hiro::QtComboButton::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
@@ -623,11 +624,10 @@ void hiro::QtComboButton::qt_static_metacall(QObject *_o, QMetaObject::Call _c,
Q_ASSERT(staticMetaObject.cast(_o));
QtComboButton *_t = static_cast<QtComboButton *>(_o);
switch (_id) {
case 0: _t->onChange(); break;
case 0: _t->onChange((*reinterpret_cast< int(*)>(_a[1]))); break;
default: ;
}
}
Q_UNUSED(_a);
}
const QMetaObjectExtraData hiro::QtComboButton::staticMetaObjectExtraData = {
@@ -804,7 +804,7 @@ int hiro::QtHexEditScrollBar::qt_metacall(QMetaObject::Call _c, int _id, void **
}
return _id;
}
static const uint qt_meta_data_hiro__QtHorizontalScroller[] = {
static const uint qt_meta_data_hiro__QtHorizontalScrollBar[] = {
// content:
6, // revision
@@ -818,21 +818,21 @@ static const uint qt_meta_data_hiro__QtHorizontalScroller[] = {
0, // signalCount
// slots: signature, parameters, type, tag, flags
27, 38, 38, 38, 0x0a,
28, 39, 39, 39, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_hiro__QtHorizontalScroller[] = {
"hiro::QtHorizontalScroller\0onChange()\0"
static const char qt_meta_stringdata_hiro__QtHorizontalScrollBar[] = {
"hiro::QtHorizontalScrollBar\0onChange()\0"
"\0"
};
void hiro::QtHorizontalScroller::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
void hiro::QtHorizontalScrollBar::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
QtHorizontalScroller *_t = static_cast<QtHorizontalScroller *>(_o);
QtHorizontalScrollBar *_t = static_cast<QtHorizontalScrollBar *>(_o);
switch (_id) {
case 0: _t->onChange(); break;
default: ;
@@ -841,33 +841,33 @@ void hiro::QtHorizontalScroller::qt_static_metacall(QObject *_o, QMetaObject::Ca
Q_UNUSED(_a);
}
const QMetaObjectExtraData hiro::QtHorizontalScroller::staticMetaObjectExtraData = {
const QMetaObjectExtraData hiro::QtHorizontalScrollBar::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject hiro::QtHorizontalScroller::staticMetaObject = {
{ &QScrollBar::staticMetaObject, qt_meta_stringdata_hiro__QtHorizontalScroller,
qt_meta_data_hiro__QtHorizontalScroller, &staticMetaObjectExtraData }
const QMetaObject hiro::QtHorizontalScrollBar::staticMetaObject = {
{ &QScrollBar::staticMetaObject, qt_meta_stringdata_hiro__QtHorizontalScrollBar,
qt_meta_data_hiro__QtHorizontalScrollBar, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &hiro::QtHorizontalScroller::getStaticMetaObject() { return staticMetaObject; }
const QMetaObject &hiro::QtHorizontalScrollBar::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *hiro::QtHorizontalScroller::metaObject() const
const QMetaObject *hiro::QtHorizontalScrollBar::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *hiro::QtHorizontalScroller::qt_metacast(const char *_clname)
void *hiro::QtHorizontalScrollBar::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtHorizontalScroller))
return static_cast<void*>(const_cast< QtHorizontalScroller*>(this));
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtHorizontalScrollBar))
return static_cast<void*>(const_cast< QtHorizontalScrollBar*>(this));
return QScrollBar::qt_metacast(_clname);
}
int hiro::QtHorizontalScroller::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
int hiro::QtHorizontalScrollBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QScrollBar::qt_metacall(_c, _id, _a);
if (_id < 0)
@@ -1049,7 +1049,7 @@ static const uint qt_meta_data_hiro__QtListView[] = {
31, 30, 30, 30, 0x0a,
42, 30, 30, 30, 0x0a,
54, 66, 30, 30, 0x0a,
73, 100, 30, 30, 0x0a,
73, 104, 30, 30, 0x0a,
0 // eod
};
@@ -1057,8 +1057,8 @@ static const uint qt_meta_data_hiro__QtListView[] = {
static const char qt_meta_stringdata_hiro__QtListView[] = {
"hiro::QtListView\0onActivate()\0\0"
"onChange()\0onContext()\0onSort(int)\0"
"column\0onToggle(QTreeWidgetItem*)\0"
"item\0"
"column\0onToggle(QTreeWidgetItem*,int)\0"
"item,column\0"
};
void hiro::QtListView::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
@@ -1071,7 +1071,7 @@ void hiro::QtListView::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int
case 1: _t->onChange(); break;
case 2: _t->onContext(); break;
case 3: _t->onSort((*reinterpret_cast< int(*)>(_a[1]))); break;
case 4: _t->onToggle((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break;
case 4: _t->onToggle((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
default: ;
}
}
@@ -1411,7 +1411,7 @@ int hiro::QtTextEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
}
return _id;
}
static const uint qt_meta_data_hiro__QtVerticalScroller[] = {
static const uint qt_meta_data_hiro__QtVerticalScrollBar[] = {
// content:
6, // revision
@@ -1425,21 +1425,21 @@ static const uint qt_meta_data_hiro__QtVerticalScroller[] = {
0, // signalCount
// slots: signature, parameters, type, tag, flags
25, 36, 36, 36, 0x0a,
26, 37, 37, 37, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_hiro__QtVerticalScroller[] = {
"hiro::QtVerticalScroller\0onChange()\0"
static const char qt_meta_stringdata_hiro__QtVerticalScrollBar[] = {
"hiro::QtVerticalScrollBar\0onChange()\0"
"\0"
};
void hiro::QtVerticalScroller::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
void hiro::QtVerticalScrollBar::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
QtVerticalScroller *_t = static_cast<QtVerticalScroller *>(_o);
QtVerticalScrollBar *_t = static_cast<QtVerticalScrollBar *>(_o);
switch (_id) {
case 0: _t->onChange(); break;
default: ;
@@ -1448,33 +1448,33 @@ void hiro::QtVerticalScroller::qt_static_metacall(QObject *_o, QMetaObject::Call
Q_UNUSED(_a);
}
const QMetaObjectExtraData hiro::QtVerticalScroller::staticMetaObjectExtraData = {
const QMetaObjectExtraData hiro::QtVerticalScrollBar::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject hiro::QtVerticalScroller::staticMetaObject = {
{ &QScrollBar::staticMetaObject, qt_meta_stringdata_hiro__QtVerticalScroller,
qt_meta_data_hiro__QtVerticalScroller, &staticMetaObjectExtraData }
const QMetaObject hiro::QtVerticalScrollBar::staticMetaObject = {
{ &QScrollBar::staticMetaObject, qt_meta_stringdata_hiro__QtVerticalScrollBar,
qt_meta_data_hiro__QtVerticalScrollBar, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &hiro::QtVerticalScroller::getStaticMetaObject() { return staticMetaObject; }
const QMetaObject &hiro::QtVerticalScrollBar::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *hiro::QtVerticalScroller::metaObject() const
const QMetaObject *hiro::QtVerticalScrollBar::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *hiro::QtVerticalScroller::qt_metacast(const char *_clname)
void *hiro::QtVerticalScrollBar::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtVerticalScroller))
return static_cast<void*>(const_cast< QtVerticalScroller*>(this));
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtVerticalScrollBar))
return static_cast<void*>(const_cast< QtVerticalScrollBar*>(this));
return QScrollBar::qt_metacast(_clname);
}
int hiro::QtVerticalScroller::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
int hiro::QtVerticalScrollBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QScrollBar::qt_metacall(_c, _id, _a);
if (_id < 0)

View File

@@ -4,8 +4,10 @@ namespace hiro {
auto pComboButtonItem::construct() -> void {
if(auto parent = _parent()) {
parent->lock();
parent->qtComboButton->addItem("");
_setState();
parent->unlock();
}
}

View File

@@ -4,7 +4,7 @@ namespace hiro {
auto pComboButton::construct() -> void {
qtWidget = qtComboButton = new QtComboButton(*this);
qtComboButton->connect(qtComboButton, SIGNAL(currentIndexChanged(int)), SLOT(onChange()));
qtComboButton->connect(qtComboButton, SIGNAL(currentIndexChanged(int)), SLOT(onChange(int)));
pWidget::construct();
}
@@ -35,7 +35,13 @@ auto pComboButton::reset() -> void {
unlock();
}
auto QtComboButton::onChange() -> void {
auto QtComboButton::onChange(int offset) -> void {
for(auto& item : p.state().items) {
item->state.selected = false;
}
if(auto item = p.self().item(offset)) {
item->state.selected = true;
}
if(!p.locked()) p.self().doChange();
}

View File

@@ -0,0 +1,46 @@
#if defined(Hiro_HorizontalScrollBar)
namespace hiro {
auto pHorizontalScrollBar::construct() -> void {
qtWidget = qtHorizontalScrollBar = new QtHorizontalScrollBar(*this);
qtHorizontalScrollBar->setRange(0, 100);
qtHorizontalScrollBar->setPageStep(101 >> 3);
qtHorizontalScrollBar->connect(qtHorizontalScrollBar, SIGNAL(valueChanged(int)), SLOT(onChange()));
pWidget::construct();
_setState();
}
auto pHorizontalScrollBar::destruct() -> void {
delete qtHorizontalScrollBar;
qtWidget = qtHorizontalScrollBar = nullptr;
}
auto pHorizontalScrollBar::minimumSize() const -> Size {
return {0, 15};
}
auto pHorizontalScrollBar::setLength(unsigned length) -> void {
_setState();
}
auto pHorizontalScrollBar::setPosition(unsigned position) -> void {
_setState();
}
auto pHorizontalScrollBar::_setState() -> void {
signed length = state().length + (state().length == 0);
qtHorizontalScrollBar->setRange(0, length - 1);
qtHorizontalScrollBar->setPageStep(length >> 3);
qtHorizontalScrollBar->setValue(state().position);
}
auto QtHorizontalScrollBar::onChange() -> void {
p.state().position = value();
p.self().doChange();
}
}
#endif

View File

@@ -1,9 +1,9 @@
#if defined(Hiro_HorizontalScroller)
#if defined(Hiro_HorizontalScrollBar)
namespace hiro {
struct pHorizontalScroller : pWidget {
Declare(HorizontalScroller, Widget)
struct pHorizontalScrollBar : pWidget {
Declare(HorizontalScrollBar, Widget)
auto minimumSize() const -> Size override;
auto setLength(unsigned length) -> void;
@@ -11,7 +11,7 @@ struct pHorizontalScroller : pWidget {
auto _setState() -> void;
QtHorizontalScroller* qtHorizontalScroller = nullptr;
QtHorizontalScrollBar* qtHorizontalScrollBar = nullptr;
};
}

View File

@@ -1,46 +0,0 @@
#if defined(Hiro_HorizontalScroller)
namespace hiro {
auto pHorizontalScroller::construct() -> void {
qtWidget = qtHorizontalScroller = new QtHorizontalScroller(*this);
qtHorizontalScroller->setRange(0, 100);
qtHorizontalScroller->setPageStep(101 >> 3);
qtHorizontalScroller->connect(qtHorizontalScroller, SIGNAL(valueChanged(int)), SLOT(onChange()));
pWidget::construct();
_setState();
}
auto pHorizontalScroller::destruct() -> void {
delete qtHorizontalScroller;
qtWidget = qtHorizontalScroller = nullptr;
}
auto pHorizontalScroller::minimumSize() const -> Size {
return {0, 15};
}
auto pHorizontalScroller::setLength(unsigned length) -> void {
_setState();
}
auto pHorizontalScroller::setPosition(unsigned position) -> void {
_setState();
}
auto pHorizontalScroller::_setState() -> void {
signed length = state().length + (state().length == 0);
qtHorizontalScroller->setRange(0, length - 1);
qtHorizontalScroller->setPageStep(length >> 3);
qtHorizontalScroller->setValue(state().position);
}
auto QtHorizontalScroller::onChange() -> void {
p.state().position = value();
p.self().doChange();
}
}
#endif

View File

@@ -49,18 +49,22 @@ auto pListViewCell::_parent() -> maybe<pListViewItem&> {
auto pListViewCell::_setState() -> void {
if(auto parent = _parent()) {
parent->qtItem->setBackground(self().offset(), CreateBrush(self().backgroundColor(true)));
if(state().checkable) {
parent->qtItem->setCheckState(self().offset(), state().checked ? Qt::Checked : Qt::Unchecked);
} else {
//extremely unintuitive; but this is the only way to remove an existing checkbox from a cell
parent->qtItem->setData(self().offset(), Qt::CheckStateRole, QVariant());
if(auto grandparent = parent->_parent()) {
grandparent->lock();
parent->qtItem->setBackground(self().offset(), CreateBrush(self().backgroundColor(true)));
if(state().checkable) {
parent->qtItem->setCheckState(self().offset(), state().checked ? Qt::Checked : Qt::Unchecked);
} else {
//extremely unintuitive; but this is the only way to remove an existing checkbox from a cell
parent->qtItem->setData(self().offset(), Qt::CheckStateRole, QVariant());
}
parent->qtItem->setFont(self().offset(), pFont::create(self().font(true)));
parent->qtItem->setForeground(self().offset(), CreateBrush(self().foregroundColor(true)));
parent->qtItem->setIcon(self().offset(), CreateIcon(state().icon));
parent->qtItem->setText(self().offset(), QString::fromUtf8(state().text));
parent->qtItem->setTextAlignment(self().offset(), CalculateAlignment(self().alignment(true)));
grandparent->unlock();
}
parent->qtItem->setFont(self().offset(), pFont::create(self().font(true)));
parent->qtItem->setForeground(self().offset(), CreateBrush(self().foregroundColor(true)));
parent->qtItem->setIcon(self().offset(), CreateIcon(state().icon));
parent->qtItem->setText(self().offset(), QString::fromUtf8(state().text));
parent->qtItem->setTextAlignment(self().offset(), CalculateAlignment(self().alignment(true)));
}
}

View File

@@ -6,10 +6,12 @@ auto pListViewItem::construct() -> void {
}
auto pListViewItem::destruct() -> void {
if(auto parent = _parent()) parent->lock();
if(qtItem) {
delete qtItem;
qtItem = nullptr;
}
if(auto parent = _parent()) parent->unlock();
}
auto pListViewItem::append(sListViewCell cell) -> void {

View File

@@ -17,7 +17,7 @@ auto pListView::construct() -> void {
qtListView->connect(qtListView, SIGNAL(itemSelectionChanged()), SLOT(onChange()));
qtListView->connect(qtListView, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(onContext()));
qtListView->connect(qtListView->header(), SIGNAL(sectionClicked(int)), SLOT(onSort(int)));
qtListView->connect(qtListView, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onToggle(QTreeWidgetItem*)));
qtListView->connect(qtListView, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onToggle(QTreeWidgetItem*, int)));
setBackgroundColor(state().backgroundColor);
setBatchable(state().batchable);
@@ -57,12 +57,6 @@ auto pListView::remove(sListViewHeader header) -> void {
auto pListView::remove(sListViewItem item) -> void {
}
auto pListView::reset() -> void {
lock();
qtListView->clear();
unlock();
}
auto pListView::resizeColumns() -> void {
lock();
@@ -194,15 +188,13 @@ auto QtListView::onActivate() -> void {
}
auto QtListView::onChange() -> void {
/*
for(auto& item : listView.state.items) item.selected = false;
for(unsigned position = 0; position < qtListView->topLevelItemCount(); position++) {
if(auto item = qtListView->topLevelItem(position)) {
if(item->isSelected()) listView.state.items[position].selected = true;
for(auto& item : p.state().items) {
item->state.selected = false;
if(auto self = item->self()) {
if(self->qtItem->isSelected()) item->state.selected = true;
}
}
if(!locked() && listView.onChange) listView.onChange();
*/
if(!p.locked()) p.self().doChange();
}
auto QtListView::onContext() -> void {
@@ -217,22 +209,17 @@ auto QtListView::onSort(int columnNumber) -> void {
}
}
auto QtListView::onToggle(QTreeWidgetItem* item) -> void {
/*
maybe<unsigned> row;
for(unsigned position = 0; position < qtListView->topLevelItemCount(); position++) {
if(auto topLevelItem = qtListView->topLevelItem(position)) {
if(topLevelItem == item) {
row = position;
break;
auto QtListView::onToggle(QTreeWidgetItem* qtItem, int column) -> void {
for(auto& item : p.state().items) {
if(auto self = item->self()) {
if(qtItem == self->qtItem) {
if(auto cell = item->cell(column)) {
cell->state.checked = (qtItem->checkState(column) == Qt::Checked);
if(!p.locked()) p.self().doToggle(cell);
}
}
}
}
if(row) {
listView.state.items[*row].checked = (item->checkState(0) == Qt::Checked);
if(!locked() && listView.onToggle) listView.onToggle(*row);
}
*/
}
auto QtListView::mousePressEvent(QMouseEvent* event) -> void {

View File

@@ -9,7 +9,6 @@ struct pListView : pWidget {
auto append(sListViewItem item) -> void;
auto remove(sListViewHeader header) -> void;
auto remove(sListViewItem item) -> void;
auto reset() -> void;
auto resizeColumns() -> void;
auto setAlignment(Alignment alignment) -> void;
auto setBackgroundColor(Color color) -> void;

View File

@@ -35,12 +35,14 @@ auto pTabFrameItem::setGeometry(Geometry geometry) -> void {
}
auto pTabFrameItem::setIcon(const image& icon) -> void {
_setState();
}
auto pTabFrameItem::setMovable(bool movable) -> void {
}
auto pTabFrameItem::setSelected() -> void {
_setState();
}
auto pTabFrameItem::setText(const string& text) -> void {
@@ -60,6 +62,8 @@ auto pTabFrameItem::_parent() -> maybe<pTabFrame&> {
auto pTabFrameItem::_setState() -> void {
if(auto parent = _parent()) {
parent->qtTabFrame->setTabIcon(self().offset(), CreateIcon(state().icon));
if(state().selected) parent->qtTabFrame->setCurrentIndex(self().offset());
parent->qtTabFrame->setTabText(self().offset(), QString::fromUtf8(state().text));
if(auto layout = state().layout) {
auto geometry = parent->self().geometry();

View File

@@ -16,6 +16,7 @@ auto pTabFrame::destruct() -> void {
}
auto pTabFrame::append(sTabFrameItem item) -> void {
setGeometry(self().geometry());
}
auto pTabFrame::remove(sTabFrameItem item) -> void {
@@ -24,91 +25,17 @@ auto pTabFrame::remove(sTabFrameItem item) -> void {
auto pTabFrame::setEdge(Edge edge) -> void {
}
/*
auto pTabFrame::container(Widget& widget) -> QWidget* {
Layout* widgetLayout = GetParentWidgetLayout(&widget);
unsigned selection = 0;
for(auto& layout : tabFrame.state.layout) {
if(layout == widgetLayout) return qtTabFrame->widget(selection);
selection++;
}
return nullptr;
}
auto pTabFrame::displacement() -> Position {
return {5, 33};
}
auto pTabFrame::remove(unsigned selection) -> void {
qtTabFrame->removeTab(selection);
}
auto pTabFrame::setEnabled(bool enabled) -> void {
for(auto& layout : tabFrame.state.layout) {
if(layout) layout->setEnabled(layout->enabled());
}
pWidget::setEnabled(enabled);
}
auto pTabFrame::setGeometry(Geometry geometry) -> void {
pWidget::setGeometry(geometry);
geometry.x += 0, geometry.width -= 5;
geometry.y += 29, geometry.height -= 33;
for(auto& layout : tabFrame.state.layout) {
if(layout) layout->setGeometry(geometry);
}
synchronizeLayout();
}
*/
auto pTabFrame::setGeometry(Geometry geometry) -> void {
pWidget::setGeometry(geometry);
// geometry.setPosition({0, 0});
// geometry.setWidth(geometry.width() - 4);
// geometry.setHeight(geometry.height() - 25);
for(auto& item : state().items) {
if(auto self = item->self()) self->setGeometry(geometry);
}
}
/*
auto pTabFrame::setIcon(unsigned selection, const image& icon) -> void {
qtTabFrame->setTabIcon(selection, CreateIcon(image));
}
auto pTabFrame::setSelected(unsigned selection) -> void {
lock();
qtTabFrame->setCurrentIndex(selection);
synchronizeLayout();
unlock();
}
auto pTabFrame::setVisible(bool visible) -> void {
for(auto& layout : tabFrame.state.layout) {
if(layout) layout->setVisible(layout->visible());
}
pWidget::setVisible(visible);
}
*/
/*
auto pTabFrame::synchronizeLayout() -> void {
unsigned selection = 0;
for(auto& layout : tabFrame.state.layout) {
if(layout) layout->setVisible(selection == tabFrame.state.selection);
selection++;
}
}
*/
auto pTabFrame::_setState() -> void {
for(auto& item : state().items) {
if(auto self = item->self()) self->_setState();
// if(auto layout = item->state.layout) {
// item->setVisible(item->visible(true));
// }
}
}
@@ -118,9 +45,12 @@ auto QtTabFrame::showEvent(QShowEvent* event) -> void {
}
auto QtTabFrame::onChange(int selection) -> void {
// state().selection = selection;
// synchronizeLayout();
// if(!p.locked()) p.self().doChange();
//geometry of tab frames is only valid once said tab frame is visible
//as such, as need to call _setState() to update the TabFrameItem's geometry here
if(auto item = p.self().item(selection)) {
if(auto self = item->self()) self->_setState();
}
if(!p.locked()) p.self().doChange();
}
}

View File

@@ -0,0 +1,46 @@
#if defined(Hiro_VerticalScrollBar)
namespace hiro {
auto pVerticalScrollBar::construct() -> void {
qtWidget = qtVerticalScrollBar = new QtVerticalScrollBar(*this);
qtVerticalScrollBar->setRange(0, 100);
qtVerticalScrollBar->setPageStep(101 >> 3);
qtVerticalScrollBar->connect(qtVerticalScrollBar, SIGNAL(valueChanged(int)), SLOT(onChange()));
pWidget::construct();
_setState();
}
auto pVerticalScrollBar::destruct() -> void {
delete qtVerticalScrollBar;
qtWidget = qtVerticalScrollBar = nullptr;
}
auto pVerticalScrollBar::minimumSize() const -> Size {
return {15, 0};
}
auto pVerticalScrollBar::setLength(unsigned length) -> void {
_setState();
}
auto pVerticalScrollBar::setPosition(unsigned position) -> void {
_setState();
}
auto pVerticalScrollBar::_setState() -> void {
signed length = state().length + (state().length == 0);
qtVerticalScrollBar->setRange(0, length - 1);
qtVerticalScrollBar->setPageStep(length >> 3);
qtVerticalScrollBar->setValue(state().position);
}
auto QtVerticalScrollBar::onChange() -> void {
p.state().position = value();
p.self().doChange();
}
}
#endif

View File

@@ -1,9 +1,9 @@
#if defined(Hiro_VerticalScroller)
#if defined(Hiro_VerticalScrollBar)
namespace hiro {
struct pVerticalScroller : pWidget {
Declare(VerticalScroller, Widget)
struct pVerticalScrollBar : pWidget {
Declare(VerticalScrollBar, Widget)
auto minimumSize() const -> Size override;
auto setLength(unsigned length) -> void;
@@ -11,7 +11,7 @@ struct pVerticalScroller : pWidget {
auto _setState() -> void;
QtVerticalScroller* qtVerticalScroller = nullptr;
QtVerticalScrollBar* qtVerticalScrollBar = nullptr;
};
}

View File

@@ -1,46 +0,0 @@
#if defined(Hiro_VerticalScroller)
namespace hiro {
auto pVerticalScroller::construct() -> void {
qtWidget = qtVerticalScroller = new QtVerticalScroller(*this);
qtVerticalScroller->setRange(0, 100);
qtVerticalScroller->setPageStep(101 >> 3);
qtVerticalScroller->connect(qtVerticalScroller, SIGNAL(valueChanged(int)), SLOT(onChange()));
pWidget::construct();
_setState();
}
auto pVerticalScroller::destruct() -> void {
delete qtVerticalScroller;
qtWidget = qtVerticalScroller = nullptr;
}
auto pVerticalScroller::minimumSize() const -> Size {
return {15, 0};
}
auto pVerticalScroller::setLength(unsigned length) -> void {
_setState();
}
auto pVerticalScroller::setPosition(unsigned position) -> void {
_setState();
}
auto pVerticalScroller::_setState() -> void {
signed length = state().length + (state().length == 0);
qtVerticalScroller->setRange(0, length - 1);
qtVerticalScroller->setPageStep(length >> 3);
qtVerticalScroller->setValue(state().position);
}
auto QtVerticalScroller::onChange() -> void {
p.state().position = value();
p.self().doChange();
}
}
#endif