Qt: Use C++20.

This commit is contained in:
BearOso 2024-10-07 14:24:26 -05:00
parent 14c434d40d
commit befb0ba768
3 changed files with 9 additions and 11 deletions

View File

@ -3,7 +3,7 @@ project(snes9x-qt VERSION 1.63)
include(GNUInstallDirs)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@ -302,7 +302,7 @@ add_executable(snes9x-qt ${QT_GUI_SOURCES} ${SOURCES} ${PLATFORM_SOURCES} src/re
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set_target_properties(snes9x-qt PROPERTIES WIN32_EXECUTABLE True)
endif()
target_link_libraries(snes9x-qt snes9x-core ${LIBS})
target_link_libraries(snes9x-qt PRIVATE snes9x-core ${LIBS})
target_compile_definitions(snes9x-qt PRIVATE ${DEFINES})
target_compile_options(snes9x-qt PRIVATE ${FLAGS})
target_include_directories(snes9x-qt PRIVATE "../" ${INCLUDES})

View File

@ -23,9 +23,7 @@ FoldersPanel::~FoldersPanel()
void FoldersPanel::connectEntry(QComboBox *combo, QLineEdit *lineEdit, QPushButton *browse, int *location, std::string *folder)
{
auto config = app->config.get();
QObject::connect(combo, &QComboBox::activated, [=](int index) {
QObject::connect(combo, &QComboBox::activated, [=, this](int index) {
*location = index;
this->refreshEntry(combo, lineEdit, browse, location, folder);
app->updateSettings();
@ -68,7 +66,7 @@ void FoldersPanel::refreshEntry(QComboBox *combo, QLineEdit *lineEdit, QPushButt
if (custom)
{
browse->setText(tr("Browse..."));
QObject::connect(browse, &QPushButton::pressed, [=] {
QObject::connect(browse, &QPushButton::pressed, [=, this] {
QFileDialog dialog(this, tr("Select a Folder"));
dialog.setFileMode(QFileDialog::Directory);
dialog.setDirectory(QString::fromUtf8(*folder));

View File

@ -415,9 +415,9 @@ std::string S9xGetDirectory(s9x_getdirtype dirtype)
path.remove_filename();
if (!fs::is_directory(path))
dirname = fs::current_path().u8string();
dirname = fs::current_path().string();
else
dirname = path.u8string();
dirname = path.string();
}
return dirname;
@ -473,7 +473,7 @@ std::string S9xGetFilenameInc(std::string e, enum s9x_getdirtype dirtype)
i++;
} while (fs::exists(new_filename));
return new_filename.u8string();
return new_filename;
}
bool8 S9xInitUpdate()
@ -729,7 +729,7 @@ bool Snes9xController::slotUsed(int slot)
bool Snes9xController::loadState(int slot)
{
return loadState(save_slot_path(slot).u8string());
return loadState(save_slot_path(slot));
}
bool Snes9xController::loadState(std::string filename)
@ -792,7 +792,7 @@ void Snes9xController::softReset()
bool Snes9xController::saveState(int slot)
{
return saveState(save_slot_path(slot).u8string());
return saveState(save_slot_path(slot));
}
void Snes9xController::setMessage(std::string message)