Update to bsnes v052 release.

This is a maintenance release, which fixes a few important bugs. It also adds some graphical icons to soften the user interface. Note that if you have set any custom paths with v051, you'll need to set them again for the fix to work. As always, my apologies for releasing two versions so close together. I felt the bugs were important enough to warrant it.
Changelog:
    - fixed loading of files and folders containing non-ANSI characters (Chinese, Japanese, etc)
    - fixed a slight lag on startup due to the new file browser
    - fixed path selection setting, screenshots will now be saved to the correct directory
    - hid memory editor scrollbar since it does not work yet
    - disabled window positioning on Linux due to bugs in the Compiz compositor
    - added icons from the Tango icon library to the menus and panels
This commit is contained in:
byuu 2009-09-29 12:25:41 +00:00
parent b6a85353bf
commit a0000c7846
43 changed files with 139 additions and 73 deletions

View File

@ -1,4 +1,4 @@
static const char bsnesVersion[] = "0.051";
static const char bsnesVersion[] = "0.052";
static const char bsnesTitle[] = "bsnes";
static const unsigned bsnesSaveStateVersion = 3;

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

View File

@ -202,7 +202,7 @@ DiskBrowser::DiskBrowser() {
applyPatch = new QCheckBox("Apply UPS patch");
applyPatch->setChecked(true);
applyPatch->setVisible(false);
//applyPatch->setEnabled(false);
applyPatch->setEnabled(false);
layout->addWidget(applyPatch);
connect(this, SIGNAL(itemActivated(const QString&, bool)), this, SLOT(onActivate(const QString&, bool)));

View File

@ -11,31 +11,39 @@ MainWindow::MainWindow() {
system = menuBar->addMenu("System");
system_load = system->addAction("Load Cartridge ...");
system_load->setIcon(QIcon(":/16x16/document-open.png"));
system->addSeparator();
system_power = system->addMenu("Power");
system_power_on = system_power->addAction("On");
system_power_on->setCheckable(true);
system_power_off = system_power->addAction("Off");
system_power_off->setCheckable(true);
system_power = system->addAction("Power");
system_power->setIcon(QIcon(":/16x16/system-shutdown.png"));
system_power->setCheckable(true);
system_reset = system->addAction("Reset");
system_reset->setIcon(QIcon(":/16x16/view-refresh.png"));
system->addSeparator();
system_port1 = system->addMenu("Controller Port 1");
system_port1->setIcon(QIcon(":/16x16/input-gaming.png"));
system_port1_none = system_port1->addAction("None");
system_port1_none->setCheckable(true);
system_port1_joypad = system_port1->addAction("Joypad");
system_port1_joypad->setIcon(QIcon(":/16x16/input-gaming.png"));
system_port1_joypad->setCheckable(true);
system_port1_multitap = system_port1->addAction("Multitap");
system_port1_multitap->setIcon(QIcon(":/16x16/input-gaming.png"));
system_port1_multitap->setCheckable(true);
system_port1_mouse = system_port1->addAction("Mouse");
system_port1_mouse->setIcon(QIcon(":/16x16/input-mouse.png"));
system_port1_mouse->setCheckable(true);
system_port2 = system->addMenu("Controller Port 2");
system_port2->setIcon(QIcon(":/16x16/input-gaming.png"));
system_port2_none = system_port2->addAction("None");
system_port2_none->setCheckable(true);
system_port2_joypad = system_port2->addAction("Joypad");
system_port2_joypad->setIcon(QIcon(":/16x16/input-gaming.png"));
system_port2_joypad->setCheckable(true);
system_port2_multitap = system_port2->addAction("Multitap");
system_port2_multitap->setIcon(QIcon(":/16x16/input-gaming.png"));
system_port2_multitap->setCheckable(true);
system_port2_mouse = system_port2->addAction("Mouse");
system_port2_mouse->setIcon(QIcon(":/16x16/input-mouse.png"));
system_port2_mouse->setCheckable(true);
system_port2_superscope = system_port2->addAction("Super Scope");
system_port2_superscope->setCheckable(true);
@ -47,10 +55,12 @@ MainWindow::MainWindow() {
system->addSeparator();
#endif
system_exit = system->addAction("Exit");
system_exit->setIcon(QIcon(":/16x16/process-stop.png"));
system_exit->setMenuRole(QAction::QuitRole);
settings = menuBar->addMenu("Settings");
settings_videoMode = settings->addMenu("Video Mode");
settings_videoMode->setIcon(QIcon(":/16x16/video-display.png"));
settings_videoMode_1x = settings_videoMode->addAction("Scale 1x");
settings_videoMode_1x->setCheckable(true);
settings_videoMode_2x = settings_videoMode->addAction("Scale 2x");
@ -65,6 +75,7 @@ MainWindow::MainWindow() {
settings_videoMode_correctAspectRatio = settings_videoMode->addAction("Correct Aspect Ratio");
settings_videoMode_correctAspectRatio->setCheckable(true);
settings_videoMode_fullscreen = settings_videoMode->addAction("Fullscreen");
settings_videoMode_fullscreen->setIcon(QIcon(":/16x16/view-fullscreen.png"));
settings_videoMode_fullscreen->setCheckable(true);
settings_videoMode->addSeparator();
settings_videoMode_ntsc = settings_videoMode->addAction("NTSC");
@ -72,6 +83,7 @@ MainWindow::MainWindow() {
settings_videoMode_pal = settings_videoMode->addAction("PAL");
settings_videoMode_pal->setCheckable(true);
settings_videoFilter = settings->addMenu("Video Filter");
settings_videoFilter->setIcon(QIcon(":/16x16/image-x-generic.png"));
settings_videoFilter_point = settings_videoFilter->addAction("Point");
settings_videoFilter_point->setCheckable(true);
settings_videoFilter_linear = settings_videoFilter->addAction("Linear");
@ -91,9 +103,11 @@ MainWindow::MainWindow() {
settings_videoFilter_ntsc->setCheckable(true);
settings->addSeparator();
settings_muteAudio = settings->addAction("Mute Audio Output");
settings_muteAudio->setIcon(QIcon(":/16x16/audio-volume-muted.png"));
settings_muteAudio->setCheckable(true);
settings->addSeparator();
settings_emulationSpeed = settings->addMenu("Emulation Speed");
settings_emulationSpeed->setIcon(QIcon(":/16x16/appointment-new.png"));
settings_emulationSpeed_slowest = settings_emulationSpeed->addAction("50%");
settings_emulationSpeed_slowest->setCheckable(true);
settings_emulationSpeed_slow = settings_emulationSpeed->addAction("75%");
@ -106,30 +120,39 @@ MainWindow::MainWindow() {
settings_emulationSpeed_fastest->setCheckable(true);
settings_emulationSpeed->addSeparator();
settings_emulationSpeed_syncVideo = settings_emulationSpeed->addAction("Sync Video");
settings_emulationSpeed_syncVideo->setIcon(QIcon(":/16x16/video-display.png"));
settings_emulationSpeed_syncVideo->setCheckable(true);
settings_emulationSpeed_syncAudio = settings_emulationSpeed->addAction("Sync Audio");
settings_emulationSpeed_syncAudio->setIcon(QIcon(":/16x16/audio-volume-high.png"));
settings_emulationSpeed_syncAudio->setCheckable(true);
settings_configuration = settings->addAction("Configuration ...");
settings_configuration->setIcon(QIcon(":/16x16/preferences-desktop.png"));
settings_configuration->setMenuRole(QAction::PreferencesRole);
tools = menuBar->addMenu("Tools");
tools_cheatEditor = tools->addAction("Cheat Editor ...");
tools_cheatEditor->setIcon(QIcon(":/16x16/accessories-text-editor.png"));
tools_stateManager = tools->addAction("State Manager ...");
tools_stateManager->setIcon(QIcon(":/16x16/system-file-manager.png"));
#if defined(DEBUGGER)
tools->addSeparator();
#endif
tools_debugger = tools->addAction("Debugger ...");
tools_debugger->setIcon(QIcon(":/16x16/utilities-terminal.png"));
#if !defined(DEBUGGER)
tools_debugger->setVisible(false);
#endif
help = menuBar->addMenu("Help");
help_documentation = help->addAction("Documentation ...");
help_documentation->setIcon(QIcon(":/16x16/text-x-generic.png"));
help_license = help->addAction("License ...");
help_license->setIcon(QIcon(":/16x16/text-x-generic.png"));
#if !defined(PLATFORM_OSX)
help->addSeparator();
#endif
help_about = help->addAction("About ...");
help_about->setIcon(QIcon(":/16x16/help-browser.png"));
help_about->setMenuRole(QAction::AboutRole);
//canvas
@ -175,8 +198,7 @@ MainWindow::MainWindow() {
//slots
connect(system_load, SIGNAL(triggered()), this, SLOT(loadCartridge()));
connect(system_power_on, SIGNAL(triggered()), this, SLOT(powerOn()));
connect(system_power_off, SIGNAL(triggered()), this, SLOT(powerOff()));
connect(system_power, SIGNAL(triggered()), this, SLOT(power()));
connect(system_reset, SIGNAL(triggered()), this, SLOT(reset()));
connect(system_port1_none, SIGNAL(triggered()), this, SLOT(setPort1None()));
connect(system_port1_joypad, SIGNAL(triggered()), this, SLOT(setPort1Joypad()));
@ -228,8 +250,8 @@ MainWindow::MainWindow() {
void MainWindow::syncUi() {
system_power->setEnabled(SNES::cartridge.loaded());
system_power_on->setChecked (application.power == true);
system_power_off->setChecked(application.power == false);
system_power->setChecked (application.power == true);
system_power->setEnabled(SNES::cartridge.loaded());
system_reset->setEnabled(SNES::cartridge.loaded() && application.power);
system_port1_none->setChecked (SNES::config.controller_port1 == SNES::Input::DeviceNone);
@ -284,9 +306,17 @@ void MainWindow::loadCartridge() {
diskBrowser->loadAnyCartridge();
}
void MainWindow::powerOn() { utility.modifySystemState(Utility::PowerOn); }
void MainWindow::powerOff() { utility.modifySystemState(Utility::PowerOff); }
void MainWindow::reset() { utility.modifySystemState(Utility::Reset); }
void MainWindow::power() {
if(system_power->isChecked()) {
utility.modifySystemState(Utility::PowerOn);
} else {
utility.modifySystemState(Utility::PowerOff);
}
}
void MainWindow::reset() {
utility.modifySystemState(Utility::Reset);
}
void MainWindow::setPort1None() { SNES::config.controller_port1 = SNES::Input::DeviceNone; utility.updateControllers(); syncUi(); }
void MainWindow::setPort1Joypad() { SNES::config.controller_port1 = SNES::Input::DeviceJoypad; utility.updateControllers(); syncUi(); }

View File

@ -24,9 +24,7 @@ public:
QVBoxLayout *layout;
QMenu *system;
QAction *system_load;
QMenu *system_power;
QAction *system_power_on;
QAction *system_power_off;
QAction *system_power;
QAction *system_reset;
QMenu *system_port1;
QAction *system_port1_none;
@ -92,8 +90,7 @@ public:
public slots:
void loadCartridge();
void powerOn();
void powerOff();
void power();
void reset();
void setPort1None();
void setPort1Joypad();

View File

@ -106,7 +106,7 @@ Configuration::Configuration() {
attach(audio.outputFrequency = 48000, "audio.outputFrequency");
attach(audio.inputFrequency = 32000, "audio.inputFrequency");
attach(input.focusPolicy = Input::FocusPolicyPauseEmulation, "input.focusPolicy");
attach(input.focusPolicy = Input::FocusPolicyIgnoreInput, "input.focusPolicy");
attach(input.allowInvalidInput = false, "input.allowInvalidInput", "Allow up+down / left+right combinations; may trigger bugs in some games");
attach(input.joypad1.up = "keyboard00.up", "input.joypad1.up");

View File

@ -16,11 +16,15 @@ Debugger::Debugger() {
tools = menu->addMenu("Tools");
tools_breakpoint = tools->addAction("Breakpoint Editor ...");
tools_breakpoint->setIcon(QIcon(":/16x16/process-stop.png"));
tools_memory = tools->addAction("Memory Editor ...");
tools_memory->setIcon(QIcon(":/16x16/text-x-generic.png"));
tools_vramViewer = tools->addAction("Video RAM Viewer ...");
tools_vramViewer->setIcon(QIcon(":/16x16/image-x-generic.png"));
miscOptions = menu->addMenu("Misc");
miscOptions_clear = miscOptions->addAction("Clear Console");
miscOptions_clear->setIcon(QIcon(":/16x16/document-new.png"));
console = new QTextEdit;
console->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

View File

@ -35,7 +35,7 @@ MemoryEditor::MemoryEditor() {
editor = new QbHexEdit;
editor->setFont(QFont(Style::Monospace));
editor->setMinimumWidth((60 + 2) * editor->fontMetrics().width(' '));
editor->setMinimumWidth((58 + 2) * editor->fontMetrics().width(' '));
editor->setMinimumHeight((16 + 1) * editor->fontMetrics().height());
editor->reader = bind(&MemoryEditor::reader, this);

View File

@ -40,15 +40,16 @@ QPushButton *QbDiskBrowser::acceptButton() { return load; }
void QbDiskBrowser::setPath(const QString &reqPath) {
disconnect(path, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePath()));
QString effectivePath = reqPath;
if(effectivePath == "<root>") effectivePath = "";
path->clear();
view->setRootIndex(model->index(reqPath));
model->setRootPath(effectivePath);
view->setRootIndex(model->index(effectivePath));
view->setCurrentIndex(view->rootIndex());
view->setFocus();
string effectivePath = reqPath.toUtf8().constData();
if(effectivePath == "<root>") effectivePath = "";
if(effectivePath.length() > 0) {
QDir directory((const char*)effectivePath);
QDir directory(effectivePath);
while(true) {
path->addItem(directory.absolutePath());
if(directory.isRoot()) break;
@ -157,7 +158,6 @@ QbDiskBrowser::QbDiskBrowser() {
controlLayout->addWidget(cancel);
model = new QFileSystemModel;
model->setRootPath("");
model->setFilter(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
model->setNameFilterDisables(false);

View File

@ -152,6 +152,6 @@ QbHexEdit::QbHexEdit() {
scrollBar = new QbHexEditScrollBar;
scrollBar->setEnabled(false);
setVerticalScrollBar(scrollBar);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}

View File

@ -1,11 +1,5 @@
void QbWindow::showHidden(bool state) {
#if defined(PLATFORM_X)
if(state) {
showMinimized();
} else {
showNormal();
}
#else
#if !defined(PLATFORM_X)
if(state) {
setWindowOpacity(0.0);
} else {
@ -16,18 +10,14 @@ void QbWindow::showHidden(bool state) {
}
void QbWindow::showAt(double x, double y) {
#if defined(PLATFORM_X)
resize(0, 0);
showNormal();
#else
if(isVisible() == false) showHidden(true);
resize(0, 0);
QApplication::processEvents();
#if defined(PLATFORM_X)
for(unsigned counter = 0; counter < 4096; counter++) {
if(frameSize() != size()) break;
usleep(5000);
QApplication::processEvents();
}
#endif
QRect deskRect = QApplication::desktop()->availableGeometry(this);
//convert cartesian coordinates to linear scale (-1.0 -> 0.0, 0.0 -> 0.5, +1.0 -> +1.0)
@ -39,6 +29,7 @@ void QbWindow::showAt(double x, double y) {
move(deskRect.left() + availableWidth * x, deskRect.top() + availableHeight * y);
showHidden(false);
#endif
}
void QbWindow::setFocus() {

View File

@ -1,5 +1,3 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <nall/utf8.hpp>
char* realpath(const char *filename, char *resolvedname) {

View File

@ -6,5 +6,33 @@
<file alias="joypad.png">../../data/joypad.png</file>
<file alias="documentation.html">../../data/documentation.html</file>
<file alias="license.html">../../data/license.html</file>
<file alias="16x16/accessories-text-editor.png">../../data/icons-16x16/accessories-text-editor.png</file>
<file alias="16x16/appointment-new.png">../../data/icons-16x16/appointment-new.png</file>
<file alias="16x16/audio-volume-high.png">../../data/icons-16x16/audio-volume-high.png</file>
<file alias="16x16/audio-volume-muted.png">../../data/icons-16x16/audio-volume-muted.png</file>
<file alias="16x16/document-new.png">../../data/icons-16x16/document-new.png</file>
<file alias="16x16/document-open.png">../../data/icons-16x16/document-open.png</file>
<file alias="16x16/help-browser.png">../../data/icons-16x16/help-browser.png</file>
<file alias="16x16/image-x-generic.png">../../data/icons-16x16/image-x-generic.png</file>
<file alias="16x16/input-gaming.png">../../data/icons-16x16/input-gaming.png</file>
<file alias="16x16/input-mouse.png">../../data/icons-16x16/input-mouse.png</file>
<file alias="16x16/preferences-desktop.png">../../data/icons-16x16/preferences-desktop.png</file>
<file alias="16x16/process-stop.png">../../data/icons-16x16/process-stop.png</file>
<file alias="16x16/system-file-manager.png">../../data/icons-16x16/system-file-manager.png</file>
<file alias="16x16/system-shutdown.png">../../data/icons-16x16/system-shutdown.png</file>
<file alias="16x16/text-x-generic.png">../../data/icons-16x16/text-x-generic.png</file>
<file alias="16x16/utilities-terminal.png">../../data/icons-16x16/utilities-terminal.png</file>
<file alias="16x16/video-display.png">../../data/icons-16x16/video-display.png</file>
<file alias="16x16/view-fullscreen.png">../../data/icons-16x16/view-fullscreen.png</file>
<file alias="16x16/view-refresh.png">../../data/icons-16x16/view-refresh.png</file>
<file alias="22x22/accessories-text-editor.png">../../data/icons-22x22/accessories-text-editor.png</file>
<file alias="22x22/audio-volume-high.png">../../data/icons-22x22/audio-volume-high.png</file>
<file alias="22x22/folder.png">../../data/icons-22x22/folder.png</file>
<file alias="22x22/input-gaming.png">../../data/icons-22x22/input-gaming.png</file>
<file alias="22x22/preferences-system.png">../../data/icons-22x22/preferences-system.png</file>
<file alias="22x22/system-file-manager.png">../../data/icons-22x22/system-file-manager.png</file>
<file alias="22x22/video-display.png">../../data/icons-22x22/video-display.png</file>
</qresource>
</RCC>

View File

@ -32,7 +32,7 @@ PathSettingWidget::PathSettingWidget(string &pathValue_, const char *labelText,
}
void PathSettingWidget::selectPath(const string &newPath) {
pathValue = newPath;
pathValue = string() << newPath << "/";
updatePath();
}

View File

@ -10,14 +10,26 @@ SettingsWindow::SettingsWindow() {
setWindowTitle("Configuration Settings");
setMinimumSize(625, 360);
list = new QListWidget;
list->addItem(video = new QListWidgetItem("Video"));
list->addItem(audio = new QListWidgetItem("Audio"));
list->addItem(input = new QListWidgetItem("Input"));
list->addItem(paths = new QListWidgetItem("Paths"));
list->addItem(advanced = new QListWidgetItem("Advanced"));
//use QTreeWidget instead of QListWidget, as only the former has setAllColumnsShowFocus()
//this is needed to have the dotted-selection rectangle encompass the icons
list = new QTreeWidget;
list->addTopLevelItem(video = new QTreeWidgetItem(QStringList() << "Video"));
list->addTopLevelItem(audio = new QTreeWidgetItem(QStringList() << "Audio"));
list->addTopLevelItem(input = new QTreeWidgetItem(QStringList() << "Input"));
list->addTopLevelItem(paths = new QTreeWidgetItem(QStringList() << "Paths"));
list->addTopLevelItem(advanced = new QTreeWidgetItem(QStringList() << "Advanced"));
list->setCurrentItem(input); //select most frequently used panel by default
list->setFixedWidth(135);
list->setHeaderHidden(true);
list->setRootIsDecorated(false);
list->setAllColumnsShowFocus(true);
list->setIconSize(QSize(22, 22));
video->setIcon(0, QIcon(":/22x22/video-display.png"));
audio->setIcon(0, QIcon(":/22x22/audio-volume-high.png"));
input->setIcon(0, QIcon(":/22x22/input-gaming.png"));
paths->setIcon(0, QIcon(":/22x22/folder.png"));
advanced->setIcon(0, QIcon(":/22x22/preferences-system.png"));
panel = new QWidget;
panel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@ -44,13 +56,13 @@ SettingsWindow::SettingsWindow() {
panelLayout->addWidget(winAdvancedSettings->panel);
panel->setLayout(panelLayout);
connect(list, SIGNAL(currentRowChanged(int)), this, SLOT(listChanged()));
connect(list, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(itemChanged()));
listChanged();
itemChanged();
}
void SettingsWindow::listChanged() {
QListWidgetItem *item = list->currentItem();
void SettingsWindow::itemChanged() {
QTreeWidgetItem *item = list->currentItem();
if(item == video) panelLayout->setCurrentWidget(winVideoSettings->panel);
if(item == audio) panelLayout->setCurrentWidget(winAudioSettings->panel);

View File

@ -10,17 +10,17 @@ class SettingsWindow : public QbWindow {
public:
QHBoxLayout *layout;
QListWidget *list;
QListWidgetItem *video;
QListWidgetItem *audio;
QListWidgetItem *input;
QListWidgetItem *paths;
QListWidgetItem *advanced;
QTreeWidget *list;
QTreeWidgetItem *video;
QTreeWidgetItem *audio;
QTreeWidgetItem *input;
QTreeWidgetItem *paths;
QTreeWidgetItem *advanced;
QWidget *panel;
QStackedLayout *panelLayout;
SettingsWindow();
public slots:
void listChanged();
void itemChanged();
} *settingsWindow;

View File

@ -6,11 +6,17 @@ ToolsWindow::ToolsWindow() {
setWindowTitle("Tools");
setMinimumSize(625, 360);
list = new QListWidget;
list->addItem(cheatEditor = new QListWidgetItem("Cheat Editor"));
list->addItem(stateManager = new QListWidgetItem("State Manager"));
list = new QTreeWidget;
list->addTopLevelItem(cheatEditor = new QTreeWidgetItem(QStringList() << "Cheat Editor"));
list->addTopLevelItem(stateManager = new QTreeWidgetItem(QStringList() << "State Manager"));
list->setCurrentItem(cheatEditor);
list->setFixedWidth(135);
list->setHeaderHidden(true);
list->setRootIsDecorated(false);
list->setAllColumnsShowFocus(true);
list->setIconSize(QSize(22, 22));
cheatEditor->setIcon(0, QIcon(":/22x22/accessories-text-editor.png"));
stateManager->setIcon(0, QIcon(":/22x22/system-file-manager.png"));
panel = new QWidget;
panel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@ -30,13 +36,13 @@ ToolsWindow::ToolsWindow() {
panelLayout->addWidget(stateManagerWindow->panel);
panel->setLayout(panelLayout);
connect(list, SIGNAL(currentRowChanged(int)), this, SLOT(listChanged()));
connect(list, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(itemChanged()));
listChanged();
itemChanged();
}
void ToolsWindow::listChanged() {
QListWidgetItem *item = list->currentItem();
void ToolsWindow::itemChanged() {
QTreeWidgetItem *item = list->currentItem();
if(item == cheatEditor) panelLayout->setCurrentWidget(cheatEditorWindow->panel);
if(item == stateManager) panelLayout->setCurrentWidget(stateManagerWindow->panel);

View File

@ -6,9 +6,9 @@ class ToolsWindow : public QbWindow {
public:
QHBoxLayout *layout;
QListWidget *list;
QListWidgetItem *cheatEditor;
QListWidgetItem *stateManager;
QTreeWidget *list;
QTreeWidgetItem *cheatEditor;
QTreeWidgetItem *stateManager;
QWidget *panel;
QStackedLayout *panelLayout;
@ -17,5 +17,5 @@ public:
ToolsWindow();
public slots:
void listChanged();
void itemChanged();
} *toolsWindow;