...
 
Commits (35)
......@@ -119,6 +119,11 @@ add_definitions(
-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x051C00
-DKF_DEPRECATED_WARNINGS_SINCE=0x060000
)
if(NOT Qt5_VERSION VERSION_LESS "5.12.0" AND NOT KF5_VERSION VERSION_LESS "5.56.0")
add_definitions(
-DQT_NO_FOREACH
)
endif()
# Turn off missing-field-initializers warning for GCC to avoid noise from false positives with empty {}
# See discussion: https://mail.kde.org/pipermail/kdevelop-devel/2014-February/046910.html
......
......@@ -5,7 +5,7 @@ RUN cd /tmp && wget http://opensource.wandisco.com/rhel/6/svn-1.9/RPMS/x86_64/su
RUN echo ". /opt/rh/devtoolset-6/enable && chmod +x /opt/rh/python27/enable && . /opt/rh/python27/enable" >> /root/.bashrc
ENV LANG=en_US.UTF-8 PYTHON_VERSION=3.6.7 QTVERSION=5.12.4 QTVERSION_SHORT=5.12 LLVM_VERSION=8.0.1 LLVM_ROOT=/opt/llvm/ RUBY_VERSION=1.9.3-p484 GLIB_VERSION_SHORT=2.61 GLIB_VERSION=2.61.2 LD_LIBRARY_PATH=$QTDIR/lib/
ENV LANG=en_US.UTF-8 PYTHON_VERSION=3.6.7 QTVERSION=5.12.6 QTVERSION_SHORT=5.12 LLVM_VERSION=9.0.0 LLVM_ROOT=/opt/llvm/ RUBY_VERSION=1.9.3-p484 GLIB_VERSION_SHORT=2.61 GLIB_VERSION=2.61.2 LD_LIBRARY_PATH=$QTDIR/lib/
ENV QTDIR=/opt/qt5
RUN bash -c "ln -sf /opt/rh/devtoolset-6/root/usr/bin/g++ /usr/bin/g++ && ln -sf /opt/rh/devtoolset-6/root/usr/bin/c++ /usr/bin/c++"
......@@ -53,9 +53,9 @@ RUN bash -c "cd /qtwk/ && tar xvf v5.212.0-alpha3.tar.gz"
RUN bash -c ". /opt/rh/python27/enable && . /opt/rh/devtoolset-6/enable && sed -i 's/find_package(LibXml2 2.8.0 REQUIRED)/find_package(LibXml2 2.6.0 REQUIRED)/g' /qtwk/qtwebkit-5.212.0-alpha3/Source/cmake/OptionsQt.cmake && mkdir -p /qtwk/qtwebkit-5.212.0-alpha3/WebKitBuild/Release && cd /qtwk/qtwebkit-5.212.0-alpha3/WebKitBuild/Release && PKG_CONFIG_PATH=/opt/icu4c-52_2/lib/pkgconfig/:${PKG_CONFIG_PATH} cmake3 -DPORT=Qt -DCMAKE_BUILD_TYPE=Release -DQt5_DIR=${QTDIR}/lib/cmake/Qt5 -DENABLE_GEOLOCATION=0 -DENABLE_DEVICE_ORIENTATION=0 -DENABLE_WEB_AUDIO=0 -DENABLE_VIDEO=0 ../.. && make -j$(nproc) && make -j$(nproc) install && rm -Rf /qtwk"
# Build Clang/LLVM
RUN bash -c "mkdir -p /llvm && cd /llvm && wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
RUN bash -c "mkdir -p /llvm && cd /llvm && wget https://releases.llvm.org/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
RUN bash -c "cd /llvm && tar xvf llvm-${LLVM_VERSION}.src.tar.xz && cd llvm-${LLVM_VERSION}.src"
RUN bash -c "cd /llvm/llvm-${LLVM_VERSION}.src/tools && wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/cfe-${LLVM_VERSION}.src.tar.xz"
RUN bash -c "cd /llvm/llvm-${LLVM_VERSION}.src/tools && wget https://releases.llvm.org/${LLVM_VERSION}/cfe-${LLVM_VERSION}.src.tar.xz"
RUN bash -c "cd /llvm/llvm-${LLVM_VERSION}.src/tools && tar xvf cfe-${LLVM_VERSION}.src.tar.xz"
RUN bash -c ". /opt/rh/python27/enable && . /opt/rh/devtoolset-6/enable && python --version && cd /llvm/llvm-${LLVM_VERSION}.src && mkdir -p build && cd build && cmake3 -G Ninja .. -DCMAKE_INSTALL_PREFIX=/opt/llvm/ -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=OFF -DLLVM_TARGETS_TO_BUILD=X86 && ninja install && rm -Rf /llvm"
......
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e78beb2e..9963e353 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,9 +52,7 @@ function(generate_binary_resource target outfile)
${RESOURCES_WORKING_DIR}/.gitignore
${RESOURCES_WORKING_DIR}/CMakeLists.txt
COMMAND ${QT_RCC_EXECUTABLE} --project -o ${CMAKE_CURRENT_BINARY_DIR}/tmp.qrc
- COMMAND ${CMAKE_COMMAND} -E env
- $<IF:$<BOOL:${MSVC}>,PATH,LD_LIBRARY_PATH>=$<TARGET_FILE_DIR:Qt5::Core>
- $<TARGET_FILE:qrcAlias> -i ${CMAKE_CURRENT_BINARY_DIR}/tmp.qrc -o ${RESOURCE_FILE}
+ COMMAND $<TARGET_FILE:qrcAlias> -i ${CMAKE_CURRENT_BINARY_DIR}/tmp.qrc -o ${RESOURCE_FILE}
WORKING_DIRECTORY ${RESOURCES_WORKING_DIR}
DEPENDS breeze-${target}-mkdir
......@@ -27,10 +27,9 @@ fi
if [ -z "$KDEV_PG_QT_VERSION" ]; then
KDEV_PG_QT_VERSION=v2.2.0
fi
KF5_VERSION=v5.63.0
# remove kio_cmake_no_greaterless.patch with KF > 5.63.0
PLASMA_VERSION=v5.17.1
KDE_APPLICATIONS_VERSION=v19.08.2
KF5_VERSION=v5.64.0
PLASMA_VERSION=v5.17.3
KDE_APPLICATIONS_VERSION=v19.08.3
GRANTLEE_VERSION=v5.1.0
OKTETA_VERSION=v0.26.2
......@@ -178,7 +177,7 @@ build_framework kglobalaccel
build_framework kxmlgui -DBUILD_DESIGNERPLUGIN=OFF
build_framework kbookmarks
build_framework solid
(PATCH_FILE=$SCRIPT_DIR/kio_cmake_no_greaterless.patch build_framework kio -DBUILD_DESIGNERPLUGIN=OFF)
build_framework kio -DBUILD_DESIGNERPLUGIN=OFF
build_framework kparts
build_framework kitemmodels
build_framework threadweaver
......@@ -192,7 +191,7 @@ build_framework kcmutils
(PATCH_FILE=$SCRIPT_DIR/knotifications_no_phonon.patch build_framework knotifications)
build_framework knotifyconfig
build_framework kdoctools
build_framework breeze-icons -DBINARY_ICONS_RESOURCE=1
(PATCH_FILE=$SCRIPT_DIR/breeze-icons_revert_qrcAlias_breakage_cmake_3.5.patch build_framework breeze-icons -DBINARY_ICONS_RESOURCE=1)
build_framework kpty
build_framework kinit
fi
......
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d42bbb7d..3a2e4ec6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -107,7 +107,7 @@ if (HAVE_X11)
endif()
# Qt 5.13 deprecated QComboBox::currentIndexChanged(QString) and Qt 5.14 undid that...
-if (Qt5Widgets_VERSION VERSION_GREATER_EQUAL 5.14.0)
+if (NOT Qt5Widgets_VERSION VERSION_LESS 5.14.0)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00)
endif()
......@@ -82,13 +82,13 @@ double bar ()
<sect2 id="option-1--importing-a-project-from-a-version-control-system-server"><title>Option 1: Importing a project from a version control system server</title>
<para>Let's first assume that the project we want to set up &mdash; the &Linux; kernel &mdash; resides in some version control system on a server, but that you haven't checked it out to your local hard drive yet. In this case, go to the <guilabel>Project</guilabel> menu to create the &Linux; kernel as a project inside the current session and then follow these steps:</para>
<itemizedlist>
<listitem><para>Go to <menuchoice><guimenu>Projects</guimenu><guimenuitem>Fetch project</guimenuitem></menuchoice> to import a project
<listitem><para>Go to <menuchoice><guimenu>Project</guimenu><guimenuitem>Fetch Project</guimenuitem></menuchoice> to import a project
</para></listitem>
<listitem><para>You then have multiple options to start a new project in the current session, depending on where the source files should come from: You can just point &kdevelop; at an existing directory (see option 2 below), or you can ask &kdevelop; to get the sources from a repository.
</para></listitem>
<listitem><para>Assuming you don't already have a version checked out:
<itemizedlist>
<listitem><para>In the dialog box, under <guilabel>Select the source</guilabel>, choose to use <guilabel>Subversion</guilabel>, <guilabel>Git</guilabel>, or one of the other choices
<listitem><para>In the dialog box, under <guilabel>Select Source</guilabel>, choose to use <guilabel>From File System</guilabel>, <guilabel>Subversion</guilabel>, <guilabel>Git</guilabel>, <guilabel>GitHub</guilabel>, or <guilabel>KDE</guilabel>
</para></listitem>
<listitem><para>Choose a working directory as destination into which the sources should be checked out
</para></listitem>
......
......@@ -25,6 +25,7 @@
#include <QApplication>
#include <QDesktopWidget>
#include <QScreen>
#include <QSortFilterProxyModel>
using namespace KDevelop;
......@@ -69,7 +70,7 @@ QSize AsyncTreeView::sizeHint() const
for (int i = 0; i < model()->columnCount(); ++i) {
horizontalSize += columnWidth(i);
}
horizontalSize = qMin(horizontalSize, QApplication::desktop()->screenGeometry().width()*3/4);
horizontalSize = qMin(horizontalSize, QGuiApplication::primaryScreen()->geometry().width()*3/4);
return QSize(horizontalSize, margins.top() + margins.bottom() + sizeHintForRow(0));
}
......
......@@ -94,8 +94,6 @@ public:
virtual KDevelop::IDocument* openDocumentFromText( const QString& data ) = 0;
virtual IDocumentFactory* factory(const QString& mime) const = 0;
virtual KTextEditor::Document* globalTextEditorInstance()=0;
/**
* @returns the KTextEditor::View of the current document, in case it is a text document
......
......@@ -57,7 +57,7 @@ public:
/**
* @returns the default position where this tool view should appear
*/
virtual Qt::DockWidgetArea defaultPosition() = 0;
virtual Qt::DockWidgetArea defaultPosition() const = 0;
/**
* Fetch a list of actions to add to the toolbar of the tool view @p view
* @param viewWidget the view to which the actions should be added
......
......@@ -427,6 +427,11 @@ void Core::cleanup()
// before unloading language plugins, we need to make sure all parse jobs are done
d->languageController->backgroundParser()->waitForIdle();
DUChain::self()->shutdown();
// Only unload plugins after the DUChain shutdown to prevent issues with non-loaded factories for types
// See: https://bugs.kde.org/show_bug.cgi?id=379669
d->pluginController->cleanup();
d->sessionController->cleanup();
......@@ -435,8 +440,6 @@ void Core::cleanup()
//Disable the functionality of the language controller
d->languageController->cleanup();
DUChain::self()->shutdown();
}
d->m_cleanedUp = true;
......
......@@ -72,7 +72,7 @@ public:
return m_id;
}
Qt::DockWidgetArea defaultPosition() override
Qt::DockWidgetArea defaultPosition() const override
{
return m_defaultArea;
}
......
......@@ -100,7 +100,10 @@ public:
return new DocumentationView(parent, m_providersModel.data());
}
Qt::DockWidgetArea defaultPosition() override { return Qt::RightDockWidgetArea; }
Qt::DockWidgetArea defaultPosition() const override
{
return Qt::RightDockWidgetArea;
}
QString id() const override { return QStringLiteral("org.kdevelop.DocumentationView"); }
QList<QAction*> contextMenuActions(QWidget* viewWidget) const override
{
......
......@@ -85,7 +85,6 @@ public:
explicit DocumentControllerPrivate(DocumentController* c)
: controller(c)
, fileOpenRecent(nullptr)
, globalTextEditorInstance(nullptr)
{
}
......@@ -547,7 +546,6 @@ public:
QPointer<QAction> closeAll;
QPointer<QAction> closeAllOthers;
KRecentFilesAction* fileOpenRecent;
KTextEditor::Document* globalTextEditorInstance;
};
Q_DECLARE_TYPEINFO(KDevelop::DocumentControllerPrivate::HistoryEntry, Q_MOVABLE_TYPE);
......@@ -1082,15 +1080,6 @@ IDocumentFactory* DocumentController::factory(const QString& mime) const
return d->factories.value(mime);
}
KTextEditor::Document* DocumentController::globalTextEditorInstance()
{
Q_D(DocumentController);
if(!d->globalTextEditorInstance)
d->globalTextEditorInstance = Core::self()->partControllerInternal()->createTextPart();
return d->globalTextEditorInstance;
}
bool DocumentController::openDocumentsSimple( QStringList urls )
{
Sublime::Area* area = Core::self()->uiControllerInternal()->activeArea();
......
......@@ -112,8 +112,6 @@ public:
const KTextEditor::Range& range = KTextEditor::Range::invalid(),
DocumentActivationParams activationParams = {},
IDocument* buddy = nullptr) override;
KTextEditor::Document* globalTextEditorInstance() override;
public Q_SLOTS:
/**Opens a new or existing document.
......
......@@ -123,7 +123,7 @@ public:
return widget;
}
Qt::DockWidgetArea defaultPosition() override
Qt::DockWidgetArea defaultPosition() const override
{
switch (m_pos) {
case KTextEditor::MainWindow::Left:
......
......@@ -145,7 +145,7 @@
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header location="global">kmessagewidget.h</header>
<header>KMessageWidget</header>
<container>1</container>
</customwidget>
</customwidgets>
......
......@@ -28,7 +28,12 @@
#include <QVBoxLayout>
#include <KAboutData>
#include <kcmutils_version.h>
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5,65,0)
#include <KAboutPluginDialog>
#else
#include <KAboutApplicationDialog>
#endif
#include <KIconLoader>
#include <KLocalizedString>
#include <KTitleWidget>
......@@ -242,12 +247,21 @@ private Q_SLOTS:
auto *m = static_cast<PluginsModel*>(itemView()->model());
KDevelop::IPlugin *p = m->pluginForIndex(focusedIndex());
if (p) {
#if KCMUTILS_VERSION >= QT_VERSION_CHECK(5,65,0)
const KPluginMetaData pluginInfo = ::pluginInfo(p);
if (!pluginInfo.name().isEmpty()) { // Be sure the about data is not completely empty
KDevelop::ScopedDialog<KAboutPluginDialog> aboutPlugin(pluginInfo, itemView());
aboutPlugin->exec();
return;
}
#else
KAboutData aboutData = KAboutData::fromPluginMetaData(pluginInfo(p));
if (!aboutData.componentName().isEmpty()) { // Be sure the about data is not completely empty
KDevelop::ScopedDialog<KAboutApplicationDialog> aboutPlugin(aboutData, itemView());
aboutPlugin->exec();
return;
}
#endif
}
}
private:
......
......@@ -339,7 +339,8 @@ void MainWindow::initialize()
Q_D(MainWindow);
KStandardAction::keyBindings(this, SLOT(configureShortcuts()), actionCollection());
setupGUI( KXmlGuiWindow::ToolBar | KXmlGuiWindow::Create | KXmlGuiWindow::Save );
setupGUI(ToolBar | Save);
createGUI(nullptr);
Core::self()->partController()->addManagedTopLevelWidget(this);
qCDebug(SHELL) << "Adding plugin-added connection";
......
......@@ -207,33 +207,14 @@ KParts::Part* PartController::createPart( const QUrl & url, const QString& prefe
KParts::Part* part = createPart( mimeType, preferredPart );
if( part )
{
readOnly( part ) ->openUrl( url );
// only ReadOnlyParts are supported by PartController
static_cast<KParts::ReadOnlyPart*>(part)->openUrl(url);
return part;
}
return nullptr;
}
KParts::ReadOnlyPart* PartController::activeReadOnly() const
{
return readOnly( activePart() );
}
KParts::ReadWritePart* PartController::activeReadWrite() const
{
return readWrite( activePart() );
}
KParts::ReadOnlyPart* PartController::readOnly( KParts::Part * part ) const
{
return qobject_cast<KParts::ReadOnlyPart*>( part );
}
KParts::ReadWritePart* PartController::readWrite( KParts::Part * part ) const
{
return qobject_cast<KParts::ReadWritePart*>( part );
}
void PartController::loadSettings( bool projectIsLoaded )
{
Q_D(PartController);
......@@ -277,54 +258,5 @@ void PartController::setupActions()
action->setChecked(showTextEditorStatusBar());
}
//BEGIN KTextEditor::MdiContainer
void PartController::setActiveView(KTextEditor::View *view)
{
Q_UNUSED(view)
// NOTE: not implemented
}
KTextEditor::View *PartController::activeView()
{
auto* textView = qobject_cast<TextView*>(Core::self()->uiController()->activeArea()->activeView());
if (textView) {
return textView->textView();
}
return nullptr;
}
KTextEditor::Document *PartController::createDocument()
{
// NOTE: not implemented
qCWarning(SHELL) << "WARNING: interface call not implemented";
return nullptr;
}
bool PartController::closeDocument(KTextEditor::Document *doc)
{
Q_UNUSED(doc)
// NOTE: not implemented
qCWarning(SHELL) << "WARNING: interface call not implemented";
return false;
}
KTextEditor::View *PartController::createView(KTextEditor::Document *doc)
{
Q_UNUSED(doc)
// NOTE: not implemented
qCWarning(SHELL) << "WARNING: interface call not implemented";
return nullptr;
}
bool PartController::closeView(KTextEditor::View *view)
{
Q_UNUSED(view)
// NOTE: not implemented
qCWarning(SHELL) << "WARNING: interface call not implemented";
return false;
}
//END KTextEditor::MdiContainer
}
......@@ -78,20 +78,8 @@ public:
const QString &className,
const QString &preferredName = QString() );
KParts::ReadOnlyPart* activeReadOnly() const;
KParts::ReadWritePart* activeReadWrite() const;
KParts::ReadOnlyPart* readOnly( KParts::Part *part ) const;
KParts::ReadWritePart* readWrite( KParts::Part *part ) const;
bool isTextType(const QMimeType& mimeType);
virtual void setActiveView( KTextEditor::View * view );
virtual KTextEditor::View * activeView();
virtual KTextEditor::Document * createDocument();
virtual bool closeDocument( KTextEditor::Document * doc );
virtual KTextEditor::View * createView( KTextEditor::Document * doc );
virtual bool closeView( KTextEditor::View * view );
public Q_SLOTS:
void setShowTextEditorStatusBar(bool show);
......
......@@ -732,9 +732,9 @@ QVector<KPluginMetaData> PluginController::queryExtensionPlugins(const QString&
return plugins;
}
QStringList PluginController::allPluginNames()
QStringList PluginController::allPluginNames() const
{
Q_D(PluginController);
Q_D(const PluginController);
QStringList names;
names.reserve(d->plugins.size());
......
......@@ -120,7 +120,7 @@ public:
QList<IPlugin*> allPluginsForExtension(const QString &extension, const QVariantMap& constraints = QVariantMap()) override;
QStringList allPluginNames();
QStringList allPluginNames() const;
QVector<KPluginMetaData> queryExtensionPlugins(const QString& extension, const QVariantMap& constraints = QVariantMap()) const override;
......
......@@ -118,13 +118,13 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header location="global">kmessagewidget.h</header>
<header>KMessageWidget</header>
<container>1</container>
</customwidget>
</customwidgets>
......
......@@ -97,6 +97,7 @@ void EditStyleDialog::init()
if (iface) {
iface->setConfigValue(QStringLiteral("dynamic-word-wrap"), false);
iface->setConfigValue(QStringLiteral("icon-bar"), false);
iface->setConfigValue(QStringLiteral("scrollbar-minimap"), false);
}
if (m_sourceFormatter) {
......
......@@ -155,7 +155,7 @@
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -80,7 +80,7 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -113,6 +113,7 @@ SourceFormatterSelectionEdit::SourceFormatterSelectionEdit(QWidget* parent)
if (iface) {
iface->setConfigValue(QStringLiteral("dynamic-word-wrap"), false);
iface->setConfigValue(QStringLiteral("icon-bar"), false);
iface->setConfigValue(QStringLiteral("scrollbar-minimap"), false);
}
SourceFormatterController* controller = Core::self()->sourceFormatterControllerInternal();
......
......@@ -173,7 +173,7 @@
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -23,6 +23,7 @@
#include <QDesktopWidget>
#include <QMenuBar>
#include <QStatusBar>
#include <QScreen>
#include <KConfigGroup>
#include <KLocalizedString>
......@@ -378,11 +379,12 @@ bool MainWindow::queryClose()
QString MainWindow::screenKey() const
{
const int scnum = QApplication::desktop()->screenNumber(parentWidget());
QRect desk = QApplication::desktop()->screenGeometry(scnum);
QList<QScreen *> screens = QApplication::screens();
QRect desk = screens[scnum]->geometry();
// if the desktop is virtual then use virtual screen size
if (QApplication::desktop()->isVirtualDesktop())
desk = QApplication::desktop()->screenGeometry(QApplication::desktop()->screen());
if (QGuiApplication::primaryScreen()->virtualSiblings().size() > 1)
desk = QGuiApplication::primaryScreen()->virtualGeometry();
return QStringLiteral("Desktop %1 %2")
.arg(desk.width()).arg(desk.height());
......
......@@ -29,6 +29,7 @@
#include <QPalette>
#include <QPoint>
#include <QPointer>
#include <QScreen>
#include <QStyleOption>
#include <QStylePainter>
......@@ -104,7 +105,7 @@ void ActiveToolTipManager::doVisibility()
if (!fullGeometry.isEmpty()) {
QRect oldFullGeometry = fullGeometry;
QRect screenGeometry = QApplication::desktop()->screenGeometry(fullGeometry.topLeft());
QRect screenGeometry = QGuiApplication::screenAt(fullGeometry.topLeft())->geometry();
if (fullGeometry.bottom() > screenGeometry.bottom()) {
//Move up, avoiding the mouse-cursor
fullGeometry.moveBottom(fullGeometry.top() - 10);
......
......@@ -41,7 +41,7 @@ namespace KDevelop {
KDEVPLATFORMUTIL_EXPORT QString extractFormattedTextFromContext(const QString& formattedMergedText, const QString& text,
const QString& leftContext, const QString& rightContext,
int tabWidth = 4,
const QString& fuzzyCharacters = QStringLiteral( "{}()/*/" ));
const QString& fuzzyCharacters = QStringLiteral( "{}()/*\\" ));
}
#endif // KDEVPLATFORM_FORMATTINGHELPERS_H
......@@ -38,3 +38,6 @@ ecm_add_test(
TEST_NAME test_kdevformatsource
LINK_LIBRARIES Qt5::Test
)
ecm_add_test(test_formattinghelpers.cpp
LINK_LIBRARIES Qt5::Test KDev::Util)
/*
* Copyright 2019 Bernd Buschinski <b.buschinski@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "test_formattinghelpers.h"
#include "formattinghelpers.h"
#include <QString>
#include <QTest>
QTEST_MAIN(TestFormattingHelpers)
using namespace KDevelop;
void TestFormattingHelpers::testFuzzyMatching()
{
QFETCH(QString, formattedMergedText);
QFETCH(QString, selectedText);
QFETCH(QString, leftContext);
QFETCH(QString, rightContext);
QFETCH(QString, expectedOutput);
QString output = extractFormattedTextFromContext(formattedMergedText, selectedText, leftContext, rightContext);
QCOMPARE(output, expectedOutput);
}
void TestFormattingHelpers::testFuzzyMatching_data()
{
QTest::addColumn<QString>("formattedMergedText");
QTest::addColumn<QString>("selectedText");
QTest::addColumn<QString>("leftContext");
QTest::addColumn<QString>("rightContext");
QTest::addColumn<QString>("expectedOutput");
QString selectedText = QStringLiteral("void bar() {\nint x;\n}");
QString expectedOutput = QStringLiteral("void bar() {\n int x;\n}");
QTest::newRow("left-indentation-fixed")
<< QStringLiteral("void foo() {\n int i;\n int j;\n}\n\nvoid bar() {\n int x;\n}")
<< selectedText
<< QStringLiteral("void foo() {\nint i;\n\n\nint j;\n}\n\n")
<< QStringLiteral("")
<< expectedOutput;
QTest::newRow("right-indentation-fixed")
<< QStringLiteral("void bar() {\n int x;\n}\n\nvoid foo() {\n int i;\n int j;\n}")
<< selectedText
<< QStringLiteral("")
<< QStringLiteral("\n\nvoid foo() {\nint i;\n\n\nint j;\n}")
<< expectedOutput;
// clang-format can break long comments into multiple lines, adding new "//".
// For the same of readability, the comments in the test are actually not very long.
QTest::newRow("left-comment-break-fixed")
<< QStringLiteral("void foo() {\n // very\n // long\n}\n\nvoid bar() {\n int x;\n}")
<< selectedText
<< QStringLiteral("void foo() {\n// very long\n}\n\n")
<< QStringLiteral("")
<< expectedOutput;
QTest::newRow("right-comment-break-fixed")
<< QStringLiteral("void bar() {\n int x;\n}\n\nvoid foo() {\n // very\n // long\n}")
<< selectedText
<< QStringLiteral("")
<< QStringLiteral("\n\nvoid foo() {\n// very long\n}")
<< expectedOutput;
QTest::newRow("left-multilinecomment-break-fixed")
<< QStringLiteral("void foo() {\n /* very\n * long */\n}\n\nvoid bar() {\n int x;\n}")
<< selectedText
<< QStringLiteral("void foo() {\n/* very long */\n}\n\n")
<< QStringLiteral("")
<< expectedOutput;
QTest::newRow("right-multilinecomment-break-fixed")
<< QStringLiteral("void bar() {\n int x;\n}\n\nvoid foo() {\n /* very\n * long */\n}")
<< selectedText
<< QStringLiteral("")
<< QStringLiteral("\n\nvoid foo() {\n/* very long */\n}")
<< expectedOutput;
// clang-format can break long macros and add (or remove) "\"
QTest::newRow("left-macro-break-removed")
<< QStringLiteral("#define foo(a,b) a = b\n\nvoid bar() {\n int x;\n}")
<< selectedText
<< QStringLiteral("#define foo(a,b) \\ a = b\n\n")
<< QStringLiteral("")
<< expectedOutput;
QTest::newRow("right-macro-break-removed")
<< QStringLiteral("void bar() {\n int x;\n}\n\n#define foo(a,b) a = b")
<< selectedText
<< QStringLiteral("")
<< QStringLiteral("\n\n#define foo(a,b) \\ a = b")
<< expectedOutput;
QTest::newRow("left-macro-break-added")
<< QStringLiteral("#define foo(a,b) \\ a = b\n\nvoid bar() {\n int x;\n}")
<< selectedText
<< QStringLiteral("#define foo(a,b) a = b\n\n")
<< QStringLiteral("")
<< expectedOutput;
QTest::newRow("right-macro-break-added")
<< QStringLiteral("void bar() {\n int x;\n}\n\n#define foo(a,b) \\ a = b")
<< selectedText
<< QStringLiteral("")
<< QStringLiteral("\n\n#define foo(a,b) a = b")
<< expectedOutput;
}
/*
* Copyright 2019 Bernd Buschinski <b.buschinski@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <QObject>
class TestFormattingHelpers : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testFuzzyMatching();
void testFuzzyMatching_data();
};
......@@ -46,13 +46,13 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KTextEdit</class>
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
<header>KTextEdit</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -38,7 +38,7 @@
<customwidget>
<class>KTextEdit</class>
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
<header>KTextEdit</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -22,7 +22,11 @@
</widget>
</item>
<item row="2" column="1">
<widget class="KUrlRequester" name="kcfg_cmakeToolchain"/>
<widget class="KUrlRequester" name="kcfg_cmakeToolchain">
<property name="mode">
<set>KFile::File|KFile::ExistingOnly|KFile::LocalOnly</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
......@@ -32,7 +36,11 @@
</widget>
</item>
<item row="3" column="1">
<widget class="KUrlRequester" name="kcfg_ndk"/>
<widget class="KUrlRequester" name="kcfg_ndk">
<property name="mode">
<set>KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
......@@ -42,7 +50,11 @@
</widget>
</item>
<item row="4" column="1">
<widget class="KUrlRequester" name="kcfg_sdk"/>
<widget class="KUrlRequester" name="kcfg_sdk">
<property name="mode">
<set>KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_4">
......@@ -80,7 +92,7 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -22,6 +22,7 @@
#include <KProcess>
#include <QProcess>
#include <QUrl>
using namespace KDevelop;
......@@ -43,8 +44,8 @@ void AndroidRuntime::setEnabled(bool /*enable*/)
static void setEnvironmentVariables(QProcess* process)
{
auto env = process->processEnvironment();
env.insert(QStringLiteral("ANDROID_NDK"), AndroidRuntime::s_settings->ndk());
env.insert(QStringLiteral("ANDROID_SDK_ROOT"), AndroidRuntime::s_settings->sdk());
env.insert(QStringLiteral("ANDROID_NDK"), QUrl(AndroidRuntime::s_settings->ndk()).toLocalFile());
env.insert(QStringLiteral("ANDROID_SDK_ROOT"), QUrl(AndroidRuntime::s_settings->sdk()).toLocalFile());
process->setProcessEnvironment(env);
}
......@@ -52,10 +53,9 @@ static void setEnvironmentVariables(QProcess* process)
static QStringList args()
{
return {
QLatin1String("-DCMAKE_TOOLCHAIN_FILE=") + AndroidRuntime::s_settings->cmakeToolchain(),
QLatin1String("-DCMAKE_TOOLCHAIN_FILE=") + QUrl(AndroidRuntime::s_settings->cmakeToolchain()).toLocalFile(),
QLatin1String("-DANDROID_ABI=") + AndroidRuntime::s_settings->abi(),
QLatin1String("-DANDROID_NDK=") + AndroidRuntime::s_settings->ndk(),
QLatin1String("-DANDROID_NDK=") + QUrl(AndroidRuntime::s_settings->ndk()).toLocalFile(),
QLatin1String("-DANDROID_TOOLCHAIN=") + AndroidRuntime::s_settings->toolchain(),
QLatin1String("-DANDROID_API_LEVEL=") + AndroidRuntime::s_settings->api(),
QLatin1String("-DANDROID_ARCHITECTURE=") + AndroidRuntime::s_settings->arch(),
......
......@@ -154,13 +154,13 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header location="global">kmessagewidget.h</header>
<header>KMessageWidget</header>
</customwidget>
<customwidget>
<class>KDevelop::MultiLevelListView</class>
......
......@@ -40,7 +40,7 @@
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -599,7 +599,7 @@ multiple single-statement lines.</string>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -133,7 +133,7 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
<container>1</container>
</customwidget>
</customwidgets>
......
......@@ -63,7 +63,7 @@ public:
return new ClassWidget(parent, m_plugin);
}
Qt::DockWidgetArea defaultPosition() override
Qt::DockWidgetArea defaultPosition() const override
{
return Qt::LeftDockWidgetArea;
}
......
......@@ -84,12 +84,12 @@
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header>kmessagewidget.h</header>
<header>KMessageWidget</header>
</customwidget>
<customwidget>
<class>KTreeWidgetSearchLine</class>
<extends>QLineEdit</extends>
<header>ktreewidgetsearchline.h</header>
<header>KTreeWidgetSearchLine</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -185,12 +185,12 @@
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header>kmessagewidget.h</header>
<header>KMessageWidget</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -267,7 +267,7 @@ parallel checking, which can lead to multiple fixit applying for header files.</
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header>kmessagewidget.h</header>
<header>KMessageWidget</header>
</customwidget>
<customwidget>
<class>CommandLineWidget</class>
......
......@@ -202,12 +202,12 @@
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -245,12 +245,12 @@
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
<customwidget>
<class>KDevelop::EnvironmentSelectionWidget</class>
......
......@@ -47,7 +47,7 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -149,7 +149,7 @@ public:
return ret;
}
Qt::DockWidgetArea defaultPosition() override
Qt::DockWidgetArea defaultPosition() const override
{
return Qt::BottomDockWidgetArea;
}
......
......@@ -81,7 +81,7 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
<container>1</container>
</customwidget>
</customwidgets>
......
......@@ -355,7 +355,7 @@
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header>kmessagewidget.h</header>
<header>KMessageWidget</header>
</customwidget>
</customwidgets>
<tabstops>
......
......@@ -148,12 +148,12 @@ If this is the same as the source directory you can leave it empty.</string>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
<customwidget>
<class>KDevelop::EnvironmentSelectionWidget</class>
......
......@@ -89,7 +89,7 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -95,13 +95,13 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header location="global">kurlrequester.h</header>
<header>KUrlRequester</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header location="global">kmessagewidget.h</header>
<header>KMessageWidget</header>
<container>1</container>
</customwidget>
</customwidgets>
......
......@@ -212,7 +212,7 @@
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
<customwidget>
<class>DefinesWidget</class>
......
......@@ -103,7 +103,7 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -54,7 +54,7 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
<container>1</container>
</customwidget>
</customwidgets>
......
......@@ -131,7 +131,7 @@ public:
return m_id;
}
Qt::DockWidgetArea defaultPosition() override
Qt::DockWidgetArea defaultPosition() const override
{
return m_defaultArea;
}
......
......@@ -23,6 +23,7 @@ void foo() {
++i; int j = i;
noop();
noop();
(void)j; // Supress unused j warning
}
int main(int argc, char **argv) {
std::cout << "Hello, world!" << std::endl;
......@@ -31,7 +32,7 @@ int main(int argc, char **argv) {
(void)argc;(void)argv;
const char *x = "Hello";
std::cout << x << std::endl;
testStruct ts;
ts.a = 0;
ts.b = 1;
......
......@@ -60,12 +60,12 @@
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
<customwidget>
<class>KHistoryComboBox</class>
<extends>KComboBox</extends>
<header>khistorycombobox.h</header>
<header>KHistoryComboBox</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -67,7 +67,7 @@ class KDevDocumentViewPluginFactory: public KDevelop::IToolViewFactory
view, &KDevDocumentView::documentUrlChanged );
return view;
}
Qt::DockWidgetArea defaultPosition() override
Qt::DockWidgetArea defaultPosition() const override
{
return Qt::LeftDockWidgetArea;
}
......
......@@ -275,7 +275,6 @@ void NativeAppConfigType::configureLaunchFromItem ( KConfigGroup cfg, KDevelop::
void NativeAppConfigType::configureLaunchFromCmdLineArguments ( KConfigGroup cfg, const QStringList& args ) const
{
cfg.writeEntry( ExecutePlugin::isExecutableEntry, true );
Q_ASSERT(QFile::exists(args.first()));
// TODO: we probably want to flexibilize, but at least we won't be accepting wrong values anymore
cfg.writeEntry( ExecutePlugin::executableEntry, QUrl::fromLocalFile(args.first()) );
QStringList a(args);
......
......@@ -307,13 +307,13 @@
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
<customwidget>
<class>KDevelop::EnvironmentSelectionWidget</class>
......
......@@ -18,6 +18,8 @@ target_link_libraries(kdevexecutescript
KDev::Interfaces
KDev::Util
KDev::Project
KDev::OutputView)
KDev::OutputView
KDev::Shell
)
install(FILES iexecutescriptplugin.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/executescript COMPONENT Devel)
......@@ -98,6 +98,8 @@ ScriptAppConfigPage::ScriptAppConfigPage( QWidget* parent )
//Set workingdirectory widget to ask for directories rather than files
workingDirectory->setMode(KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly);
configureEnvironment->setSelectionWidget(environment);
//connect signals to changed signal
connect( interpreter->lineEdit(), &QLineEdit::textEdited, this, &ScriptAppConfigPage::changed );
connect( executablePath->lineEdit(), &KLineEdit::textEdited, this, &ScriptAppConfigPage::changed );
......
......@@ -193,11 +193,24 @@
</widget>
</item>
<item row="2" column="1">
<widget class="KDevelop::EnvironmentSelectionWidget" name="environment">
<property name="toolTip">
<string>Select an environment to be used</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="KDevelop::EnvironmentSelectionWidget" name="environment">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Select an environment to be used</string>
</property>
</widget>
</item>
<item>
<widget class="KDevelop::EnvironmentConfigureButton" name="configureEnvironment"/>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
......@@ -304,12 +317,12 @@
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
<header>KComboBox</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<header>KUrlRequester</header>
<container>1</container>
</customwidget>
<customwidget>
......@@ -317,6 +330,11 @@
<extends>KComboBox</extends>
<header>util/environmentselectionwidget.h</header>
</customwidget>
<customwidget>
<class>KDevelop::EnvironmentConfigureButton</class>
<extends>QToolButton</extends>
<header>shell/environmentconfigurebutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>arguments</tabstop>
......
......@@ -295,7 +295,7 @@
<customwidget>
<class>KShortcutWidget</class>
<extends>QWidget</extends>
<header>kshortcutwidget.h</header>
<header>KShortcutWidget</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -63,7 +63,7 @@ public:
return new ExternalScriptView(m_plugin, parent);
}
Qt::DockWidgetArea defaultPosition() override
Qt::DockWidgetArea defaultPosition() const override
{
return Qt::RightDockWidgetArea;
}
......