Update to v075r13 release.

byuu says (in the thread about rewriting Phoenix):

- added phoenix/reference; a dummy implementation that contains the 22KB
  of static boilerplate code needed to start a new target
- OS::setDefaultFont removed; problem is that objects in the global
  scope are constructed before you can call that function
- added Window::setWidgetFont, which is applied if your widgets have no
  custom font set already upon attaching them to the window with
  Window::setLayout, more understandable behavior
- renamed ListBox to ListView

byuu says (in the v075 WIP thread):

Found the source of lag on cartridge load. ListView::modify() was not
locking Qt messages, so it was causing a CheatEditor::refresh (copies
16MB of memory each call) for all 128 cheat items.

Final issue now is that nested submenus (menus inside of menus) are not
applying Window::setMenuFont yet.
This commit is contained in:
Tim Allen 2011-02-16 23:35:40 +11:00
parent 72a2967eeb
commit 3fad0a0105
52 changed files with 945 additions and 242 deletions

View File

@ -2,7 +2,7 @@ include nall/Makefile
snes := snes
gameboy := gameboy
profile := compatibility
ui := ui-gameboy
ui := ui
# compiler
c := $(compiler) -std=gnu99

View File

@ -5,8 +5,14 @@
#include <nall/concept.hpp>
#undef foreach
#define foreach(iter, object) \
#define foreach2(iter, object) foreach3(iter, object, foreach_counter)
#define foreach3(iter, object, foreach_counter) \
for(unsigned foreach_counter = 0, foreach_limit = container_size(object), foreach_once = 0, foreach_broken = 0; foreach_counter < foreach_limit && foreach_broken == 0; foreach_counter++, foreach_once = 0) \
for(auto &iter = object[foreach_counter]; foreach_once == 0 && (foreach_broken = 1); foreach_once++, foreach_broken = 0)
#define foreach_impl(...) foreach_decl(__VA_ARGS__, foreach3(__VA_ARGS__), foreach2(__VA_ARGS__), foreach_too_few_arguments)
#define foreach_decl(_1, _2, _3, N, ...) N
#define foreach(...) foreach_impl(__VA_ARGS__)
#endif

View File

@ -1,8 +1,8 @@
struct OS::State {
Font *defaultFont;
bool initialized;
State() {
defaultFont = 0;
initialized = false;
}
};
@ -35,6 +35,7 @@ struct Window::State {
bool statusVisible;
string title;
bool visible;
Font *widgetFont;
State() {
backgroundColor = false;
@ -49,15 +50,18 @@ struct Window::State {
resizable = true;
statusVisible = false;
visible = false;
widgetFont = 0;
}
};
struct Action::State {
bool enabled;
Window *parent;
bool visible;
State() {
enabled = true;
parent = 0;
visible = true;
}
};
@ -170,7 +174,7 @@ struct LineEdit::State {
}
};
struct ListBox::State {
struct ListView::State {
bool checkable;
array<bool> checked;
lstring headerText;
@ -231,23 +235,23 @@ struct VerticalSlider::State {
#if defined(PHOENIX_QT)
#include "../qt/qt.cpp"
#elif defined(PHOENIX_REFERENCE)
#include "../reference/reference.cpp"
#endif
Object::Object() { OS::initialize(); }
OS::State* OS::state = 0;
pOS* OS::p = 0;
unsigned OS::desktopWidth() { return p->desktopWidth(); }
unsigned OS::desktopHeight() { return p->desktopHeight(); }
string OS::fileLoad_(Window &parent, const string &path, lstring &filter) { if(filter.size() == 0) filter.append("All files (*)"); return p->fileLoad(parent, path, filter); }
string OS::fileSave_(Window &parent, const string &path, lstring &filter) { if(filter.size() == 0) filter.append("All files (*)"); return p->fileSave(parent, path, filter); }
string OS::folderSelect(Window &parent, const string &path) { return p->folderSelect(parent, path); }
void OS::main() { return p->main(); }
bool OS::pending() { return p->pending(); }
void OS::process() { return p->process(); }
void OS::quit() { return p->quit(); }
void OS::setDefaultFont(Font &font) { state->defaultFont = &font; return p->setDefaultFont(font); }
void OS::initialize() { if(state == 0) state = new State; if(p == 0) p = new pOS; }
OS::State OS::state;
unsigned OS::desktopWidth() { return pOS::desktopWidth(); }
unsigned OS::desktopHeight() { return pOS::desktopHeight(); }
string OS::fileLoad_(Window &parent, const string &path, lstring &filter) { if(filter.size() == 0) filter.append("All files (*)"); return pOS::fileLoad(parent, path, filter); }
string OS::fileSave_(Window &parent, const string &path, lstring &filter) { if(filter.size() == 0) filter.append("All files (*)"); return pOS::fileSave(parent, path, filter); }
string OS::folderSelect(Window &parent, const string &path) { return pOS::folderSelect(parent, path); }
void OS::main() { return pOS::main(); }
bool OS::pending() { return pOS::pending(); }
void OS::process() { return pOS::process(); }
void OS::quit() { return pOS::quit(); }
void OS::initialize() { if(state.initialized == false) { state.initialized = true; return pOS::initialize(); } }
void Font::setBold(bool bold) { state.bold = bold; return p.setBold(bold); }
void Font::setFamily(const string &family) { state.family = family; return p.setFamily(family); }
@ -262,7 +266,7 @@ MessageWindow::Response MessageWindow::warning(Window &parent, const string &tex
MessageWindow::Response MessageWindow::critical(Window &parent, const string &text, MessageWindow::Buttons buttons) { return pMessageWindow::critical(parent, text, buttons); }
Window Window::None;
void Window::append(Menu &menu) { return p.append(menu); }
void Window::append(Menu &menu) { ((Action&)menu).state.parent = this; return p.append(menu); }
Geometry Window::frameGeometry() { return p.frameGeometry(); }
bool Window::focused() { return p.focused(); }
Geometry Window::geometry() { return p.geometry(); }
@ -271,7 +275,7 @@ void Window::setFrameGeometry(const Geometry &geometry) { return p.setFrameGeome
void Window::setFocused() { return p.setFocused(); }
void Window::setFullScreen(bool fullScreen) { state.fullScreen = fullScreen; return p.setFullScreen(fullScreen); }
void Window::setGeometry(const Geometry &geometry) { state.geometry = geometry; return p.setGeometry(geometry); }
void Window::setLayout(Layout &layout) { state.layout = &layout; return p.setLayout(layout); }
void Window::setLayout(Layout &layout) { layout.state.parent = this; state.layout = &layout; return p.setLayout(layout); }
void Window::setMenuFont(Font &font) { state.menuFont = &font; return p.setMenuFont(font); }
void Window::setMenuVisible(bool visible) { state.menuVisible = visible; return p.setMenuVisible(visible); }
void Window::setResizable(bool resizable) { state.resizable = resizable; return p.setResizable(resizable); }
@ -280,6 +284,7 @@ void Window::setStatusText(const string &text) { state.statusText = text; return
void Window::setStatusVisible(bool visible) { state.statusVisible = visible; return p.setStatusVisible(visible); }
void Window::setTitle(const string &text) { state.title = text; return p.setTitle(text); }
void Window::setVisible(bool visible) { state.visible = visible; return p.setVisible(visible); }
void Window::setWidgetFont(Font &font) { state.widgetFont = &font; return p.setWidgetFont(font); }
Window::Window() : state(*new State), p(*new pWindow(*this)) {}
void Action::setEnabled(bool enabled) { state.enabled = enabled; return p.setEnabled(enabled); }
@ -352,19 +357,19 @@ void LineEdit::setText(const string &text) { state.text = text; return p.setText
string LineEdit::text() { return p.text(); }
LineEdit::LineEdit() : state(*new State), base_from_member<pLineEdit&>(*new pLineEdit(*this)), Widget(base_from_member<pLineEdit&>::value), p(base_from_member<pLineEdit&>::value) {}
void ListBox::append_(lstring &text) { state.text.append(text); return p.append(text); }
void ListBox::autosizeColumns() { return p.autosizeColumns(); }
bool ListBox::checked(unsigned row) { return p.checked(row); }
void ListBox::modify_(unsigned row, lstring &text) { state.text[row] = text; return p.modify(row, text); }
void ListBox::modify(unsigned row, unsigned column, const string &text) { state.text[row][column] = text; return p.modify(row, column, text); }
void ListBox::reset() { state.checked.reset(); state.text.reset(); return p.reset(); }
optional<unsigned> ListBox::selection() { return p.selection(); }
void ListBox::setCheckable(bool checkable) { state.checkable = checkable; return p.setCheckable(checkable); }
void ListBox::setChecked(unsigned row, bool checked) { state.checked[row] = checked; return p.setChecked(row, checked); }
void ListBox::setHeaderText_(lstring &text) { state.headerText = text; return p.setHeaderText(text); }
void ListBox::setHeaderVisible(bool visible) { state.headerVisible = visible; return p.setHeaderVisible(visible); }
void ListBox::setSelection(unsigned row) { state.selection = { true, row }; return p.setSelection(row); }
ListBox::ListBox() : state(*new State), base_from_member<pListBox&>(*new pListBox(*this)), Widget(base_from_member<pListBox&>::value), p(base_from_member<pListBox&>::value) {}
void ListView::append_(lstring &text) { state.text.append(text); return p.append(text); }
void ListView::autosizeColumns() { return p.autosizeColumns(); }
bool ListView::checked(unsigned row) { return p.checked(row); }
void ListView::modify_(unsigned row, lstring &text) { state.text[row] = text; return p.modify(row, text); }
void ListView::modify(unsigned row, unsigned column, const string &text) { state.text[row][column] = text; return p.modify(row, column, text); }
void ListView::reset() { state.checked.reset(); state.text.reset(); return p.reset(); }
optional<unsigned> ListView::selection() { return p.selection(); }
void ListView::setCheckable(bool checkable) { state.checkable = checkable; return p.setCheckable(checkable); }
void ListView::setChecked(unsigned row, bool checked) { state.checked[row] = checked; return p.setChecked(row, checked); }
void ListView::setHeaderText_(lstring &text) { state.headerText = text; return p.setHeaderText(text); }
void ListView::setHeaderVisible(bool visible) { state.headerVisible = visible; return p.setHeaderVisible(visible); }
void ListView::setSelection(unsigned row) { state.selection = { true, row }; return p.setSelection(row); }
ListView::ListView() : state(*new State), base_from_member<pListView&>(*new pListView(*this)), Widget(base_from_member<pListView&>::value), p(base_from_member<pListView&>::value) {}
void ProgressBar::setPosition(unsigned position) { state.position = position; return p.setPosition(position); }
ProgressBar::ProgressBar() : state(*new State), base_from_member<pProgressBar&>(*new pProgressBar(*this)), Widget(base_from_member<pProgressBar&>::value), p(base_from_member<pProgressBar&>::value) {}

View File

@ -22,7 +22,7 @@ struct pHexEdit;
struct pHorizontalSlider;
struct pLabel;
struct pLineEdit;
struct pListBox;
struct pListView;
struct pProgressBar;
struct pRadioBox;
struct pTextEdit;
@ -53,12 +53,10 @@ struct OS : Object {
static bool pending();
static void process();
static void quit();
static void setDefaultFont(Font &font);
OS();
struct State;
static State *state;
static pOS *p;
static State state;
static void initialize();
private:
@ -132,6 +130,7 @@ struct Window : Object {
void setStatusVisible(bool visible = true);
void setTitle(const nall::string &text);
void setVisible(bool visible = true);
void setWidgetFont(Font &font);
Window();
struct State;
@ -331,7 +330,7 @@ struct LineEdit : private nall::base_from_member<pLineEdit&>, Widget {
pLineEdit &p;
};
struct ListBox : private nall::base_from_member<pListBox&>, Widget {
struct ListView : private nall::base_from_member<pListView&>, Widget {
nall::function<void ()> onActivate;
nall::function<void ()> onChange;
nall::function<void (unsigned)> onTick;
@ -349,10 +348,10 @@ struct ListBox : private nall::base_from_member<pListBox&>, Widget {
void setHeaderVisible(bool visible = true);
void setSelection(unsigned row);
ListBox();
ListView();
struct State;
State &state;
pListBox &p;
pListView &p;
private:
void modify_(unsigned row, nall::lstring &list);

View File

@ -1,5 +1,7 @@
void pLayout::append(Widget &widget) {
if(!widget.state.font && OS::state->defaultFont) widget.p.qtWidget->setFont(*OS::state->defaultFont->p.qtFont);
if(!widget.state.font && layout.state.parent->state.widgetFont) {
widget.p.qtWidget->setFont(*layout.state.parent->state.widgetFont->p.qtFont);
}
widget.p.qtWidget->setParent(layout.state.parent->p.qtContainer);
widget.p.qtWidget->setVisible(true);
}

View File

@ -22,13 +22,15 @@
#include "widget/horizontal-slider.cpp"
#include "widget/label.cpp"
#include "widget/line-edit.cpp"
#include "widget/list-box.cpp"
#include "widget/list-view.cpp"
#include "widget/progress-bar.cpp"
#include "widget/radio-box.cpp"
#include "widget/text-edit.cpp"
#include "widget/vertical-slider.cpp"
#include "widget/viewport.cpp"
QApplication *pOS::application = 0;
unsigned pOS::desktopWidth() {
return QApplication::desktop()->screenGeometry().width();
}
@ -112,10 +114,7 @@ void pOS::quit() {
QApplication::quit();
}
void pOS::setDefaultFont(Font &font) {
}
pOS::pOS() {
void pOS::initialize() {
settings.load();
static int argc = 1;

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'qt.moc.hpp'
**
** Created: Mon Feb 14 22:32:33 2011
** Created: Wed Feb 16 04:07:28 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!
@ -618,7 +618,7 @@ int pLineEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
}
return _id;
}
static const uint qt_meta_data_pListBox[] = {
static const uint qt_meta_data_pListView[] = {
// content:
4, // revision
@ -632,43 +632,43 @@ static const uint qt_meta_data_pListBox[] = {
0, // signalCount
// slots: signature, parameters, type, tag, flags
10, 9, 9, 9, 0x0a,
23, 9, 9, 9, 0x0a,
39, 34, 9, 9, 0x0a,
11, 10, 10, 10, 0x0a,
24, 10, 10, 10, 0x0a,
40, 35, 10, 10, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_pListBox[] = {
"pListBox\0\0onActivate()\0onChange()\0"
static const char qt_meta_stringdata_pListView[] = {
"pListView\0\0onActivate()\0onChange()\0"
"item\0onTick(QTreeWidgetItem*)\0"
};
const QMetaObject pListBox::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_pListBox,
qt_meta_data_pListBox, 0 }
const QMetaObject pListView::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_pListView,
qt_meta_data_pListView, 0 }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &pListBox::getStaticMetaObject() { return staticMetaObject; }
const QMetaObject &pListView::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *pListBox::metaObject() const
const QMetaObject *pListView::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *pListBox::qt_metacast(const char *_clname)
void *pListView::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_pListBox))
return static_cast<void*>(const_cast< pListBox*>(this));
if (!strcmp(_clname, qt_meta_stringdata_pListView))
return static_cast<void*>(const_cast< pListView*>(this));
if (!strcmp(_clname, "pWidget"))
return static_cast< pWidget*>(const_cast< pListBox*>(this));
return static_cast< pWidget*>(const_cast< pListView*>(this));
return QObject::qt_metacast(_clname);
}
int pListBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
int pListView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)

View File

@ -24,20 +24,19 @@ struct pObject {
};
struct pOS : public pObject {
QApplication *application;
static QApplication *application;
unsigned desktopWidth();
unsigned desktopHeight();
string fileLoad(Window &parent, const string &path, const lstring &filter);
string fileSave(Window &parent, const string &path, const lstring &filter);
string folderSelect(Window &parent, const string &path);
void main();
bool pending();
void process();
void quit();
void setDefaultFont(Font &font);
static unsigned desktopWidth();
static unsigned desktopHeight();
static string fileLoad(Window &parent, const string &path, const lstring &filter);
static string fileSave(Window &parent, const string &path, const lstring &filter);
static string folderSelect(Window &parent, const string &path);
static void main();
static bool pending();
static void process();
static void quit();
pOS();
static void initialize();
};
struct pFont : public pObject {
@ -98,6 +97,7 @@ public:
void setStatusVisible(bool visible);
void setTitle(const string &text);
void setVisible(bool visible);
void setWidgetFont(Font &font);
pWindow(Window &window);
void updateFrameGeometry();
@ -174,7 +174,7 @@ public:
void setGroup(const array<MenuRadioItem*> &group);
void setText(const string &text);
pMenuRadioItem(MenuRadioItem &menuRadioitem);
pMenuRadioItem(MenuRadioItem &menuRadioItem);
public slots:
void onTick();
@ -324,12 +324,12 @@ public slots:
void onChange();
};
struct pListBox : public QObject, public pWidget {
struct pListView : public QObject, public pWidget {
Q_OBJECT
public:
ListBox &listBox;
QTreeWidget *qtListBox;
ListView &listView;
QTreeWidget *qtListView;
void append(const lstring &text);
void autosizeColumns();
@ -344,7 +344,7 @@ public:
void setHeaderVisible(bool visible);
void setSelection(unsigned row);
pListBox(ListBox &listBox);
pListView(ListView &listView);
public slots:
void onActivate();

View File

@ -1,120 +0,0 @@
void pListBox::append(const lstring &text) {
locked = true;
auto items = qtListBox->findItems("", Qt::MatchContains);
QTreeWidgetItem *item = new QTreeWidgetItem(qtListBox);
item->setData(0, Qt::UserRole, (unsigned)items.size());
if(listBox.state.checkable) item->setCheckState(0, Qt::Unchecked);
for(unsigned n = 0; n < text.size(); n++) {
item->setText(n, QString::fromUtf8(text[n]));
}
locked = false;
}
void pListBox::autosizeColumns() {
for(unsigned n = 0; n < listBox.state.headerText.size(); n++) qtListBox->resizeColumnToContents(n);
}
bool pListBox::checked(unsigned row) {
QTreeWidgetItem *item = qtListBox->topLevelItem(row);
return item ? item->checkState(0) == Qt::Checked : false;
}
void pListBox::modify(unsigned row, const lstring &text) {
QTreeWidgetItem *item = qtListBox->topLevelItem(row);
if(!item) return;
for(unsigned n = 0; n < text.size(); n++) {
item->setText(n, QString::fromUtf8(text[n]));
}
}
void pListBox::modify(unsigned row, unsigned column, const string &text) {
QTreeWidgetItem *item = qtListBox->topLevelItem(row);
if(!item) return;
item->setText(column, QString::fromUtf8(text));
}
void pListBox::reset() {
qtListBox->clear();
}
optional<unsigned> pListBox::selection() {
QTreeWidgetItem *item = qtListBox->currentItem();
if(item == 0) return { false, 0 };
if(item->isSelected() == false) return { false, 0 };
return { true, item->data(0, Qt::UserRole).toUInt() };
}
void pListBox::setCheckable(bool checkable) {
if(checkable) {
auto items = qtListBox->findItems("", Qt::MatchContains);
for(unsigned n = 0; n < items.size(); n++) items[n]->setCheckState(0, Qt::Unchecked);
}
}
void pListBox::setChecked(unsigned row, bool checked) {
locked = true;
QTreeWidgetItem *item = qtListBox->topLevelItem(row);
if(item) item->setCheckState(0, checked ? Qt::Checked : Qt::Unchecked);
locked = false;
}
void pListBox::setHeaderText(const lstring &text) {
QStringList labels;
foreach(column, text) labels << QString::fromUtf8(column);
qtListBox->setColumnCount(text.size());
qtListBox->setAlternatingRowColors(text.size() >= 2);
qtListBox->setHeaderLabels(labels);
autosizeColumns();
}
void pListBox::setHeaderVisible(bool visible) {
qtListBox->setHeaderHidden(!visible);
autosizeColumns();
}
void pListBox::setSelection(unsigned row) {
locked = true;
QTreeWidgetItem *item = qtListBox->currentItem();
if(item) item->setSelected(false);
auto items = qtListBox->findItems("", Qt::MatchContains);
for(unsigned n = 0; n < items.size(); n++) {
if(items[n]->data(0, Qt::UserRole).toUInt() == row) {
qtListBox->setCurrentItem(items[n]);
break;
}
}
locked = false;
}
pListBox::pListBox(ListBox &listBox) : listBox(listBox), pWidget(listBox) {
qtWidget = qtListBox = new QTreeWidget;
qtListBox->setHeaderLabels(QStringList() << "");
qtListBox->setHeaderHidden(true);
qtListBox->setAllColumnsShowFocus(true);
qtListBox->setRootIsDecorated(false);
connect(qtListBox, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(onActivate()));
connect(qtListBox, SIGNAL(itemSelectionChanged()), SLOT(onChange()));
connect(qtListBox, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onTick(QTreeWidgetItem*)));
}
void pListBox::onActivate() {
if(locked == false && listBox.onActivate) listBox.onActivate();
}
void pListBox::onChange() {
if(auto position = selection()) {
listBox.state.selection = { true, position() };
} else {
listBox.state.selection = { false, 0 };
}
if(locked == false && listBox.onChange) listBox.onChange();
}
void pListBox::onTick(QTreeWidgetItem *item) {
unsigned row = item->data(0, Qt::UserRole).toUInt();
bool checkState = checked(row);
listBox.state.checked[row] = checkState;
if(locked == false && listBox.onTick) listBox.onTick(row);
}

View File

@ -0,0 +1,124 @@
void pListView::append(const lstring &text) {
locked = true;
auto items = qtListView->findItems("", Qt::MatchContains);
QTreeWidgetItem *item = new QTreeWidgetItem(qtListView);
item->setData(0, Qt::UserRole, (unsigned)items.size());
if(listView.state.checkable) item->setCheckState(0, Qt::Unchecked);
for(unsigned n = 0; n < text.size(); n++) {
item->setText(n, QString::fromUtf8(text[n]));
}
locked = false;
}
void pListView::autosizeColumns() {
for(unsigned n = 0; n < listView.state.headerText.size(); n++) qtListView->resizeColumnToContents(n);
}
bool pListView::checked(unsigned row) {
QTreeWidgetItem *item = qtListView->topLevelItem(row);
return item ? item->checkState(0) == Qt::Checked : false;
}
void pListView::modify(unsigned row, const lstring &text) {
locked = true;
QTreeWidgetItem *item = qtListView->topLevelItem(row);
if(!item) return;
for(unsigned n = 0; n < text.size(); n++) {
item->setText(n, QString::fromUtf8(text[n]));
}
locked = false;
}
void pListView::modify(unsigned row, unsigned column, const string &text) {
locked = true;
QTreeWidgetItem *item = qtListView->topLevelItem(row);
if(!item) return;
item->setText(column, QString::fromUtf8(text));
locked = false;
}
void pListView::reset() {
qtListView->clear();
}
optional<unsigned> pListView::selection() {
QTreeWidgetItem *item = qtListView->currentItem();
if(item == 0) return { false, 0 };
if(item->isSelected() == false) return { false, 0 };
return { true, item->data(0, Qt::UserRole).toUInt() };
}
void pListView::setCheckable(bool checkable) {
if(checkable) {
auto items = qtListView->findItems("", Qt::MatchContains);
for(unsigned n = 0; n < items.size(); n++) items[n]->setCheckState(0, Qt::Unchecked);
}
}
void pListView::setChecked(unsigned row, bool checked) {
locked = true;
QTreeWidgetItem *item = qtListView->topLevelItem(row);
if(item) item->setCheckState(0, checked ? Qt::Checked : Qt::Unchecked);
locked = false;
}
void pListView::setHeaderText(const lstring &text) {
QStringList labels;
foreach(column, text) labels << QString::fromUtf8(column);
qtListView->setColumnCount(text.size());
qtListView->setAlternatingRowColors(text.size() >= 2);
qtListView->setHeaderLabels(labels);
autosizeColumns();
}
void pListView::setHeaderVisible(bool visible) {
qtListView->setHeaderHidden(!visible);
autosizeColumns();
}
void pListView::setSelection(unsigned row) {
locked = true;
QTreeWidgetItem *item = qtListView->currentItem();
if(item) item->setSelected(false);
auto items = qtListView->findItems("", Qt::MatchContains);
for(unsigned n = 0; n < items.size(); n++) {
if(items[n]->data(0, Qt::UserRole).toUInt() == row) {
qtListView->setCurrentItem(items[n]);
break;
}
}
locked = false;
}
pListView::pListView(ListView &listView) : listView(listView), pWidget(listView) {
qtWidget = qtListView = new QTreeWidget;
qtListView->setHeaderLabels(QStringList() << "");
qtListView->setHeaderHidden(true);
qtListView->setAllColumnsShowFocus(true);
qtListView->setRootIsDecorated(false);
connect(qtListView, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(onActivate()));
connect(qtListView, SIGNAL(itemSelectionChanged()), SLOT(onChange()));
connect(qtListView, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onTick(QTreeWidgetItem*)));
}
void pListView::onActivate() {
if(locked == false && listView.onActivate) listView.onActivate();
}
void pListView::onChange() {
if(auto position = selection()) {
listView.state.selection = { true, position() };
} else {
listView.state.selection = { false, 0 };
}
if(locked == false && listView.onChange) listView.onChange();
}
void pListView::onTick(QTreeWidgetItem *item) {
unsigned row = item->data(0, Qt::UserRole).toUInt();
bool checkState = checked(row);
listView.state.checked[row] = checkState;
if(locked == false && listView.onTick) listView.onTick(row);
}

View File

@ -1,4 +1,5 @@
void pWindow::append(Menu &menu) {
if(window.state.menuFont) menu.p.qtMenu->setFont(*window.state.menuFont->p.qtFont);
qtMenu->addMenu(menu.p.qtMenu);
}
@ -134,6 +135,9 @@ void pWindow::setVisible(bool visible) {
locked = false;
}
void pWindow::setWidgetFont(Font &font) {
}
pWindow::pWindow(Window &window) : window(window) {
layout = 0;
@ -146,7 +150,6 @@ pWindow::pWindow(Window &window) : window(window) {
qtWindow->setLayout(qtLayout);
qtMenu = new QMenuBar(qtWindow);
if(OS::state->defaultFont) qtMenu->setFont(*OS::state->defaultFont->p.qtFont);
qtMenu->setVisible(false);
qtLayout->addWidget(qtMenu);
@ -156,7 +159,6 @@ pWindow::pWindow(Window &window) : window(window) {
qtLayout->addWidget(qtContainer);
qtStatus = new QStatusBar(qtWindow);
if(OS::state->defaultFont) qtStatus->setFont(*OS::state->defaultFont->p.qtFont);
qtStatus->setSizeGripEnabled(true);
qtStatus->setVisible(false);
qtLayout->addWidget(qtStatus);

View File

@ -0,0 +1,8 @@
void pAction::setEnabled(bool enabled) {
}
void pAction::setVisible(bool visible) {
}
pAction::pAction(Action &action) : action(action) {
}

View File

@ -0,0 +1,12 @@
bool pMenuCheckItem::checked() {
return false;
}
void pMenuCheckItem::setChecked(bool checked) {
}
void pMenuCheckItem::setText(const string &text) {
}
pMenuCheckItem::pMenuCheckItem(MenuCheckItem &menuCheckItem) : pAction(menuCheckItem), menuCheckItem(menuCheckItem) {
}

View File

@ -0,0 +1,5 @@
void pMenuItem::setText(const string &text) {
}
pMenuItem::pMenuItem(MenuItem &menuItem) : pAction(menuItem), menuItem(menuItem) {
}

View File

@ -0,0 +1,15 @@
bool pMenuRadioItem::checked() {
return false;
}
void pMenuRadioItem::setChecked() {
}
void pMenuRadioItem::setGroup(const array<MenuRadioItem*> &group) {
}
void pMenuRadioItem::setText(const string &text) {
}
pMenuRadioItem::pMenuRadioItem(MenuRadioItem &menuRadioItem) : pAction(menuRadioItem), menuRadioItem(menuRadioItem) {
}

View File

@ -0,0 +1,2 @@
pMenuSeparator::pMenuSeparator(MenuSeparator &menuSeparator) : pAction(menuSeparator), menuSeparator(menuSeparator) {
}

View File

@ -0,0 +1,8 @@
void pMenu::append(Action &action) {
}
void pMenu::setText(const string &text) {
}
pMenu::pMenu(Menu &menu) : pAction(menu), menu(menu) {
}

View File

@ -0,0 +1,17 @@
void pFont::setBold(bool bold) {
}
void pFont::setFamily(const string &family) {
}
void pFont::setItalic(bool italic) {
}
void pFont::setSize(unsigned size) {
}
void pFont::setUnderline(bool underline) {
}
pFont::pFont(Font &font) : font(font) {
}

View File

@ -0,0 +1,5 @@
void pLayout::append(Widget &widget) {
}
pLayout::pLayout(Layout &layout) : layout(layout) {
}

View File

@ -0,0 +1,15 @@
MessageWindow::Response pMessageWindow::information(Window &parent, const string &text, MessageWindow::Buttons buttons) {
return MessageWindow::Response::Ok;
}
MessageWindow::Response pMessageWindow::question(Window &parent, const string &text, MessageWindow::Buttons buttons) {
return MessageWindow::Response::Ok;
}
MessageWindow::Response pMessageWindow::warning(Window &parent, const string &text, MessageWindow::Buttons buttons) {
return MessageWindow::Response::Ok;
}
MessageWindow::Response pMessageWindow::critical(Window &parent, const string &text, MessageWindow::Buttons buttons) {
return MessageWindow::Response::Ok;
}

View File

@ -0,0 +1,64 @@
#include "reference.hpp"
#include "font.cpp"
#include "message-window.cpp"
#include "window.cpp"
#include "layout.cpp"
#include "action/action.cpp"
#include "action/menu.cpp"
#include "action/menu-separator.cpp"
#include "action/menu-item.cpp"
#include "action/menu-check-item.cpp"
#include "action/menu-radio-item.cpp"
#include "widget/widget.cpp"
#include "widget/button.cpp"
#include "widget/check-box.cpp"
#include "widget/combo-box.cpp"
#include "widget/hex-edit.cpp"
#include "widget/horizontal-slider.cpp"
#include "widget/label.cpp"
#include "widget/line-edit.cpp"
#include "widget/list-view.cpp"
#include "widget/progress-bar.cpp"
#include "widget/radio-box.cpp"
#include "widget/text-edit.cpp"
#include "widget/vertical-slider.cpp"
#include "widget/viewport.cpp"
unsigned pOS::desktopWidth() {
return 0;
}
unsigned pOS::desktopHeight() {
return 0;
}
string pOS::fileLoad(Window &parent, const string &path, const lstring &filter) {
return "";
}
string pOS::fileSave(Window &parent, const string &path, const lstring &filter) {
return "";
}
string pOS::folderSelect(Window &parent, const string &path) {
return "";
}
void pOS::main() {
}
bool pOS::pending() {
return false;
}
void pOS::process() {
}
void pOS::quit() {
}
void pOS::initialize() {
}

View File

@ -0,0 +1,283 @@
struct pFont;
struct pWindow;
struct pMenu;
struct pLayout;
struct pWidget;
struct pObject {
bool locked;
pObject() {
locked = false;
}
};
struct pOS : public pObject {
static unsigned desktopWidth();
static unsigned desktopHeight();
static string fileLoad(Window &parent, const string &path, const lstring &filter);
static string fileSave(Window &parent, const string &path, const lstring &filter);
static string folderSelect(Window &parent, const string &path);
static void main();
static bool pending();
static void process();
static void quit();
static void initialize();
};
struct pFont : public pObject {
Font &font;
void setBold(bool bold);
void setFamily(const string &family);
void setItalic(bool italic);
void setSize(unsigned size);
void setUnderline(bool underline);
pFont(Font &font);
};
struct pMessageWindow : public pObject {
static MessageWindow::Response information(Window &parent, const string &text, MessageWindow::Buttons buttons);
static MessageWindow::Response question(Window &parent, const string &text, MessageWindow::Buttons buttons);
static MessageWindow::Response warning(Window &parent, const string &text, MessageWindow::Buttons buttons);
static MessageWindow::Response critical(Window &parent, const string &text, MessageWindow::Buttons buttons);
};
struct pWindow : public pObject {
Window &window;
void append(Menu &menu);
Geometry frameGeometry();
bool focused();
Geometry geometry();
void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue);
void setFrameGeometry(const Geometry &geometry);
void setFocused();
void setFullScreen(bool fullScreen);
void setGeometry(const Geometry &geometry);
void setLayout(Layout &layout);
void setMenuFont(Font &font);
void setMenuVisible(bool visible);
void setResizable(bool resizable);
void setStatusFont(Font &font);
void setStatusText(const string &text);
void setStatusVisible(bool visible);
void setTitle(const string &text);
void setVisible(bool visible);
void setWidgetFont(Font &font);
pWindow(Window &window);
};
struct pAction : public pObject {
Action &action;
void setEnabled(bool enabled);
void setVisible(bool visible);
pAction(Action &action);
};
struct pMenu : public pAction {
Menu &menu;
void append(Action &action);
void setText(const string &text);
pMenu(Menu &menu);
};
struct pMenuSeparator : public pAction {
MenuSeparator &menuSeparator;
pMenuSeparator(MenuSeparator &menuSeparator);
};
struct pMenuItem : public pAction {
MenuItem &menuItem;
void setText(const string &text);
pMenuItem(MenuItem &menuItem);
};
struct pMenuCheckItem : public pAction {
MenuCheckItem &menuCheckItem;
bool checked();
void setChecked(bool checked);
void setText(const string &text);
pMenuCheckItem(MenuCheckItem &menuCheckItem);
};
struct pMenuRadioItem : public pAction {
MenuRadioItem &menuRadioItem;
bool checked();
void setChecked();
void setGroup(const array<MenuRadioItem*> &group);
void setText(const string &text);
pMenuRadioItem(MenuRadioItem &menuRadioItem);
};
struct pLayout : public pObject {
Layout &layout;
void append(Widget &widget);
pLayout(Layout &layout);
};
struct pWidget : public pObject {
Widget &widget;
bool enabled();
void setEnabled(bool enabled);
void setFocused();
void setFont(Font &font);
void setGeometry(const Geometry &geometry);
void setVisible(bool visible);
pWidget(Widget &widget);
};
struct pButton : public pWidget {
Button &button;
void setText(const string &text);
pButton(Button &button);
};
struct pCheckBox : public pWidget {
CheckBox &checkBox;
bool checked();
void setChecked(bool checked);
void setText(const string &text);
pCheckBox(CheckBox &checkBox);
};
struct pComboBox : public pWidget {
ComboBox &comboBox;
void append(const string &text);
void reset();
unsigned selection();
void setSelection(unsigned row);
pComboBox(ComboBox &comboBox);
};
struct pHexEdit : public pWidget {
HexEdit &hexEdit;
void setColumns(unsigned columns);
void setLength(unsigned length);
void setOffset(unsigned offset);
void setRows(unsigned rows);
void update();
pHexEdit(HexEdit &hexEdit);
};
struct pHorizontalSlider : public pWidget {
HorizontalSlider &horizontalSlider;
unsigned position();
void setLength(unsigned length);
void setPosition(unsigned position);
pHorizontalSlider(HorizontalSlider &horizontalSlider);
};
struct pLabel : public pWidget {
Label &label;
void setText(const string &text);
pLabel(Label &label);
};
struct pLineEdit : public pWidget {
LineEdit &lineEdit;
void setEditable(bool editable);
void setText(const string &text);
string text();
pLineEdit(LineEdit &lineEdit);
};
struct pListView : public pWidget {
ListView &listView;
void append(const lstring &text);
void autosizeColumns();
bool checked(unsigned row);
void modify(unsigned row, const lstring &text);
void modify(unsigned row, unsigned column, const string &text);
void reset();
optional<unsigned> selection();
void setCheckable(bool checkable);
void setChecked(unsigned row, bool checked);
void setHeaderText(const lstring &text);
void setHeaderVisible(bool visible);
void setSelection(unsigned row);
pListView(ListView &listView);
};
struct pProgressBar : public pWidget {
ProgressBar &progressBar;
void setPosition(unsigned position);
pProgressBar(ProgressBar &progressBar);
};
struct pRadioBox : public pWidget {
RadioBox &radioBox;
bool checked();
void setChecked();
void setGroup(const array<RadioBox*> &group);
void setText(const string &text);
pRadioBox(RadioBox &radioBox);
};
struct pTextEdit : public pWidget {
TextEdit &textEdit;
void setCursorPosition(unsigned position);
void setEditable(bool editable);
void setText(const string &text);
void setWordWrap(bool wordWrap);
string text();
pTextEdit(TextEdit &textEdit);
};
struct pVerticalSlider : public pWidget {
VerticalSlider &verticalSlider;
unsigned position();
void setLength(unsigned length);
void setPosition(unsigned position);
pVerticalSlider(VerticalSlider &verticalSlider);
};
struct pViewport : public pWidget {
Viewport &viewport;
uintptr_t handle();
pViewport(Viewport &viewport);
};

View File

@ -0,0 +1,5 @@
void pButton::setText(const string &text) {
}
pButton::pButton(Button &button) : pWidget(button), button(button) {
}

View File

@ -0,0 +1,12 @@
bool pCheckBox::checked() {
return false;
}
void pCheckBox::setChecked(bool checked) {
}
void pCheckBox::setText(const string &text) {
}
pCheckBox::pCheckBox(CheckBox &checkBox) : pWidget(checkBox), checkBox(checkBox) {
}

View File

@ -0,0 +1,15 @@
void pComboBox::append(const string &text) {
}
void pComboBox::reset() {
}
unsigned pComboBox::selection() {
return 0;
}
void pComboBox::setSelection(unsigned row) {
}
pComboBox::pComboBox(ComboBox &comboBox) : pWidget(comboBox), comboBox(comboBox) {
}

View File

@ -0,0 +1,17 @@
void pHexEdit::setColumns(unsigned columns) {
}
void pHexEdit::setLength(unsigned length) {
}
void pHexEdit::setOffset(unsigned offset) {
}
void pHexEdit::setRows(unsigned rows) {
}
void pHexEdit::update() {
}
pHexEdit::pHexEdit(HexEdit &hexEdit) : pWidget(hexEdit), hexEdit(hexEdit) {
}

View File

@ -0,0 +1,12 @@
unsigned pHorizontalSlider::position() {
return 0;
}
void pHorizontalSlider::setLength(unsigned length) {
}
void pHorizontalSlider::setPosition(unsigned position) {
}
pHorizontalSlider::pHorizontalSlider(HorizontalSlider &horizontalSlider) : pWidget(horizontalSlider), horizontalSlider(horizontalSlider) {
}

View File

@ -0,0 +1,5 @@
void pLabel::setText(const string &text) {
}
pLabel::pLabel(Label &label) : pWidget(label), label(label) {
}

View File

@ -0,0 +1,11 @@
void pLineEdit::setEditable(bool editable) {
}
void pLineEdit::setText(const string &text) {
}
string pLineEdit::text() {
}
pLineEdit::pLineEdit(LineEdit &lineEdit) : pWidget(lineEdit), lineEdit(lineEdit) {
}

View File

@ -0,0 +1,39 @@
void pListView::append(const lstring &text) {
}
void pListView::autosizeColumns() {
}
bool pListView::checked(unsigned row) {
}
void pListView::modify(unsigned row, const lstring &text) {
}
void pListView::modify(unsigned row, unsigned column, const string &text) {
}
void pListView::reset() {
}
optional<unsigned> pListView::selection() {
return { false, 0 };
}
void pListView::setCheckable(bool checkable) {
}
void pListView::setChecked(unsigned row, bool checked) {
}
void pListView::setHeaderText(const lstring &text) {
}
void pListView::setHeaderVisible(bool visible) {
}
void pListView::setSelection(unsigned row) {
}
pListView::pListView(ListView &listView) : pWidget(listView), listView(listView) {
}

View File

@ -0,0 +1,5 @@
void pProgressBar::setPosition(unsigned position) {
}
pProgressBar::pProgressBar(ProgressBar &progressBar) : pWidget(progressBar), progressBar(progressBar) {
}

View File

@ -0,0 +1,15 @@
bool pRadioBox::checked() {
return false;
}
void pRadioBox::setChecked() {
}
void pRadioBox::setGroup(const array<RadioBox*> &group) {
}
void pRadioBox::setText(const string &text) {
}
pRadioBox::pRadioBox(RadioBox &radioBox) : pWidget(radioBox), radioBox(radioBox) {
}

View File

@ -0,0 +1,17 @@
void pTextEdit::setCursorPosition(unsigned position) {
}
void pTextEdit::setEditable(bool editable) {
}
void pTextEdit::setText(const string &text) {
}
void pTextEdit::setWordWrap(bool wordWrap) {
}
string pTextEdit::text() {
}
pTextEdit::pTextEdit(TextEdit &textEdit) : pWidget(textEdit), textEdit(textEdit) {
}

View File

@ -0,0 +1,12 @@
unsigned pVerticalSlider::position() {
return 0;
}
void pVerticalSlider::setLength(unsigned length) {
}
void pVerticalSlider::setPosition(unsigned position) {
}
pVerticalSlider::pVerticalSlider(VerticalSlider &verticalSlider) : pWidget(verticalSlider), verticalSlider(verticalSlider) {
}

View File

@ -0,0 +1,6 @@
uintptr_t pViewport::handle() {
return 0;
}
pViewport::pViewport(Viewport &viewport) : pWidget(viewport), viewport(viewport) {
}

View File

@ -0,0 +1,21 @@
bool pWidget::enabled() {
return false;
}
void pWidget::setEnabled(bool enabled) {
}
void pWidget::setFocused() {
}
void pWidget::setFont(Font &font) {
}
void pWidget::setGeometry(const Geometry &geometry) {
}
void pWidget::setVisible(bool visible) {
}
pWidget::pWidget(Widget &widget) : widget(widget) {
}

View File

@ -0,0 +1,62 @@
void pWindow::append(Menu &menu) {
}
Geometry pWindow::frameGeometry() {
return { 0, 0, 0, 0 };
}
bool pWindow::focused() {
return false;
}
Geometry pWindow::geometry() {
return { 0, 0, 0, 0 };
}
void pWindow::setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue) {
}
void pWindow::setFrameGeometry(const Geometry &geometry) {
}
void pWindow::setFocused() {
}
void pWindow::setFullScreen(bool fullScreen) {
}
void pWindow::setGeometry(const Geometry &geometry) {
}
void pWindow::setLayout(Layout &layout) {
}
void pWindow::setMenuFont(Font &font) {
}
void pWindow::setMenuVisible(bool visible) {
}
void pWindow::setResizable(bool resizable) {
}
void pWindow::setStatusFont(Font &font) {
}
void pWindow::setStatusText(const string &text) {
}
void pWindow::setStatusVisible(bool visible) {
}
void pWindow::setTitle(const string &text) {
}
void pWindow::setVisible(bool visible) {
}
void pWindow::setWidgetFont(Font &font) {
}
pWindow::pWindow(Window &window) : window(window) {
}

View File

@ -1,7 +1,7 @@
namespace SNES {
namespace Info {
static const char Name[] = "bsnes";
static const char Version[] = "075.12";
static const char Version[] = "075.13";
static const unsigned SerializerVersion = 18;
}
}

View File

@ -4,6 +4,7 @@ void MainWindow::create() {
setTitle({ GameBoy::Info::Name, " v", GameBoy::Info::Version });
setResizable(false);
setMenuFont(application.proportionalFont);
setWidgetFont(application.proportionalFont);
setStatusFont(application.proportionalFontBold);
system.setText("System");

View File

@ -29,7 +29,6 @@ void Application::main(int argc, char **argv) {
monospaceFont.setFamily("Liberation Mono");
monospaceFont.setSize(8);
#endif
OS::setDefaultFont(proportionalFont);
mainWindow.create();
mainWindow.setVisible();

View File

@ -61,18 +61,16 @@ struct Style {
ButtonHeight = 25,
CheckBoxHeight = 15,
ComboBoxHeight = 22,
EditBoxHeight = 22,
LabelHeight = 15,
SliderHeight = 25,
TextBoxHeight = 22,
LineEditHeight = 22,
#else
ButtonHeight = 25,
CheckBoxHeight = 15,
ComboBoxHeight = 22,
EditBoxHeight = 22,
LabelHeight = 15,
SliderHeight = 22,
TextBoxHeight = 22,
LineEditHeight = 22,
#endif
};
};

View File

@ -21,12 +21,12 @@ void BreakpointEditor::create() {
layout.setMargin(5);
layout.append(runToBreakpoint, 0, Style::CheckBoxHeight, 5);
for(unsigned n = 0; n < Breakpoints; n++) {
breakpointLayout[n].append(enableBox[n], 35, Style::EditBoxHeight);
breakpointLayout[n].append(addressBox[n], 60, Style::EditBoxHeight, 5);
breakpointLayout[n].append(valueBox[n], 30, Style::EditBoxHeight, 5);
breakpointLayout[n].append(typeBox[n], 80, Style::EditBoxHeight, 5);
breakpointLayout[n].append(sourceBox[n], 80, Style::EditBoxHeight);
layout.append(breakpointLayout[n], 0, Style::EditBoxHeight, 5);
breakpointLayout[n].append(enableBox[n], 35, Style::LineEditHeight);
breakpointLayout[n].append(addressBox[n], 60, Style::LineEditHeight, 5);
breakpointLayout[n].append(valueBox[n], 30, Style::LineEditHeight, 5);
breakpointLayout[n].append(typeBox[n], 80, Style::LineEditHeight, 5);
breakpointLayout[n].append(sourceBox[n], 80, Style::LineEditHeight);
layout.append(breakpointLayout[n], 0, Style::LineEditHeight, 5);
}
setGeometry({ 0, 0, 310, layout.minimumHeight() });

View File

@ -8,9 +8,9 @@ void FileBrowser::create() {
layout.setMargin(5);
pathLayout.append(pathBox, 0, 0, 5);
pathLayout.append(browseButton, Style::TextBoxHeight, 0, 5);
pathLayout.append(upButton, Style::TextBoxHeight, 0);
layout.append(pathLayout, 0, Style::TextBoxHeight, 5);
pathLayout.append(browseButton, Style::LineEditHeight, 0, 5);
pathLayout.append(upButton, Style::LineEditHeight, 0);
layout.append(pathLayout, 0, Style::LineEditHeight, 5);
layout.append(contentsBox, 0, 0);
setGeometry({ 0, 0, 640, layout.minimumHeight() + 400 });

View File

@ -4,7 +4,7 @@ struct FileBrowser : TopLevelWindow {
LineEdit pathBox;
Button browseButton;
Button upButton;
ListBox contentsBox;
ListView contentsBox;
enum class Mode : unsigned { Cartridge, Satellaview, SufamiTurbo, GameBoy, Filter, Shader } mode;
void fileOpen(Mode mode, function<void (string)> callback);

View File

@ -13,12 +13,12 @@ void SingleSlotLoader::create() {
layout.setMargin(5);
baseLayout.append(baseLabel, 40, 0, 5);
baseLayout.append(basePath, 0, 0, 5);
baseLayout.append(baseBrowse, Style::TextBoxHeight, 0);
layout.append(baseLayout, 0, Style::TextBoxHeight, 5);
baseLayout.append(baseBrowse, Style::LineEditHeight, 0);
layout.append(baseLayout, 0, Style::LineEditHeight, 5);
slotLayout.append(slotLabel, 40, 0, 5);
slotLayout.append(slotPath, 0, 0, 5);
slotLayout.append(slotBrowse, Style::TextBoxHeight, 0);
layout.append(slotLayout, 0, Style::TextBoxHeight, 5);
slotLayout.append(slotBrowse, Style::LineEditHeight, 0);
layout.append(slotLayout, 0, Style::LineEditHeight, 5);
controlLayout.append(spacer, 0, 0);
controlLayout.append(okButton, 80, 0);
layout.append(controlLayout, 0, Style::ButtonHeight);
@ -107,16 +107,16 @@ void DoubleSlotLoader::create() {
layout.setMargin(5);
baseLayout.append(baseLabel, 40, 0, 5);
baseLayout.append(basePath, 0, 0, 5);
baseLayout.append(baseBrowse, Style::TextBoxHeight, 0);
layout.append(baseLayout, 0, Style::TextBoxHeight, 5);
baseLayout.append(baseBrowse, Style::LineEditHeight, 0);
layout.append(baseLayout, 0, Style::LineEditHeight, 5);
slotALayout.append(slotALabel, 40, 0, 5);
slotALayout.append(slotAPath, 0, 0, 5);
slotALayout.append(slotABrowse, Style::TextBoxHeight, 0);
layout.append(slotALayout, 0, Style::TextBoxHeight, 5);
slotALayout.append(slotABrowse, Style::LineEditHeight, 0);
layout.append(slotALayout, 0, Style::LineEditHeight, 5);
slotBLayout.append(slotBLabel, 40, 0, 5);
slotBLayout.append(slotBPath, 0, 0, 5);
slotBLayout.append(slotBBrowse, Style::TextBoxHeight, 0);
layout.append(slotBLayout, 0, Style::TextBoxHeight, 5);
slotBLayout.append(slotBBrowse, Style::LineEditHeight, 0);
layout.append(slotBLayout, 0, Style::LineEditHeight, 5);
controlLayout.append(spacer, 0, 0);
controlLayout.append(okButton, 80, 0);
layout.append(controlLayout, 0, Style::ButtonHeight);

View File

@ -39,7 +39,6 @@ void Application::main(int argc, char **argv) {
monospaceFont.setFamily("Liberation Mono");
monospaceFont.setSize(8);
#endif
OS::setDefaultFont(proportionalFont);
SNES::system.init(&interface);
@ -144,6 +143,7 @@ void Application::addWindow(TopLevelWindow *window, const string &name, const st
windows.append(window);
window->name = name;
window->position = position;
window->setWidgetFont(proportionalFont);
geometryConfig.attach(window->position, window->name);
}

View File

@ -5,7 +5,7 @@ struct InputSettings : TopLevelWindow {
ComboBox portBox;
Label deviceLabel;
ComboBox deviceBox;
ListBox mappingList;
ListView mappingList;
HorizontalLayout mapLayout;
Button mouseXaxis;
Button mouseYaxis;

View File

@ -52,14 +52,14 @@ void VideoSettings::create() {
layout.append(fullscreenLayout, 0, Style::CheckBoxHeight, 5);
layout.append(filterLabel, 0, Style::LabelHeight);
filterLayout.append(filterPath, 0, 0, 5);
filterLayout.append(filterClear, Style::TextBoxHeight, 0, 5);
filterLayout.append(filterSelect, Style::TextBoxHeight, 0);
layout.append(filterLayout, 0, Style::TextBoxHeight, 5);
filterLayout.append(filterClear, Style::LineEditHeight, 0, 5);
filterLayout.append(filterSelect, Style::LineEditHeight, 0);
layout.append(filterLayout, 0, Style::LineEditHeight, 5);
layout.append(shaderLabel, 0, Style::LabelHeight);
shaderLayout.append(shaderPath, 0, 0, 5);
shaderLayout.append(shaderClear, Style::TextBoxHeight, 0, 5);
shaderLayout.append(shaderSelect, Style::TextBoxHeight, 0);
layout.append(shaderLayout, 0, Style::TextBoxHeight);
shaderLayout.append(shaderClear, Style::LineEditHeight, 0, 5);
shaderLayout.append(shaderSelect, Style::LineEditHeight, 0);
layout.append(shaderLayout, 0, Style::LineEditHeight);
setGeometry({ 0, 0, 480, layout.minimumHeight() });
setLayout(layout);

View File

@ -95,10 +95,10 @@ void CheatEditor::create() {
layout.append(cheatList, 0, 0, 5);
codeLayout.append(codeLabel, 80, 0, 5);
codeLayout.append(codeEdit, 0, 0);
layout.append(codeLayout, 0, Style::TextBoxHeight, 5);
layout.append(codeLayout, 0, Style::LineEditHeight, 5);
descLayout.append(descLabel, 80, 0, 5);
descLayout.append(descEdit, 0, 0);
layout.append(descLayout, 0, Style::TextBoxHeight, 5);
layout.append(descLayout, 0, Style::LineEditHeight, 5);
controlLayout.append(findButton, 100, 0);
controlLayout.append(spacer, 0, 0);
controlLayout.append(clearAllButton, 80, 0, 5);

View File

@ -1,6 +1,6 @@
struct CheatEditor : TopLevelWindow {
VerticalLayout layout;
ListBox cheatList;
ListView cheatList;
HorizontalLayout codeLayout;
Label codeLabel;
LineEdit codeEdit;
@ -15,7 +15,7 @@ struct CheatEditor : TopLevelWindow {
TopLevelWindow databaseWindow;
VerticalLayout databaseLayout;
ListBox databaseList;
ListView databaseList;
HorizontalLayout databaseControlLayout;
Button databaseSelectAll;
Button databaseUnselectAll;

View File

@ -15,7 +15,7 @@ void StateManager::create() {
layout.append(stateList, 0, 0, 5);
descLayout.append(descLabel, 80, 0, 5);
descLayout.append(descEdit, 0, 0);
layout.append(descLayout, 0, Style::TextBoxHeight, 5);
layout.append(descLayout, 0, Style::LineEditHeight, 5);
controlLayout.append(spacer, 0, 0);
controlLayout.append(loadButton, 80, 0, 5);
controlLayout.append(saveButton, 80, 0, 5);

View File

@ -1,6 +1,6 @@
struct StateManager : TopLevelWindow {
VerticalLayout layout;
ListBox stateList;
ListView stateList;
HorizontalLayout descLayout;
Label descLabel;
LineEdit descEdit;