Commit e5356f57 authored by Dominik Haumann's avatar Dominik Haumann

compile without kde4 support

parent a14a93ee
########### next target ###############
find_package(KF5 CONFIG REQUIRED COMPONENTS ItemModels KDE4Support)
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
set(katebacktracebrowserplugin_PART_SRCS
......@@ -19,11 +17,7 @@ qt5_wrap_ui(katebacktracebrowserplugin_PART_SRCS ${katebacktracebrowserplugin_PA
add_library(katebacktracebrowserplugin MODULE ${katebacktracebrowserplugin_PART_SRCS})
target_link_libraries(katebacktracebrowserplugin
KF5::TextEditor
KF5::Parts
KF5::IconThemes
KF5::I18n
KF5::Service
KF5::KDE4Support
)
########### install files ###############
......
......@@ -49,7 +49,7 @@ QString KateBtDatabase::value(const QString& key)
{
// key is either of the form "foo/bar.txt" or only "bar.txt"
QString file = key;
QStringList sl = key.split('/');
QStringList sl = key.split(QLatin1Char('/'));
if (sl.size() > 1) {
file = sl[1];
}
......@@ -76,7 +76,7 @@ void KateBtDatabase::add(const QString& folder, const QStringList& files)
QMutexLocker locker(&mutex);
foreach (const QString& file, files) {
QStringList& sl = db[file];
QString entry = QDir::fromNativeSeparators(folder + '/' + file);
QString entry = QDir::fromNativeSeparators(folder + QLatin1Char('/') + file);
if (!sl.contains(entry)) {
sl << entry;
}
......
......@@ -61,7 +61,7 @@ void BtFileIndexer::run()
if (cancelAsap) { break; }
indexFiles(searchPaths[i]);
}
qDebug() << QString("Backtrace file database contains %1 files").arg(db->size());
qDebug() << QStringLiteral("Backtrace file database contains %1 files").arg(db->size());
}
void BtFileIndexer::cancel()
......@@ -82,7 +82,7 @@ void BtFileIndexer::indexFiles(const QString& url)
QStringList subdirs = dir.entryList(QDir::Dirs | QDir::NoSymLinks | QDir::Readable | QDir::NoDotAndDotDot | QDir::CaseSensitive);
for (int i = 0; i < subdirs.size(); ++i) {
if (cancelAsap) { break; }
indexFiles(url + '/' + subdirs[i]);
indexFiles(url + QLatin1Char('/') + subdirs[i]);
}
}
......
......@@ -25,18 +25,18 @@
static QString eolDelimiter(const QString& str)
{
// find the split character
QString separator('\n');
if (str.indexOf("\r\n") != -1) {
separator = "\r\n";
} else if (str.indexOf('\r') != -1 ) {
separator = '\r';
QString separator(QLatin1Char('\n'));
if (str.indexOf(QLatin1String("\r\n")) != -1) {
separator = QLatin1String("\r\n");
} else if (str.indexOf(QLatin1Char('\r')) != -1 ) {
separator = QLatin1Char('\r');
}
return separator;
}
static bool lineNoLessThan(const QString& lhs, const QString& rhs)
{
QRegExp rx("^#(\\d+)");
QRegExp rx(QLatin1String("^#(\\d+)"));
int ilhs = rx.indexIn(lhs);
int lhsLn = rx.cap(1).toInt();
int irhs = rx.indexIn(rhs);
......@@ -57,11 +57,11 @@ static QStringList normalizeBt(const QStringList& l)
for (int i = 0; i < l.size(); ++i) {
QString str = l[i].trimmed();
if (str.length()) {
if (str[0] == QChar('#')) {
if (str[0] == QLatin1Char('#')) {
normalized << str;
append = true;
} else if (append) {
normalized.last() += ' ' + str;
normalized.last() += QLatin1Char(' ') + str;
}
} else {
append = false;
......@@ -86,7 +86,7 @@ static BtInfo parseBtLine(const QString& line)
// try a) cap #number(1), address(2), function(3), filename(4), linenumber(5)
static QRegExp rxa("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+at\\s+(.+):(\\d+)$");
static QRegExp rxa(QLatin1String("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+at\\s+(.+):(\\d+)$"));
index = rxa.indexIn(line);
if (index == 0) {
BtInfo info;
......@@ -101,7 +101,7 @@ static BtInfo parseBtLine(const QString& line)
}
// try b) cap #number(1), address(2), function(3), lib(4)
static QRegExp rxb("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+from\\s+(.+)$");
static QRegExp rxb(QLatin1String("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+from\\s+(.+)$"));
index = rxb.indexIn(line);
if (index == 0) {
BtInfo info;
......@@ -116,7 +116,7 @@ static BtInfo parseBtLine(const QString& line)
}
// try c) #41 0x0805e690 in ?? ()
static QRegExp rxc("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+\\?\\?\\s+\\(\\)$");
static QRegExp rxc(QLatin1String("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+\\?\\?\\s+\\(\\)$"));
index = rxc.indexIn(line);
if (index == 0) {
BtInfo info;
......@@ -131,7 +131,7 @@ static BtInfo parseBtLine(const QString& line)
}
// try d) #5 0xffffe410 in __kernel_vsyscall ()
static QRegExp rxd("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)$");
static QRegExp rxd(QLatin1String("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)$"));
index = rxd.indexIn(line);
if (index == 0) {
BtInfo info;
......
......@@ -26,29 +26,30 @@
#include <kpluginfactory.h>
#include <kpluginloader.h>
#include <kaboutdata.h>
#include <QStandardPaths>
#include <ktexteditor/view.h>
#include <ksharedconfig.h>
#include <klineedit.h>
#include <kfiledialog.h>
#include <kurl.h>
#include <KConfigGroup>
#include <KLineEdit>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QFileDialog>
#include <QDataStream>
#include <QStandardPaths>
#include <QTimer>
#include <QClipboard>
#include <QDialogButtonBox>
#include <QUrl>
//END Includes
K_PLUGIN_FACTORY_WITH_JSON (KateBtBrowserFactory, "katebacktracebrowserplugin.json", registerPlugin<KateBtBrowserPlugin>();)
KateBtBrowserPlugin* KateBtBrowserPlugin::s_self = 0L;
static QStringList fileExtensions =
QStringList() << "*.cpp" << "*.cxx" << "*.c" << "*.cc"
<< "*.h" << "*.hpp" << "*.hxx"
<< "*.moc";
QStringList() << QLatin1String("*.cpp") << QLatin1String("*.cxx") <<
QLatin1String("*.c") << QLatin1String("*.cc") << QLatin1String("*.h") <<
QLatin1String("*.hpp") << QLatin1String("*.hxx") << QLatin1String("*.moc");
KateBtBrowserPlugin::KateBtBrowserPlugin(QObject* parent, const QList<QVariant>&)
: KTextEditor::Plugin(parent)
......@@ -56,7 +57,8 @@ KateBtBrowserPlugin::KateBtBrowserPlugin(QObject* parent, const QList<QVariant>&
, indexer(&db)
{
s_self = this;
db.loadFromFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kate/backtracedatabase"));
db.loadFromFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QLatin1String("kate/backtracedatabase")));
}
KateBtBrowserPlugin::~KateBtBrowserPlugin()
......@@ -66,7 +68,8 @@ KateBtBrowserPlugin::~KateBtBrowserPlugin()
indexer.wait();
}
db.saveToFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kate/backtracedatabase"));
db.saveToFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QLatin1String("kate/backtracedatabase")));
s_self = 0L;
}
......@@ -153,7 +156,7 @@ KateBtBrowserPluginView::KateBtBrowserPluginView(KateBtBrowserPlugin* plugin, KT
KTextEditor::MainWindow::Bottom,
QIcon::fromTheme(QLatin1String("kbugbuster")),
i18n("Backtrace Browser"));
m_widget = new KateBtBrowserWidget(m_plugin, mainWindow, toolview);
m_widget = new KateBtBrowserWidget(mainWindow, toolview);
connect(plugin, SIGNAL(newStatus(QString)),
this, SLOT(setStatus(QString)));
......@@ -172,7 +175,7 @@ KateBtBrowserPluginView::~KateBtBrowserPluginView ()
KateBtBrowserWidget::KateBtBrowserWidget(KateBtBrowserPlugin* plugin, KTextEditor::MainWindow *mainwindow, QWidget* parent)
KateBtBrowserWidget::KateBtBrowserWidget(KTextEditor::MainWindow *mainwindow, QWidget* parent)
: QWidget(parent)
, mw(mainwindow)
{
......@@ -193,10 +196,10 @@ KateBtBrowserWidget::~KateBtBrowserWidget ()
void KateBtBrowserWidget::loadFile()
{
QString url = KFileDialog::getOpenFileName(KUrl(), QString(), mw->window(), i18n("Load Backtrace"));
QString url = QFileDialog::getOpenFileName(mw->window(), i18n("Load Backtrace"));
QFile f(url);
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString str = f.readAll();
QString str = QString::fromUtf8(f.readAll());
loadBacktrace(str);
}
}
......@@ -262,12 +265,12 @@ void KateBtBrowserWidget::itemActivated(QTreeWidgetItem* item, int column)
// if not absolute path + exists, try to find with index
if (!QFile::exists(path)) {
// try to match the backtrace forms ".*/foo/bar.txt" and "foo/bar.txt"
static QRegExp rx1("/([^/]+)/([^/]+)$");
static QRegExp rx1(QLatin1String("/([^/]+)/([^/]+)$"));
int idx = rx1.indexIn(file);
if (idx != -1) {
file = rx1.cap(1) + '/' + rx1.cap(2);
file = rx1.cap(1) + QLatin1Char('/') + rx1.cap(2);
} else {
static QRegExp rx2("([^/]+)/([^/]+)$");
static QRegExp rx2(QLatin1String("([^/]+)/([^/]+)$"));
idx = rx2.indexIn(file);
if (idx != -1) {
// file is of correct form
......@@ -281,8 +284,7 @@ void KateBtBrowserWidget::itemActivated(QTreeWidgetItem* item, int column)
}
if (!path.isEmpty() && QFile::exists(path)) {
KUrl url(path);
KTextEditor::View* kv = mw->openUrl(url);
KTextEditor::View* kv = mw->openUrl(QUrl(path));
kv->setCursorPosition(KTextEditor::Cursor(line - 1, 0));
kv->setFocus();
setStatus(i18n("Opened file: %1", file));
......@@ -311,7 +313,7 @@ KateBtConfigWidget::KateBtConfigWidget(QWidget* parent)
{
setupUi(this);
edtUrl->setMode(KFile::Directory);
edtUrl->setUrl(KUrl(QDir().absolutePath()));
edtUrl->setUrl(QUrl(QDir().absolutePath()));
reset();
......@@ -337,8 +339,8 @@ void KateBtConfigWidget::apply()
cg.writeEntry("search-folders", sl);
QString filter = edtExtensions->text();
filter.replace(',', ' ').replace(';', ' ');
cg.writeEntry("file-extensions", filter.split(' ', QString::SkipEmptyParts));
filter.replace(QLatin1Char(','), QLatin1Char(' ')).replace(QLatin1Char(';'), QLatin1Char(' '));
cg.writeEntry("file-extensions", filter.split(QLatin1Char(' '), QString::SkipEmptyParts));
KateBtBrowserPlugin::self().startIndexer();
m_changed = false;
......@@ -350,13 +352,13 @@ void KateBtConfigWidget::reset()
KConfigGroup cg(KSharedConfig::openConfig(), "backtracebrowser");
lstFolders->clear();
lstFolders->addItems(cg.readEntry("search-folders", QStringList()));
edtExtensions->setText(cg.readEntry("file-extensions", fileExtensions).join(" "));
edtExtensions->setText(cg.readEntry("file-extensions", fileExtensions).join(QLatin1String(" ")));
}
void KateBtConfigWidget::defaults()
{
lstFolders->clear();
edtExtensions->setText(fileExtensions.join(" "));
edtExtensions->setText(fileExtensions.join(QLatin1String(" ")));
m_changed = true;
}
......@@ -393,16 +395,22 @@ void KateBtConfigWidget::textChanged()
KateBtConfigDialog::KateBtConfigDialog(QWidget* parent)
: KDialog(parent)
: QDialog(parent)
{
setCaption(i18n("Backtrace Browser Settings"));
setButtons(KDialog::Ok | KDialog::Cancel);
setWindowTitle(i18n("Backtrace Browser Settings"));
m_configWidget = new KateBtConfigWidget(this);
setMainWidget(m_configWidget);
connect(this, SIGNAL(applyClicked()), m_configWidget, SLOT(apply()));
connect(this, SIGNAL(okClicked()), m_configWidget, SLOT(apply()));
QVBoxLayout * layout = new QVBoxLayout(this);
QDialogButtonBox * box = new QDialogButtonBox(this);
box->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
layout->addWidget(m_configWidget);
layout->addWidget(box);
connect(box->button(QDialogButtonBox::Ok), SIGNAL(clicked()), m_configWidget, SLOT(apply()));
connect(m_configWidget, SIGNAL(changed()), this, SLOT(changed()));
}
......@@ -412,7 +420,7 @@ KateBtConfigDialog::~KateBtConfigDialog()
void KateBtConfigDialog::changed()
{
enableButtonApply(true);
// enableButtonApply(true); // FIXME KF5
}
#include "katebacktracebrowser.moc"
......
......@@ -31,8 +31,8 @@
#include <QString>
#include <QTimer>
#include <QDialog>
#include "kdialog.h"
class KateBtConfigWidget;
class KateBtBrowserWidget;
......@@ -99,7 +99,7 @@ class KateBtBrowserWidget : public QWidget, public Ui::BtBrowserWidget
Q_OBJECT
public:
KateBtBrowserWidget(KateBtBrowserPlugin* plugin, KTextEditor::MainWindow *mainwindow, QWidget* parent);
KateBtBrowserWidget(KTextEditor::MainWindow *mainwindow, QWidget* parent);
~KateBtBrowserWidget();
......@@ -141,7 +141,7 @@ class KateBtConfigWidget : public KTextEditor::ConfigPage, private Ui::BtConfigW
bool m_changed;
};
class KateBtConfigDialog : public KDialog
class KateBtConfigDialog : public QDialog
{
Q_OBJECT
public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment