summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKåre Särs <kare.sars@iki.fi>2014-01-20 18:58:25 (GMT)
committerKåre Särs <kare.sars@iki.fi>2014-01-20 19:02:00 (GMT)
commit34fce7c98b0cfa00ce8debcd3bb2c7db3ab96380 (patch)
treecefc361c4cddd9580fff9448cca966ca4218c18a
parentef48700e54574692a4cfa5862fe7d56e9f97314d (diff)
Port the GDB plugin to frameworks
-rw-r--r--addons/kate/CMakeLists.txt6
-rw-r--r--addons/kate/gdbplugin/CMakeLists.txt27
-rw-r--r--addons/kate/gdbplugin/advanced_settings.cpp47
-rw-r--r--addons/kate/gdbplugin/advanced_settings.h4
-rw-r--r--addons/kate/gdbplugin/advanced_settings.ui14
-rw-r--r--addons/kate/gdbplugin/configview.cpp94
-rw-r--r--addons/kate/gdbplugin/configview.h44
-rw-r--r--addons/kate/gdbplugin/debugview.cpp460
-rw-r--r--addons/kate/gdbplugin/debugview.h50
-rw-r--r--addons/kate/gdbplugin/ioview.cpp32
-rw-r--r--addons/kate/gdbplugin/ioview.h4
-rw-r--r--addons/kate/gdbplugin/kategdbplugin.desktop3
-rw-r--r--addons/kate/gdbplugin/localsview.cpp57
-rw-r--r--addons/kate/gdbplugin/plugin_kategdb.cpp604
-rw-r--r--addons/kate/gdbplugin/plugin_kategdb.h56
-rw-r--r--addons/kate/gdbplugin/ui.rc2
16 files changed, 750 insertions, 754 deletions
diff --git a/addons/kate/CMakeLists.txt b/addons/kate/CMakeLists.txt
index cd00075..9ca90bd 100644
--- a/addons/kate/CMakeLists.txt
+++ b/addons/kate/CMakeLists.txt
@@ -28,9 +28,9 @@ ecm_optional_add_subdirectory (filebrowser)
# xml completion
ecm_optional_add_subdirectory (xmltools)
-#if(NOT WIN32)
-# add_subdirectory( gdbplugin ) # reading /proc/...
-#endif(NOT WIN32)
+if(NOT WIN32)
+ add_subdirectory( gdbplugin ) # should be tested on windows...
+endif(NOT WIN32)
#add_subdirectory( textfilter )
diff --git a/addons/kate/gdbplugin/CMakeLists.txt b/addons/kate/gdbplugin/CMakeLists.txt
index e638630..49eacde 100644
--- a/addons/kate/gdbplugin/CMakeLists.txt
+++ b/addons/kate/gdbplugin/CMakeLists.txt
@@ -1,13 +1,3 @@
-cmake_minimum_required( VERSION 2.6 )
-
-# building separately or as part of kdesdk?
-if(NOT KDE4_FOUND)
- find_package(KDE4 REQUIRED)
- ADD_DEFINITIONS(-DKDE_DEFAULT_DEBUG_AREA=13040)
-endif(NOT KDE4_FOUND)
-
-include_directories(${KDE4_INCLUDES})
-include_directories(${KDE4_KIO_INCLUDES})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
@@ -20,12 +10,15 @@ set(kategdbplugin_PART_SRCS
advanced_settings.cpp
)
-kde4_add_ui_files(kategdbplugin_PART_SRCS advanced_settings.ui)
+qt5_wrap_ui(kategdbplugin_PART_SRCS advanced_settings.ui)
+
+add_library(kategdbplugin MODULE ${kategdbplugin_PART_SRCS})
-kde4_add_plugin( kategdbplugin ${kategdbplugin_PART_SRCS} )
-target_link_libraries( kategdbplugin ${KDE4_KDEUI_LIBS} ${KDE4_KDECORE_LIBS} ktexteditor kateinterfaces )
+target_link_libraries(kategdbplugin KF5::TextEditor KF5::I18n KF5::IconThemes)
-install( FILES ui.rc DESTINATION ${DATA_INSTALL_DIR}/kate/plugins/kategdb )
-install( TARGETS kategdbplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
-install( FILES kategdbplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-kde4_install_icons( ${ICON_INSTALL_DIR} )
+########### install files ###############
+install(FILES ui.rc DESTINATION ${DATA_INSTALL_DIR}/kategdb)
+install(TARGETS kategdbplugin DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES kategdbplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+ecm_install_icons (${ICON_INSTALL_DIR})
+kservice_desktop_to_json (kategdbplugin.desktop)
diff --git a/addons/kate/gdbplugin/advanced_settings.cpp b/addons/kate/gdbplugin/advanced_settings.cpp
index f191f4f..1e3a0a1 100644
--- a/addons/kate/gdbplugin/advanced_settings.cpp
+++ b/addons/kate/gdbplugin/advanced_settings.cpp
@@ -18,15 +18,16 @@
// Boston, MA 02110-1301, USA.
#include "advanced_settings.h"
-#include "advanced_settings.moc"
-#include <KFileDialog>
+#include <QFileDialog>
-AdvancedGDBSettings::AdvancedGDBSettings(QWidget *parent) : KDialog(parent)
+AdvancedGDBSettings::AdvancedGDBSettings(QWidget *parent) : QDialog(parent)
{
QWidget *widget = new QWidget(this);
setupUi(widget);
- setMainWidget(widget);
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ setLayout(mainLayout);
+ mainLayout->addWidget(widget);
connect(u_gdbBrowse, SIGNAL(clicked()), this, SLOT(slotBrowseGDB()));
}
@@ -41,30 +42,30 @@ const QStringList AdvancedGDBSettings::configs() const
tmp << u_gdbCmd->text();
switch(u_localRemote->currentIndex()) {
case 1:
- tmp << QString("target remote %1:%2").arg(u_tcpHost->text()).arg(u_tcpPort->text());
+ tmp << QStringLiteral("target remote %1:%2").arg(u_tcpHost->text()).arg(u_tcpPort->text());
tmp << QString();
break;
case 2:
- tmp << QString("target remote %1").arg(u_ttyPort->text());
- tmp << QString("set remotebaud %1").arg(u_baudCombo->currentText());
+ tmp << QStringLiteral("target remote %1").arg(u_ttyPort->text());
+ tmp << QStringLiteral("set remotebaud %1").arg(u_baudCombo->currentText());
break;
default:
tmp << QString();
tmp << QString();
}
if (!u_soAbsPrefix->text().isEmpty()) {
- tmp << QString("set solib-absolute-prefix %1").arg(u_soAbsPrefix->text());
+ tmp << QStringLiteral("set solib-absolute-prefix %1").arg(u_soAbsPrefix->text());
}
else {
tmp << QString();
}
if (!u_soSearchPath->text().isEmpty()) {
- tmp << QString("set solib-search-path %1").arg(u_soSearchPath->text());
+ tmp << QStringLiteral("set solib-search-path %1").arg(u_soSearchPath->text());
}
else {
tmp << QString();
}
- tmp << u_customInit->toPlainText().split('\n');
+ tmp << u_customInit->toPlainText().split(QLatin1Char('\n'));
return tmp;
}
@@ -72,14 +73,14 @@ const QStringList AdvancedGDBSettings::configs() const
void AdvancedGDBSettings::setConfigs(const QStringList &cfgs)
{
// clear all info
- u_gdbCmd->setText("gdb");
+ u_gdbCmd->setText(QStringLiteral("gdb"));
u_localRemote->setCurrentIndex(0);
u_soAbsPrefix->clear();
u_soSearchPath->clear();
u_customInit->clear();
- u_tcpHost->setText("");
- u_tcpPort->setText("");
- u_ttyPort->setText("");
+ u_tcpHost->setText(QString());
+ u_tcpPort->setText(QString());
+ u_ttyPort->setText(QString());
u_baudCombo->setCurrentIndex(0);
// GDB
@@ -95,26 +96,26 @@ void AdvancedGDBSettings::setConfigs(const QStringList &cfgs)
u_localRemote->setCurrentIndex(0);
u_remoteStack->setCurrentIndex(0);
}
- else if (cfgs[LocalRemoteIndex].contains(":")) {
+ else if (cfgs[LocalRemoteIndex].contains(QLatin1Char(':'))) {
u_localRemote->setCurrentIndex(1);
u_remoteStack->setCurrentIndex(1);
- start = cfgs[LocalRemoteIndex].lastIndexOf(' ');
- end = cfgs[LocalRemoteIndex].indexOf(':');
+ start = cfgs[LocalRemoteIndex].lastIndexOf(QLatin1Char(' '));
+ end = cfgs[LocalRemoteIndex].indexOf(QLatin1Char(':'));
u_tcpHost->setText(cfgs[LocalRemoteIndex].mid(start+1, end-start-1));
u_tcpPort->setText(cfgs[LocalRemoteIndex].mid(end+1));
}
else {
u_localRemote->setCurrentIndex(2);
u_remoteStack->setCurrentIndex(2);
- start = cfgs[LocalRemoteIndex].lastIndexOf(' ');
+ start = cfgs[LocalRemoteIndex].lastIndexOf(QLatin1Char(' '));
u_ttyPort->setText(cfgs[LocalRemoteIndex].mid(start+1));
- start = cfgs[RemoteBaudIndex].lastIndexOf(' ');
+ start = cfgs[RemoteBaudIndex].lastIndexOf(QLatin1Char(' '));
setComboText(u_baudCombo, cfgs[RemoteBaudIndex].mid(start+1));
}
// Solib absolute path
- if (cfgs.count() <= SoAbsoluteIndex ) return;
+ if (cfgs.count() <= SoAbsoluteIndex) return;
start = 26; // "set solib-absolute-prefix "
u_soAbsPrefix->setText(cfgs[SoAbsoluteIndex].mid(start));
@@ -131,9 +132,9 @@ void AdvancedGDBSettings::setConfigs(const QStringList &cfgs)
void AdvancedGDBSettings::slotBrowseGDB()
{
- u_gdbCmd->setText(KFileDialog::getOpenFileName(u_gdbCmd->text(), "application/x-executable"));
+ u_gdbCmd->setText(QFileDialog::getOpenFileName(this, QString(), u_gdbCmd->text(), QStringLiteral("application/x-executable")));
if (u_gdbCmd->text().isEmpty()) {
- u_gdbCmd->setText("gdb");
+ u_gdbCmd->setText(QStringLiteral("gdb"));
}
}
@@ -151,3 +152,5 @@ void AdvancedGDBSettings::setComboText(KComboBox *combo, const QString &str)
combo->addItem(str);
combo->setCurrentIndex(combo->count()-1);
}
+
+#include "advanced_settings.moc"
diff --git a/addons/kate/gdbplugin/advanced_settings.h b/addons/kate/gdbplugin/advanced_settings.h
index 6778f01..36b1c94 100644
--- a/addons/kate/gdbplugin/advanced_settings.h
+++ b/addons/kate/gdbplugin/advanced_settings.h
@@ -22,9 +22,9 @@
#include "ui_advanced_settings.h"
#include <QStringList>
-#include <KDialog>
+#include <QDialog>
-class AdvancedGDBSettings : public KDialog, public Ui::AdvancedGDBSettings
+class AdvancedGDBSettings : public QDialog, public Ui::AdvancedGDBSettings
{
Q_OBJECT
public:
diff --git a/addons/kate/gdbplugin/advanced_settings.ui b/addons/kate/gdbplugin/advanced_settings.ui
index 36a4f33..90aaf8c 100644
--- a/addons/kate/gdbplugin/advanced_settings.ui
+++ b/addons/kate/gdbplugin/advanced_settings.ui
@@ -13,7 +13,7 @@
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="KLineEdit" name="u_gdbCmd">
+ <widget class="QLineEdit" name="u_gdbCmd">
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
@@ -36,7 +36,7 @@
</widget>
</item>
<item row="3" column="1">
- <widget class="KLineEdit" name="u_soAbsPrefix">
+ <widget class="QLineEdit" name="u_soAbsPrefix">
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
@@ -50,7 +50,7 @@
</widget>
</item>
<item row="4" column="1">
- <widget class="KLineEdit" name="u_soSearchPath">
+ <widget class="QLineEdit" name="u_soSearchPath">
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
@@ -116,7 +116,7 @@
</widget>
</item>
<item>
- <widget class="KLineEdit" name="u_tcpHost">
+ <widget class="QLineEdit" name="u_tcpHost">
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
@@ -130,7 +130,7 @@
</widget>
</item>
<item>
- <widget class="KLineEdit" name="u_tcpPort">
+ <widget class="QLineEdit" name="u_tcpPort">
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
@@ -155,7 +155,7 @@
</widget>
</item>
<item>
- <widget class="KLineEdit" name="u_ttyPort">
+ <widget class="QLineEdit" name="u_ttyPort">
<property name="text">
<string comment="KDE::DoNotExtract">/dev/ttyUSB0</string>
</property>
@@ -221,7 +221,7 @@
<header>kcombobox.h</header>
</customwidget>
<customwidget>
- <class>KLineEdit</class>
+ <class>QLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
diff --git a/addons/kate/gdbplugin/configview.cpp b/addons/kate/gdbplugin/configview.cpp
index 43f4112..f78aef6 100644
--- a/addons/kate/gdbplugin/configview.cpp
+++ b/addons/kate/gdbplugin/configview.cpp
@@ -22,25 +22,25 @@
// Boston, MA 02110-1301, USA.
#include "configview.h"
-#include "configview.moc"
-#include <QtGui/QCompleter>
-#include <QtGui/QDirModel>
-#include <QtGui/QLayout>
-#include <QtCore/QTimer>
+#include <QCompleter>
+#include <QDirModel>
+#include <QLayout>
+#include <QTimer>
+#include <QPushButton>
+#include <QFileDialog>
+
+#include <KTextEditor/View>
+#include <KTextEditor/Document>
#include <klocalizedstring.h>
-#include <kicon.h>
-#include <ktexteditor/view.h>
-#include <ktexteditor/document.h>
-#include <kfiledialog.h>
#include <kmessagebox.h>
-ConfigView::ConfigView(QWidget* parent, Kate::MainWindow* mainWin)
+ConfigView::ConfigView(QWidget* parent, KTextEditor::MainWindow* mainWin)
: QWidget(parent),
m_mainWindow(mainWin)
{
- m_targetCombo = new KComboBox();
+ m_targetCombo = new QComboBox();
m_targetCombo->setEditable(true);
// don't let Qt insert items when the user edits; new targets are only
// added when the user explicitly says so
@@ -48,15 +48,15 @@ ConfigView::ConfigView(QWidget* parent, Kate::MainWindow* mainWin)
m_targetCombo->setDuplicatesEnabled(true);
m_addTarget = new QToolButton();
- m_addTarget->setIcon(SmallIcon("document-new"));
+ m_addTarget->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
m_addTarget->setToolTip(i18n("Add new target"));
m_copyTarget = new QToolButton();
- m_copyTarget->setIcon(SmallIcon("document-copy"));
+ m_copyTarget->setIcon(QIcon::fromTheme(QStringLiteral("document-copy")));
m_copyTarget->setToolTip(i18n("Copy target"));
m_deleteTarget = new QToolButton();
- m_deleteTarget->setIcon(SmallIcon("edit-delete"));
+ m_deleteTarget->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
m_deleteTarget->setToolTip(i18n("Delete target"));
m_line = new QFrame(this);
@@ -65,28 +65,28 @@ ConfigView::ConfigView(QWidget* parent, Kate::MainWindow* mainWin)
m_execLabel = new QLabel(i18n("Executable:"));
m_execLabel->setBuddy(m_targetCombo);
- m_executable = new KLineEdit();
+ m_executable = new QLineEdit();
QCompleter* completer1 = new QCompleter(this);
completer1->setModel(new QDirModel(QStringList(),
QDir::AllDirs|QDir::NoDotAndDotDot,
QDir::Name, this));
m_executable->setCompleter(completer1);
- m_executable->setClearButtonShown(true);
+ // FIXME KF5 m_executable->setClearButtonShown(true);
m_browseExe = new QToolButton(this);
- m_browseExe->setIcon(KIcon("application-x-executable"));
+ m_browseExe->setIcon(QIcon::fromTheme(QStringLiteral("application-x-executable")));
- m_workingDirectory = new KLineEdit();
+ m_workingDirectory = new QLineEdit();
QCompleter* completer2 = new QCompleter(this);
completer2->setModel(new QDirModel(completer2));
m_workingDirectory->setCompleter(completer2);
- m_workingDirectory->setClearButtonShown(true);
+ // FIXME KF5 m_workingDirectory->setClearButtonShown(true);
m_workDirLabel = new QLabel(i18n("Working Directory:"));
m_workDirLabel->setBuddy(m_workingDirectory);
m_browseDir = new QToolButton(this);
- m_browseDir->setIcon(KIcon("inode-directory"));
+ m_browseDir->setIcon(QIcon::fromTheme(QStringLiteral("inode-directory")));
- m_arguments = new KLineEdit();
- m_arguments->setClearButtonShown(true);
+ m_arguments = new QLineEdit();
+ // FIXME KF5 m_arguments->setClearButtonShown(true);
m_argumentsLabel = new QLabel(i18nc("Program argument list", "Arguments:"));
m_argumentsLabel->setBuddy(m_arguments);
@@ -97,7 +97,7 @@ ConfigView::ConfigView(QWidget* parent, Kate::MainWindow* mainWin)
m_redirectTerminal = new QCheckBox(i18n("Redirect IO"));
m_redirectTerminal->setToolTip(i18n("Redirect the debugged programs IO to a separate tab"));
- m_advancedSettings = new KPushButton(i18n("Advanced Settings"));
+ m_advancedSettings = new QPushButton(i18n("Advanced Settings"));
m_checBoxLayout = 0;
@@ -130,21 +130,20 @@ ConfigView::~ConfigView()
void ConfigView::registerActions(KActionCollection* actionCollection)
{
- m_targetSelectAction = actionCollection->add<KSelectAction>("targets");
+ m_targetSelectAction = actionCollection->add<KSelectAction>(QStringLiteral("targets"));
m_targetSelectAction->setText(i18n("Targets"));
connect(m_targetSelectAction, SIGNAL(triggered(int)),
this, SLOT(slotTargetSelected(int)));
}
-void ConfigView::readConfig(KConfigBase* config, QString const& groupPrefix)
+void ConfigView::readConfig(const KConfigGroup& group)
{
m_targetCombo->clear();
- KConfigGroup group = config->group(groupPrefix);
- int version = group.readEntry("version", 4);
- int targetCount = group.readEntry("targetCount", 1);
- int lastTarget = group.readEntry("lastTarget", 0);
- QString targetKey("target_%1");
+ int version = group.readEntry(QStringLiteral("version"), 4);
+ int targetCount = group.readEntry(QStringLiteral("targetCount"), 1);
+ int lastTarget = group.readEntry(QStringLiteral("lastTarget"), 0);
+ QString targetKey(QStringLiteral("target_%1"));
QStringList targetConfStrs;
@@ -172,9 +171,9 @@ void ConfigView::readConfig(KConfigBase* config, QString const& groupPrefix)
if (version < 4) {
// all targets now have only one argument string
- int argListsCount = group.readEntry("argsCount", 0);
- QString argsKey("args_%1");
- QString targetName("%1<%2>");
+ int argListsCount = group.readEntry(QStringLiteral("argsCount"), 0);
+ QString argsKey(QStringLiteral("args_%1"));
+ QString targetName(QStringLiteral("%1<%2>"));
QString argStr;
int count = m_targetCombo->count();
@@ -210,16 +209,14 @@ void ConfigView::readConfig(KConfigBase* config, QString const& groupPrefix)
m_redirectTerminal->setChecked(group.readEntry("redirectTerminal",false));
}
-void ConfigView::writeConfig(KConfigBase* config, QString const& groupPrefix)
+void ConfigView::writeConfig(KConfigGroup& group)
{
// make sure the data is up to date before writing
saveCurrentToIndex(m_currentTarget);
- KConfigGroup group = config->group(groupPrefix);
-
group.writeEntry("version", 4);
- QString targetKey("target_%1");
+ QString targetKey(QStringLiteral("target_%1"));
QStringList targetConfStrs;
group.writeEntry("targetCount", m_targetCombo->count());
@@ -246,7 +243,7 @@ const GDBTargetConf ConfigView::currentTarget() const
cfg.customInit.removeFirst();
}
else {
- cfg.gdbCmd = "gdb";
+ cfg.gdbCmd = QStringLiteral("gdb");
}
// remove empty strings in the customInit
int i = cfg.customInit.size()-1;
@@ -419,7 +416,7 @@ void ConfigView::slotAdvancedClicked()
while (tmp.count() < CustomStartIndex) tmp << QString();
if (tmp[GDBIndex].isEmpty()) {
- tmp[GDBIndex] = "gdb";
+ tmp[GDBIndex] = QStringLiteral("gdb");
}
// Remove the strings that are not part of the advanced settings
@@ -437,32 +434,32 @@ void ConfigView::slotAdvancedClicked()
void ConfigView::slotBrowseExec()
{
- KUrl exe(m_executable->text());
+ QString exe = m_executable->text();
if (m_executable->text().isEmpty()) {
// try current document dir
KTextEditor::View* view = m_mainWindow->activeView();
if (view != NULL) {
- exe = view->document()->url();
+ exe = view->document()->url().toLocalFile();
}
}
- m_executable->setText(KFileDialog::getOpenFileName(exe, "application/x-executable"));
+ m_executable->setText(QFileDialog::getOpenFileName((QWidget *)0, QString(), exe, QStringLiteral("application/x-executable")));
}
void ConfigView::slotBrowseDir()
{
- KUrl dir(m_workingDirectory->text());
+ QString dir = m_workingDirectory->text();
if (m_workingDirectory->text().isEmpty()) {
// try current document dir
KTextEditor::View* view = m_mainWindow->activeView();
if (view != NULL) {
- dir = view->document()->url();
+ dir = view->document()->url().toLocalFile();
}
}
- m_workingDirectory->setText(KFileDialog::getExistingDirectory (dir));
+ m_workingDirectory->setText(QFileDialog::getExistingDirectory(this, QString(), dir));
}
void ConfigView::saveCurrentToIndex(int index)
@@ -470,16 +467,16 @@ void ConfigView::saveCurrentToIndex(int index)
if ((index < 0) || (index >= m_targetCombo->count())) {
return;
}
-
+
QStringList tmp = m_targetCombo->itemData(index).toStringList();
// make sure we have enough strings. The custom init strings are set in slotAdvancedClicked().
while (tmp.count() < CustomStartIndex) tmp << QString();
-
+
tmp[NameIndex] = m_targetCombo->itemText(index);
tmp[ExecIndex] = m_executable->text();
tmp[WorkDirIndex] = m_workingDirectory->text();
tmp[ArgsIndex] = m_arguments->text();
-
+
m_targetCombo->setItemData(index, tmp);
}
@@ -498,4 +495,5 @@ void ConfigView::loadFromIndex(int index)
m_arguments->setText(tmp[ArgsIndex]);
}
+#include "configview.moc"
diff --git a/addons/kate/gdbplugin/configview.h b/addons/kate/gdbplugin/configview.h
index 182ed5d..06dcf7e 100644
--- a/addons/kate/gdbplugin/configview.h
+++ b/addons/kate/gdbplugin/configview.h
@@ -26,21 +26,19 @@
#include "advanced_settings.h"
-#include <QtGui/QWidget>
-#include <QtGui/QLabel>
-#include <QtGui/QToolButton>
-#include <QtGui/QComboBox>
-#include <QtGui/QCheckBox>
-#include <QtGui/QBoxLayout>
-#include <QtGui/QResizeEvent>
-
-#include <QtCore/QList>
-
-#include <kate/mainwindow.h>
+#include <QWidget>
+#include <QLabel>
+#include <QLineEdit>
+#include <QToolButton>
+#include <QComboBox>
+#include <QCheckBox>
+#include <QBoxLayout>
+#include <QResizeEvent>
+
+#include <QList>
+
+#include <KTextEditor/MainWindow>
#include <kconfiggroup.h>
-#include <kcombobox.h>
-#include <klineedit.h>
-#include <kpushbutton.h>
#include <kactioncollection.h>
#include <kselectaction.h>
@@ -65,14 +63,14 @@ public:
CustomStartIndex
};
- ConfigView(QWidget* parent, Kate::MainWindow* mainWin);
+ ConfigView(QWidget* parent, KTextEditor::MainWindow* mainWin);
~ConfigView();
public:
void registerActions(KActionCollection* actionCollection);
- void readConfig(KConfigBase* config, QString const& groupPrefix);
- void writeConfig(KConfigBase* config, QString const& groupPrefix);
+ void readConfig (const KConfigGroup& config);
+ void writeConfig (KConfigGroup& config);
const GDBTargetConf currentTarget() const;
bool takeFocusAlways() const;
@@ -99,25 +97,25 @@ private:
void loadFromIndex(int index);
private:
- Kate::MainWindow* m_mainWindow;
- KComboBox* m_targetCombo;
+ KTextEditor::MainWindow* m_mainWindow;
+ QComboBox* m_targetCombo;
int m_currentTarget;
QToolButton* m_addTarget;
QToolButton* m_copyTarget;
QToolButton* m_deleteTarget;
QFrame* m_line;
- KLineEdit* m_executable;
+ QLineEdit* m_executable;
QToolButton* m_browseExe;
- KLineEdit* m_workingDirectory;
+ QLineEdit* m_workingDirectory;
QToolButton* m_browseDir;
- KLineEdit* m_arguments;
+ QLineEdit* m_arguments;
QCheckBox* m_takeFocus;
QCheckBox* m_redirectTerminal;
- KPushButton* m_advancedSettings;
+ QPushButton* m_advancedSettings;
QBoxLayout* m_checBoxLayout;
bool m_useBottomLayout;
diff --git a/addons/kate/gdbplugin/debugview.cpp b/addons/kate/gdbplugin/debugview.cpp
index fcd6eb0..672e4ee 100644
--- a/addons/kate/gdbplugin/debugview.cpp
+++ b/addons/kate/gdbplugin/debugview.cpp
@@ -24,9 +24,9 @@
#include "debugview.h"
#include "debugview.moc"
-#include <QtCore/QRegExp>
-#include <QtCore/QFile>
-#include <QtCore/QTimer>
+#include <QRegExp>
+#include <QFile>
+#include <QTimer>
#include <kmessagebox.h>
#include <kurlrequester.h>
@@ -36,25 +36,25 @@
#include <signal.h>
#include <stdlib.h>
-static const QString PromptStr = "(prompt)";
+static const QString PromptStr = QStringLiteral("(prompt)");
-DebugView::DebugView( QObject* parent )
-: QObject( parent ),
+DebugView::DebugView(QObject* parent)
+: QObject(parent),
m_debugProcess(0),
- m_state( none ),
- m_subState( normal ),
- m_debugLocationChanged( true ),
- m_queryLocals( false )
+ m_state(none),
+ m_subState(normal),
+ m_debugLocationChanged(true),
+ m_queryLocals(false)
{
}
DebugView::~DebugView()
{
- if ( m_debugProcess.state() != QProcess::NotRunning )
+ if ( m_debugProcess.state() != QProcess::NotRunning)
{
m_debugProcess.kill();
- m_debugProcess.blockSignals( true );
+ m_debugProcess.blockSignals(true);
m_debugProcess.waitForFinished();
}
}
@@ -66,7 +66,7 @@ void DebugView::runDebugger(const GDBTargetConf &conf, const QStringList &ioFifo
}
m_targetConf = conf;
if (ioFifos.size() == 3) {
- m_ioPipeString = QString("< %1 1> %2 2> %3")
+ m_ioPipeString = QStringLiteral("< %1 1> %2 2> %3")
.arg(ioFifos[0])
.arg(ioFifos[1])
.arg(ioFifos[2]);
@@ -80,23 +80,21 @@ void DebugView::runDebugger(const GDBTargetConf &conf, const QStringList &ioFifo
//create a process to control GDB
m_debugProcess.setWorkingDirectory(m_targetConf.workDir);
- connect( &m_debugProcess, SIGNAL(error(QProcess::ProcessError)),
- this, SLOT(slotError()) );
+ connect(&m_debugProcess, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(slotError()));
- connect( &m_debugProcess, SIGNAL(readyReadStandardError()),
- this, SLOT(slotReadDebugStdErr()) );
+ connect(&m_debugProcess, SIGNAL(readyReadStandardError()),
+ this, SLOT(slotReadDebugStdErr()));
- connect( &m_debugProcess, SIGNAL(readyReadStandardOutput()),
- this, SLOT(slotReadDebugStdOut()) );
+ connect(&m_debugProcess, SIGNAL(readyReadStandardOutput()),
+ this, SLOT(slotReadDebugStdOut()));
- connect( &m_debugProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
- this, SLOT(slotDebugFinished(int,QProcess::ExitStatus)) );
+ connect(&m_debugProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
+ this, SLOT(slotDebugFinished(int,QProcess::ExitStatus)));
- m_debugProcess.setShellCommand(m_targetConf.gdbCmd);
- m_debugProcess.setOutputChannelMode(KProcess::SeparateChannels);
- m_debugProcess.start();
+ m_debugProcess.start(m_targetConf.gdbCmd);
- m_nextCommands << "set pagination off";
+ m_nextCommands << QStringLiteral("set pagination off");
m_state = ready;
}
else
@@ -105,80 +103,80 @@ void DebugView::runDebugger(const GDBTargetConf &conf, const QStringList &ioFifo
// here we have to trigger it manually.
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
- m_nextCommands << QString("file %1").arg(m_targetConf.executable);
- m_nextCommands << QString("set args %1 %2").arg(m_targetConf.arguments).arg(m_ioPipeString);
- m_nextCommands << QString("set inferior-tty /dev/null");
+ m_nextCommands << QStringLiteral("file %1").arg(m_targetConf.executable);
+ m_nextCommands << QStringLiteral("set args %1 %2").arg(m_targetConf.arguments).arg(m_ioPipeString);
+ m_nextCommands << QStringLiteral("set inferior-tty /dev/null");
m_nextCommands << m_targetConf.customInit;
- m_nextCommands << QString("(Q) info breakpoints");
+ m_nextCommands << QStringLiteral("(Q) info breakpoints");
}
bool DebugView::debuggerRunning() const
{
- return( m_state != none );
+ return(m_state != none);
}
bool DebugView::debuggerBusy() const
{
- return( m_state == executingCmd );
+ return(m_state == executingCmd);
}
-bool DebugView::hasBreakpoint( const KUrl& url, int line )
+bool DebugView::hasBreakpoint(const QUrl& url, int line)
{
for (int i = 0; i<m_breakPointList.size(); i++) {
- if ( (url == m_breakPointList[i].file) && (line == m_breakPointList[i].line) ) {
+ if ((url == m_breakPointList[i].file) && (line == m_breakPointList[i].line)) {
return true;
}
}
return false;
}
-void DebugView::toggleBreakpoint( KUrl const& url, int line )
+void DebugView::toggleBreakpoint(QUrl const& url, int line)
{
- if( m_state == ready )
+ if(m_state == ready)
{
QString cmd;
- if (hasBreakpoint( url, line ))
+ if (hasBreakpoint(url, line))
{
- cmd = QString("clear %1:%2").arg(url.path()).arg(line);
+ cmd = QStringLiteral("clear %1:%2").arg(url.path()).arg(line);
}
else {
- cmd = QString("break %1:%2").arg(url.path()).arg(line);
+ cmd = QStringLiteral("break %1:%2").arg(url.path()).arg(line);
}
- issueCommand( cmd );
+ issueCommand(cmd);
}
}
void DebugView::slotError()
{
- KMessageBox::sorry( NULL, i18n("Could not start debugger process") );
+ KMessageBox::sorry(NULL, i18n("Could not start debugger process"));
}
void DebugView::slotReadDebugStdOut()
{
- m_outBuffer += QString::fromLocal8Bit( m_debugProcess.readAllStandardOutput().data() );
+ m_outBuffer += QString::fromLocal8Bit(m_debugProcess.readAllStandardOutput().data());
int end=0;
// handle one line at a time
do {
- end = m_outBuffer.indexOf('\n');
+ end = m_outBuffer.indexOf(QLatin1Char('\n'));
if (end < 0) break;
- processLine( m_outBuffer.mid(0, end) );
+ processLine(m_outBuffer.mid(0, end));
m_outBuffer.remove(0,end+1);
} while (1);
- if (m_outBuffer == "(gdb) " || m_outBuffer == ">")
+ if (m_outBuffer == QLatin1String("(gdb) ") || m_outBuffer == QLatin1String(">"))
{
m_outBuffer.clear();
- processLine( PromptStr );
+ processLine(PromptStr);
}
}
void DebugView::slotReadDebugStdErr()
{
- m_errBuffer += QString::fromLocal8Bit( m_debugProcess.readAllStandardError().data() );
+ m_errBuffer += QString::fromLocal8Bit(m_debugProcess.readAllStandardError().data());
int end=0;
// add whole lines at a time to the error list
do {
- end = m_errBuffer.indexOf('\n');
+ end = m_errBuffer.indexOf(QLatin1Char('\n'));
if (end < 0) break;
m_errorList << m_errBuffer.mid(0, end);
m_errBuffer.remove(0,end+1);
@@ -187,44 +185,44 @@ void DebugView::slotReadDebugStdErr()
processErrors();
}
-void DebugView::slotDebugFinished( int /*exitCode*/, QProcess::ExitStatus status )
+void DebugView::slotDebugFinished(int /*exitCode*/, QProcess::ExitStatus status)
{
- if( status != QProcess::NormalExit )
+ if(status != QProcess::NormalExit)
{
- emit outputText( i18n("*** gdb exited normally ***") + '\n' );
+ emit outputText(i18n("*** gdb exited normally ***") + QLatin1Char('\n'));
}
m_state = none;
- emit readyForInput( false );
+ emit readyForInput(false);
// remove all old breakpoints
BreakPoint bPoint;
- while ( m_breakPointList.size() > 0 )
+ while (m_breakPointList.size() > 0)
{
bPoint = m_breakPointList.takeFirst();
- emit breakPointCleared( bPoint.file, bPoint.line -1 );
+ emit breakPointCleared(bPoint.file, bPoint.line -1);
}
emit gdbEnded();
}
-void DebugView::movePC( KUrl const& url, int line )
+void DebugView::movePC(QUrl const& url, int line)
{
- if( m_state == ready )
+ if(m_state == ready)
{
- QString cmd = QString("tbreak %1:%2").arg(url.path()).arg(line);
- m_nextCommands << QString("jump %1:%2").arg(url.path()).arg(line);
- issueCommand( cmd );
+ QString cmd = QStringLiteral("tbreak %1:%2").arg(url.path()).arg(line);
+ m_nextCommands << QStringLiteral("jump %1:%2").arg(url.path()).arg(line);
+ issueCommand(cmd);
}
}
-void DebugView::runToCursor( KUrl const& url, int line )
+void DebugView::runToCursor(QUrl const& url, int line)
{
- if( m_state == ready )
+ if(m_state == ready)
{
- QString cmd = QString("tbreak %1:%2").arg(url.path()).arg(line);
- m_nextCommands << "continue";
- issueCommand( cmd );
+ QString cmd = QStringLiteral("tbreak %1:%2").arg(url.path()).arg(line);
+ m_nextCommands << QStringLiteral("continue");
+ issueCommand(cmd);
}
}
@@ -241,70 +239,70 @@ void DebugView::slotInterrupt()
void DebugView::slotKill()
{
- if( m_state != ready )
+ if(m_state != ready)
{
slotInterrupt();
m_state = ready;
}
- issueCommand( "kill" );
+ issueCommand(QStringLiteral("kill"));
}
void DebugView::slotReRun()
{
slotKill();
- m_nextCommands << QString("file %1").arg(m_targetConf.executable);
- m_nextCommands << QString("set args %1 %2").arg(m_targetConf.arguments).arg(m_ioPipeString);
- m_nextCommands << QString("set inferior-tty /dev/null");
+ m_nextCommands << QStringLiteral("file %1").arg(m_targetConf.executable);
+ m_nextCommands << QStringLiteral("set args %1 %2").arg(m_targetConf.arguments).arg(m_ioPipeString);
+ m_nextCommands << QStringLiteral("set inferior-tty /dev/null");
m_nextCommands << m_targetConf.customInit;
- m_nextCommands << QString("(Q) info breakpoints");
+ m_nextCommands << QStringLiteral("(Q) info breakpoints");
- m_nextCommands << QString("tbreak main");
- m_nextCommands << QString("run");
- m_nextCommands << QString("p setvbuf(stdout, 0, %1, 1024)").arg(_IOLBF);
- m_nextCommands << QString("continue");
+ m_nextCommands << QStringLiteral("tbreak main");
+ m_nextCommands << QStringLiteral("run");
+ m_nextCommands << QStringLiteral("p setvbuf(stdout, 0, %1, 1024)").arg(_IOLBF);
+ m_nextCommands << QStringLiteral("continue");
}
void DebugView::slotStepInto()
{
- issueCommand( "step" );
+ issueCommand(QStringLiteral("step"));
}
void DebugView::slotStepOver()
{
- issueCommand( "next" );
+ issueCommand(QStringLiteral("next"));
}
void DebugView::slotStepOut()
{
- issueCommand( "finish" );
+ issueCommand(QStringLiteral("finish"));
}
void DebugView::slotContinue()
{
- issueCommand( "continue" );
+ issueCommand(QStringLiteral("continue"));
}
-static QRegExp breakpointList( "Num\\s+Type\\s+Disp\\s+Enb\\s+Address\\s+What.*" );
-static QRegExp breakpointListed( "(\\d)\\s+breakpoint\\s+keep\\sy\\s+0x[\\da-f]+\\sin\\s.+\\sat\\s([^:]+):(\\d+).*" );
-static QRegExp stackFrameAny( "#(\\d+)\\s(.*)" );
-static QRegExp stackFrameFile( "#(\\d+)\\s+(?:0x[\\da-f]+\\s*in\\s)*(\\S+)(\\s\\(.*\\)) at ([^:]+):(\\d+).*" );
-static QRegExp changeFile( "(?:(?:Temporary\\sbreakpoint|Breakpoint)\\s*\\d+,\\s*|0x[\\da-f]+\\s*in\\s*)?[^\\s]+\\s*\\([^)]*\\)\\s*at\\s*([^:]+):(\\d+).*" );
-static QRegExp changeLine( "(\\d+)\\s+.*" );
-static QRegExp breakPointReg( "Breakpoint\\s+(\\d+)\\s+at\\s+0x[\\da-f]+:\\s+file\\s+([^\\,]+)\\,\\s+line\\s+(\\d+).*" );
-static QRegExp breakPointMultiReg( "Breakpoint\\s+(\\d+)\\s+at\\s+0x[\\da-f]+:\\s+([^\\,]+):(\\d+).*" );
-static QRegExp breakPointDel( "Deleted\\s+breakpoint.*" );
-static QRegExp exitProgram( "(?:Program|.*Inferior.*)\\s+exited.*" );
-static QRegExp threadLine( "\\**\\s+(\\d+)\\s+Thread.*" );
-
-void DebugView::processLine( QString line )
+static QRegExp breakpointList(QStringLiteral("Num\\s+Type\\s+Disp\\s+Enb\\s+Address\\s+What.*"));
+static QRegExp breakpointListed(QStringLiteral("(\\d)\\s+breakpoint\\s+keep\\sy\\s+0x[\\da-f]+\\sin\\s.+\\sat\\s([^:]+):(\\d+).*"));
+static QRegExp stackFrameAny(QStringLiteral("#(\\d+)\\s(.*)"));
+static QRegExp stackFrameFile(QStringLiteral("#(\\d+)\\s+(?:0x[\\da-f]+\\s*in\\s)*(\\S+)(\\s\\(.*\\)) at ([^:]+):(\\d+).*"));
+static QRegExp changeFile(QStringLiteral("(?:(?:Temporary\\sbreakpoint|Breakpoint)\\s*\\d+,\\s*|0x[\\da-f]+\\s*in\\s*)?[^\\s]+\\s*\\([^)]*\\)\\s*at\\s*([^:]+):(\\d+).*"));
+static QRegExp changeLine(QStringLiteral("(\\d+)\\s+.*"));
+static QRegExp breakPointReg(QStringLiteral("Breakpoint\\s+(\\d+)\\s+at\\s+0x[\\da-f]+:\\s+file\\s+([^\\,]+)\\,\\s+line\\s+(\\d+).*"));
+static QRegExp breakPointMultiReg(QStringLiteral("Breakpoint\\s+(\\d+)\\s+at\\s+0x[\\da-f]+:\\s+([^\\,]+):(\\d+).*"));
+static QRegExp breakPointDel(QStringLiteral("Deleted\\s+breakpoint.*"));
+static QRegExp exitProgram(QStringLiteral("(?:Program|.*Inferior.*)\\s+exited.*"));
+static QRegExp threadLine(QStringLiteral("\\**\\s+(\\d+)\\s+Thread.*"));
+
+void DebugView::processLine(QString line)
{
if (line.isEmpty()) return;
- switch( m_state )
+ switch(m_state)
{
case none:
case ready:
- if( PromptStr == line )
+ if(PromptStr == line)
{
// we get here after initialization
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
@@ -312,114 +310,114 @@ void DebugView::processLine( QString line )
break;
case executingCmd:
- if( breakpointList.exactMatch( line ) )
+ if(breakpointList.exactMatch(line))
{
m_state = listingBreakpoints;
emit clearBreakpointMarks();
m_breakPointList.clear();
}
- else if ( line.contains( "No breakpoints or watchpoints.") )
+ else if (line.contains(QStringLiteral("No breakpoints or watchpoints.")))
{
emit clearBreakpointMarks();
m_breakPointList.clear();
}
- else if ( stackFrameAny.exactMatch( line ) )
+ else if (stackFrameAny.exactMatch(line))
{
- if ( m_lastCommand.contains( "info stack" ) )
+ if (m_lastCommand.contains(QStringLiteral("info stack")))
{
- emit stackFrameInfo( stackFrameAny.cap(1), stackFrameAny.cap(2));
+ emit stackFrameInfo(stackFrameAny.cap(1), stackFrameAny.cap(2));
}
else
{
- m_subState = ( m_subState == normal ) ? stackFrameSeen : stackTraceSeen;
+ m_subState = (m_subState == normal) ? stackFrameSeen : stackTraceSeen;
- m_newFrameLevel = stackFrameAny.cap( 1 ).toInt();
+ m_newFrameLevel = stackFrameAny.cap(1).toInt();
- if ( stackFrameFile.exactMatch( line ) )
+ if (stackFrameFile.exactMatch(line))
{
- m_newFrameFile = stackFrameFile.cap( 4 );
+ m_newFrameFile = stackFrameFile.cap(4);
}
}
}
- else if( changeFile.exactMatch( line ) )
+ else if(changeFile.exactMatch(line))
{
- m_currentFile = changeFile.cap( 1 ).trimmed();
- int lineNum = changeFile.cap( 2 ).toInt();
+ m_currentFile = changeFile.cap(1).trimmed();
+ int lineNum = changeFile.cap(2).toInt();
- if ( !m_nextCommands.contains("continue") ) {
+ if (!m_nextCommands.contains(QStringLiteral("continue"))) {
// GDB uses 1 based line numbers, kate uses 0 based...
- emit debugLocationChanged( resolveFileName(m_currentFile), lineNum - 1 );
+ emit debugLocationChanged(resolveFileName(m_currentFile), lineNum - 1);
}
m_debugLocationChanged = true;
}
- else if( changeLine.exactMatch( line ) )
+ else if(changeLine.exactMatch(line))
{
- int lineNum = changeLine.cap( 1 ).toInt();
+ int lineNum = changeLine.cap(1).toInt();
- if( m_subState == stackFrameSeen )
+ if(m_subState == stackFrameSeen)
{
m_currentFile = m_newFrameFile;
}
- if ( !m_nextCommands.contains("continue") ) {
+ if (!m_nextCommands.contains(QStringLiteral("continue"))) {
// GDB uses 1 based line numbers, kate uses 0 based...
- emit debugLocationChanged( resolveFileName(m_currentFile), lineNum - 1 );
+ emit debugLocationChanged(resolveFileName(m_currentFile), lineNum - 1);
}
m_debugLocationChanged = true;
}
else if (breakPointReg.exactMatch(line))
{
BreakPoint breakPoint;
- breakPoint.number = breakPointReg.cap( 1 ).toInt();
- breakPoint.file = resolveFileName( breakPointReg.cap( 2 ) );
- breakPoint.line = breakPointReg.cap( 3 ).toInt();
+ breakPoint.number = breakPointReg.cap(1).toInt();
+ breakPoint.file = resolveFileName(breakPointReg.cap(2));
+ breakPoint.line = breakPointReg.cap(3).toInt();
m_breakPointList << breakPoint;
- emit breakPointSet( breakPoint.file, breakPoint.line -1 );
+ emit breakPointSet(breakPoint.file, breakPoint.line -1);
}
else if (breakPointMultiReg.exactMatch(line))
{
BreakPoint breakPoint;
- breakPoint.number = breakPointMultiReg.cap( 1 ).toInt();
- breakPoint.file = resolveFileName( breakPointMultiReg.cap( 2 ) );
- breakPoint.line = breakPointMultiReg.cap( 3 ).toInt();
+ breakPoint.number = breakPointMultiReg.cap(1).toInt();
+ breakPoint.file = resolveFileName(breakPointMultiReg.cap(2));
+ breakPoint.line = breakPointMultiReg.cap(3).toInt();
m_breakPointList << breakPoint;
- emit breakPointSet( breakPoint.file, breakPoint.line -1 );
+ emit breakPointSet(breakPoint.file, breakPoint.line -1);
}
else if (breakPointDel.exactMatch(line))
{
- line.remove("Deleted breakpoint");
- line.remove('s'); // in case of multiple breakpoints
- QStringList numbers = line.split(' ', QString::SkipEmptyParts);
+ line.remove(QStringLiteral("Deleted breakpoint"));
+ line.remove(QLatin1Char('s')); // in case of multiple breakpoints
+ QStringList numbers = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
for (int i=0; i<numbers.size(); i++)
{
for (int j = 0; j<m_breakPointList.size(); j++)
{
- if ( numbers[i].toInt() == m_breakPointList[j].number )
+ if (numbers[i].toInt() == m_breakPointList[j].number)
{
- emit breakPointCleared( m_breakPointList[j].file, m_breakPointList[j].line -1 );
+ emit breakPointCleared(m_breakPointList[j].file, m_breakPointList[j].line -1);
m_breakPointList.removeAt(j);
break;
}
}
}
}
- else if ( exitProgram.exactMatch( line ) ||
- line.contains( "The program no longer exists" ) ||
- line.contains( "Kill the program being debugged" ) )
+ else if (exitProgram.exactMatch(line) ||
+ line.contains(QStringLiteral("The program no longer exists")) ||
+ line.contains(QStringLiteral("Kill the program being debugged")))
{
// if there are still commands to execute remove them to remove unneeded output
// except if the "kill was for "re-run"
- if ( ( m_nextCommands.size() > 0 ) && !m_nextCommands[0].contains("file") )
+ if ((m_nextCommands.size() > 0) && !m_nextCommands[0].contains(QStringLiteral("file")))
{
m_nextCommands.clear();
}
m_debugLocationChanged = false; // do not insert (Q) commands
emit programEnded();
}
- else if( PromptStr == line )
+ else if(PromptStr == line)
{
- if( m_subState == stackFrameSeen )
+ if(m_subState == stackFrameSeen)
{
- emit stackFrameChanged( m_newFrameLevel );
+ emit stackFrameChanged(m_newFrameLevel);
}
m_state = ready;
@@ -429,77 +427,77 @@ void DebugView::processLine( QString line )
break;
case listingBreakpoints:
- if (breakpointListed.exactMatch( line ) )
+ if (breakpointListed.exactMatch(line))
{
BreakPoint breakPoint;
- breakPoint.number = breakpointListed.cap( 1 ).toInt();
- breakPoint.file = resolveFileName( breakpointListed.cap( 2 ) );
- breakPoint.line = breakpointListed.cap( 3 ).toInt();
+ breakPoint.number = breakpointListed.cap(1).toInt();
+ breakPoint.file = resolveFileName(breakpointListed.cap(2));
+ breakPoint.line = breakpointListed.cap(3).toInt();
m_breakPointList << breakPoint;
- emit breakPointSet( breakPoint.file, breakPoint.line -1 );
+ emit breakPointSet(breakPoint.file, breakPoint.line -1);
}
- else if( PromptStr == line )
+ else if(PromptStr == line)
{
m_state = ready;
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
break;
case infoArgs:
- if( PromptStr == line )
+ if(PromptStr == line)
{
m_state = ready;
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
else {
- emit infoLocal( line );
+ emit infoLocal(line);
}
break;
case printThis:
- if( PromptStr == line )
+ if(PromptStr == line)
{
m_state = ready;
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
else {
- emit infoLocal( line );
+ emit infoLocal(line);
}
break;
case infoLocals:
- if( PromptStr == line )
+ if(PromptStr == line)
{
m_state = ready;
- emit infoLocal( QString() );
+ emit infoLocal(QString());
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
else {
- emit infoLocal( line );
+ emit infoLocal(line);
}
break;
case infoStack:
- if( PromptStr == line )
+ if(PromptStr == line)
{
m_state = ready;
- emit stackFrameInfo( QString(), QString() );
+ emit stackFrameInfo(QString(), QString());
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
- else if ( stackFrameAny.exactMatch( line ) )
+ else if (stackFrameAny.exactMatch(line))
{
- emit stackFrameInfo( stackFrameAny.cap(1), stackFrameAny.cap(2));
+ emit stackFrameInfo(stackFrameAny.cap(1), stackFrameAny.cap(2));
}
break;
case infoThreads:
- if( PromptStr == line )
+ if(PromptStr == line)
{
m_state = ready;
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
- else if ( threadLine.exactMatch( line ) )
+ else if (threadLine.exactMatch(line))
{
- emit threadInfo( threadLine.cap(1).toInt(), (line[0] == '*'));
+ emit threadInfo(threadLine.cap(1).toInt(), (line[0] == QLatin1Char('*')));
}
break;
}
- outputTextMaybe( line );
+ outputTextMaybe(line);
}
void DebugView::processErrors()
@@ -508,165 +506,171 @@ void DebugView::processErrors()
while (m_errorList.size() > 0) {
error = m_errorList.takeFirst();
//qDebug() << error;
- if( error == "The program is not being run." )
+ if(error == QLatin1String("The program is not being run."))
{
- if ( m_lastCommand == "continue" )
+ if (m_lastCommand == QLatin1String("continue"))
{
m_nextCommands.clear();
- m_nextCommands << QString("tbreak main");
- m_nextCommands << QString("run");
- m_nextCommands << QString("p setvbuf(stdout, 0, %1, 1024)").arg(_IOLBF);
- m_nextCommands << QString("continue");
+ m_nextCommands << QStringLiteral("tbreak main");
+ m_nextCommands << QStringLiteral("run");
+ m_nextCommands << QStringLiteral("p setvbuf(stdout, 0, %1, 1024)").arg(_IOLBF);
+ m_nextCommands << QStringLiteral("continue");
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
- else if ( ( m_lastCommand == "step" ) ||
- ( m_lastCommand == "next" ) ||
- ( m_lastCommand == "finish" ) )
+ else if ((m_lastCommand == QLatin1String("step")) ||
+ (m_lastCommand == QLatin1String("next")) ||
+ (m_lastCommand == QLatin1String("finish")))
{
m_nextCommands.clear();
- m_nextCommands << "tbreak main";
- m_nextCommands << "run";
- m_nextCommands << QString("p setvbuf(stdout, 0, %1, 1024)").arg(_IOLBF);
+ m_nextCommands << QStringLiteral("tbreak main");
+ m_nextCommands << QStringLiteral("run");
+ m_nextCommands << QStringLiteral("p setvbuf(stdout, 0, %1, 1024)").arg(_IOLBF);
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
- else if ((m_lastCommand == "kill"))
+ else if ((m_lastCommand == QLatin1String("kill")))
{
- if ( m_nextCommands.size() > 0 )
+ if (m_nextCommands.size() > 0)
{
- if ( !m_nextCommands[0].contains("file") )
+ if (!m_nextCommands[0].contains(QStringLiteral("file")))
{
m_nextCommands.clear();
- m_nextCommands << "quit";
+ m_nextCommands << QStringLiteral("quit");
}
// else continue with "ReRun"
}
else
{
- m_nextCommands << "quit";
+ m_nextCommands << QStringLiteral("quit");
}
m_state = ready;
QTimer::singleShot(0, this, SLOT(issueNextCommand()));
}
// else do nothing
}
- else if ( error.contains( "No line " ) ||
- error.contains( "No source file named" ) )
+ else if (error.contains(QStringLiteral("No line ")) ||
+ error.contains(QStringLiteral("No source file named")))
{
// setting a breakpoint failed. Do not continue.
m_nextCommands.clear();
- emit readyForInput( true );
+ emit readyForInput(true);
}
- else if ( error.contains( "No stack" ) )
+ else if (error.contains(QStringLiteral("No stack")))
{
m_nextCommands.clear();
emit programEnded();
}
- if ((m_lastCommand == "(Q)print *this") && error.contains("No symbol \"this\" in current context.")) {
+ if ((m_lastCommand == QLatin1String("(Q)print *this")) && error.contains(QStringLiteral("No symbol \"this\" in current context."))) {
continue;
}
- emit outputError( error + '\n' );
+ emit outputError(error + QLatin1Char('\n'));
}
}
-void DebugView::issueCommand( QString const& cmd )
+void DebugView::issueCommand(QString const& cmd)
{
- if( m_state == ready )
+ if(m_state == ready)
{
- emit readyForInput( false );
+ emit readyForInput(false);
m_state = executingCmd;
- if (cmd == "(Q)info locals") {
+ if (cmd == QLatin1String("(Q)info locals")) {
m_state = infoLocals;
}
- else if (cmd == "(Q)info args") {
+ else if (cmd == QLatin1String("(Q)info args")) {
m_state = infoArgs;
}
- else if (cmd == "(Q)print *this") {
+ else if (cmd == QLatin1String("(Q)print *this")) {
m_state = printThis;
}
- else if (cmd == "(Q)info stack") {
+ else if (cmd == QLatin1String("(Q)info stack")) {
m_state = infoStack;
}
- else if (cmd == "(Q)info thread") {
- emit threadInfo( -1 , false );
+ else if (cmd == QLatin1String("(Q)info thread")) {
+ emit threadInfo(-1 , false);
m_state = infoThreads;
}
m_subState = normal;
m_lastCommand = cmd;
- if ( cmd.startsWith("(Q)") )
+ if (cmd.startsWith(QStringLiteral("(Q)")))
{
- m_debugProcess.write( cmd.mid(3).toLocal8Bit() + '\n' );
+ m_debugProcess.write(qPrintable(cmd.mid(3)));
}
else {
- emit outputText( "(gdb) " + cmd + '\n' );
- m_debugProcess.write( cmd.toLocal8Bit() + '\n' );
+ emit outputText(QStringLiteral("(gdb) ") + cmd + QLatin1Char('\n'));
+ m_debugProcess.write(qPrintable(cmd));
}
+ m_debugProcess.write("\n");
}
}
void DebugView::issueNextCommand()
{
- if( m_state == ready )
+ if(m_state == ready)
{
- if( m_nextCommands.size() > 0)
+ if(m_nextCommands.size() > 0)
{
QString cmd = m_nextCommands.takeFirst();
//qDebug() << "Next command" << cmd;
- issueCommand( cmd );
+ issueCommand(cmd);
}
else
{
// FIXME "thread" needs a better generic solution
- if (m_debugLocationChanged || m_lastCommand.startsWith("thread")) {
+ if (m_debugLocationChanged || m_lastCommand.startsWith(QStringLiteral("thread"))) {
m_debugLocationChanged = false;
- if (m_queryLocals && !m_lastCommand.startsWith("(Q)")) {
- m_nextCommands << "(Q)info stack";
- m_nextCommands << "(Q)frame";
- m_nextCommands << "(Q)info args";
- m_nextCommands << "(Q)print *this";
- m_nextCommands << "(Q)info locals";
- m_nextCommands << "(Q)info thread";
+ if (m_queryLocals && !m_lastCommand.startsWith(QStringLiteral("(Q)"))) {
+ m_nextCommands << QStringLiteral("(Q)info stack");
+ m_nextCommands << QStringLiteral("(Q)frame");
+ m_nextCommands << QStringLiteral("(Q)info args");
+ m_nextCommands << QStringLiteral("(Q)print *this");
+ m_nextCommands << QStringLiteral("(Q)info locals");
+ m_nextCommands << QStringLiteral("(Q)info thread");
issueNextCommand();
return;
}
}
- emit readyForInput( true );
+ emit readyForInput(true);
}
}
}
-KUrl DebugView::resolveFileName( const QString &fileName )
+QUrl DebugView::resolveFileName(const QString &fileName)
{
- KUrl url;
+ QUrl url;
+ QFileInfo fInfo = QFileInfo(fileName);
//did we end up with an absolute path or a relative one?
- if ( QFileInfo(fileName).isAbsolute() ) {
- url.setPath( fileName );
- url.cleanPath();
+ if (fInfo.exists()) {
+ return QUrl::fromUserInput(fInfo.absoluteFilePath());
}
- else {
- url.setPath(m_targetConf.workDir);
- url.addPath(fileName);
- url.cleanPath();
-
- if (!QFileInfo(url.path()).exists()) {
- url.setPath(m_targetConf.executable);
- url.upUrl(); // get path
- url.addPath(fileName);
- url.cleanPath();
- }
- // Now, if not found just give up ;)
+
+ if (fInfo.isAbsolute()) {
+ // we can not do anything just return the fileName
+ return QUrl::fromUserInput(fileName);
+ }
+
+ // Now try to add the working path
+ fInfo = QFileInfo(m_targetConf.workDir + fileName);
+ if (fInfo.exists()) {
+ return QUrl::fromUserInput(fInfo.absoluteFilePath());
+ }
+
+ // now try the executable path
+ fInfo = QFileInfo(QFileInfo(m_targetConf.executable).absolutePath() + fileName);
+ if (fInfo.exists()) {
+ return QUrl::fromUserInput(fInfo.absoluteFilePath());
}
- return url;
+ // we can not do anything just return the fileName
+ return QUrl::fromUserInput(fileName);
}
-void DebugView::outputTextMaybe( const QString &text )
+void DebugView::outputTextMaybe(const QString &text)
{
- if ( !m_lastCommand.startsWith( "(Q)" ) && !text.contains( PromptStr ) )
+ if (!m_lastCommand.startsWith(QStringLiteral("(Q)")) && !text.contains(PromptStr))
{
- emit outputText( text + '\n' );
+ emit outputText(text + QLatin1Char('\n'));
}
}
@@ -674,14 +678,14 @@ void DebugView::outputTextMaybe( const QString &text )
void DebugView::slotQueryLocals(bool query)
{
m_queryLocals = query;
- if ( query && ( m_state == ready ) && ( m_nextCommands.size() == 0 ) )
+ if (query && (m_state == ready) && (m_nextCommands.size() == 0))
{
- m_nextCommands << "(Q)info stack";
- m_nextCommands << "(Q)frame";
- m_nextCommands << "(Q)info args";
- m_nextCommands << "(Q)print *this";
- m_nextCommands << "(Q)info locals";
- m_nextCommands << "(Q)info thread";
+ m_nextCommands << QStringLiteral("(Q)info stack");
+ m_nextCommands << QStringLiteral("(Q)frame");
+ m_nextCommands << QStringLiteral("(Q)info args");
+ m_nextCommands << QStringLiteral("(Q)print *this");
+ m_nextCommands << QStringLiteral("(Q)info locals");
+ m_nextCommands << QStringLiteral("(Q)info thread");
issueNextCommand();
}
}
diff --git a/addons/kate/gdbplugin/debugview.h b/addons/kate/gdbplugin/debugview.h
index 3b64dee..d3bbb52 100644
--- a/addons/kate/gdbplugin/debugview.h
+++ b/addons/kate/gdbplugin/debugview.h
@@ -24,10 +24,10 @@
#ifndef DEBUGVIEW_H
#define DEBUGVIEW_H
-#include <QtCore/QObject>
+#include <QObject>
-#include <kprocess.h>
-#include <kurl.h>
+#include <QProcess>
+#include <QUrl>
#include "configview.h"
@@ -35,19 +35,19 @@ class DebugView : public QObject
{
Q_OBJECT
public:
- DebugView( QObject* parent );
+ DebugView(QObject* parent);
~DebugView();
void runDebugger(const GDBTargetConf &conf, const QStringList &ioFifos);
bool debuggerRunning() const;
bool debuggerBusy() const;
- bool hasBreakpoint( KUrl const& url, int line );
+ bool hasBreakpoint(QUrl const& url, int line);
- void toggleBreakpoint( KUrl const& url, int line );
- void movePC( KUrl const& url, int line );
- void runToCursor( KUrl const& url, int line );
+ void toggleBreakpoint(QUrl const& url, int line);
+ void movePC(QUrl const& url, int line);
+ void runToCursor(QUrl const& url, int line);
- void issueCommand( QString const& cmd );
+ void issueCommand(QString const& cmd);
public Q_SLOTS:
@@ -65,23 +65,23 @@ private Q_SLOTS:
void slotError();
void slotReadDebugStdOut();
void slotReadDebugStdErr();
- void slotDebugFinished( int exitCode, QProcess::ExitStatus status );
+ void slotDebugFinished(int exitCode, QProcess::ExitStatus status);
void issueNextCommand();
Q_SIGNALS:
- void debugLocationChanged( const KUrl &file, int lineNum );
- void breakPointSet( const KUrl &file, int lineNum );
- void breakPointCleared( const KUrl &file, int lineNum );
+ void debugLocationChanged(const QUrl &file, int lineNum);
+ void breakPointSet(const QUrl &file, int lineNum);
+ void breakPointCleared(const QUrl &file, int lineNum);
void clearBreakpointMarks();
- void stackFrameInfo( QString const& level, QString const& info );
- void stackFrameChanged( int level );
- void threadInfo( int number, bool avtive );
+ void stackFrameInfo(QString const& level, QString const& info);
+ void stackFrameChanged(int level);
+ void threadInfo(int number, bool avtive);
- void infoLocal( QString const& line );
+ void infoLocal(QString const& line);
- void outputText( const QString &text );
- void outputError( const QString &text );
- void readyForInput( bool ready );
+ void outputText(const QString &text);
+ void outputError(const QString &text);
+ void readyForInput(bool ready);
void programEnded();
void gdbEnded();
@@ -109,18 +109,18 @@ private:
struct BreakPoint
{
int number;
- KUrl file;
+ QUrl file;
int line;
};
private:
- void processLine( QString output );
+ void processLine(QString output);
void processErrors();
- void outputTextMaybe( const QString &text );
- KUrl resolveFileName( const QString &fileName );
+ void outputTextMaybe(const QString &text);
+ QUrl resolveFileName(const QString &fileName);
private:
- KProcess m_debugProcess;
+ QProcess m_debugProcess;
GDBTargetConf m_targetConf;
QString m_ioPipeString;
diff --git a/addons/kate/gdbplugin/ioview.cpp b/addons/kate/gdbplugin/ioview.cpp
index 5e0cf0d..a0e3222 100644
--- a/addons/kate/gdbplugin/ioview.cpp
+++ b/addons/kate/gdbplugin/ioview.cpp
@@ -21,18 +21,17 @@
// Boston, MA 02110-1301, USA.
#include "ioview.h"
-#include "ioview.moc"
-#include <QtGui/QVBoxLayout>
-#include <QtCore/QFile>
-#include <QtGui/QTextEdit>
-#include <QtGui/QLineEdit>
-#include <QtGui/QScrollBar>
+#include <QVBoxLayout>
+#include <QFile>
+#include <QTextEdit>
+#include <QLineEdit>
+#include <QScrollBar>
#include <QSocketNotifier>
+#include <QString>
+#include <QFontDatabase>
-#include <kglobalsettings.h>
#include <kcolorscheme.h>
-#include <kstandarddirs.h>
#include <krandom.h>
#include <sys/types.h>
@@ -48,7 +47,7 @@ IOView::IOView(QWidget *parent)
m_output->setUndoRedoEnabled(false);
m_output->setAcceptRichText(false);
// fixed wide font, like konsole
- m_output->setFont(KGlobalSettings::fixedFont());
+ m_output->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
// alternate color scheme, like konsole
KColorScheme schemeView(QPalette::Active, KColorScheme::View);
m_output->setTextBackgroundColor(schemeView.foreground().color());
@@ -89,9 +88,9 @@ IOView::~IOView()
void IOView::createFifos()
{
- m_stdinFifo = createFifo("stdInFifo");
- m_stdoutFifo = createFifo("stdOutFifo");
- m_stderrFifo = createFifo("stdErrFifo");
+ m_stdinFifo = createFifo(QStringLiteral("stdInFifo"));
+ m_stdoutFifo = createFifo(QStringLiteral("stdOutFifo"));
+ m_stderrFifo = createFifo(QStringLiteral("stdErrFifo"));
m_stdin.setFileName(m_stdinFifo);
if (!m_stdin.open(QIODevice::ReadWrite)) return;
@@ -100,7 +99,7 @@ void IOView::createFifos()
m_stdoutD.open(QIODevice::ReadWrite);
m_stdout.setFileName(m_stdoutFifo);
- m_stdoutFD = ::open(m_stdoutFifo.toLocal8Bit(), O_RDWR|O_NONBLOCK );
+ m_stdoutFD = ::open(m_stdoutFifo.toLocal8Bit().data(), O_RDWR|O_NONBLOCK);
if (m_stdoutFD == -1) return;
if (!m_stdout.open(m_stdoutFD, QIODevice::ReadWrite)) return;
@@ -113,7 +112,7 @@ void IOView::createFifos()
m_stderrD.open(QIODevice::ReadWrite);
m_stderr.setFileName(m_stderrFifo);
- m_stderrFD = ::open(m_stderrFifo.toLocal8Bit(), O_RDONLY|O_NONBLOCK );
+ m_stderrFD = ::open(m_stderrFifo.toLocal8Bit().data(), O_RDONLY|O_NONBLOCK);
if (m_stderrFD == -1) return;
if (!m_stderr.open(m_stderrFD, QIODevice::ReadOnly)) return;
@@ -203,8 +202,8 @@ void IOView::addStdErrText(const QString &text)
QString IOView::createFifo(const QString &prefix)
{
- QString fifo = KStandardDirs::locateLocal("socket", prefix + KRandom::randomString(3));
- int result = mkfifo(QFile::encodeName(fifo), 0666);
+ QString fifo = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + prefix + KRandom::randomString(3);
+ int result = mkfifo(QFile::encodeName(fifo).data(), 0666);
if (result != 0) return QString();
return fifo;
}
@@ -216,3 +215,4 @@ const QString IOView::stderrFifo() { return m_stderrFifo; }
void IOView::enableInput(bool enable) { m_input->setEnabled(enable); }
void IOView::clearOutput() { m_output->clear(); }
+
diff --git a/addons/kate/gdbplugin/ioview.h b/addons/kate/gdbplugin/ioview.h
index a3d1a64..33340f7 100644
--- a/addons/kate/gdbplugin/ioview.h
+++ b/addons/kate/gdbplugin/ioview.h
@@ -23,8 +23,8 @@
#ifndef IOVIEW_H
#define IOVIEW_H
-#include <QtGui/QWidget>
-#include <QtCore/QFile>
+#include <QWidget>
+#include <QFile>
class QTextEdit;
class QLineEdit;
diff --git a/addons/kate/gdbplugin/kategdbplugin.desktop b/addons/kate/gdbplugin/kategdbplugin.desktop
index 4cb7af9..cb502fb 100644
--- a/addons/kate/gdbplugin/kategdbplugin.desktop
+++ b/addons/kate/gdbplugin/kategdbplugin.desktop
@@ -1,8 +1,7 @@
[Desktop Entry]
Type=Service
-ServiceTypes=Kate/Plugin
+ServiceTypes=KTextEditor/Plugin
X-KDE-Library=kategdbplugin
-X-Kate-Version=2.9
Name=GDB
Name[ast]=GDB
Name[bg]=GDB
diff --git a/addons/kate/gdbplugin/localsview.cpp b/addons/kate/gdbplugin/localsview.cpp
index 76b4801..35dac75 100644
--- a/addons/kate/gdbplugin/localsview.cpp
+++ b/addons/kate/gdbplugin/localsview.cpp
@@ -19,6 +19,7 @@
#include "localsview.h"
#include <QLabel>
+#include <QDebug>
#include <klocalizedstring.h>
@@ -65,12 +66,12 @@ void LocalsView::createWrappedItem(QTreeWidget *parent, const QString &name, con
void LocalsView::addLocal(const QString &vString)
{
- static QRegExp isValue("(\\S*)\\s=\\s(.*)");
- static QRegExp isStruct("\\{\\S*\\s=\\s.*");
- static QRegExp isStartPartial("\\S*\\s=\\s\\S*\\s=\\s\\{");
- static QRegExp isPrettyQList("\\s*\\[\\S*\\]\\s=\\s\\S*");
- static QRegExp isPrettyValue("(\\S*)\\s=\\s(\\S*)\\s=\\s(.*)");
- static QRegExp isThisValue("\\$\\d+");
+ static QRegExp isValue(QStringLiteral("(\\S*)\\s=\\s(.*)"));
+ static QRegExp isStruct(QStringLiteral("\\{\\S*\\s=\\s.*"));
+ static QRegExp isStartPartial(QStringLiteral("\\S*\\s=\\s\\S*\\s=\\s\\{"));
+ static QRegExp isPrettyQList(QStringLiteral("\\s*\\[\\S*\\]\\s=\\s\\S*"));
+ static QRegExp isPrettyValue(QStringLiteral("(\\S*)\\s=\\s(\\S*)\\s=\\s(.*)"));
+ static QRegExp isThisValue(QStringLiteral("\\$\\d+"));
if (m_allAdded) {
clear();
@@ -87,10 +88,10 @@ void LocalsView::addLocal(const QString &vString)
}
if (isPrettyQList.exactMatch(vString)) {
m_local += vString.trimmed();
- if (m_local.endsWith(',')) m_local += ' ';
+ if (m_local.endsWith(QLatin1Char(','))) m_local += QLatin1Char(' ');
return;
}
- if (vString == "}") {
+ if (vString == QLatin1String("}")) {
m_local += vString;
}
@@ -98,7 +99,7 @@ void LocalsView::addLocal(const QString &vString)
QString value;
if (m_local.isEmpty()) {
- if (vString == "No symbol table info available.") {
+ if (vString == QLatin1String("No symbol table info available.")) {
return; /* this is not an error */
}
if (!isValue.exactMatch(vString)) {
@@ -108,7 +109,7 @@ void LocalsView::addLocal(const QString &vString)
symbolAndValue << isValue.cap(1);
// check out for "print *this"
if (isThisValue.exactMatch(symbolAndValue[0])) {
- symbolAndValue[0] = "*this";
+ symbolAndValue[0] = QLatin1String("*this");
}
value = isValue.cap(2);
}
@@ -123,8 +124,8 @@ void LocalsView::addLocal(const QString &vString)
}
QTreeWidgetItem *item;
- if (value[0] == '{') {
- if (value[1] == '{') {
+ if (value[0] == QLatin1Char('{')) {
+ if (value[1] == QLatin1Char('{')) {
item = new QTreeWidgetItem(this, symbolAndValue);
addArray(item, value.mid(1, value.size()-2));
}
@@ -148,8 +149,8 @@ void LocalsView::addLocal(const QString &vString)
void LocalsView::addStruct(QTreeWidgetItem *parent, const QString &vString)
{
- static QRegExp isArray("\\{\\.*\\s=\\s.*");
- static QRegExp isStruct("\\.*\\s=\\s.*");
+ static QRegExp isArray(QStringLiteral("\\{\\.*\\s=\\s.*"));
+ static QRegExp isStruct(QStringLiteral("\\.*\\s=\\s.*"));
QTreeWidgetItem *item;
QStringList symbolAndValue;
QString subValue;
@@ -158,7 +159,7 @@ void LocalsView::addStruct(QTreeWidgetItem *parent, const QString &vString)
while (start < vString.size()) {
// Symbol
symbolAndValue.clear();
- end = vString.indexOf(" = ", start);
+ end = vString.indexOf(QStringLiteral(" = "), start);
if (end < 0) {
// error situation -> bail out
createWrappedItem(parent, QString(), vString.right(start));
@@ -169,7 +170,7 @@ void LocalsView::addStruct(QTreeWidgetItem *parent, const QString &vString)
// Value
start = end + 3;
end = start;
- if (vString[start] == '{') {
+ if (vString[start] == QLatin1Char('{')) {
start++;
end++;
int count = 1;
@@ -177,13 +178,13 @@ void LocalsView::addStruct(QTreeWidgetItem *parent, const QString &vString)
// search for the matching }
while(end < vString.size()) {
if (!inComment) {
- if (vString[end] == '"') inComment = true;
- else if (vString[end] == '}') count--;
- else if (vString[end] == '{') count++;
+ if (vString[end] == QLatin1Char('"')) inComment = true;
+ else if (vString[end] == QLatin1Char('}')) count--;
+ else if (vString[end] == QLatin1Char('{')) count++;
if (count == 0) break;
}
else {
- if ((vString[end] == '"') && (vString[end-1] != '\\')) {
+ if ((vString[end] == QLatin1Char('"')) && (vString[end-1] != QLatin1Char('\\'))) {
inComment = false;
}
}
@@ -208,11 +209,11 @@ void LocalsView::addStruct(QTreeWidgetItem *parent, const QString &vString)
bool inComment = false;
while(end < vString.size()) {
if (!inComment) {
- if (vString[end] == '"') inComment = true;
- else if (vString[end] == ',') break;
+ if (vString[end] == QLatin1Char('"')) inComment = true;
+ else if (vString[end] == QLatin1Char(',')) break;
}
else {
- if ((vString[end] == '"') && (vString[end-1] != '\\')) {
+ if ((vString[end] == QLatin1Char('"')) && (vString[end-1] != QLatin1Char('\\'))) {
inComment = false;
}
}
@@ -237,12 +238,12 @@ void LocalsView::addArray(QTreeWidgetItem *parent, const QString &vString)
while (end < vString.size()) {
if (!inComment) {
- if (vString[end] == '"') inComment = true;
- else if (vString[end] == '}') count--;
- else if (vString[end] == '{') count++;
+ if (vString[end] == QLatin1Char('"')) inComment = true;
+ else if (vString[end] == QLatin1Char('}')) count--;
+ else if (vString[end] == QLatin1Char('{')) count++;
if (count == 0) {
QStringList name;
- name << QString("[%1]").arg(index);
+ name << QStringLiteral("[%1]").arg(index);
index++;
item = new QTreeWidgetItem(parent, name);
addStruct(item, vString.mid(start, end-start));
@@ -252,7 +253,7 @@ void LocalsView::addArray(QTreeWidgetItem *parent, const QString &vString)
}
}
else {
- if ((vString[end] == '"') && (vString[end-1] != '\\')) {
+ if ((vString[end] == QLatin1Char('"')) && (vString[end-1] != QLatin1Char('\\'))) {
inComment = false;
}
}
diff --git a/addons/kate/gdbplugin/plugin_kategdb.cpp b/addons/kate/gdbplugin/plugin_kategdb.cpp
index 207d8bc..00e2494 100644
--- a/addons/kate/gdbplugin/plugin_kategdb.cpp
+++ b/addons/kate/gdbplugin/plugin_kategdb.cpp
@@ -3,7 +3,7 @@
//
//
// Copyright (c) 2010 Ian Wakeling <ian.wakeling@ntlworld.com>
-// Copyright (c) 2010-2013 Kåre Särs <kare.sars@iki.fi>
+// Copyright (c) 2010-2014 Kåre Särs <kare.sars@iki.fi>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -20,135 +20,132 @@
// Boston, MA 02110-1301, USA.
#include "plugin_kategdb.h"
-#include "plugin_kategdb.moc"
-#include <QtCore/QFile>
-#include <QtCore/QFileInfo>
-#include <QtGui/QTabWidget>
-#include <QtGui/QToolBar>
-#include <QtGui/QSplitter>
-#include <QtGui/QLayout>
-#include <QtGui/QTextEdit>
-#include <QtGui/QScrollBar>
-#include <QtGui/QTreeWidget>
-#include <QtGui/QKeyEvent>
+#include <QFile>
+#include <QFileInfo>
+#include <QTabWidget>
+#include <QToolBar>
+#include <QSplitter>
+#include <QLayout>
+#include <QTextEdit>
+#include <QScrollBar>
+#include <QTreeWidget>
+#include <QKeyEvent>
+#include <QFontDatabase>
#include <QAction>
-#include <kactioncollection.h>
+#include <KXMLGUIFactory>
+#include <KActionCollection>
+#include <KConfigGroup>
+#include <QMenu>
+
#include <klocalizedstring.h>
-#include <kglobalsettings.h>
#include <kcolorscheme.h>
#include <kpluginfactory.h>
#include <kpluginloader.h>
#include <kaboutdata.h>
-#include <kmenu.h>
#include <khistorycombobox.h>
-#include <kate/application.h>
-#include <kate/documentmanager.h>
#include <ktexteditor/view.h>
#include <ktexteditor/document.h>
#include <ktexteditor/markinterface.h>
+#include <ktexteditor/editor.h>
-K_PLUGIN_FACTORY(KatePluginGDBFactory, registerPlugin<KatePluginGDB>();)
-K_EXPORT_PLUGIN(KatePluginGDBFactory(
- KAboutData( "kategdb",
- "kategdbplugin",
- ki18n( "GDB Integration" ),
- "0.1",
- ki18n( "Kate GDB Integration" ) ) ) )
+K_PLUGIN_FACTORY_WITH_JSON (KatePluginGDBFactory, "kategdbplugin.json", registerPlugin<KatePluginGDB>();)
-KatePluginGDB::KatePluginGDB( QObject* parent, const VariantList& )
-: Kate::Plugin( (Kate::Application*)parent, "kate-gdb-plugin" )
+KatePluginGDB::KatePluginGDB(QObject* parent, const VariantList&)
+: KTextEditor::Plugin(parent)
{
- KGlobal::locale()->insertCatalog("kategdbplugin");
+ // FIXME KF5 KGlobal::locale()->insertCatalog("kategdbplugin");
}
KatePluginGDB::~KatePluginGDB()
{
}
-Kate::PluginView* KatePluginGDB::createView( Kate::MainWindow* mainWindow )
+QObject* KatePluginGDB::createView(KTextEditor::MainWindow* mainWindow)
{
- return new KatePluginGDBView( mainWindow, application() );
+ return new KatePluginGDBView(this, mainWindow);
}
-KatePluginGDBView::KatePluginGDBView( Kate::MainWindow* mainWin, Kate::Application* application )
-: Kate::PluginView( mainWin ), Kate::XMLGUIClient(KatePluginGDBFactory::componentData())
+KatePluginGDBView::KatePluginGDBView(KTextEditor::Plugin *plugin, KTextEditor::MainWindow *mainWin)
+: QObject(mainWin), m_mainWin(mainWin)
{
- m_lastExecUrl = "";
+ m_lastExecUrl = QUrl();
m_lastExecLine = -1;
m_lastExecFrame = 0;
- m_kateApplication = application;
+ m_kateApplication = KTextEditor::Editor::instance()->application();
m_focusOnInput = true;
m_activeThread = -1;
+ KXMLGUIClient::setComponentName (QLatin1String("kategdb"), i18n ("Kate GDB"));
+ setXMLFile(QLatin1String("ui.rc"));
- m_toolView = mainWindow()->createToolView(i18n("Debug View"),
- Kate::MainWindow::Bottom,
- SmallIcon("debug-kategdb"),
- i18n("Debug View"));
+ m_toolView = m_mainWin->createToolView(plugin, i18n("Debug View"),
+ KTextEditor::MainWindow::Bottom,
+ QIcon::fromTheme(QStringLiteral("debug-kategdb")),
+ i18n("Debug View"));
- m_localsStackToolView = mainWindow()->createToolView(i18n("Locals and Stack"),
- Kate::MainWindow::Right,
- SmallIcon("debug-kategdb"),
- i18n("Locals and Stack"));
+ m_localsStackToolView = m_mainWin->createToolView(plugin, i18n("Locals and Stack"),
+ KTextEditor::MainWindow::Right,
+ QIcon::fromTheme(QStringLiteral("debug-kategdb")),
+ i18n("Locals and Stack"));
- m_tabWidget = new QTabWidget( m_toolView );
+ m_tabWidget = new QTabWidget(m_toolView);
// Output
m_outputArea = new QTextEdit();
- m_outputArea->setAcceptRichText( false );
- m_outputArea->setReadOnly( true );
- m_outputArea->setUndoRedoEnabled( false );
+ m_outputArea->setAcceptRichText(false );
+ m_outputArea->setReadOnly(true);
+ m_outputArea->setUndoRedoEnabled(false);
// fixed wide font, like konsole
- m_outputArea->setFont( KGlobalSettings::fixedFont() );
+ m_outputArea->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
// alternate color scheme, like konsole
- KColorScheme schemeView( QPalette::Active, KColorScheme::View );
- m_outputArea->setTextBackgroundColor( schemeView.foreground().color() );
- m_outputArea->setTextColor( schemeView.background().color() );
+ KColorScheme schemeView(QPalette::Active, KColorScheme::View);
+ m_outputArea->setTextBackgroundColor(schemeView.foreground().color());
+ m_outputArea->setTextColor(schemeView.background().color());
QPalette p = m_outputArea->palette ();
- p.setColor( QPalette::Base, schemeView.foreground().color() );
- m_outputArea->setPalette( p );
+ p.setColor(QPalette::Base, schemeView.foreground().color());
+ m_outputArea->setPalette(p);
// input
- m_inputArea = new KHistoryComboBox( true );
- connect( m_inputArea, SIGNAL(returnPressed()), this, SLOT(slotSendCommand()) );
+ m_inputArea = new KHistoryComboBox(true);
+ connect(m_inputArea, SIGNAL(returnPressed()), this, SLOT(slotSendCommand()));
QHBoxLayout *inputLayout = new QHBoxLayout();
- inputLayout->addWidget( m_inputArea, 10 );
- inputLayout->setContentsMargins( 0,0,0,0 );
- m_outputArea->setFocusProxy( m_inputArea ); // take the focus from the outputArea
+ inputLayout->addWidget(m_inputArea, 10);
+ inputLayout->setContentsMargins(0,0,0,0);
+ m_outputArea->setFocusProxy(m_inputArea); // take the focus from the outputArea
m_gdbPage = new QWidget();
- QVBoxLayout *layout = new QVBoxLayout( m_gdbPage );
- layout->addWidget( m_outputArea );
- layout->addLayout( inputLayout );
+ QVBoxLayout *layout = new QVBoxLayout(m_gdbPage);
+ layout->addWidget(m_outputArea);
+ layout->addLayout(inputLayout);
layout->setStretch(0, 10);
layout->setContentsMargins(0,0,0,0);
layout->setSpacing(0);
// stack page
QWidget *stackContainer = new QWidget();
- QVBoxLayout *stackLayout = new QVBoxLayout( stackContainer );
+ QVBoxLayout *stackLayout = new QVBoxLayout(stackContainer);
m_threadCombo = new QComboBox();
m_stackTree = new QTreeWidget();
- stackLayout->addWidget( m_threadCombo );
- stackLayout->addWidget( m_stackTree );
+ stackLayout->addWidget(m_threadCombo);
+ stackLayout->addWidget(m_stackTree);
stackLayout->setStretch(0, 10);
stackLayout->setContentsMargins(0,0,0,0);
stackLayout->setSpacing(0);
QStringList headers;
- headers << " " << i18nc( "Column label (frame number)", "Nr" ) << i18nc( "Column label", "Frame" );
+ headers << QStringLiteral(" ") << i18nc("Column label (frame number)", "Nr") << i18nc("Column label", "Frame");
m_stackTree->setHeaderLabels(headers);
m_stackTree->setRootIsDecorated(false);
m_stackTree->resizeColumnToContents(0);
m_stackTree->resizeColumnToContents(1);
m_stackTree->setAutoScroll(false);
- connect( m_stackTree, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
- this, SLOT(stackFrameSelected()) );
+ connect(m_stackTree, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
+ this, SLOT(stackFrameSelected()));
- connect( m_threadCombo, SIGNAL(currentIndexChanged(int)),
- this, SLOT(threadSelected(int)) );
+ connect(m_threadCombo, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(threadSelected(int)));
m_localsView = new LocalsView();
@@ -159,178 +156,176 @@ KatePluginGDBView::KatePluginGDBView( Kate::MainWindow* mainWin, Kate::Applicati
locStackSplitter->setOrientation(Qt::Vertical);
// config page
- m_configView = new ConfigView( NULL, mainWin );
+ m_configView = new ConfigView(NULL, mainWin);
m_ioView = new IOView();
- connect( m_configView, SIGNAL(showIO(bool)),
- this, SLOT(showIO(bool)) );
+ connect(m_configView, SIGNAL(showIO(bool)),
+ this, SLOT(showIO(bool)));
- m_tabWidget->addTab( m_gdbPage, i18nc( "Tab label", "GDB Output" ) );
- m_tabWidget->addTab( m_configView, i18nc( "Tab label", "Settings" ) );
+ m_tabWidget->addTab(m_gdbPage, i18nc("Tab label", "GDB Output"));
+ m_tabWidget->addTab(m_configView, i18nc("Tab label", "Settings"));
- m_debugView = new DebugView( this );
- connect( m_debugView, SIGNAL(readyForInput(bool)),
- this, SLOT(enableDebugActions(bool)) );
+ m_debugView = new DebugView(this);
+ connect(m_debugView, SIGNAL(readyForInput(bool)),
+ this, SLOT(enableDebugActions(bool)));
- connect( m_debugView, SIGNAL(outputText(QString)),
- this, SLOT(addOutputText(QString)) );
+ connect(m_debugView, SIGNAL(outputText(QString)),
+ this, SLOT(addOutputText(QString)));
- connect( m_debugView, SIGNAL(outputError(QString)),
- this, SLOT(addErrorText(QString)) );
+ connect(m_debugView, SIGNAL(outputError(QString)),
+ this, SLOT(addErrorText(QString)));
- connect( m_debugView, SIGNAL(debugLocationChanged(KUrl,int)),
- this, SLOT(slotGoTo(KUrl,int)) );
+ connect(m_debugView, SIGNAL(debugLocationChanged(QUrl,int)),
+ this, SLOT(slotGoTo(QUrl,int)));
- connect( m_debugView, SIGNAL(breakPointSet(KUrl,int)),
- this, SLOT(slotBreakpointSet(KUrl,int)) );
+ connect(m_debugView, SIGNAL(breakPointSet(QUrl,int)),
+ this, SLOT(slotBreakpointSet(QUrl,int)));
- connect( m_debugView, SIGNAL(breakPointCleared(KUrl,int)),
- this, SLOT(slotBreakpointCleared(KUrl,int)) );
+ connect(m_debugView, SIGNAL(breakPointCleared(QUrl,int)),
+ this, SLOT(slotBreakpointCleared(QUrl,int)));
- connect( m_debugView, SIGNAL(clearBreakpointMarks()),
- this, SLOT(clearMarks()) );
+ connect(m_debugView, SIGNAL(clearBreakpointMarks()),
+ this, SLOT(clearMarks()));
- connect( m_debugView, SIGNAL(programEnded()),
- this, SLOT(programEnded()) );
+ connect(m_debugView, SIGNAL(programEnded()),
+ this, SLOT(programEnded()));
- connect( m_debugView, SIGNAL(gdbEnded()),
- this, SLOT(programEnded()) );
+ connect(m_debugView, SIGNAL(gdbEnded()),
+ this, SLOT(programEnded()));
- connect( m_debugView, SIGNAL(gdbEnded()),
- this, SLOT(gdbEnded()) );
+ connect(m_debugView, SIGNAL(gdbEnded()),
+ this, SLOT(gdbEnded()));
- connect( m_debugView, SIGNAL(stackFrameInfo(QString,QString)),
- this, SLOT(insertStackFrame(QString,QString)) );
+ connect(m_debugView, SIGNAL(stackFrameInfo(QString,QString)),
+ this, SLOT(insertStackFrame(QString,QString)));
- connect( m_debugView, SIGNAL(stackFrameChanged(int)),
- this, SLOT(stackFrameChanged(int)) );
+ connect(m_debugView, SIGNAL(stackFrameChanged(int)),
+ this, SLOT(stackFrameChanged(int)));
- connect( m_debugView, SIGNAL(infoLocal(QString)),
- m_localsView, SLOT(addLocal(QString)) );
+ connect(m_debugView, SIGNAL(infoLocal(QString)),
+ m_localsView, SLOT(addLocal(QString)));
- connect( m_debugView, SIGNAL(threadInfo(int,bool)),
- this, SLOT(insertThread(int,bool)) );
+ connect(m_debugView, SIGNAL(threadInfo(int,bool)),
+ this, SLOT(insertThread(int,bool)));
- connect( m_localsView, SIGNAL(localsVisible(bool)),
- m_debugView, SLOT(slotQueryLocals(bool)) );
+ connect(m_localsView, SIGNAL(localsVisible(bool)),
+ m_debugView, SLOT(slotQueryLocals(bool)));
// Actions
- m_configView->registerActions( actionCollection() );
-
- KAction* a = actionCollection()->addAction( "debug" );
- a->setText( i18n( "Start Debugging" ) );
- a->setIcon( KIcon( "debug-kategdb" ) );
- connect( a, SIGNAL(triggered(bool)),
- this, SLOT(slotDebug()) );
-
- a = actionCollection()->addAction( "kill" );
- a->setText( i18n( "Kill / Stop Debugging" ) );
- a->setIcon( KIcon( "media-playback-stop" ) );
- connect( a, SIGNAL(triggered(bool)),
- m_debugView, SLOT(slotKill()) );
-
- a = actionCollection()->addAction( "rerun" );
- a->setText( i18n( "Restart Debugging" ) );
- a->setIcon( KIcon( "view-refresh" ) );
- connect( a, SIGNAL(triggered(bool)),
- this, SLOT(slotRestart()) );
-
- a = actionCollection()->addAction( "toggle_breakpoint" );
- a->setText( i18n( "Toggle Breakpoint / Break" ) );
- a->setIcon( KIcon( "media-playback-pause" ) );
- connect( a, SIGNAL(triggered(bool)),
- this, SLOT(slotToggleBreakpoint()) );
-
- a = actionCollection()->addAction( "step_in" );
- a->setText( i18n( "Step In" ) );
- a->setIcon( KIcon( "debug-step-into" ) );
- connect( a, SIGNAL(triggered(bool)),
- m_debugView, SLOT(slotStepInto()) );
-
- a = actionCollection()->addAction( "step_over" );
- a->setText( i18n( "Step Over" ) );
- a->setIcon( KIcon( "debug-step-over" ) );
- connect( a, SIGNAL(triggered(bool)),
- m_debugView, SLOT(slotStepOver()) );
-
- a = actionCollection()->addAction( "step_out" );
- a->setText( i18n( "Step Out" ) );
- a->setIcon( KIcon( "debug-step-out" ) );
- connect( a, SIGNAL(triggered(bool)),
- m_debugView, SLOT(slotStepOut()) );
-
- a = actionCollection()->addAction( "move_pc" );
- a->setText( i18nc( "Move Program Counter (next execution)", "Move PC" ) );
- connect( a, SIGNAL(triggered(bool)),
- this, SLOT(slotMovePC()) );
-
- a = actionCollection()->addAction( "run_to_cursor" );
- a->setText( i18n( "Run To Cursor" ) );
- a->setIcon( KIcon( "debug-run-cursor" ) );
- connect( a, SIGNAL(triggered(bool)),
- this, SLOT(slotRunToCursor()) );
-
- a = actionCollection()->addAction( "continue" );
- a->setText( i18n( "Continue" ) );
- a->setIcon( KIcon( "media-playback-start" ) );
- connect( a, SIGNAL(triggered(bool)),
- m_debugView, SLOT(slotContinue()) );
-
- a = actionCollection()->addAction( "print_value" );
- a->setText( i18n( "Print Value" ) );
- a->setIcon( KIcon( "document-preview" ) );
- connect( a, SIGNAL(triggered(bool)),
- this, SLOT(slotValue()) );
+ m_configView->registerActions(actionCollection());
+
+ QAction* a = actionCollection()->addAction(QStringLiteral("debug"));
+ a->setText(i18n("Start Debugging"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("debug-kategdb")));
+ connect( a, SIGNAL(triggered(bool)),
+ this, SLOT(slotDebug()));
+
+ a = actionCollection()->addAction(QStringLiteral("kill"));
+ a->setText(i18n("Kill / Stop Debugging"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-stop")));
+ connect( a, SIGNAL(triggered(bool)),
+ m_debugView, SLOT(slotKill()));
+
+ a = actionCollection()->addAction(QStringLiteral("rerun"));
+ a->setText(i18n("Restart Debugging"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
+ connect( a, SIGNAL(triggered(bool)),
+ this, SLOT(slotRestart()));
+
+ a = actionCollection()->addAction(QStringLiteral("toggle_breakpoint"));
+ a->setText(i18n("Toggle Breakpoint / Break"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-pause")));
+ connect( a, SIGNAL(triggered(bool)),
+ this, SLOT(slotToggleBreakpoint()));
+
+ a = actionCollection()->addAction(QStringLiteral("step_in"));
+ a->setText(i18n("Step In"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-into")));
+ connect( a, SIGNAL(triggered(bool)),
+ m_debugView, SLOT(slotStepInto()));
+
+ a = actionCollection()->addAction(QStringLiteral("step_over"));
+ a->setText(i18n("Step Over"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-over")));
+ connect( a, SIGNAL(triggered(bool)),
+ m_debugView, SLOT(slotStepOver()));
+
+ a = actionCollection()->addAction(QStringLiteral("step_out"));
+ a->setText(i18n("Step Out"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-out")));
+ connect( a, SIGNAL(triggered(bool)),
+ m_debugView, SLOT(slotStepOut()));
+
+ a = actionCollection()->addAction(QStringLiteral("move_pc"));
+ a->setText(i18nc("Move Program Counter (next execution)", "Move PC"));
+ connect( a, SIGNAL(triggered(bool)),
+ this, SLOT(slotMovePC()));
+
+ a = actionCollection()->addAction(QStringLiteral("run_to_cursor"));
+ a->setText(i18n("Run To Cursor"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("debug-run-cursor")));
+ connect( a, SIGNAL(triggered(bool)),
+ this, SLOT(slotRunToCursor()));
+
+ a = actionCollection()->addAction(QStringLiteral("continue"));
+ a->setText(i18n("Continue"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
+ connect( a, SIGNAL(triggered(bool)),
+ m_debugView, SLOT(slotContinue()));
+
+ a = actionCollection()->addAction(QStringLiteral("print_value"));
+ a->setText(i18n("Print Value"));
+ a->setIcon(QIcon::fromTheme(QStringLiteral("document-preview")));
+ connect( a, SIGNAL(triggered(bool)),
+ this, SLOT(slotValue()));
// popup context m_menu
- m_menu = new KActionMenu( i18n("Debug"), this );
- actionCollection()->addAction( "popup_gdb", m_menu );
- connect( m_menu->menu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShowMenu()) );
+ m_menu = new KActionMenu(i18n("Debug"), this);
+ actionCollection()->addAction(QStringLiteral("popup_gdb"), m_menu);
+ connect(m_menu->menu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShowMenu()));
m_breakpoint = m_menu->menu()->addAction(i18n("popup_breakpoint"),
- this, SLOT(slotToggleBreakpoint()) );
+ this, SLOT(slotToggleBreakpoint()));
- QAction* popupAction = m_menu->menu()->addAction(i18n( "popup_run_to_cursor" ),
- this, SLOT(slotRunToCursor()) );
- popupAction->setText( i18n( "Run To Cursor" ) );
- popupAction = m_menu->menu()->addAction( "move_pc",
- this, SLOT(slotMovePC()) );
- popupAction->setText( i18nc( "Move Program Counter (next execution)", "Move PC" ) );
+ QAction* popupAction = m_menu->menu()->addAction(i18n("popup_run_to_cursor"),
+ this, SLOT(slotRunToCursor()));
+ popupAction->setText(i18n("Run To Cursor"));
+ popupAction = m_menu->menu()->addAction(QStringLiteral("move_pc"),
+ this, SLOT(slotMovePC()));
+ popupAction->setText(i18nc("Move Program Counter (next execution)", "Move PC"));
- enableDebugActions( false );
+ enableDebugActions(false);
- connect( mainWindow(), SIGNAL(unhandledShortcutOverride(QEvent*)),
- this, SLOT(handleEsc(QEvent*)) );
+ connect(m_mainWin, SIGNAL(unhandledShortcutOverride(QEvent*)),
+ this, SLOT(handleEsc(QEvent*)));
m_toolView->installEventFilter(this);
- mainWindow()->guiFactory()->addClient( this );
+ m_mainWin->guiFactory()->addClient(this);
}
KatePluginGDBView::~KatePluginGDBView()
{
- mainWindow()->guiFactory()->removeClient( this );
+ m_mainWin->guiFactory()->removeClient(this);
delete m_toolView;
delete m_localsStackToolView;
}
-void KatePluginGDBView::readSessionConfig( KConfigBase* config,
- const QString& groupPrefix )
+void KatePluginGDBView::readSessionConfig( const KConfigGroup& config)
{
- m_configView->readConfig( config, groupPrefix );
+ m_configView->readConfig(config);
}
-void KatePluginGDBView::writeSessionConfig( KConfigBase* config,
- const QString& groupPrefix )
+void KatePluginGDBView::writeSessionConfig(KConfigGroup& config)
{
- m_configView->writeConfig( config, groupPrefix );
+ m_configView->writeConfig(config);
}
void KatePluginGDBView::slotDebug()
{
disconnect(m_ioView, SIGNAL(stdOutText(QString)), 0, 0);
disconnect(m_ioView, SIGNAL(stdErrText(QString)), 0, 0);
- if ( m_configView->showIOTab() ) {
+ if (m_configView->showIOTab()) {
connect(m_ioView, SIGNAL(stdOutText(QString)), m_ioView, SLOT(addStdOutText(QString)));
connect(m_ioView, SIGNAL(stdErrText(QString)), m_ioView, SLOT(addStdErrText(QString)));
}
@@ -344,7 +339,7 @@ void KatePluginGDBView::slotDebug()
ioFifos << m_ioView->stderrFifo();
enableDebugActions(true);
- mainWindow()->showToolView(m_toolView);
+ m_mainWin->showToolView(m_toolView);
m_tabWidget->setCurrentWidget(m_gdbPage);
QScrollBar *sb = m_outputArea->verticalScrollBar();
sb->setValue(sb->maximum());
@@ -355,8 +350,8 @@ void KatePluginGDBView::slotDebug()
void KatePluginGDBView::slotRestart()
{
- mainWindow()->showToolView( m_toolView );
- m_tabWidget->setCurrentWidget( m_gdbPage );
+ m_mainWin->showToolView(m_toolView);
+ m_tabWidget->setCurrentWidget(m_gdbPage);
QScrollBar *sb = m_outputArea->verticalScrollBar();
sb->setValue(sb->maximum());
m_localsView->clear();
@@ -374,8 +369,8 @@ void KatePluginGDBView::aboutToShowMenu()
m_breakpoint->setDisabled(false);
- KTextEditor::View* editView = mainWindow()->activeView();
- KUrl url = editView->document()->url();
+ KTextEditor::View* editView = m_mainWin->activeView();
+ QUrl url = editView->document()->url();
int line = editView->cursorPosition().line();
line++; // GDB uses 1 based line numbers, kate uses 0 based...
@@ -390,61 +385,61 @@ void KatePluginGDBView::aboutToShowMenu()
void KatePluginGDBView::slotToggleBreakpoint()
{
- if (!actionCollection()->action("continue")->isEnabled()) {
+ if (!actionCollection()->action(QStringLiteral("continue"))->isEnabled()) {
m_debugView->slotInterrupt();
}
else {
- KTextEditor::View* editView = mainWindow()->activeView();
- KUrl currURL = editView->document()->url();
+ KTextEditor::View* editView = m_mainWin->activeView();
+ QUrl currURL = editView->document()->url();
int line = editView->cursorPosition().line();
m_debugView->toggleBreakpoint(currURL, line + 1);
}
}
-void KatePluginGDBView::slotBreakpointSet( const KUrl &file, int line)
+void KatePluginGDBView::slotBreakpointSet(const QUrl &file, int line)
{
KTextEditor::MarkInterface* iface =
- qobject_cast<KTextEditor::MarkInterface*>( m_kateApplication->documentManager()->findUrl( file ) );
+ qobject_cast<KTextEditor::MarkInterface*>(m_kateApplication->findUrl(file));
if (iface) {
iface->setMarkDescription(KTextEditor::MarkInterface::BreakpointActive, i18n("Breakpoint"));
iface->setMarkPixmap(KTextEditor::MarkInterface::BreakpointActive,
- KIcon("media-playback-pause").pixmap(10,10));
- iface->addMark(line, KTextEditor::MarkInterface::BreakpointActive );
+ QIcon::fromTheme(QStringLiteral("media-playback-pause")).pixmap(10,10));
+ iface->addMark(line, KTextEditor::MarkInterface::BreakpointActive);
}
}
-void KatePluginGDBView::slotBreakpointCleared( const KUrl &file, int line)
+void KatePluginGDBView::slotBreakpointCleared(const QUrl &file, int line)
{
KTextEditor::MarkInterface* iface =
- qobject_cast<KTextEditor::MarkInterface*>( m_kateApplication->documentManager()->findUrl( file ) );
+ qobject_cast<KTextEditor::MarkInterface*>(m_kateApplication->findUrl(file));
if (iface) {
- iface->removeMark( line, KTextEditor::MarkInterface::BreakpointActive );
+ iface->removeMark(line, KTextEditor::MarkInterface::BreakpointActive);
}
}
void KatePluginGDBView::slotMovePC()
{
- KTextEditor::View* editView = mainWindow()->activeView();
- KUrl currURL = editView->document()->url();
+ KTextEditor::View* editView = m_mainWin->activeView();
+ QUrl currURL = editView->document()->url();
KTextEditor::Cursor cursor = editView->cursorPosition();
- m_debugView->movePC( currURL, cursor.line() + 1 );
+ m_debugView->movePC(currURL, cursor.line() + 1);
}
void KatePluginGDBView::slotRunToCursor()
{
- KTextEditor::View* editView = mainWindow()->activeView();
- KUrl currURL = editView->document()->url();
+ KTextEditor::View* editView = m_mainWin->activeView();
+ QUrl currURL = editView->document()->url();
KTextEditor::Cursor cursor = editView->cursorPosition();
// GDB starts lines from 1, kate returns lines starting from 0 (displaying 1)
- m_debugView->runToCursor( currURL, cursor.line() + 1 );
+ m_debugView->runToCursor(currURL, cursor.line() + 1);
}
-void KatePluginGDBView::slotGoTo( const KUrl &url, int lineNum )
+void KatePluginGDBView::slotGoTo(const QUrl &url, int lineNum)
{
// skip not existing files
if (!QFile::exists (url.toLocalFile ())) {
@@ -455,64 +450,64 @@ void KatePluginGDBView::slotGoTo( const KUrl &url, int lineNum )
m_lastExecUrl = url;
m_lastExecLine = lineNum;
- KTextEditor::View* editView = mainWindow()->openUrl( m_lastExecUrl );
- editView->setCursorPosition( KTextEditor::Cursor( m_lastExecLine, 0 ) );
- mainWindow()->window()->raise();
- mainWindow()->window()->setFocus();
+ KTextEditor::View* editView = m_mainWin->openUrl(m_lastExecUrl);
+ editView->setCursorPosition(KTextEditor::Cursor(m_lastExecLine, 0));
+ m_mainWin->window()->raise();
+ m_mainWin->window()->setFocus();
}
-void KatePluginGDBView::enableDebugActions( bool enable )
+void KatePluginGDBView::enableDebugActions(bool enable)
{
- actionCollection()->action( "step_in" )->setEnabled( enable );
- actionCollection()->action( "step_over" )->setEnabled( enable );
- actionCollection()->action( "step_out" )->setEnabled( enable );
- actionCollection()->action( "move_pc" )->setEnabled( enable );
- actionCollection()->action( "run_to_cursor" )->setEnabled( enable );
- actionCollection()->action( "popup_gdb" )->setEnabled( enable );
- actionCollection()->action( "continue" )->setEnabled( enable );
- actionCollection()->action( "print_value" )->setEnabled( enable );
+ actionCollection()->action(QStringLiteral("step_in" ))->setEnabled(enable);
+ actionCollection()->action(QStringLiteral("step_over" ))->setEnabled(enable);
+ actionCollection()->action(QStringLiteral("step_out" ))->setEnabled(enable);
+ actionCollection()->action(QStringLiteral("move_pc" ))->setEnabled(enable);
+ actionCollection()->action(QStringLiteral("run_to_cursor"))->setEnabled(enable);
+ actionCollection()->action(QStringLiteral("popup_gdb" ))->setEnabled(enable);
+ actionCollection()->action(QStringLiteral("continue" ))->setEnabled(enable);
+ actionCollection()->action(QStringLiteral("print_value" ))->setEnabled(enable);
// "toggle breakpoint" doubles as interrupt while the program is running
- actionCollection()->action( "toggle_breakpoint" )->setEnabled( m_debugView->debuggerRunning() );
- actionCollection()->action( "kill" )->setEnabled( m_debugView->debuggerRunning() );
- actionCollection()->action( "rerun" )->setEnabled( m_debugView->debuggerRunning() );
+ actionCollection()->action(QStringLiteral("toggle_breakpoint"))->setEnabled(m_debugView->debuggerRunning());
+ actionCollection()->action(QStringLiteral("kill" ))->setEnabled(m_debugView->debuggerRunning());
+ actionCollection()->action(QStringLiteral("rerun" ))->setEnabled(m_debugView->debuggerRunning());
- m_inputArea->setEnabled( enable );
- m_threadCombo->setEnabled( enable );
- m_stackTree->setEnabled( enable );
- m_localsView->setEnabled( enable );
+ m_inputArea->setEnabled(enable);
+ m_threadCombo->setEnabled(enable);
+ m_stackTree->setEnabled(enable);
+ m_localsView->setEnabled(enable);
- if ( enable ) {
- m_inputArea->setFocusPolicy( Qt::WheelFocus );
+ if (enable) {
+ m_inputArea->setFocusPolicy(Qt::WheelFocus);
- if ( m_focusOnInput || m_configView->takeFocusAlways() ) {
+ if (m_focusOnInput || m_configView->takeFocusAlways()) {
m_inputArea->setFocus();
m_focusOnInput = false;
}
else {
- mainWindow()->activeView()->setFocus();
+ m_mainWin->activeView()->setFocus();
}
}
else {
- m_inputArea->setFocusPolicy( Qt::NoFocus );
- if ( mainWindow()->activeView() ) mainWindow()->activeView()->setFocus();
+ m_inputArea->setFocusPolicy(Qt::NoFocus);
+ if (m_mainWin->activeView()) m_mainWin->activeView()->setFocus();
}
- m_ioView->enableInput( !enable && m_debugView->debuggerRunning() );
+ m_ioView->enableInput(!enable && m_debugView->debuggerRunning());
- if ( ( m_lastExecLine > -1 ) )
+ if ((m_lastExecLine > -1))
{
KTextEditor::MarkInterface* iface =
- qobject_cast<KTextEditor::MarkInterface*>( m_kateApplication->documentManager()->findUrl( m_lastExecUrl ) );
+ qobject_cast<KTextEditor::MarkInterface*>(m_kateApplication->findUrl(m_lastExecUrl));
if (iface) {
- if ( enable ) {
+ if (enable) {
iface->setMarkDescription(KTextEditor::MarkInterface::Execution, i18n("Execution point"));
- iface->setMarkPixmap(KTextEditor::MarkInterface::Execution, KIcon("arrow-right").pixmap(10,10));
+ iface->setMarkPixmap(KTextEditor::MarkInterface::Execution, QIcon::fromTheme(QStringLiteral("arrow-right")).pixmap(10,10));
iface->addMark(m_lastExecLine, KTextEditor::MarkInterface::Execution);
}
else {
- iface->removeMark( m_lastExecLine, KTextEditor::MarkInterface::Execution );
+ iface->removeMark(m_lastExecLine, KTextEditor::MarkInterface::Execution);
}
}
}
@@ -527,8 +522,8 @@ void KatePluginGDBView::programEnded()
m_threadCombo->clear();
// Indicate the state change by showing the debug outputArea
- mainWindow()->showToolView( m_toolView );
- m_tabWidget->setCurrentWidget( m_gdbPage );
+ m_mainWin->showToolView(m_toolView);
+ m_tabWidget->setCurrentWidget(m_gdbPage);
}
void KatePluginGDBView::gdbEnded()
@@ -542,7 +537,7 @@ void KatePluginGDBView::gdbEnded()
void KatePluginGDBView::clearMarks()
{
KTextEditor::MarkInterface* iface;
- foreach (KTextEditor::Document* doc, m_kateApplication->documentManager()->documents()) {
+ foreach (KTextEditor::Document* doc, m_kateApplication->documents()) {
iface = qobject_cast<KTextEditor::MarkInterface*>(doc);
if (iface) {
const QHash<int, KTextEditor::Mark*> marks = iface->marks();
@@ -562,85 +557,85 @@ void KatePluginGDBView::slotSendCommand()
{
QString cmd = m_inputArea->currentText();
- if ( cmd.isEmpty() ) cmd = m_lastCommand;
+ if (cmd.isEmpty()) cmd = m_lastCommand;
- m_inputArea->addToHistory( cmd );
- m_inputArea->setCurrentItem("");
+ m_inputArea->addToHistory(cmd);
+ m_inputArea->setCurrentItem(QStringLiteral());
m_focusOnInput = true;
m_lastCommand = cmd;
- m_debugView->issueCommand( cmd );
+ m_debugView->issueCommand(cmd);
QScrollBar *sb = m_outputArea->verticalScrollBar();
sb->setValue(sb->maximum());
}
-void KatePluginGDBView::insertStackFrame( QString const& level, QString const& info )
+void KatePluginGDBView::insertStackFrame(QString const& level, QString const& info)
{
- if ( level.isEmpty() && info.isEmpty() ) {
+ if (level.isEmpty() && info.isEmpty()) {
m_stackTree->resizeColumnToContents(2);
return;
}
- if ( level == "0")
+ if (level == QLatin1String("0"))
{
m_stackTree->clear();
}
QStringList columns;
- columns << " "; // icon place holder
+ columns << QStringLiteral(" "); // icon place holder
columns << level;
- int lastSpace = info.lastIndexOf(" ");
+ int lastSpace = info.lastIndexOf(QLatin1String(" "));
QString shortInfo = info.mid(lastSpace);
columns << shortInfo;
QTreeWidgetItem *item = new QTreeWidgetItem(columns);
- item->setToolTip(2, QString("<qt>%1<qt>").arg(info));
+ item->setToolTip(2, QStringLiteral("<qt>%1<qt>").arg(info));
m_stackTree->insertTopLevelItem(level.toInt(), item);
}
void KatePluginGDBView::stackFrameSelected()
{
- m_debugView->issueCommand( QString( "(Q)f %1" ).arg( m_stackTree->currentIndex().row() ) );
+ m_debugView->issueCommand(QStringLiteral("(Q)f %1").arg(m_stackTree->currentIndex().row()));
}
-void KatePluginGDBView::stackFrameChanged( int level )
+void KatePluginGDBView::stackFrameChanged(int level)
{
QTreeWidgetItem *current = m_stackTree->topLevelItem(m_lastExecFrame);
QTreeWidgetItem *next = m_stackTree->topLevelItem(level);
- if ( current ) current->setIcon ( 0, QIcon() );
- if ( next ) next->setIcon( 0, KIcon("arrow-right") );
+ if (current) current->setIcon (0, QIcon());
+ if (next) next->setIcon(0, QIcon::fromTheme(QStringLiteral("arrow-right")));
m_lastExecFrame = level;
}
-void KatePluginGDBView::insertThread( int number, bool active )
+void KatePluginGDBView::insertThread(int number, bool active)
{
- if ( number < 0 ) {
+ if (number < 0) {
m_threadCombo->clear();
m_activeThread = -1;
return;
}
if (!active) {
- m_threadCombo->addItem(KIcon("").pixmap(10,10),
+ m_threadCombo->addItem(QIcon::fromTheme(QStringLiteral("")).pixmap(10,10),
i18n("Thread %1", number), number);
}
else {
- m_threadCombo->addItem(KIcon("arrow-right").pixmap(10,10),
+ m_threadCombo->addItem(QIcon::fromTheme(QStringLiteral("arrow-right")).pixmap(10,10),
i18n("Thread %1", number), number);
m_activeThread = m_threadCombo->count()-1;
}
m_threadCombo->setCurrentIndex(m_activeThread);
}
-void KatePluginGDBView::threadSelected( int thread )
+void KatePluginGDBView::threadSelected(int thread)
{
- m_debugView->issueCommand( QString( "thread %1" ).
- arg( m_threadCombo->itemData( thread ).toInt() ) );
+ m_debugView->issueCommand(QStringLiteral("thread %1").
+ arg(m_threadCombo->itemData(thread).toInt()));
}
-QString KatePluginGDBView::currentWord( )
+QString KatePluginGDBView::currentWord()
{
- KTextEditor::View *kv = mainWindow()->activeView();
+ KTextEditor::View *kv = m_mainWin->activeView();
if (!kv) {
qDebug() << "no KTextEditor::View" << endl;
return QString();
@@ -661,25 +656,25 @@ QString KatePluginGDBView::currentWord( )
int endPos = startPos;
while (startPos >= 0 &&
(linestr[startPos].isLetterOrNumber() ||
- linestr[startPos] == '_' ||
- linestr[startPos] == '~' ||
- ((startPos > 1) && (linestr[startPos] == '.') && !linestr[startPos-1].isSpace()) ||
- ((startPos > 2) && (linestr[startPos] == '>') && (linestr[startPos-1] == '-') && !linestr[startPos-2].isSpace()) ))
+ linestr[startPos] == QLatin1Char('_') ||
+ linestr[startPos] == QLatin1Char('~') ||
+ ((startPos > 1) && (linestr[startPos] == QLatin1Char('.')) && !linestr[startPos-1].isSpace()) ||
+ ((startPos > 2) && (linestr[startPos] == QLatin1Char('>')) && (linestr[startPos-1] == QLatin1Char('-')) && !linestr[startPos-2].isSpace())))
{
- if (linestr[startPos] == '>') {
+ if (linestr[startPos] == QLatin1Char('>')) {
startPos--;
}
startPos--;
}
while (endPos < (int)linestr.length() &&
(linestr[endPos].isLetterOrNumber() ||
- linestr[endPos] == '_' ||
- ((endPos < lindex-1) && (linestr[endPos] == '.') && !linestr[endPos+1].isSpace()) ||
- ((endPos < lindex-2) && (linestr[endPos] == '-') && (linestr[endPos+1] == '>') && !linestr[endPos+2].isSpace()) ||
- ((endPos > 1) && (linestr[endPos-1] == '-') && (linestr[endPos] == '>'))
- ))
+ linestr[endPos] == QLatin1Char('_') ||
+ ((endPos < lindex-1) && (linestr[endPos] == QLatin1Char('.')) && !linestr[endPos+1].isSpace()) ||
+ ((endPos < lindex-2) && (linestr[endPos] == QLatin1Char('-')) && (linestr[endPos+1] == QLatin1Char('>')) && !linestr[endPos+2].isSpace()) ||
+ ((endPos > 1) && (linestr[endPos-1] == QLatin1Char('-')) && (linestr[endPos] == QLatin1Char('>')))
+ ))
{
- if (linestr[endPos] == '-') {
+ if (linestr[endPos] == QLatin1Char('-')) {
endPos++;
}
endPos++;
@@ -696,38 +691,38 @@ QString KatePluginGDBView::currentWord( )
void KatePluginGDBView::slotValue()
{
QString variable;
- KTextEditor::View* editView = mainWindow()->activeView();
- if ( editView && editView->selection() ) variable = editView->selectionText();
+ KTextEditor::View* editView = m_mainWin->activeView();
+ if (editView && editView->selection()) variable = editView->selectionText();
- if ( variable.isEmpty() ) variable = currentWord();
+ if (variable.isEmpty()) variable = currentWord();
- if ( variable.isEmpty() ) return;
+ if (variable.isEmpty()) return;
- QString cmd = QString( "print %1" ).arg( variable );
- m_debugView->issueCommand( cmd );
- m_inputArea->addToHistory( cmd );
- m_inputArea->setCurrentItem("");
+ QString cmd = QStringLiteral("print %1").arg(variable);
+ m_debugView->issueCommand(cmd);
+ m_inputArea->addToHistory(cmd);
+ m_inputArea->setCurrentItem(QStringLiteral());
- mainWindow()->showToolView( m_toolView );
- m_tabWidget->setCurrentWidget( m_gdbPage );
+ m_mainWin->showToolView(m_toolView);
+ m_tabWidget->setCurrentWidget(m_gdbPage);
QScrollBar *sb = m_outputArea->verticalScrollBar();
sb->setValue(sb->maximum());
}
-void KatePluginGDBView::showIO( bool show )
+void KatePluginGDBView::showIO(bool show)
{
- if ( show )
+ if (show)
{
- m_tabWidget->addTab( m_ioView, i18n( "IO" ) );
+ m_tabWidget->addTab(m_ioView, i18n("IO"));
}
else
{
- m_tabWidget->removeTab( m_tabWidget->indexOf(m_ioView) );
+ m_tabWidget->removeTab(m_tabWidget->indexOf(m_ioView));
}
}
-void KatePluginGDBView::addOutputText( QString const& text )
+void KatePluginGDBView::addOutputText(QString const& text)
{
QScrollBar *scrollb = m_outputArea->verticalScrollBar();
if (!scrollb) return;
@@ -742,11 +737,11 @@ void KatePluginGDBView::addOutputText( QString const& text )
}
}
-void KatePluginGDBView::addErrorText( QString const& text )
+void KatePluginGDBView::addErrorText(QString const& text)
{
- m_outputArea->setFontItalic( true );
- addOutputText( text );
- m_outputArea->setFontItalic( false );
+ m_outputArea->setFontItalic(true);
+ addOutputText(text);
+ m_outputArea->setFontItalic(false);
}
bool KatePluginGDBView::eventFilter(QObject *obj, QEvent *event)
@@ -754,7 +749,7 @@ bool KatePluginGDBView::eventFilter(QObject *obj, QEvent *event)
if (event->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent*>(event);
if ((obj == m_toolView) && (ke->key() == Qt::Key_Escape)) {
- mainWindow()->hideToolView(m_toolView);
+ m_mainWin->hideToolView(m_toolView);
event->accept();
return true;
}
@@ -764,14 +759,15 @@ bool KatePluginGDBView::eventFilter(QObject *obj, QEvent *event)
void KatePluginGDBView::handleEsc(QEvent *e)
{
- if (!mainWindow()) return;
+ if (!m_mainWin) return;
QKeyEvent *k = static_cast<QKeyEvent *>(e);
if (k->key() == Qt::Key_Escape && k->modifiers() == Qt::NoModifier) {
if (m_toolView->isVisible()) {
- mainWindow()->hideToolView(m_toolView);
+ m_mainWin->hideToolView(m_toolView);
}
}
}
+#include "plugin_kategdb.moc"
diff --git a/addons/kate/gdbplugin/plugin_kategdb.h b/addons/kate/gdbplugin/plugin_kategdb.h
index 4c26469..8c20307 100644
--- a/addons/kate/gdbplugin/plugin_kategdb.h
+++ b/addons/kate/gdbplugin/plugin_kategdb.h
@@ -3,7 +3,7 @@
//
//
// Copyright (c) 2010 Ian Wakeling <ian.wakeling@ntlworld.com>
-// Copyright (c) 2010-2013 Kåre Särs <kare.sars@iki.fi>
+// Copyright (c) 2010-2014 Kåre Särs <kare.sars@iki.fi>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,11 +24,12 @@
#include <QPointer>
-#include <kate/mainwindow.h>
-#include <kate/plugin.h>
-
-#include <kdeversion.h>
-#include <kactionmenu.h>
+#include <KTextEditor/Application>
+#include <KTextEditor/MainWindow>
+#include <KTextEditor/Plugin>
+#include <KXMLGUIClient>
+#include <KActionMenu>
+#include <KTextEditor/SessionConfigInterface>
#include "debugview.h"
#include "configview.h"
@@ -41,27 +42,29 @@ class QTreeWidget;
typedef QList<QVariant> VariantList;
-class KatePluginGDB : public Kate::Plugin
+class KatePluginGDB : public KTextEditor::Plugin
{
Q_OBJECT
public:
- explicit KatePluginGDB( QObject* parent = NULL, const VariantList& = VariantList() );
+ explicit KatePluginGDB(QObject* parent = NULL, const VariantList& = VariantList());
virtual ~KatePluginGDB();
- Kate::PluginView* createView( Kate::MainWindow* mainWindow );
+ QObject* createView(KTextEditor::MainWindow* mainWindow);
};
-class KatePluginGDBView : public Kate::PluginView, public Kate::XMLGUIClient
+class KatePluginGDBView : public QObject, public KXMLGUIClient, public KTextEditor::SessionConfigInterface
{
Q_OBJECT
+ Q_INTERFACES(KTextEditor::SessionConfigInterface)
public:
- KatePluginGDBView( Kate::MainWindow* mainWindow, Kate::Application* application );
+ KatePluginGDBView(KTextEditor::Plugin *plugin, KTextEditor::MainWindow *mainWin);
~KatePluginGDBView();
- virtual void readSessionConfig( KConfigBase* config, const QString& groupPrefix );
- virtual void writeSessionConfig( KConfigBase* config, const QString& groupPrefix );
+ // reimplemented: read and write session config
+ void readSessionConfig (const KConfigGroup& config);
+ void writeSessionConfig (KConfigGroup& config);
private Q_SLOTS:
void slotDebug();
@@ -69,27 +72,27 @@ private Q_SLOTS:
void slotToggleBreakpoint();
void slotMovePC();
void slotRunToCursor();
- void slotGoTo( const KUrl &fileName, int lineNum );
+ void slotGoTo(const QUrl &fileName, int lineNum);
void slotValue();
void aboutToShowMenu();
- void slotBreakpointSet( const KUrl &file, int line );
- void slotBreakpointCleared( const KUrl &file, int line );
+ void slotBreakpointSet(const QUrl &file, int line);
+ void slotBreakpointCleared(const QUrl &file, int line);
void slotSendCommand();
- void enableDebugActions( bool enable );
+ void enableDebugActions(bool enable);
void programEnded();
void gdbEnded();
- void insertStackFrame( QString const& level, QString const& info );
- void stackFrameChanged( int level );
+ void insertStackFrame(QString const& level, QString const& info);
+ void stackFrameChanged(int level);
void stackFrameSelected();
- void insertThread( int number, bool active );
- void threadSelected( int thread );
+ void insertThread(int number, bool active);
+ void threadSelected(int thread);
- void showIO( bool show );
- void addOutputText( QString const& text );
- void addErrorText( QString const& text );
+ void showIO(bool show);
+ void addOutputText(QString const& text);
+ void addErrorText(QString const& text);
void clearMarks();
void handleEsc(QEvent *e);
@@ -100,7 +103,8 @@ private:
QString currentWord();
- Kate::Application* m_kateApplication;
+ KTextEditor::Application *m_kateApplication;
+ KTextEditor::MainWindow *m_mainWin;
QWidget* m_toolView;
QWidget* m_localsStackToolView;
QTabWidget* m_tabWidget;
@@ -117,7 +121,7 @@ private:
LocalsView* m_localsView;
QPointer<KActionMenu> m_menu;
QAction* m_breakpoint;
- KUrl m_lastExecUrl;
+ QUrl m_lastExecUrl;
int m_lastExecLine;
int m_lastExecFrame;
bool m_focusOnInput;
diff --git a/addons/kate/gdbplugin/ui.rc b/addons/kate/gdbplugin/ui.rc
index 1073e51..72293c9 100644
--- a/addons/kate/gdbplugin/ui.rc
+++ b/addons/kate/gdbplugin/ui.rc
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui>
-<gui name="kategdb-plugin" library="kategdbplugin" version="1">
+<gui name="kategdbplugin" library="kategdbplugin" version="1">
<MenuBar>
<Menu name="debug"><Text>&amp;Debug</Text>
<Action name="targets" />