diff --git a/documentation/documentationfindwidget.ui b/documentation/documentationfindwidget.ui
index ce07311f2..e8f305a23 100644
--- a/documentation/documentationfindwidget.ui
+++ b/documentation/documentationfindwidget.ui
@@ -1,93 +1,86 @@
FindWidget
0
0
696
46
0
0
-
...
true
-
Find:
-
true
-
Next
-
Previous
-
Match case
-
-
- QLineEdit
- QLineEdit
-
-
-
hideButton
clicked()
FindWidget
hide()
19
12
54
29
diff --git a/plugins/appwizard/projectselectionpage.ui b/plugins/appwizard/projectselectionpage.ui
index 1e7365819..008363572 100644
--- a/plugins/appwizard/projectselectionpage.ui
+++ b/plugins/appwizard/projectselectionpage.ui
@@ -1,175 +1,175 @@
ProjectSelectionPage
0
0
807
598
-
false
0
0
Properties
-
Application Name:
-
-
Location:
-
-
-
0
0
300
400
300
16777215
false
QFrame::StyledPanel
QFrame::Sunken
0
0
0
0
0
-
true
-
Qt::AlignHCenter|Qt::AlignTop
true
-
-
Qt::AlignHCenter|Qt::AlignTop
-
0
0
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
true
KUrlRequester
- QFrame
+ QWidget
1
KMessageWidget
QFrame
1
appNameEdit
diff --git a/plugins/cvs/checkoutdialog.ui b/plugins/cvs/checkoutdialog.ui
index ffa6dc903..404b795bc 100644
--- a/plugins/cvs/checkoutdialog.ui
+++ b/plugins/cvs/checkoutdialog.ui
@@ -1,161 +1,161 @@
CheckoutDialogBase
0
0
400
252
Checkout
-
-
&Local destination directory:
false
localWorkingDir
-
-
-
0
0
&Server path (e.g. :pserver:username@cvs.example.com:/cvsroot):
false
serverPath
-
-
-
&Module:
module
-
true
-
-
Tag/Branch:
-
-
Qt::Horizontal
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
KComboBox
QComboBox
QLineEdit
QLineEdit
KUrlRequester
- QFrame
+ QWidget
buttonBox
accepted()
CheckoutDialogBase
accept()
248
254
157
274
buttonBox
rejected()
CheckoutDialogBase
reject()
316
260
286
274
diff --git a/plugins/cvs/importmetadatawidget.ui b/plugins/cvs/importmetadatawidget.ui
index 7505357c3..1aafbb903 100644
--- a/plugins/cvs/importmetadatawidget.ui
+++ b/plugins/cvs/importmetadatawidget.ui
@@ -1,172 +1,172 @@
ImportMetadataWidget
0
0
581
261
Import
-
Source Directory:
-
-
0
0
&Repository:
false
repository
-
-
0
0
Mo&dule:
false
module
-
-
0
0
&Vendor tag:
false
vendorTag
-
vendor
-
0
0
Re&lease tag:
false
releaseTag
-
start
-
0
0
Co&mment:
false
comment
-
QLineEdit
QLineEdit
KTextEdit
QTextEdit
KUrlRequester
- QFrame
+ QWidget
1
repository
module
vendorTag
releaseTag
diff --git a/plugins/executescript/scriptappconfig.ui b/plugins/executescript/scriptappconfig.ui
index 92f9e4aaf..bafd49658 100644
--- a/plugins/executescript/scriptappconfig.ui
+++ b/plugins/executescript/scriptappconfig.ui
@@ -1,400 +1,395 @@
ScriptAppPage
0
0
675
510
-
Interpreter
QFormLayout::AllNonFixedFieldsGrow
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
Script interpreter:
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
0
0
true
-
-
python
-
ruby
-
bash
-
php
-
Script file
-
Run the file currently open in the editor
true
-
Always run the same file
-
-
false
Script file:
-
false
Enter the absolute path to the script to run
-
Behavior
QFormLayout::ExpandingFieldsGrow
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
Arguments:
arguments
-
Enter arguments to give to the executable
Enter arguments to give to the executable
-
Working Directory:
workingDirectory
-
Select a working directory for the executable
Select a working directory for the executable
-
Environment:
environment
-
Select an environment to be used
-
Output Filter:
-
Select the filter to applied to the output. E.g. to mark errors with red text
-
No Filter
-
Compiler Filter
-
Script Error Filter
-
Static Analysis Filter
-
0
0
Execute on Host
-
Execute on remote host
-
-
false
Remote host (ssh):
remoteHost
-
false
Enter a remote host (user@example.com)
-
Qt::Vertical
20
40
KComboBox
QComboBox
-
- QLineEdit
- QLineEdit
-
-
KUrlRequester
- QFrame
+ QWidget
1
KDevelop::EnvironmentSelectionWidget
KComboBox
util/environmentselectionwidget.h
arguments
workingDirectory
environment
outputFilteringMode
remoteHost
runFixedFile
toggled(bool)
executablePath
setEnabled(bool)
337
157
337
179
remoteHostCheckbox
toggled(bool)
remoteHostLabel
setEnabled(bool)
337
413
86
443
remoteHostCheckbox
toggled(bool)
remoteHost
setEnabled(bool)
337
413
401
443
runFixedFile
toggled(bool)
scriptLabel
setEnabled(bool)
337
157
179
183
diff --git a/plugins/externalscript/externalscriptview.ui b/plugins/externalscript/externalscriptview.ui
index bcdecad2e..e11d599c0 100644
--- a/plugins/externalscript/externalscriptview.ui
+++ b/plugins/externalscript/externalscriptview.ui
@@ -1,65 +1,58 @@
Robert Gruber <rgruber@users.salomon.at>
ExternalScriptViewBase
0
0
210
377
2
0
-
0
-
0
0
Define filter here
Filter...
true
-
-
-
- QLineEdit
- QLineEdit
-
-
-
filterText
scriptTree
diff --git a/plugins/filetemplates/filetemplatesplugin.cpp b/plugins/filetemplates/filetemplatesplugin.cpp
index 25803372b..954cc2ce9 100644
--- a/plugins/filetemplates/filetemplatesplugin.cpp
+++ b/plugins/filetemplates/filetemplatesplugin.cpp
@@ -1,288 +1,317 @@
#include "filetemplatesplugin.h"
#include "templateclassassistant.h"
#include "templatepreviewtoolview.h"
#include "debug.h"
#include
#include
#include
+#include
#include
#include
#include
#include
+#include
+#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace KDevelop;
K_PLUGIN_FACTORY_WITH_JSON(FileTemplatesFactory, "kdevfiletemplates.json", registerPlugin();)
class TemplatePreviewFactory : public KDevelop::IToolViewFactory
{
public:
explicit TemplatePreviewFactory(FileTemplatesPlugin* plugin)
: KDevelop::IToolViewFactory()
, m_plugin(plugin)
{
}
QWidget* create(QWidget* parent = nullptr) override
{
return new TemplatePreviewToolView(m_plugin, parent);
}
QString id() const override
{
return QStringLiteral("org.kdevelop.TemplateFilePreview");
}
Qt::DockWidgetArea defaultPosition() override
{
return Qt::RightDockWidgetArea;
}
private:
FileTemplatesPlugin* m_plugin;
};
FileTemplatesPlugin::FileTemplatesPlugin(QObject* parent, const QVariantList& args)
: IPlugin(QStringLiteral("kdevfiletemplates"), parent)
, m_model(nullptr)
{
Q_UNUSED(args);
setXMLFile(QStringLiteral("kdevfiletemplates.rc"));
QAction* action = actionCollection()->addAction(QStringLiteral("new_from_template"));
action->setText(i18n("New From Template..."));
action->setIcon( QIcon::fromTheme( QStringLiteral("code-class") ) );
action->setWhatsThis( i18n( "Allows you to create new source code files, such as classes or unit tests, using templates." ) );
action->setStatusTip( i18n( "Create new files from a template" ) );
connect (action, &QAction::triggered, this, &FileTemplatesPlugin::createFromTemplate);
m_toolView = new TemplatePreviewFactory(this);
core()->uiController()->addToolView(i18n("Template Preview"), m_toolView);
}
FileTemplatesPlugin::~FileTemplatesPlugin()
{
}
void FileTemplatesPlugin::unload()
{
core()->uiController()->removeToolView(m_toolView);
}
ContextMenuExtension FileTemplatesPlugin::contextMenuExtension (Context* context)
{
ContextMenuExtension ext;
QUrl fileUrl;
if (context->type() == Context::ProjectItemContext)
{
ProjectItemContext* projectContext = dynamic_cast(context);
QList items = projectContext->items();
if (items.size() != 1)
{
return ext;
}
QUrl url;
ProjectBaseItem* item = items.first();
if (item->folder())
{
url = item->path().toUrl();
}
else if (item->target())
{
url = item->parent()->path().toUrl();
}
if (url.isValid())
{
QAction* action = new QAction(i18n("Create From Template..."), this);
action->setIcon(QIcon::fromTheme(QStringLiteral("code-class")));
action->setData(url);
connect(action, &QAction::triggered, this, &FileTemplatesPlugin::createFromTemplate);
ext.addAction(ContextMenuExtension::FileGroup, action);
}
if (item->file())
{
fileUrl = item->path().toUrl();
}
}
else if (context->type() == Context::EditorContext)
{
KDevelop::EditorContext* editorContext = dynamic_cast(context);
fileUrl = editorContext->url();
}
if (fileUrl.isValid() && determineTemplateType(fileUrl) != NoTemplate)
{
QAction* action = new QAction(i18n("Show Template Preview"), this);
action->setIcon(QIcon::fromTheme(QStringLiteral("document-preview")));
action->setData(fileUrl);
connect(action, &QAction::triggered, this, &FileTemplatesPlugin::previewTemplate);
ext.addAction(ContextMenuExtension::ExtensionGroup, action);
}
return ext;
}
QString FileTemplatesPlugin::name() const
{
return i18n("File Templates");
}
QIcon FileTemplatesPlugin::icon() const
{
return QIcon::fromTheme(QStringLiteral("code-class"));
}
QAbstractItemModel* FileTemplatesPlugin::templatesModel()
{
if(!m_model) {
m_model = new TemplatesModel(QStringLiteral("kdevfiletemplates"), this);
}
return m_model;
}
QString FileTemplatesPlugin::knsConfigurationFile() const
{
return QStringLiteral("kdevfiletemplates.knsrc");
}
QStringList FileTemplatesPlugin::supportedMimeTypes() const
{
QStringList types;
types << QStringLiteral("application/x-desktop");
types << QStringLiteral("application/x-bzip-compressed-tar");
types << QStringLiteral("application/zip");
return types;
}
void FileTemplatesPlugin::reload()
{
templatesModel();
m_model->refresh();
}
void FileTemplatesPlugin::loadTemplate(const QString& fileName)
{
templatesModel();
m_model->loadTemplateFile(fileName);
}
void FileTemplatesPlugin::createFromTemplate()
{
QUrl baseUrl;
if (QAction* action = qobject_cast(sender()))
{
baseUrl = action->data().toUrl();
}
if (!baseUrl.isValid()) {
// fall-back to currently active document's parent directory
IDocument* doc = ICore::self()->documentController()->activeDocument();
if (doc && doc->url().isValid()) {
baseUrl = doc->url().adjusted(QUrl::RemoveFilename);
}
}
+ if (!baseUrl.isValid()) {
+ // fall-back to currently selected project's or item's base directory
+ ProjectItemContext* projectContext = dynamic_cast(ICore::self()->selectionController()->currentSelection());
+ if (projectContext) {
+ const QList items = projectContext->items();
+ if (items.size() == 1) {
+ ProjectBaseItem* item = items.at(0);
+ if (item->folder()) {
+ baseUrl = item->path().toUrl();
+ } else if (item->target()) {
+ baseUrl = item->parent()->path().toUrl();
+ }
+ }
+ }
+ }
+ if (!baseUrl.isValid()) {
+ // fall back to base directory of currently open project, if there is only one
+ const QList projects = ICore::self()->projectController()->projects();
+ if (projects.size() == 1) {
+ baseUrl = projects.at(0)->path().toUrl();
+ }
+ }
+ if (!baseUrl.isValid()) {
+ // last resort: home path
+ baseUrl = QUrl::fromLocalFile(QDir::homePath());
+ }
TemplateClassAssistant* assistant = new TemplateClassAssistant(QApplication::activeWindow(), baseUrl);
assistant->setAttribute(Qt::WA_DeleteOnClose);
assistant->show();
}
FileTemplatesPlugin::TemplateType FileTemplatesPlugin::determineTemplateType(const QUrl& url)
{
QDir dir(url.toLocalFile());
/*
* Search for a description file in the url's directory.
* If it is not found there, try cascading up a maximum of 5 directories.
*/
int level = 0;
while (dir.cdUp() && level < 5)
{
QStringList filters;
filters << QStringLiteral("*.kdevtemplate") << QStringLiteral("*.desktop");
foreach (const QString& entry, dir.entryList(filters))
{
qCDebug(PLUGIN_FILETEMPLATES) << "Trying entry" << entry;
/*
* This logic is not perfect, but it works for most cases.
*
* Project template description files usually have the suffix
* ".kdevtemplate", so those are easy to find. For project templates,
* all the files in the directory are template files.
*
* On the other hand, file templates use the generic suffix ".desktop".
* Fortunately, those explicitly list input and output files, so we
* only match the explicitly listed files
*/
if (entry.endsWith(QLatin1String(".kdevtemplate")))
{
return ProjectTemplate;
}
KConfig* config = new KConfig(dir.absoluteFilePath(entry), KConfig::SimpleConfig);
KConfigGroup group = config->group("General");
qCDebug(PLUGIN_FILETEMPLATES) << "General group keys:" << group.keyList();
if (!group.hasKey("Name") || !group.hasKey("Category"))
{
continue;
}
if (group.hasKey("Files"))
{
qCDebug(PLUGIN_FILETEMPLATES) << "Group has files " << group.readEntry("Files", QStringList());
foreach (const QString& outputFile, group.readEntry("Files", QStringList()))
{
if (dir.absoluteFilePath(config->group(outputFile).readEntry("File")) == url.toLocalFile())
{
return FileTemplate;
}
}
}
if (group.hasKey("ShowFilesAfterGeneration"))
{
return ProjectTemplate;
}
}
++level;
}
return NoTemplate;
}
void FileTemplatesPlugin::previewTemplate()
{
QAction* action = qobject_cast(sender());
if (!action || !action->data().toUrl().isValid())
{
return;
}
TemplatePreviewToolView* preview = qobject_cast(core()->uiController()->findToolView(i18n("Template Preview"), m_toolView));
if (!preview)
{
return;
}
core()->documentController()->activateDocument(core()->documentController()->openDocument(action->data().toUrl()));
}
#include "filetemplatesplugin.moc"
diff --git a/plugins/filetemplates/ui/newclass.ui b/plugins/filetemplates/ui/newclass.ui
index c0d921034..2b5b7129b 100644
--- a/plugins/filetemplates/ui/newclass.ui
+++ b/plugins/filetemplates/ui/newclass.ui
@@ -1,84 +1,79 @@
NewClassDialog
0
0
555
488
-
Identify the class and any classes from which it is to inherit.
-
&Identifier:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
identifierLineEdit
-
In&heritance:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
Qt::Vertical
20
40
-
-
KEditListWidget
QWidget
-
- QLineEdit
- QLineEdit
-
-
identifierLineEdit
diff --git a/plugins/filetemplates/ui/testcases.ui b/plugins/filetemplates/ui/testcases.ui
index 8bbd61fbe..b657d062b 100644
--- a/plugins/filetemplates/ui/testcases.ui
+++ b/plugins/filetemplates/ui/testcases.ui
@@ -1,93 +1,88 @@
TestCasesPage
0
0
555
488
-
Set the test name and its test cases.
-
-
&Identifier:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
identifierLineEdit
-
-
&Test Cases:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
Qt::Vertical
20
40
-
-
-
KEditListWidget
QWidget
-
- QLineEdit
- QLineEdit
-
-
diff --git a/plugins/patchreview/localpatchwidget.ui b/plugins/patchreview/localpatchwidget.ui
index c3171de33..0b4c6c05e 100644
--- a/plugins/patchreview/localpatchwidget.ui
+++ b/plugins/patchreview/localpatchwidget.ui
@@ -1,99 +1,99 @@
LocalPatchWidget
0
0
400
300
-
Patch
QFormLayout::ExpandingFieldsGrow
-
Base:
-
Patch base...
-
1
From File
-
Patch location...
From Command
-
Command's output...
-
Patch is already applied on local version
Already applied
false
KUrlRequester
- QFrame
+ QWidget
diff --git a/plugins/problemreporter/problemhighlighter.cpp b/plugins/problemreporter/problemhighlighter.cpp
index 92ae52a2c..cce7d0822 100644
--- a/plugins/problemreporter/problemhighlighter.cpp
+++ b/plugins/problemreporter/problemhighlighter.cpp
@@ -1,231 +1,227 @@
/*
* KDevelop Problem Reporter
*
* Copyright 2008 Hamish Rodda
* Copyright 2008-2009 David Nolden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* 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, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "problemhighlighter.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace KTextEditor;
using namespace KDevelop;
namespace
{
QColor colorForSeverity(IProblem::Severity severity)
{
KColorScheme scheme(QPalette::Active);
switch (severity) {
case IProblem::Error:
return scheme.foreground(KColorScheme::NegativeText).color();
case IProblem::Warning:
return scheme.foreground(KColorScheme::NeutralText).color();
case IProblem::Hint:
default:
return scheme.foreground(KColorScheme::PositiveText).color();
}
}
}
ProblemHighlighter::ProblemHighlighter(KTextEditor::Document* document)
: m_document(document)
{
Q_ASSERT(m_document);
connect(ICore::self()->languageController()->completionSettings(), &ICompletionSettings::settingsChanged, this,
&ProblemHighlighter::settingsChanged);
connect(m_document.data(), &Document::aboutToReload, this, &ProblemHighlighter::clearProblems);
if (qobject_cast(m_document)) {
// can't use new signal/slot syntax here, MovingInterface is not a QObject
connect(m_document, SIGNAL(aboutToInvalidateMovingInterfaceContent(KTextEditor::Document*)), this,
SLOT(clearProblems()));
}
connect(m_document, SIGNAL(aboutToRemoveText(KTextEditor::Range)), this,
SLOT(aboutToRemoveText(KTextEditor::Range)));
}
void ProblemHighlighter::settingsChanged()
{
// Re-highlight
setProblems(m_problems);
}
ProblemHighlighter::~ProblemHighlighter()
{
if (m_topHLRanges.isEmpty() || !m_document)
return;
qDeleteAll(m_topHLRanges);
}
void ProblemHighlighter::setProblems(const QVector& problems)
{
if (!m_document)
return;
if (m_problems == problems)
return;
const bool hadProblems = !m_problems.isEmpty();
m_problems = problems;
qDeleteAll(m_topHLRanges);
m_topHLRanges.clear();
- m_problemsForRanges.clear();
IndexedString url(m_document->url());
/// TODO: create a better MarkInterface that makes it possible to add the marks to the scrollbar
/// but having no background.
/// also make it nicer together with other plugins, this would currently fail with
/// this method...
const uint errorMarkType = KTextEditor::MarkInterface::Error;
const uint warningMarkType = KTextEditor::MarkInterface::Warning;
KTextEditor::MarkInterface* markIface = dynamic_cast(m_document.data());
if (markIface && hadProblems) {
// clear previously added marks
foreach (KTextEditor::Mark* mark, markIface->marks()) {
if (mark->type == errorMarkType || mark->type == warningMarkType) {
markIface->removeMark(mark->line, mark->type);
}
}
}
if (problems.isEmpty()) {
return;
}
DUChainReadLocker lock;
TopDUContext* top = DUChainUtils::standardContextForUrl(m_document->url());
KTextEditor::MovingInterface* iface = dynamic_cast(m_document.data());
Q_ASSERT(iface);
foreach (const IProblem::Ptr& problem, problems) {
if (problem->finalLocation().document != url || !problem->finalLocation().isValid())
continue;
KTextEditor::Range range;
if (top)
range = top->transformFromLocalRevision(RangeInRevision::castFromSimpleRange(problem->finalLocation()));
else
range = problem->finalLocation();
// Fix problem's location range if necessary
if (problem->finalLocationMode() != IProblem::Range && range.onSingleLine()) {
int line = range.start().line();
const QString lineString = m_document->line(line);
int startColumn = 0;
int endColumn = lineString.length() - 1;
if (problem->finalLocationMode() == IProblem::TrimmedLine) {
while (lineString.at(startColumn++).isSpace()) {}
--startColumn;
while (lineString.at(endColumn--).isSpace()) {}
++endColumn;
}
range.setStart(Cursor(line, startColumn));
range.setEnd(Cursor(line, endColumn));
problem->setFinalLocation(DocumentRange(problem->finalLocation().document, range));
problem->setFinalLocationMode(IProblem::Range);
}
if (range.end().line() >= m_document->lines())
range.end() = KTextEditor::Cursor(m_document->endOfLine(m_document->lines() - 1));
if (range.isEmpty()) {
range.setEnd(range.end() + KTextEditor::Cursor(0, 1));
}
KTextEditor::MovingRange* problemRange = iface->newMovingRange(range);
-
- m_problemsForRanges.insert(problemRange, problem);
m_topHLRanges.append(problemRange);
if (problem->source() != IProblem::ToDo
&& (problem->severity() != IProblem::Hint
|| ICore::self()->languageController()->completionSettings()->highlightSemanticProblems())) {
KTextEditor::Attribute::Ptr attribute(new KTextEditor::Attribute());
attribute->setUnderlineStyle(QTextCharFormat::WaveUnderline);
attribute->setUnderlineColor(colorForSeverity(problem->severity()));
problemRange->setAttribute(attribute);
}
if (markIface && ICore::self()->languageController()->completionSettings()->highlightProblematicLines()) {
uint mark;
if (problem->severity() == IProblem::Error) {
mark = errorMarkType;
} else if (problem->severity() == IProblem::Warning) {
mark = warningMarkType;
} else {
continue;
}
markIface->addMark(problem->finalLocation().start().line(), mark);
}
}
}
void ProblemHighlighter::aboutToRemoveText(const KTextEditor::Range& range)
{
if (range.onSingleLine()) { // no need to optimize this
return;
}
QList::iterator it = m_topHLRanges.begin();
while (it != m_topHLRanges.end()) {
if (range.contains((*it)->toRange())) {
- m_problemsForRanges.remove(*it);
delete (*it);
it = m_topHLRanges.erase(it);
} else {
++it;
}
}
}
void ProblemHighlighter::clearProblems()
{
setProblems({});
}
diff --git a/plugins/problemreporter/problemhighlighter.h b/plugins/problemreporter/problemhighlighter.h
index 6026818b6..97dde7a2e 100644
--- a/plugins/problemreporter/problemhighlighter.h
+++ b/plugins/problemreporter/problemhighlighter.h
@@ -1,54 +1,53 @@
/*
* KDevelop Problem Reporter
*
* Copyright 2008 Hamish Rodda
* Copyright 2008-2009 David Nolden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* 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, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KDEVPLATFORM_PLUGIN_PROBLEM_HIGHLIGHT_H
#define KDEVPLATFORM_PLUGIN_PROBLEM_HIGHLIGHT_H
#include
#include
#include
#include
class ProblemHighlighter : public QObject
{
Q_OBJECT
public:
explicit ProblemHighlighter(KTextEditor::Document* document);
~ProblemHighlighter() override;
void setProblems(const QVector& problems);
private slots:
void aboutToRemoveText(const KTextEditor::Range& range);
void clearProblems();
private:
QPointer m_document;
QList m_topHLRanges;
QVector m_problems;
- QMap m_problemsForRanges;
public slots:
void settingsChanged();
};
#endif // KDEVPLATFORM_PLUGIN_PROBLEM_HIGHLIGHT_H
diff --git a/plugins/subversion/ui/catoptiondlg.ui b/plugins/subversion/ui/catoptiondlg.ui
index 862202d05..e1208fdd2 100644
--- a/plugins/subversion/ui/catoptiondlg.ui
+++ b/plugins/subversion/ui/catoptiondlg.ui
@@ -1,69 +1,69 @@
SvnCatOptionDlg
0
0
400
294
-
0
0
TextLabel
-
0
0
-
0
0
TextLabel
-
KUrlRequester
- QFrame
+ QWidget
SvnRevisionWidget
QWidget
1
diff --git a/plugins/subversion/ui/checkoutmetadatawidget.ui b/plugins/subversion/ui/checkoutmetadatawidget.ui
index ae2be92a7..6abe0797a 100644
--- a/plugins/subversion/ui/checkoutmetadatawidget.ui
+++ b/plugins/subversion/ui/checkoutmetadatawidget.ui
@@ -1,61 +1,61 @@
SvnCheckoutMetadataWidget
0
0
393
105
Checkout
-
Repository Url:
-
-
Destination Path:
-
-
Recursive:
-
KUrlRequester
- QFrame
+ QWidget
diff --git a/plugins/subversion/ui/copyoptiondlg.ui b/plugins/subversion/ui/copyoptiondlg.ui
index d9867bc93..22f40ef24 100644
--- a/plugins/subversion/ui/copyoptiondlg.ui
+++ b/plugins/subversion/ui/copyoptiondlg.ui
@@ -1,121 +1,116 @@
SvnCopyOptionDlg
0
0
444
469
-
0
0
Requested local path:
-
true
-
Source
-
Specify by repository URL
-
Specify by local working copy
-
-
Source revision
-
-
Destination
-
0
0
Specify either the full repository URL or local working path
-
-
- QLineEdit
- QLineEdit
-
-
KUrlRequester
- QFrame
+ QWidget
SvnRevisionWidget
QWidget
1
diff --git a/plugins/subversion/ui/diffoptiondlg.ui b/plugins/subversion/ui/diffoptiondlg.ui
index 914b030af..33eccad55 100644
--- a/plugins/subversion/ui/diffoptiondlg.ui
+++ b/plugins/subversion/ui/diffoptiondlg.ui
@@ -1,79 +1,72 @@
SvnPegDiffDialogWidget
0
0
431
328
-
0
0
Target Url
-
true
-
Start Revision
-
End Revision
-
Non Recursive
-
No diff deleted
-
Ignore contents type
-
-
- QLineEdit
- QLineEdit
-
-
-
diff --git a/plugins/subversion/ui/importmetadatawidget.ui b/plugins/subversion/ui/importmetadatawidget.ui
index 60f5b9ce9..bfb3772a7 100644
--- a/plugins/subversion/ui/importmetadatawidget.ui
+++ b/plugins/subversion/ui/importmetadatawidget.ui
@@ -1,73 +1,73 @@
SvnImportMetadataWidget
0
0
549
280
-
Source directory:
-
Repository:
-
Repository Location
Repository Location to import into
Choose the repository into which the source directory is imported
-
-
-
Commit Message:
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
KUrlRequester
- QFrame
+ QWidget
KTextEdit
QTextEdit
diff --git a/plugins/subversion/ui/moveoptiondlg.ui b/plugins/subversion/ui/moveoptiondlg.ui
index cfd3363b2..58146dd0f 100644
--- a/plugins/subversion/ui/moveoptiondlg.ui
+++ b/plugins/subversion/ui/moveoptiondlg.ui
@@ -1,110 +1,105 @@
SvnMoveOptionDlg
0
0
469
339
-
0
0
Requested local path:
-
true
-
Source
-
Specify by repository URL
-
Specify by local working copy
-
-
Destination
-
0
0
Specify either the full repository URL or local working path
-
-
Forcefully delete locally modified and/or unversioned items
-
- QLineEdit
- QLineEdit
-
-
KUrlRequester
- QFrame
+ QWidget
diff --git a/plugins/subversion/ui/statusoptiondlg.ui b/plugins/subversion/ui/statusoptiondlg.ui
index 3111a6152..9adc21356 100644
--- a/plugins/subversion/ui/statusoptiondlg.ui
+++ b/plugins/subversion/ui/statusoptiondlg.ui
@@ -1,106 +1,101 @@
SvnStatusOptionDlg
0
0
474
415
-
0
0
Status Requested for:
-
true
-
Specify revision
-
-
Non recursive
-
Retrieve only "interesting" entries (such as local modifications)
true
-
0
0
Contact repository and augment with repository information
-
Do not ignore svn:ignore
-
Ignore external items
-
- QLineEdit
- QLineEdit
-
-
SvnRevisionWidget
QWidget
1
diff --git a/shell/projectsourcepage.ui b/shell/projectsourcepage.ui
index 79699aa5b..819cd6116 100644
--- a/shell/projectsourcepage.ui
+++ b/shell/projectsourcepage.ui
@@ -1,133 +1,133 @@
ProjectSourcePage
0
0
420
353
-
-
0
0
Source:
-
-
Destination
-
Directory:
-
Select the directory to use...
-
0
0
Source
-
-
-
false
Get
-
false
0
-
-
Qt::Vertical
20
40
KUrlRequester
- QFrame
+ QWidget
1
KMessageWidget
QFrame
1
diff --git a/shell/settings/projectpreferences.ui b/shell/settings/projectpreferences.ui
index f93ed69ed..126d8fb8b 100644
--- a/shell/settings/projectpreferences.ui
+++ b/shell/settings/projectpreferences.ui
@@ -1,88 +1,88 @@
ProjectPreferences
0
0
597
247
0
-
-
Select the base directory where new projects are to be created.
Projects base directory:
kcfg_projectsBaseDirectory
-
Select the base directory where new projects are to be created.
KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly
-
Parse all files in a project after the project has been opened.
Schedule all project files for parsing
-
Save all modified documents when the "build" action is triggered.
Save all documents before building
-
Qt::Vertical
403
147
KUrlRequester
- QFrame
+ QWidget
diff --git a/sublime/idealbuttonbarwidget.cpp b/sublime/idealbuttonbarwidget.cpp
index 6a630c36d..39e839577 100644
--- a/sublime/idealbuttonbarwidget.cpp
+++ b/sublime/idealbuttonbarwidget.cpp
@@ -1,383 +1,354 @@
/*
Copyright 2007 Roberto Raggi
Copyright 2007 Hamish Rodda
Copyright 2011 Alexander Dymo
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "idealbuttonbarwidget.h"
#include "mainwindow.h"
#include "idealdockwidget.h"
#include "ideallayout.h"
#include "idealtoolbutton.h"
#include "document.h"
#include "view.h"
#include
#include
#include
#include
#include
using namespace Sublime;
class ToolViewAction : public QAction
{
public:
ToolViewAction(IdealDockWidget *dock, QObject* parent) : QAction(parent), m_dock(dock)
{
setCheckable(true);
const QString title = dock->view()->document()->title();
setIcon(dock->windowIcon());
setToolTip(i18n("Toggle '%1' tool view.", title));
setText(title);
//restore toolview shortcut config
KConfigGroup config = KSharedConfig::openConfig()->group("UI");
QStringList shortcutStrings = config.readEntry(QStringLiteral("Shortcut for %1").arg(title), QStringList());
setShortcuts({ QKeySequence::fromString(shortcutStrings.value(0)), QKeySequence::fromString(shortcutStrings.value(1)) });
dock->setWindowTitle(title);
dock->view()->widget()->installEventFilter(this);
refreshText();
}
IdealDockWidget *dockWidget() const
{
Q_ASSERT(m_dock);
return m_dock;
}
IdealToolButton* button() { return m_button; }
void setButton(IdealToolButton* button) {
m_button = button;
refreshText();
}
QString id() {
return m_dock->view()->document()->documentSpecifier();
}
private:
bool eventFilter(QObject * watched, QEvent * event) override
{
if (watched == m_dock->view()->widget() && event->type() == QEvent::EnabledChange) {
refreshText();
}
return QObject::eventFilter(watched, event);
}
void refreshText()
{
const auto widget = m_dock->view()->widget();
const QString title = m_dock->view()->document()->title();
setText(widget->isEnabled() ? title : QStringLiteral("(%1)").arg(title));
}
QPointer m_dock;
QPointer m_button;
};
IdealButtonBarWidget::IdealButtonBarWidget(Qt::DockWidgetArea area,
IdealController *controller, Sublime::MainWindow *parent)
: QWidget(parent)
, _area(area)
, _controller(controller)
, _corner(nullptr)
, _showState(false)
{
setContextMenuPolicy(Qt::CustomContextMenu);
setToolTip(i18nc("@info:tooltip", "Right click to add new tool views."));
if (area == Qt::BottomDockWidgetArea)
{
QBoxLayout *statusLayout = new QBoxLayout(QBoxLayout::RightToLeft, this);
statusLayout->setMargin(0);
statusLayout->setSpacing(IDEAL_LAYOUT_SPACING);
statusLayout->setContentsMargins(0, IDEAL_LAYOUT_MARGIN, 0, IDEAL_LAYOUT_MARGIN);
IdealButtonBarLayout *l = new IdealButtonBarLayout(orientation());
statusLayout->addLayout(l);
_corner = new QWidget(this);
QBoxLayout *cornerLayout = new QBoxLayout(QBoxLayout::LeftToRight, _corner);
cornerLayout->setMargin(0);
cornerLayout->setSpacing(0);
statusLayout->addWidget(_corner);
statusLayout->addStretch(1);
}
else
(void) new IdealButtonBarLayout(orientation(), this);
}
QAction* IdealButtonBarWidget::addWidget(IdealDockWidget *dock,
Area *area, View *view)
{
if (_area == Qt::BottomDockWidgetArea || _area == Qt::TopDockWidgetArea)
dock->setFeatures( dock->features() | IdealDockWidget::DockWidgetVerticalTitleBar );
dock->setArea(area);
dock->setView(view);
dock->setDockWidgetArea(_area);
auto action = new ToolViewAction(dock, this);
addAction(action);
return action;
}
QWidget* IdealButtonBarWidget::corner()
{
return _corner;
}
void IdealButtonBarWidget::addAction(QAction* qaction)
{
QWidget::addAction(qaction);
auto action = dynamic_cast(qaction);
if (!action || action->button()) {
return;
}
bool wasEmpty = isEmpty();
IdealToolButton *button = new IdealToolButton(_area);
//apol: here we set the usual width of a button for the vertical toolbars as the minimumWidth
//this is done because otherwise when we remove all the buttons and re-add new ones we get all
//the screen flickering. This is solved by not defaulting to a smaller width when it's empty
int w = button->sizeHint().width();
if (orientation() == Qt::Vertical && w > minimumWidth()) {
setMinimumWidth(w);
}
action->setButton(button);
button->setDefaultAction(action);
Q_ASSERT(action->dockWidget());
connect(action, &QAction::toggled, this, static_cast(&IdealButtonBarWidget::showWidget));
- connect(button, &IdealToolButton::clicked, this, &IdealButtonBarWidget::buttonPressed);
connect(button, &IdealToolButton::customContextMenuRequested,
action->dockWidget(), &IdealDockWidget::contextMenuRequested);
addButtonToOrder(button);
applyOrderToLayout();
if (wasEmpty) {
emit emptyChanged();
}
}
void IdealButtonBarWidget::removeAction(QAction* widgetAction)
{
QWidget::removeAction(widgetAction);
auto action = dynamic_cast(widgetAction);
delete action->button();
delete action;
if (layout()->isEmpty()) {
emit emptyChanged();
}
}
bool IdealButtonBarWidget::isEmpty()
{
return actions().isEmpty();
}
bool IdealButtonBarWidget::isShown()
{
return std::any_of(actions().cbegin(), actions().cend(),
[](const QAction* action){ return action->isChecked(); });
}
void IdealButtonBarWidget::saveShowState()
{
_showState = isShown();
}
bool IdealButtonBarWidget::lastShowState()
{
return _showState;
}
QString IdealButtonBarWidget::id(const IdealToolButton* button) const
{
foreach (QAction* a, actions()) {
auto tva = dynamic_cast(a);
if (tva && tva->button() == button) {
return tva->id();
}
}
return QString();
}
IdealToolButton* IdealButtonBarWidget::button(const QString& id) const
{
foreach (QAction* a, actions()) {
auto tva = dynamic_cast(a);
if (tva && tva->id() == id) {
return tva->button();
}
}
return nullptr;
}
void IdealButtonBarWidget::addButtonToOrder(const IdealToolButton* button)
{
QString buttonId = id(button);
if (!_buttonsOrder.contains(buttonId)) {
if (_area == Qt::BottomDockWidgetArea) {
_buttonsOrder.push_front(buttonId);
}
else {
_buttonsOrder.push_back(buttonId);
}
}
}
void IdealButtonBarWidget::loadOrderSettings(const KConfigGroup& configGroup)
{
_buttonsOrder = configGroup.readEntry(QStringLiteral("(%1) Tool Views Order").arg(_area), QStringList());
applyOrderToLayout();
}
void IdealButtonBarWidget::saveOrderSettings(KConfigGroup& configGroup)
{
takeOrderFromLayout();
configGroup.writeEntry(QStringLiteral("(%1) Tool Views Order").arg(_area), _buttonsOrder);
}
void IdealButtonBarWidget::applyOrderToLayout()
{
// If widget already have some buttons in the layout then calling loadOrderSettings() may leads
// to situations when loaded order does not contains all existing buttons. Therefore we should
// fix this with using addToOrder() method.
for (int i = 0; i < layout()->count(); ++i) {
if (auto button = dynamic_cast(layout()->itemAt(i)->widget())) {
addButtonToOrder(button);
layout()->removeWidget(button);
}
}
foreach(const QString& id, _buttonsOrder) {
if (auto b = button(id)) {
layout()->addWidget(b);
}
}
}
void IdealButtonBarWidget::takeOrderFromLayout()
{
_buttonsOrder.clear();
for (int i = 0; i < layout()->count(); ++i) {
if (auto button = dynamic_cast(layout()->itemAt(i)->widget())) {
_buttonsOrder += id(button);
}
}
}
Qt::Orientation IdealButtonBarWidget::orientation() const
{
if (_area == Qt::LeftDockWidgetArea || _area == Qt::RightDockWidgetArea)
return Qt::Vertical;
return Qt::Horizontal;
}
Qt::DockWidgetArea IdealButtonBarWidget::area() const
{
return _area;
}
void IdealButtonBarWidget::showWidget(bool checked)
{
Q_ASSERT(parentWidget() != nullptr);
QAction *action = qobject_cast(sender());
Q_ASSERT(action);
showWidget(action, checked);
}
void IdealButtonBarWidget::showWidget(QAction *action, bool checked)
{
auto widgetAction = dynamic_cast(action);
IdealToolButton* button = widgetAction->button();
Q_ASSERT(button);
if (checked) {
- IdealController::RaiseMode mode = IdealController::RaiseMode(widgetAction->property("raise").toInt());
- if ( mode == IdealController::HideOtherViews ) {
+ if ( !QApplication::keyboardModifiers().testFlag(Qt::ControlModifier) ) {
// Make sure only one widget is visible at any time.
// The alternative to use a QActionCollection and setting that to "exclusive"
// has a big drawback: QActions in a collection that is exclusive cannot
// be un-checked by the user, e.g. in the View -> Tool Views menu.
foreach(QAction *otherAction, actions()) {
if ( otherAction != widgetAction && otherAction->isChecked() )
otherAction->setChecked(false);
}
}
_controller->lastDockWidget[_area] = widgetAction->dockWidget();
}
_controller->showDockWidget(widgetAction->dockWidget(), checked);
widgetAction->setChecked(checked);
button->setChecked(checked);
}
IdealDockWidget * IdealButtonBarWidget::widgetForAction(QAction *_action) const
{
return dynamic_cast(_action)->dockWidget();
}
-
-void IdealButtonBarWidget::buttonPressed(bool state)
-{
- auto button = qobject_cast(sender());
- Q_ASSERT(button);
- ToolViewAction* action = nullptr;
- foreach(QAction* a, actions()) {
- auto tva = dynamic_cast(a);
- if (tva && tva->button() == button)
- action = tva;
- }
- Q_ASSERT(action);
-
- const bool forceGrouping = QApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
-
- if (forceGrouping) {
- action->setProperty("raise", IdealController::GroupWithOtherViews);
- }
-
- action->setChecked(state);
-
- if (forceGrouping) {
- // need to reset the raise property so that subsequent
- // showWidget()'s will not do grouping unless explicitly asked
- action->setProperty("raise", IdealController::HideOtherViews);
- }
-}
diff --git a/sublime/idealbuttonbarwidget.h b/sublime/idealbuttonbarwidget.h
index aec5f1c9a..22a5ee2ab 100644
--- a/sublime/idealbuttonbarwidget.h
+++ b/sublime/idealbuttonbarwidget.h
@@ -1,101 +1,99 @@
/*
Copyright 2007 Roberto Raggi
Copyright 2007 Hamish Rodda
Copyright 2011 Alexander Dymo
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef IDEALBUTTONBARWIDGET_H
#define IDEALBUTTONBARWIDGET_H
#include
#include
class IdealToolButton;
class ToolViewAction;
class QAction;
class KConfigGroup;
namespace Sublime
{
class MainWindow;
class IdealController;
class IdealDockWidget;
class View;
class Area;
class IdealButtonBarWidget: public QWidget
{
Q_OBJECT
public:
IdealButtonBarWidget(Qt::DockWidgetArea area,
IdealController *controller, Sublime::MainWindow *parent);
QAction* addWidget(IdealDockWidget *widget,
Area* area, View *view);
void addAction(QAction *action);
void removeAction(QAction* action);
Qt::Orientation orientation() const;
Qt::DockWidgetArea area() const;
IdealDockWidget* widgetForAction(QAction* action) const;
QWidget* corner();
void showWidget(QAction *widgetAction, bool checked);
bool isEmpty();
bool isShown();
void saveShowState();
bool lastShowState();
void loadOrderSettings(const KConfigGroup& configGroup);
void saveOrderSettings(KConfigGroup& configGroup);
-private Q_SLOTS:
- void showWidget(bool checked);
- void buttonPressed(bool state);
-
signals:
void emptyChanged();
private:
+ void showWidget(bool checked);
+
void applyOrderToLayout();
void takeOrderFromLayout();
IdealToolButton* button(const QString& id) const;
QString id(const IdealToolButton* button) const;
void addButtonToOrder(const IdealToolButton* button);
Qt::DockWidgetArea _area;
IdealController *_controller;
QWidget *_corner;
bool _showState;
QStringList _buttonsOrder;
};
}
#endif // IDEALBUTTONBARWIDGET_H
diff --git a/vcs/dvcs/ui/dvcsimportmetadatawidget.ui b/vcs/dvcs/ui/dvcsimportmetadatawidget.ui
index e700d902b..e5f122c47 100644
--- a/vcs/dvcs/ui/dvcsimportmetadatawidget.ui
+++ b/vcs/dvcs/ui/dvcsimportmetadatawidget.ui
@@ -1,38 +1,38 @@
DvcsImportMetadataWidget
0
0
581
37
Import
-
Source Directory:
-
KUrlRequester
- QFrame
+ QWidget
1