Merge branch 'qt' of https://github.com/jgilje/86Box into qt
This commit is contained in:
@@ -85,6 +85,13 @@ add_library(ui STATIC
|
||||
qt_models_common.cpp
|
||||
qt_models_common.hpp
|
||||
|
||||
qt_specifydimensions.h
|
||||
qt_specifydimensions.cpp
|
||||
qt_specifydimensions.ui
|
||||
qt_soundgain.hpp
|
||||
qt_soundgain.cpp
|
||||
qt_soundgain.ui
|
||||
|
||||
../qt_resources.qrc
|
||||
)
|
||||
if (APPLE)
|
||||
@@ -121,6 +128,13 @@ endif()
|
||||
if (UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
target_link_libraries(ui PRIVATE X11::X11)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(LIBEVDEV IMPORTED_TARGET libevdev)
|
||||
if (LIBEVDEV_FOUND)
|
||||
target_compile_definitions(ui PRIVATE EVDEV_INPUT)
|
||||
target_link_libraries(ui PUBLIC PkgConfig::LIBEVDEV)
|
||||
target_sources(ui PRIVATE evdev_mouse.cpp)
|
||||
endif()
|
||||
|
||||
find_package(ECM NO_MODULE)
|
||||
if (ECM_FOUND)
|
||||
|
102
src/qt/evdev_mouse.cpp
Normal file
102
src/qt/evdev_mouse.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
#include "evdev_mouse.hpp"
|
||||
#include <libevdev/libevdev.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
#include <QThread>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <86box/86box.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/mouse.h>
|
||||
}
|
||||
|
||||
static std::vector<std::pair<int, libevdev*>> evdev_mice;
|
||||
static std::atomic<bool> stopped = false;
|
||||
static QThread* evdev_thread;
|
||||
|
||||
static std::atomic<int> evdev_mouse_rel_x = 0, evdev_mouse_rel_y = 0;
|
||||
|
||||
void evdev_mouse_poll()
|
||||
{
|
||||
if (!evdev_mice.size() || !mouse_capture)
|
||||
{
|
||||
evdev_mouse_rel_x = 0;
|
||||
evdev_mouse_rel_y = 0;
|
||||
return;
|
||||
}
|
||||
mouse_x = evdev_mouse_rel_x;
|
||||
mouse_y = evdev_mouse_rel_y;
|
||||
evdev_mouse_rel_x = evdev_mouse_rel_y = 0;
|
||||
}
|
||||
|
||||
void evdev_thread_func()
|
||||
{
|
||||
while (!stopped)
|
||||
{
|
||||
for (int i = 0; i < evdev_mice.size(); i++)
|
||||
{
|
||||
struct input_event ev;
|
||||
int rc = libevdev_next_event(evdev_mice[i].second, LIBEVDEV_READ_FLAG_NORMAL, &ev);
|
||||
if (rc == 0 && ev.type == EV_REL && mouse_capture)
|
||||
{
|
||||
if (ev.code == REL_X) evdev_mouse_rel_x += ev.value;
|
||||
if (ev.code == REL_Y) evdev_mouse_rel_y += ev.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < evdev_mice.size(); i++)
|
||||
{
|
||||
libevdev_free(evdev_mice[i].second);
|
||||
close(evdev_mice[i].first);
|
||||
}
|
||||
evdev_mice.clear();
|
||||
}
|
||||
|
||||
void evdev_stop()
|
||||
{
|
||||
stopped = true;
|
||||
evdev_thread->wait();
|
||||
}
|
||||
|
||||
void evdev_init()
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
std::string evdev_device_path = "/dev/input/event" + std::to_string(i);
|
||||
int fd = open(evdev_device_path.c_str(), O_NONBLOCK | O_RDONLY);
|
||||
if (fd != -1)
|
||||
{
|
||||
libevdev* input_struct = nullptr;
|
||||
int rc = libevdev_new_from_fd(fd, &input_struct);
|
||||
if (rc <= -1)
|
||||
{
|
||||
close(fd);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!libevdev_has_event_type(input_struct, EV_REL) || !libevdev_has_event_code(input_struct, EV_KEY, BTN_LEFT))
|
||||
{
|
||||
libevdev_free(input_struct);
|
||||
close(fd);
|
||||
continue;
|
||||
}
|
||||
evdev_mice.push_back(std::make_pair(fd, input_struct));
|
||||
}
|
||||
}
|
||||
else if (errno == ENOENT) break;
|
||||
}
|
||||
if (evdev_mice.size() != 0)
|
||||
{
|
||||
evdev_thread = QThread::create(evdev_thread_func);
|
||||
evdev_thread->start();
|
||||
atexit(evdev_stop);
|
||||
}
|
||||
}
|
4
src/qt/evdev_mouse.hpp
Normal file
4
src/qt/evdev_mouse.hpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifdef EVDEV_INPUT
|
||||
void evdev_init();
|
||||
void evdev_mouse_poll();
|
||||
#endif
|
@@ -30,12 +30,6 @@ public:
|
||||
: QOpenGLWidget(parent), QOpenGLFunctions()
|
||||
{
|
||||
setMinimumSize(16, 16);
|
||||
#ifdef WAYLAND
|
||||
if (QApplication::platformName().contains("wayland")) {
|
||||
wayland = true;
|
||||
wl_init();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
~HardwareRenderer()
|
||||
{
|
||||
|
@@ -97,7 +97,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
pc_init(argc, argv);
|
||||
if (! pc_init_modules()) {
|
||||
ui_msgbox_header(MBX_FATAL, VC(L"No ROMs found."), VC(L"86Box could not find any usable ROM images.\n\nPlease download a ROM set and extract it into the \"roms\" directory."));
|
||||
ui_msgbox_header(MBX_FATAL, VC(L"No ROMs found."), VC(L"86Box could not find any usable ROM images.\n\nPlease <a href='https://github.com/86Box/roms/releases/latest'>download</a> a ROM set and extract it into the \"roms\" directory."));
|
||||
return 6;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,6 @@ int main(int argc, char* argv[]) {
|
||||
onesec.start(1000);
|
||||
|
||||
/* Initialize the rendering window, or fullscreen. */
|
||||
QTimer::singleShot(50, []() { plat_resize(640, 480); } );
|
||||
auto main_thread = std::thread([] {
|
||||
main_thread_fn();
|
||||
});
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#include "qt_mainwindow.hpp"
|
||||
#include "ui_qt_mainwindow.h"
|
||||
|
||||
#include "qt_specifydimensions.h"
|
||||
#include "qt_soundgain.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <86box/86box.h>
|
||||
#include <86box/config.h>
|
||||
@@ -8,6 +11,7 @@ extern "C" {
|
||||
#include <86box/plat.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_ega.h>
|
||||
#include <86box/version.h>
|
||||
};
|
||||
|
||||
#include <QGuiApplication>
|
||||
@@ -21,6 +25,7 @@ extern "C" {
|
||||
#include <QPushButton>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include <array>
|
||||
#include <unordered_map>
|
||||
@@ -52,6 +57,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->stackedWidget->setMouseTracking(true);
|
||||
ui->ogl->setRenderType(HardwareRenderer::RenderType::OpenGL);
|
||||
ui->gles->setRenderType(HardwareRenderer::RenderType::OpenGLES);
|
||||
statusBar()->setVisible(!hide_status_bar);
|
||||
|
||||
this->setWindowIcon(QIcon(":/settings/win/icons/86Box-yellow.ico"));
|
||||
|
||||
@@ -60,6 +66,18 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(this, &MainWindow::setTitleForNonQtThread, this, &MainWindow::setTitle_, Qt::BlockingQueuedConnection);
|
||||
connect(this, &MainWindow::getTitleForNonQtThread, this, &MainWindow::getTitle_, Qt::BlockingQueuedConnection);
|
||||
|
||||
connect(this, &MainWindow::updateMenuResizeOptions, [this]() {
|
||||
ui->actionResizable_window->setEnabled(vid_resize != 2);
|
||||
ui->actionResizable_window->setChecked(vid_resize == 1);
|
||||
ui->menuWindow_scale_factor->setEnabled(vid_resize == 0);
|
||||
});
|
||||
|
||||
connect(this, &MainWindow::updateWindowRememberOption, [this]() {
|
||||
ui->actionRemember_size_and_position->setChecked(window_remember);
|
||||
});
|
||||
|
||||
emit updateMenuResizeOptions();
|
||||
|
||||
connect(this, &MainWindow::pollMouse, ui->stackedWidget, &RendererStack::mousePoll);
|
||||
|
||||
connect(this, &MainWindow::setMouseCapture, this, [this](bool state) {
|
||||
@@ -83,8 +101,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
});
|
||||
|
||||
connect(this, &MainWindow::resizeContents, this, [this](int w, int h) {
|
||||
if (!QApplication::platformName().contains("eglfs")) {
|
||||
int modifiedHeight = h + menuBar()->height() + statusBar()->height();
|
||||
if (!QApplication::platformName().contains("eglfs") && vid_resize == 0) {
|
||||
w = w / (!dpi_scale ? devicePixelRatio() : 1);
|
||||
int modifiedHeight = (h / (!dpi_scale ? devicePixelRatio() : 1)) + menuBar()->height() + (statusBar()->height() * !hide_status_bar);
|
||||
ui->stackedWidget->resize(w, h);
|
||||
if (vid_resize == 0) {
|
||||
setFixedSize(w, modifiedHeight);
|
||||
@@ -108,8 +127,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
ui->actionKeyboard_requires_capture->setChecked(kbd_req_capture);
|
||||
ui->actionRight_CTRL_is_left_ALT->setChecked(rctrl_is_lalt);
|
||||
ui->actionResizable_window->setChecked(vid_resize > 0);
|
||||
ui->actionResizable_window->setChecked(vid_resize == 1);
|
||||
ui->actionRemember_size_and_position->setChecked(window_remember);
|
||||
ui->menuWindow_scale_factor->setEnabled(vid_resize == 0);
|
||||
ui->actionHiDPI_scaling->setChecked(dpi_scale);
|
||||
ui->actionHide_status_bar->setChecked(hide_status_bar);
|
||||
ui->actionUpdate_status_bar_icons->setChecked(update_icons);
|
||||
switch (vid_api) {
|
||||
case 0:
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
@@ -211,10 +234,56 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
video_setblit(qt_blit);
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
if (confirm_exit)
|
||||
{
|
||||
QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", "Are you sure you want to exit 86Box?", QMessageBox::Yes | QMessageBox::No, this);
|
||||
QCheckBox *chkbox = new QCheckBox("Do not ask me again");
|
||||
questionbox.setCheckBox(chkbox);
|
||||
chkbox->setChecked(!confirm_exit);
|
||||
bool confirm_exit_temp = false;
|
||||
QObject::connect(chkbox, &QCheckBox::stateChanged, [](int state) {
|
||||
confirm_exit = (state == Qt::CheckState::Unchecked);
|
||||
});
|
||||
questionbox.exec();
|
||||
if (questionbox.result() == QMessageBox::No) {
|
||||
confirm_exit = true;
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
config_save();
|
||||
}
|
||||
if (window_remember) {
|
||||
window_w = ui->stackedWidget->width();
|
||||
window_h = ui->stackedWidget->height();
|
||||
if (!QApplication::platformName().contains("wayland")) {
|
||||
window_x = this->geometry().x();
|
||||
window_y = this->geometry().y();
|
||||
}
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::showEvent(QShowEvent *event) {
|
||||
if (window_remember && !QApplication::platformName().contains("wayland")) {
|
||||
setGeometry(window_x, window_y, window_w, window_h);
|
||||
}
|
||||
if (vid_resize == 2) {
|
||||
setFixedSize(fixed_size_x, fixed_size_y + this->menuBar()->height() + this->statusBar()->height());
|
||||
scrnsz_x = fixed_size_x;
|
||||
scrnsz_y = fixed_size_y;
|
||||
}
|
||||
else if (window_remember) {
|
||||
emit resizeContents(window_w, window_h);
|
||||
scrnsz_x = window_w;
|
||||
scrnsz_y = window_h;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionKeyboard_requires_capture_triggered() {
|
||||
kbd_req_capture ^= 1;
|
||||
}
|
||||
@@ -865,6 +934,7 @@ void MainWindow::showMessage(const QString& header, const QString& message) {
|
||||
|
||||
void MainWindow::showMessage_(const QString &header, const QString &message) {
|
||||
QMessageBox box(QMessageBox::Warning, header, message, QMessageBox::NoButton, this);
|
||||
box.setTextFormat(Qt::TextFormat::RichText);
|
||||
box.exec();
|
||||
}
|
||||
|
||||
@@ -906,6 +976,11 @@ void MainWindow::keyReleaseEvent(QKeyEvent* event)
|
||||
#endif
|
||||
}
|
||||
|
||||
QSize MainWindow::getRenderWidgetSize()
|
||||
{
|
||||
return ui->stackedWidget->size();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSoftware_Renderer_triggered() {
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
ui->actionHardware_Renderer_OpenGL->setChecked(false);
|
||||
@@ -1109,7 +1184,11 @@ void MainWindow::on_actionAbout_86Box_triggered()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setTextFormat(Qt::RichText);
|
||||
msgBox.setText("<b>About 86Box</b>");
|
||||
QString githash;
|
||||
#ifdef EMU_GIT_HASH
|
||||
githash = QString(" [%1]").arg(EMU_GIT_HASH);
|
||||
#endif
|
||||
msgBox.setText(QString("<b>86Box v%1%2</b>").arg(EMU_VERSION_FULL, githash));
|
||||
msgBox.setInformativeText(R"(
|
||||
An emulator of old computers
|
||||
|
||||
@@ -1149,6 +1228,66 @@ void MainWindow::on_actionForce_4_3_display_ratio_triggered() {
|
||||
video_force_resize_set(1);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionRemember_size_and_position_triggered()
|
||||
{
|
||||
window_remember ^= 1;
|
||||
window_w = ui->stackedWidget->width();
|
||||
window_h = ui->stackedWidget->height();
|
||||
if (!QApplication::platformName().contains("wayland")) {
|
||||
window_x = geometry().x();
|
||||
window_y = geometry().y();
|
||||
}
|
||||
ui->actionRemember_size_and_position->setChecked(window_remember);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSpecify_dimensions_triggered()
|
||||
{
|
||||
SpecifyDimensions dialog(this);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionHiDPI_scaling_triggered()
|
||||
{
|
||||
dpi_scale ^= 1;
|
||||
ui->actionHiDPI_scaling->setChecked(dpi_scale);
|
||||
emit resizeContents(scrnsz_x, scrnsz_y);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionHide_status_bar_triggered()
|
||||
{
|
||||
hide_status_bar ^= 1;
|
||||
ui->actionHide_status_bar->setChecked(hide_status_bar);
|
||||
statusBar()->setVisible(!hide_status_bar);
|
||||
if (vid_resize >= 2) setFixedSize(fixed_size_x, fixed_size_y + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height()));
|
||||
else {
|
||||
int vid_resize_orig = vid_resize;
|
||||
vid_resize = 0;
|
||||
emit resizeContents(scrnsz_x, scrnsz_y);
|
||||
vid_resize = vid_resize_orig;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionUpdate_status_bar_icons_triggered()
|
||||
{
|
||||
update_icons ^= 1;
|
||||
ui->actionUpdate_status_bar_icons->setChecked(update_icons);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionTake_screenshot_triggered()
|
||||
{
|
||||
startblit();
|
||||
screenshots++;
|
||||
endblit();
|
||||
device_force_redraw();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSound_gain_triggered()
|
||||
{
|
||||
SoundGain gain(this);
|
||||
gain.exec();
|
||||
}
|
||||
|
||||
void MainWindow::setSendKeyboardInput(bool enabled)
|
||||
{
|
||||
send_keyboard_input = enabled;
|
||||
|
@@ -28,6 +28,7 @@ public:
|
||||
void setTitle(const wchar_t* title);
|
||||
void getTitle(wchar_t* title);
|
||||
void blitToWidget(int x, int y, int w, int h);
|
||||
QSize getRenderWidgetSize();
|
||||
void setSendKeyboardInput(bool enabled);
|
||||
signals:
|
||||
void paint(const QImage& image);
|
||||
@@ -37,6 +38,8 @@ signals:
|
||||
void updateStatusBarPanes();
|
||||
void updateStatusBarActivity(int tag, bool active);
|
||||
void updateStatusBarEmpty(int tag, bool empty);
|
||||
void updateMenuResizeOptions();
|
||||
void updateWindowRememberOption();
|
||||
|
||||
void setFullscreen(bool state);
|
||||
void setMouseCapture(bool state);
|
||||
@@ -83,17 +86,28 @@ private slots:
|
||||
void on_actionForce_4_3_display_ratio_triggered();
|
||||
void on_actionChange_contrast_for_monochrome_display_triggered();
|
||||
void on_actionCGA_PCjr_Tandy_EGA_S_VGA_overscan_triggered();
|
||||
void on_actionRemember_size_and_position_triggered();
|
||||
void on_actionSpecify_dimensions_triggered();
|
||||
void on_actionHiDPI_scaling_triggered();
|
||||
void on_actionHide_status_bar_triggered();
|
||||
void on_actionUpdate_status_bar_icons_triggered();
|
||||
|
||||
void refreshMediaMenu();
|
||||
void showMessage_(const QString& header, const QString& message);
|
||||
void setTitle_(const wchar_t* title);
|
||||
void getTitle_(wchar_t* title);
|
||||
void on_actionTake_screenshot_triggered();
|
||||
|
||||
void on_actionSound_gain_triggered();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
bool eventFilter(QObject* receiver, QEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
@@ -78,6 +78,10 @@
|
||||
<string>Tools</string>
|
||||
</property>
|
||||
<addaction name="actionSettings"/>
|
||||
<addaction name="actionUpdate_status_bar_icons"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionTake_screenshot"/>
|
||||
<addaction name="actionSound_gain"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
@@ -496,6 +500,24 @@
|
||||
<string>Documentation...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUpdate_status_bar_icons">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update status bar icons</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTake_screenshot">
|
||||
<property name="text">
|
||||
<string>Take screenshot...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSound_gain">
|
||||
<property name="text">
|
||||
<string>Sound gain...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@@ -4,6 +4,8 @@
|
||||
#include "qt_softwarerenderer.hpp"
|
||||
#include "qt_hardwarerenderer.hpp"
|
||||
|
||||
#include "evdev_mouse.hpp"
|
||||
|
||||
#include <QScreen>
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -25,6 +27,16 @@ RendererStack::RendererStack(QWidget *parent) :
|
||||
imagebufs = QVector<QImage>(2);
|
||||
imagebufs[0] = QImage{QSize(2048 + 64, 2048 + 64), QImage::Format_RGB32};
|
||||
imagebufs[1] = QImage{QSize(2048 + 64, 2048 + 64), QImage::Format_RGB32};
|
||||
#ifdef WAYLAND
|
||||
if (QApplication::platformName().contains("wayland")) {
|
||||
wl_init();
|
||||
}
|
||||
#endif
|
||||
#ifdef EVDEV_INPUT
|
||||
if (QApplication::platformName() == "xcb" || QApplication::platformName() == "eglfs") {
|
||||
evdev_init();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
RendererStack::~RendererStack()
|
||||
@@ -67,6 +79,9 @@ void RendererStack::mousePoll()
|
||||
if (QApplication::platformName().contains("wayland"))
|
||||
wl_mouse_poll();
|
||||
#endif
|
||||
#ifdef EVDEV_INPUT
|
||||
evdev_mouse_poll();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -131,8 +131,15 @@ void SettingsFloppyCDROM::save() {
|
||||
|
||||
/* Removable devices category */
|
||||
model = ui->tableViewCDROM->model();
|
||||
memset(cdrom, 0, sizeof(cdrom));
|
||||
for (int i = 0; i < CDROM_NUM; i++) {
|
||||
cdrom[i].img_fp = NULL;
|
||||
cdrom[i].priv = NULL;
|
||||
cdrom[i].ops = NULL;
|
||||
cdrom[i].image = NULL;
|
||||
cdrom[i].insert = NULL;
|
||||
cdrom[i].close = NULL;
|
||||
cdrom[i].get_volume = NULL;
|
||||
cdrom[i].get_channel = NULL;
|
||||
cdrom[i].bus_type = model->index(i, 0).data(Qt::UserRole).toUInt();
|
||||
cdrom[i].res = model->index(i, 0).data(Qt::UserRole + 1).toUInt();
|
||||
cdrom[i].speed = model->index(i, 1).data(Qt::UserRole).toUInt();
|
||||
|
@@ -128,7 +128,6 @@ SettingsOtherRemovable::~SettingsOtherRemovable()
|
||||
|
||||
void SettingsOtherRemovable::save() {
|
||||
auto* model = ui->tableViewMO->model();
|
||||
memset(mo_drives, 0, sizeof(mo_drives));
|
||||
for (int i = 0; i < MO_NUM; i++) {
|
||||
mo_drives[i].f = NULL;
|
||||
mo_drives[i].priv = NULL;
|
||||
@@ -138,7 +137,6 @@ void SettingsOtherRemovable::save() {
|
||||
}
|
||||
|
||||
model = ui->tableViewZIP->model();
|
||||
memset(zip_drives, 0, sizeof(zip_drives));
|
||||
for (int i = 0; i < ZIP_NUM; i++) {
|
||||
zip_drives[i].f = NULL;
|
||||
zip_drives[i].priv = NULL;
|
||||
|
35
src/qt/qt_soundgain.cpp
Normal file
35
src/qt/qt_soundgain.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "qt_soundgain.hpp"
|
||||
#include "ui_qt_soundgain.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <86box/86box.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/sound.h>
|
||||
}
|
||||
|
||||
SoundGain::SoundGain(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SoundGain)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->verticalSlider->setValue(sound_gain);
|
||||
sound_gain_orig = sound_gain;
|
||||
}
|
||||
|
||||
SoundGain::~SoundGain()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SoundGain::on_verticalSlider_valueChanged(int value)
|
||||
{
|
||||
sound_gain = value;
|
||||
}
|
||||
|
||||
|
||||
void SoundGain::on_SoundGain_rejected()
|
||||
{
|
||||
sound_gain = sound_gain_orig;
|
||||
}
|
||||
|
28
src/qt/qt_soundgain.hpp
Normal file
28
src/qt/qt_soundgain.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef QT_SOUNDGAIN_HPP
|
||||
#define QT_SOUNDGAIN_HPP
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class SoundGain;
|
||||
}
|
||||
|
||||
class SoundGain : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SoundGain(QWidget *parent = nullptr);
|
||||
~SoundGain();
|
||||
|
||||
private slots:
|
||||
void on_verticalSlider_valueChanged(int value);
|
||||
|
||||
void on_SoundGain_rejected();
|
||||
|
||||
private:
|
||||
Ui::SoundGain *ui;
|
||||
int sound_gain_orig;
|
||||
};
|
||||
|
||||
#endif // QT_SOUNDGAIN_HPP
|
109
src/qt/qt_soundgain.ui
Normal file
109
src/qt/qt_soundgain.ui
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SoundGain</class>
|
||||
<widget class="QDialog" name="SoundGain">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>262</width>
|
||||
<height>279</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Sound Gain</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>20</y>
|
||||
<width>81</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="verticalSlider">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>30</y>
|
||||
<width>31</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>18</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBothSides</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>10</y>
|
||||
<width>54</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gain:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SoundGain</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SoundGain</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
60
src/qt/qt_specifydimensions.cpp
Normal file
60
src/qt/qt_specifydimensions.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include "qt_specifydimensions.h"
|
||||
#include "ui_qt_specifydimensions.h"
|
||||
|
||||
#include "qt_mainwindow.hpp"
|
||||
|
||||
#include <QStatusBar>
|
||||
#include <QMenuBar>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <86box/86box.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/video.h>
|
||||
}
|
||||
|
||||
extern MainWindow* main_window;
|
||||
|
||||
SpecifyDimensions::SpecifyDimensions(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SpecifyDimensions)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->checkBox->setChecked(vid_resize == 2);
|
||||
ui->spinBoxWidth->setRange(16, 2048 + 64);
|
||||
ui->spinBoxWidth->setValue(main_window->getRenderWidgetSize().width());
|
||||
ui->spinBoxHeight->setRange(16, 2048 + 64);
|
||||
ui->spinBoxHeight->setValue(main_window->getRenderWidgetSize().height());
|
||||
}
|
||||
|
||||
SpecifyDimensions::~SpecifyDimensions()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SpecifyDimensions::on_SpecifyDimensions_accepted()
|
||||
{
|
||||
if (ui->checkBox->isChecked())
|
||||
{
|
||||
vid_resize = 2;
|
||||
window_remember = 0;
|
||||
fixed_size_x = ui->spinBoxWidth->value();
|
||||
fixed_size_y = ui->spinBoxHeight->value();
|
||||
main_window->setFixedSize(ui->spinBoxWidth->value(), ui->spinBoxHeight->value() + (hide_status_bar ? main_window->statusBar()->height() : 0) + main_window->menuBar()->height());
|
||||
emit main_window->updateMenuResizeOptions();
|
||||
}
|
||||
else
|
||||
{
|
||||
vid_resize = 0;
|
||||
window_remember = 1;
|
||||
window_w = ui->spinBoxWidth->value();
|
||||
window_h = ui->spinBoxHeight->value();
|
||||
main_window->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
emit main_window->resizeContents(ui->spinBoxWidth->value(), ui->spinBoxHeight->value());
|
||||
vid_resize = 1;
|
||||
emit main_window->updateMenuResizeOptions();
|
||||
}
|
||||
emit main_window->updateWindowRememberOption();
|
||||
}
|
||||
|
25
src/qt/qt_specifydimensions.h
Normal file
25
src/qt/qt_specifydimensions.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef QT_SPECIFYDIMENSIONS_H
|
||||
#define QT_SPECIFYDIMENSIONS_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class SpecifyDimensions;
|
||||
}
|
||||
|
||||
class SpecifyDimensions : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SpecifyDimensions(QWidget *parent = nullptr);
|
||||
~SpecifyDimensions();
|
||||
|
||||
private slots:
|
||||
void on_SpecifyDimensions_accepted();
|
||||
|
||||
private:
|
||||
Ui::SpecifyDimensions *ui;
|
||||
};
|
||||
|
||||
#endif // QT_SPECIFYDIMENSIONS_H
|
127
src/qt/qt_specifydimensions.ui
Normal file
127
src/qt/qt_specifydimensions.ui
Normal file
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SpecifyDimensions</class>
|
||||
<widget class="QDialog" name="SpecifyDimensions">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>388</width>
|
||||
<height>158</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Specify Main Window Dimensions</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>110</y>
|
||||
<width>361</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="spinBoxWidth">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>50</y>
|
||||
<width>81</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelWidth">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>50</y>
|
||||
<width>41</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>90</y>
|
||||
<width>131</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lock to this size</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelHeight">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>50</y>
|
||||
<width>51</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="spinBoxHeight">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>50</y>
|
||||
<width>81</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SpecifyDimensions</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SpecifyDimensions</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@@ -63,7 +63,9 @@ int ui_msgbox_header(int flags, void *header, void* message) {
|
||||
|
||||
// any error in early init
|
||||
if (main_window == nullptr) {
|
||||
QMessageBox::critical(nullptr, hdr, msg);
|
||||
QMessageBox msgBox(QMessageBox::Icon::Critical, hdr, msg);
|
||||
msgBox.setTextFormat(Qt::TextFormat::RichText);
|
||||
msgBox.exec();
|
||||
} else {
|
||||
// else scope it to main_window
|
||||
main_window->showMessage(hdr, msg);
|
||||
@@ -107,6 +109,7 @@ ui_sb_update_icon_state(int tag, int state) {
|
||||
|
||||
void
|
||||
ui_sb_update_icon(int tag, int active) {
|
||||
if (!update_icons) return;
|
||||
main_window->updateStatusBarActivity(tag, active > 0 ? true : false);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user