Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
e96dd60f
Commit
e96dd60f
authored
Feb 26, 2021
by
Christoph Cullmann
🐮
Browse files
use the new output in the git stuff
parent
7b358356
Changes
8
Hide whitespace changes
Inline
Side-by-side
addons/project/branchesdialog.cpp
View file @
e96dd60f
...
...
@@ -6,6 +6,7 @@
#include "branchesdialog.h"
#include "branchesdialogmodel.h"
#include "git/gitutils.h"
#include "kateprojectpluginview.h"
#include <QCoreApplication>
#include <QKeyEvent>
...
...
@@ -151,9 +152,10 @@ private:
QString
m_filterString
;
};
BranchesDialog
::
BranchesDialog
(
QWidget
*
parent
,
KTextEditor
::
MainWindow
*
mainWindow
,
QString
projectPath
)
BranchesDialog
::
BranchesDialog
(
QWidget
*
parent
,
KTextEditor
::
MainWindow
*
mainWindow
,
KateProjectPluginView
*
pluginView
,
QString
projectPath
)
:
QMenu
(
parent
)
,
m_mainWindow
(
mainWindow
)
,
m_pluginView
(
pluginView
)
,
m_projectPath
(
projectPath
)
{
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
...
...
@@ -331,12 +333,7 @@ void BranchesDialog::reselectFirst()
void
BranchesDialog
::
sendMessage
(
const
QString
&
message
,
bool
warn
)
{
KTextEditor
::
Message
*
msg
=
new
KTextEditor
::
Message
(
message
,
warn
?
KTextEditor
::
Message
::
Warning
:
KTextEditor
::
Message
::
Positive
);
msg
->
setPosition
(
KTextEditor
::
Message
::
TopInView
);
msg
->
setAutoHide
(
3000
);
msg
->
setAutoHideMode
(
KTextEditor
::
Message
::
Immediate
);
msg
->
setView
(
m_mainWindow
->
activeView
());
m_mainWindow
->
activeView
()
->
document
()
->
postMessage
(
msg
);
m_pluginView
->
sendMessage
(
message
,
warn
);
}
void
BranchesDialog
::
createNewBranch
(
const
QString
&
branch
,
const
QString
&
fromBranch
)
...
...
addons/project/branchesdialog.h
View file @
e96dd60f
...
...
@@ -14,6 +14,7 @@ class BranchesDialogModel;
class
QAction
;
class
BranchFilterModel
;
class
KActionCollection
;
class
KateProjectPluginView
;
namespace
KTextEditor
{
...
...
@@ -24,7 +25,7 @@ class BranchesDialog : public QMenu
{
Q_OBJECT
public:
BranchesDialog
(
QWidget
*
parent
,
KTextEditor
::
MainWindow
*
mainWindow
,
QString
projectPath
);
BranchesDialog
(
QWidget
*
parent
,
KTextEditor
::
MainWindow
*
mainWindow
,
KateProjectPluginView
*
pluginView
,
QString
projectPath
);
void
openDialog
();
...
...
@@ -52,6 +53,7 @@ private:
BranchesDialogModel
*
m_model
;
BranchFilterModel
*
m_proxyModel
;
KTextEditor
::
MainWindow
*
m_mainWindow
;
KateProjectPluginView
*
m_pluginView
;
QString
m_projectPath
;
QFutureWatcher
<
GitUtils
::
CheckoutResult
>
m_checkoutWatcher
;
QString
m_checkoutBranchName
;
...
...
addons/project/gitwidget.cpp
View file @
e96dd60f
...
...
@@ -124,25 +124,7 @@ void GitWidget::initGitExe()
void
GitWidget
::
sendMessage
(
const
QString
&
message
,
bool
warn
)
{
// use generic output view
// FIXME: proper attributes
// if finished => remove the other case below!
QVariantMap
genericMessage
;
genericMessage
.
insert
(
QStringLiteral
(
"type"
),
warn
?
QStringLiteral
(
"Warning"
)
:
QStringLiteral
(
"Info"
));
genericMessage
.
insert
(
QStringLiteral
(
"plainText"
),
message
);
Q_EMIT
m_pluginView
->
message
(
genericMessage
);
// quickfix crash on startup
if
(
!
m_mainWin
->
activeView
())
{
return
;
}
KTextEditor
::
Message
*
msg
=
new
KTextEditor
::
Message
(
message
,
warn
?
KTextEditor
::
Message
::
Warning
:
KTextEditor
::
Message
::
Positive
);
msg
->
setPosition
(
KTextEditor
::
Message
::
TopInView
);
msg
->
setAutoHide
(
warn
?
5000
:
3000
);
msg
->
setAutoHideMode
(
KTextEditor
::
Message
::
Immediate
);
msg
->
setView
(
m_mainWin
->
activeView
());
m_mainWin
->
activeView
()
->
document
()
->
postMessage
(
msg
);
m_pluginView
->
sendMessage
(
message
,
warn
);
}
QProcess
*
GitWidget
::
gitprocess
()
...
...
@@ -431,7 +413,7 @@ void GitWidget::buildMenu()
}
});
m_gitMenu
->
addAction
(
i18n
(
"Checkout Branch"
),
this
,
[
this
]
{
BranchesDialog
bd
(
this
,
m_mainWin
,
m_project
->
baseDir
());
BranchesDialog
bd
(
this
,
m_mainWin
,
m_pluginView
,
m_project
->
baseDir
());
bd
.
openDialog
();
});
...
...
addons/project/gitwidget.h
View file @
e96dd60f
...
...
@@ -39,7 +39,6 @@ public:
bool
eventFilter
(
QObject
*
o
,
QEvent
*
e
)
override
;
void
getStatus
(
bool
untracked
=
true
,
bool
submodules
=
false
);
void
sendMessage
(
const
QString
&
message
,
bool
warn
);
QProcess
*
gitprocess
();
KTextEditor
::
MainWindow
*
mainWindow
();
...
...
@@ -47,6 +46,9 @@ public:
std
::
vector
<
TempFileViewPair
>
*
tempFilesVector
();
void
openTempFile
(
const
QString
&
file
,
const
QString
&
templatString
);
// will just proxy the message to the plugin view
void
sendMessage
(
const
QString
&
message
,
bool
warn
);
private:
QToolButton
*
m_menuBtn
;
QToolButton
*
m_commitBtn
;
...
...
addons/project/kateprojectpluginview.cpp
View file @
e96dd60f
...
...
@@ -638,4 +638,13 @@ void KateProjectPluginView::slotUpdateStatus(bool visible)
}
}
void
KateProjectPluginView
::
sendMessage
(
const
QString
&
plainText
,
bool
warn
)
{
// use generic output view
QVariantMap
genericMessage
;
genericMessage
.
insert
(
QStringLiteral
(
"type"
),
warn
?
QStringLiteral
(
"Warning"
)
:
QStringLiteral
(
"Info"
));
genericMessage
.
insert
(
QStringLiteral
(
"plainText"
),
plainText
);
Q_EMIT
message
(
genericMessage
);
}
#include "kateprojectpluginview.moc"
addons/project/kateprojectpluginview.h
View file @
e96dd60f
...
...
@@ -100,6 +100,13 @@ public:
return
m_plugin
;
}
/**
* Send out trivial plain text message, potential warnings
* @param message plain text message
* @param warn warning or not?
*/
void
sendMessage
(
const
QString
&
plainText
,
bool
warn
);
public
Q_SLOTS
:
/**
* Create views for given project.
...
...
addons/project/kateprojectview.cpp
View file @
e96dd60f
...
...
@@ -68,7 +68,7 @@ KateProjectView::KateProjectView(KateProjectPluginView *pluginView, KateProject
* Setup git checkout stuff
*/
m_branchBtn
->
setHidden
(
true
);
m_branchesDialog
=
new
BranchesDialog
(
this
,
mainWindow
,
m_project
->
baseDir
());
m_branchesDialog
=
new
BranchesDialog
(
this
,
mainWindow
,
m_pluginView
,
m_project
->
baseDir
());
connect
(
m_branchBtn
,
&
QPushButton
::
clicked
,
this
,
[
this
]
{
m_branchesDialog
->
openDialog
();
});
...
...
addons/project/stashdialog.cpp
View file @
e96dd60f
...
...
@@ -6,6 +6,7 @@
#include "stashdialog.h"
#include "git/gitutils.h"
#include "gitwidget.h"
#include "kateprojectpluginview.h"
#include <QCoreApplication>
#include <QFileInfo>
...
...
@@ -295,12 +296,8 @@ void StashDialog::reselectFirst()
void
StashDialog
::
sendMessage
(
const
QString
&
message
,
bool
warn
)
{
KTextEditor
::
Message
*
msg
=
new
KTextEditor
::
Message
(
message
,
warn
?
KTextEditor
::
Message
::
Warning
:
KTextEditor
::
Message
::
Positive
);
msg
->
setPosition
(
KTextEditor
::
Message
::
TopInView
);
msg
->
setAutoHide
(
3000
);
msg
->
setAutoHideMode
(
KTextEditor
::
Message
::
Immediate
);
msg
->
setView
(
m_mainWindow
->
activeView
());
m_mainWindow
->
activeView
()
->
document
()
->
postMessage
(
msg
);
// just proxy to git widget => proxy to plugin view
m_gitwidget
->
sendMessage
(
message
,
warn
);
}
void
StashDialog
::
stash
(
bool
keepIndex
,
bool
includeUntracked
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment