Skip to content

Port to Qt6/KF6 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
cmake_minimum_required(VERSION 3.3)
project(KDbg)
set(QT_MIN_VERSION "5.5.0")
set(KF5_MIN_VERSION "5.2.0")
set(QT_MIN_VERSION "6.4.2")
set(KF6_MIN_VERSION "5.102.0")

set(KDBG_VERSION 3.0.1)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/kdbg/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdbg/version.h)

find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core Widgets
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core Widgets Core5Compat
)

find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
I18n
Config
IconThemes
Expand Down
10 changes: 5 additions & 5 deletions kdbg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ IF (HAVE_LIB_UTIL)
ENDIF (HAVE_LIB_UTIL)

target_link_libraries(kdbg
KF5::I18n
KF5::ConfigCore
KF5::IconThemes
KF5::XmlGui
KF5::WindowSystem
Qt6::Core5Compat
KF6::I18n
KF6::ConfigCore
KF6::IconThemes
KF6::XmlGui
${LIB_UTIL}
)

Expand Down
2 changes: 1 addition & 1 deletion kdbg/dbgdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool DebuggerDriver::startup(QString cmdStr)
if (cmdStr.isEmpty())
cmdStr = defaultInvocation();

QStringList cmd = cmdStr.split(' ', QString::SkipEmptyParts);
QStringList cmd = cmdStr.split(' ', Qt::SkipEmptyParts);
if (cmd.isEmpty())
return false;
QString pgm = cmd.takeFirst();
Expand Down
1 change: 0 additions & 1 deletion kdbg/dbgdriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class VarTree;
class ExprValue;
class ExprWnd;
class KDebugger;
class QStringList;


/**
Expand Down
8 changes: 4 additions & 4 deletions kdbg/dbgmainwnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ bool DebuggerMainWnd::debugProgram(const QString& exe, const QString& lang)
if (!success)
{
QString msg = i18n("`%1' is not a file or does not exist");
KMessageBox::sorry(this, msg.arg(exe));
KMessageBox::error(this, msg.arg(exe));
}
else
{
Expand Down Expand Up @@ -712,7 +712,7 @@ bool DebuggerMainWnd::startDriver(const QString& executable, QString lang)
{
// oops
QString msg = i18n("Don't know how to debug language `%1'");
KMessageBox::sorry(this, msg.arg(lang));
KMessageBox::error(this, msg.arg(lang));
return false;
}
if (typeid(*driver) == typeid(XsldbgDriver)) {
Expand All @@ -729,7 +729,7 @@ bool DebuggerMainWnd::startDriver(const QString& executable, QString lang)

QString msg = i18n("Could not start the debugger process.\n"
"Please shut down KDbg and resolve the problem.");
KMessageBox::sorry(this, msg);
KMessageBox::error(this, msg);
}

return success;
Expand Down Expand Up @@ -1272,5 +1272,5 @@ void DebuggerMainWnd::slotExecArgs()

void DebuggerMainWnd::slotConfigureKeys()
{
KShortcutsDialog::configure(actionCollection());
KShortcutsDialog::showDialog(actionCollection(), KShortcutsEditor::LetterShortcutsDisallowed, this);
}
15 changes: 9 additions & 6 deletions kdbg/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,8 @@ void KDebugger::saveProgramSettings()
gg.writeEntry(FileVersion, 1);
gg.writeEntry(ProgramArgs, m_programArgs);
gg.writeEntry(WorkingDirectory, m_programWD);
gg.writeEntry(OptionsSelected, m_boolOptions.toList());
QList<QString> boolOptions(m_boolOptions.begin(), m_boolOptions.end());
gg.writeEntry(OptionsSelected, boolOptions);
gg.writeEntry(DebuggerCmdStr, m_debuggerCmd);
gg.writeEntry(TTYLevelEntry, int(m_ttyLevel));
gg.writeEntry(DisassemblyFlavor, m_flavor);
Expand Down Expand Up @@ -835,7 +836,8 @@ void KDebugger::restoreProgramSettings()
// m_ttyLevel has been read in already
QString pgmArgs = gg.readEntry(ProgramArgs);
QString pgmWd = gg.readEntry(WorkingDirectory);
QSet<QString> boolOptions = QSet<QString>::fromList(gg.readEntry(OptionsSelected, QStringList()));
auto selectedOptions = gg.readEntry(OptionsSelected, QStringList());
QSet<QString> boolOptions(selectedOptions.begin(), selectedOptions.end());
m_boolOptions.clear();
m_flavor = gg.readEntry(DisassemblyFlavor, QString{});

Expand Down Expand Up @@ -905,8 +907,9 @@ QString KDebugger::readDebuggerCmd(const KConfigGroup& g)
"The settings for this program specify "
"the following debugger command:\n%1\n"
"Shall this command be used?");
if (KMessageBox::warningYesNo(parentWidget(), msg.arg(debuggerCmd))
!= KMessageBox::Yes)
if (KMessageBox::questionTwoActions(parentWidget(), msg.arg(debuggerCmd), i18n("Question"),
KGuiItem(i18nc("@action:button", "Yes"), QStringLiteral("dialog-ok")), KStandardGuiItem::cancel(), QString(), KMessageBox::Notify | KMessageBox::Dangerous)
!= KMessageBox::PrimaryAction)
{
// don't use it
debuggerCmd = QString();
Expand Down Expand Up @@ -1076,7 +1079,7 @@ void KDebugger::parse(CmdQueueItem* cmd, const char* output)
emit updateStatusMessage();
} else {
QString msg = m_d->driverName() + ": " + m_statusMessage;
KMessageBox::sorry(parentWidget(), msg);
KMessageBox::error(parentWidget(), msg);
m_executable = "";
m_corefile = ""; /* don't process core file */
m_haveExecutable = false;
Expand All @@ -1093,7 +1096,7 @@ void KDebugger::parse(CmdQueueItem* cmd, const char* output)
} else {
// report error
QString msg = m_d->driverName() + ": " + QString(output);
KMessageBox::sorry(parentWidget(), msg);
KMessageBox::error(parentWidget(), msg);

// if core file was loaded from command line, revert to info line main
if (!cmd->m_byUser) {
Expand Down
1 change: 0 additions & 1 deletion kdbg/exprwnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class ProgramTypeTable;
class TypeInfo;
struct ExprValue;
class ExprWnd;
class QStringList;

/*! \brief a variable's value is the tree of sub-variables */
class VarTree : public QTreeWidgetItem
Expand Down
3 changes: 2 additions & 1 deletion kdbg/gdbdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "exprwnd.h"
#include <QFileInfo>
#include <QRegExp>
#include <QRegularExpression>
#include <QStringList>
#include <klocalizedstring.h> /* i18n */
#include <ctype.h>
Expand Down Expand Up @@ -2387,7 +2388,7 @@ bool GdbDriver::parseFindType(const char* output, QString& type)
if (strncmp(output, "const ", 6) == 0)
output += 6;
type = output;
type.replace(QRegExp("\\s+"), "");
type.replace(QRegularExpression("\\s+"), "");
if (type.endsWith("&"))
type.truncate(type.length() - 1);
return true;
Expand Down
2 changes: 0 additions & 2 deletions kdbg/pgmargs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <map>
#include "envvar.h"

class QStringList;

class PgmArgs : public QDialog, private Ui::PgmArgsBase
{
Q_OBJECT
Expand Down
38 changes: 19 additions & 19 deletions kdbg/regwnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "regwnd.h"
#include "dbgdriver.h"
#include <klocalizedstring.h> /* i18n */
#include <KLazyLocalizedString>
#include <QFontDatabase>
#include <QMenu>
#include <QRegExp>
Expand Down Expand Up @@ -63,28 +63,28 @@ class RegisterDisplay {
// helper struct
struct MenuPair
{
const char* name;
KLazyLocalizedString name;
uint mode;
bool isSeparator() { return name == 0; }
bool isSeparator() { return name.isEmpty(); }
};

static MenuPair menuitems[] = {
// treat as
{ I18N_NOOP("&GDB default"), RegisterDisplay::nada },
{ I18N_NOOP("&Binary"), RegisterDisplay::binary },
{ I18N_NOOP("&Octal"), RegisterDisplay::octal },
{ I18N_NOOP("&Decimal"), RegisterDisplay::decimal },
{ I18N_NOOP("He&xadecimal"), RegisterDisplay::hex },
{ I18N_NOOP("Real (&e)"), RegisterDisplay::realE },
{ I18N_NOOP("Real (&f)"), RegisterDisplay::realF },
{ I18N_NOOP("&Real (g)"), RegisterDisplay::realG },
{ 0, 0 },
{ "8 bits", RegisterDisplay::bits8 },
{ "16 bits", RegisterDisplay::bits16 },
{ "32 bits", RegisterDisplay::bits32 },
{ "64 bits", RegisterDisplay::bits64 },
{ "80 bits", RegisterDisplay::bits80 },
{ "128 bits",RegisterDisplay::bits128 },
{ kli18n("&GDB default"), RegisterDisplay::nada },
{ kli18n("&Binary"), RegisterDisplay::binary },
{ kli18n("&Octal"), RegisterDisplay::octal },
{ kli18n("&Decimal"), RegisterDisplay::decimal },
{ kli18n("He&xadecimal"), RegisterDisplay::hex },
{ kli18n("Real (&e)"), RegisterDisplay::realE },
{ kli18n("Real (&f)"), RegisterDisplay::realF },
{ kli18n("&Real (g)"), RegisterDisplay::realG },
{ KLazyLocalizedString(), 0 },
{ kli18n("8 bits"), RegisterDisplay::bits8 },
{ kli18n("16 bits"), RegisterDisplay::bits16 },
{ kli18n("32 bits"), RegisterDisplay::bits32 },
{ kli18n("64 bits"), RegisterDisplay::bits64 },
{ kli18n("80 bits"), RegisterDisplay::bits80 },
{ kli18n("128 bits"),RegisterDisplay::bits128 },
};

uint RegisterDisplay::bitMap[] = {
Expand Down Expand Up @@ -427,7 +427,7 @@ RegisterView::RegisterView(QWidget* parent) :
if (menuitems[i].isSeparator())
m_modemenu->addSeparator();
else {
QAction* action = m_modemenu->addAction(i18n(menuitems[i].name));
QAction* action = m_modemenu->addAction(menuitems[i].name.toString());
action->setData(menuitems[i].mode);
action->setCheckable(true);
}
Expand Down
6 changes: 3 additions & 3 deletions kdbg/xsldbgdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ XsldbgDriver::commandFinished(CmdQueueItem * cmd)
if (!::isErrorExpr(m_output.constData()))
parseMarker();
else{
// This only shows an error for DCinfolocals
// need to update KDebugger::handleRunCommand ?
KMessageBox::sorry(0L, m_output);
// This only shows an error for DCinfolocals
// need to update KDebugger::handleRunCommand ?
KMessageBox::error(0L, m_output);
}
}
break;
Expand Down