Skip to content

Commit

Permalink
Enforce c++20, Add Ubuntu24, and return nullptr for TextEditDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Oct 10, 2024
1 parent e171158 commit 296063e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04]
python-version: [3.8.x]
system-deps: [true]
cc-override: [default]
Expand Down
3 changes: 2 additions & 1 deletion src/Iaito.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ IAITO_VERSION_MAJOR = 5
IAITO_VERSION_MINOR = 9
IAITO_VERSION_PATCH = 4

CONFIG += c++20
CONFIG+=app_bundle
# LIBS+= -dead_strip

Expand Down Expand Up @@ -113,7 +114,7 @@ win32 {
}

macx {
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 -std=c++17 -stdlib=libc++ -g
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7 -std=c++20 -stdlib=libc++ -g
QMAKE_TARGET_BUNDLE_PREFIX = org.radare
QMAKE_BUNDLE = iaito
QMAKE_INFO_PLIST = macos/Info.plist
Expand Down
10 changes: 5 additions & 5 deletions src/common/TextEditDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ void TextEditDialog::accept()
QDialog::accept();
}

IAITO_EXPORT std::optional<QString> openTextEditDialog(const QString& initialText, QWidget *parent) {
IAITO_EXPORT QString* openTextEditDialog(const QString& initialText, QWidget *parent) {
TextEditDialog dialog(initialText, parent);
if (dialog.exec() == QDialog::Accepted) {
return dialog.getEditedText();
return new QString(dialog.getEditedText());
}
return std::nullopt;
return nullptr;
// return initialText; // Return original text if canceled
}

Expand All @@ -48,9 +48,9 @@ IAITO_EXPORT bool openTextEditDialogFromFile(const QString& textFileName, QWidge
return false;
}
const QString qdata (data);
std::optional<QString> s = openTextEditDialog(qdata, parent);
QString *s = openTextEditDialog(qdata, parent);
bool res = true;
if (s) {
if (s != nullptr) {
ut8 *newData = (ut8*)r_str_newf ("%s\n", s->toUtf8().constData());
if (!r_file_dump (dp, newData, -1, false)) {
res = false;
Expand Down
2 changes: 1 addition & 1 deletion src/common/TextEditDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TextEditDialog : public QDialog {
QString editedText;
};

IAITO_EXPORT std::optional<QString> openTextEditDialog(const QString& initialText, QWidget *parent = nullptr);
IAITO_EXPORT QString* openTextEditDialog(const QString& initialText, QWidget *parent = nullptr);
IAITO_EXPORT bool openTextEditDialogFromFile(const QString& textFileName, QWidget *parent = nullptr);

#endif // HELPERS_H
4 changes: 2 additions & 2 deletions src/menus/DecompilerContextMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ void DecompilerContextMenu::actionCopyInstructionAddressTriggered()
void DecompilerContextMenu::actionEditAnnotationTriggered()
{
QString os = Core()->cmdRaw("anos");
std::optional<QString> s = openTextEditDialog(os, this);
if (s) {
QString* s = openTextEditDialog(os, this);
if (s != nullptr) {
Core()->cmdRaw(QString("ano=%1").arg(QString(s->toLocal8Bit().toBase64())));
this->mainWindow->refreshAll();
}
Expand Down
4 changes: 2 additions & 2 deletions src/menus/DisassemblyContextMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,8 @@ void DisassemblyContextMenu::on_actionAnalyzeFunction_triggered()
void DisassemblyContextMenu::on_actionEditAnnotation_triggered()
{
QString os = Core()->cmdRaw("anos");
std::optional<QString> s = openTextEditDialog(os, this);
if (s) {
QString *s = openTextEditDialog(os, this);
if (s != nullptr) {
Core()->cmdRaw(QString("ano=%1").arg(QString(s->toLocal8Bit().toBase64())));
this->mainWindow->refreshAll();
}
Expand Down

0 comments on commit 296063e

Please sign in to comment.