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
Marco Bubke
flatpak-qt-creator
Commits
ed5afa14
Commit
ed5afa14
authored
Jan 20, 2009
by
mae
Browse files
added new empty split actions and fixed a few loopy bugs with double select files.
parent
c0c53423
Changes
12
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/coreconstants.h
View file @
ed5afa14
...
...
@@ -126,9 +126,9 @@ const char * const TOGGLE_SIDEBAR = "QtCreator.ToggleSidebar";
const
char
*
const
MINIMIZE_WINDOW
=
"QtCreator.MinimizeWindow"
;
const
char
*
const
ZOOM_WINDOW
=
"QtCreator.ZoomWindow"
;
const
char
*
const
HORIZONTAL
=
"QtCreator.
Horizontal
"
;
const
char
*
const
VERTICAL
=
"QtCreator.
Vertical
"
;
const
char
*
const
REMOVE
=
"QtCreator.
Remove
"
;
const
char
*
const
SPLIT
=
"QtCreator.
Split
"
;
const
char
*
const
SPLIT_SIDE_BY_SIDE
=
"QtCreator.
SplitSideBySide
"
;
const
char
*
const
UNSPLIT
=
"QtCreator.
Unsplit
"
;
const
char
*
const
SAVEASDEFAULT
=
"QtCreator.SaveAsDefaultLayout"
;
const
char
*
const
RESTOREDEFAULT
=
"QtCreator.RestoreDefaultLayout"
;
const
char
*
const
CLOSE
=
"QtCreator.Close"
;
...
...
src/plugins/coreplugin/coreplugin.pro
View file @
ed5afa14
...
...
@@ -34,11 +34,8 @@ SOURCES += mainwindow.cpp \
vcsmanager
.
cpp
\
viewmanager
.
cpp
\
versiondialog
.
cpp
\
editormanager
/
editorgroup
.
cpp
\
editormanager
/
editormanager
.
cpp
\
editormanager
/
editorview
.
cpp
\
editormanager
/
stackededitorgroup
.
cpp
\
editormanager
/
editorsplitter
.
cpp
\
editormanager
/
openeditorsview
.
cpp
\
editormanager
/
openeditorswindow
.
cpp
\
actionmanager
/
actionmanager
.
cpp
\
...
...
@@ -91,11 +88,8 @@ HEADERS += mainwindow.h \
outputpane
.
h
\
vcsmanager
.
h
\
viewmanager
.
h
\
editormanager
/
editorgroup
.
h
\
editormanager
/
editormanager
.
h
\
editormanager
/
editorview
.
h
\
editormanager
/
stackededitorgroup
.
h
\
editormanager
/
editorsplitter
.
h
\
editormanager
/
openeditorsview
.
h
\
editormanager
/
openeditorswindow
.
h
\
editormanager
/
ieditor
.
h
\
...
...
src/plugins/coreplugin/editormanager/editorgroup.cpp
View file @
ed5afa14
...
...
@@ -34,7 +34,7 @@
#include "editorgroup.h"
#include "editormanager.h"
#include "editorview.h"
#include <coreplugin/coreconstants.h>
#include <utils/qtcassert.h>
...
...
src/plugins/coreplugin/editormanager/editormanager.cpp
View file @
ed5afa14
...
...
@@ -70,6 +70,7 @@
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
#include <QtGui/QSplitter>
#include <QtGui/QStackedLayout>
using
namespace
Core
;
using
namespace
Core
::
Internal
;
...
...
@@ -129,6 +130,9 @@ struct EditorManagerPrivate {
explicit
EditorManagerPrivate
(
ICore
*
core
,
QWidget
*
parent
);
~
EditorManagerPrivate
();
Internal
::
EditorView
*
m_view
;
QSplitter
*
m_splitter
;
QStackedLayout
*
m_stackedLayout
;
ICore
*
m_core
;
bool
m_suppressEditorChanges
;
...
...
@@ -144,6 +148,9 @@ struct EditorManagerPrivate {
QAction
*
m_goBackAction
;
QAction
*
m_goForwardAction
;
QAction
*
m_openInExternalEditorAction
;
QAction
*
m_splitAction
;
QAction
*
m_splitSideBySideAction
;
QAction
*
m_unsplitAction
;
QList
<
IEditor
*>
m_editorHistory
;
QList
<
EditLocation
*>
m_navigationHistory
;
...
...
@@ -165,6 +172,8 @@ struct EditorManagerPrivate {
EditorManagerPrivate
::
EditorManagerPrivate
(
ICore
*
core
,
QWidget
*
parent
)
:
m_view
(
0
),
m_splitter
(
0
),
m_stackedLayout
(
0
),
m_core
(
core
),
m_suppressEditorChanges
(
false
),
m_revertToSavedAction
(
new
QAction
(
EditorManager
::
tr
(
"Revert to Saved"
),
parent
)),
...
...
@@ -307,6 +316,25 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
mwindow
->
addAction
(
cmd
,
Constants
::
G_WINDOW_NAVIGATE
);
connect
(
m_d
->
m_goForwardAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
goForwardInNavigationHistory
()));
m_d
->
m_splitAction
=
new
QAction
(
tr
(
"Split"
),
this
);
cmd
=
am
->
registerAction
(
m_d
->
m_splitAction
,
Constants
::
SPLIT
,
editManagerContext
);
cmd
->
setDefaultKeySequence
(
QKeySequence
(
tr
(
"Ctrl+E,1"
)));
mwindow
->
addAction
(
cmd
,
Constants
::
G_WINDOW_SPLIT
);
connect
(
m_d
->
m_splitAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
split
()));
m_d
->
m_splitSideBySideAction
=
new
QAction
(
tr
(
"Split Side by Side"
),
this
);
cmd
=
am
->
registerAction
(
m_d
->
m_splitSideBySideAction
,
Constants
::
SPLIT_SIDE_BY_SIDE
,
editManagerContext
);
cmd
->
setDefaultKeySequence
(
QKeySequence
(
tr
(
"Ctrl+E,2"
)));
mwindow
->
addAction
(
cmd
,
Constants
::
G_WINDOW_SPLIT
);
connect
(
m_d
->
m_splitSideBySideAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
splitSideBySide
()));
m_d
->
m_unsplitAction
=
new
QAction
(
tr
(
"Unsplit"
),
this
);
cmd
=
am
->
registerAction
(
m_d
->
m_unsplitAction
,
Constants
::
UNSPLIT
,
editManagerContext
);
cmd
->
setDefaultKeySequence
(
QKeySequence
(
tr
(
"Ctrl+E,0"
)));
mwindow
->
addAction
(
cmd
,
Constants
::
G_WINDOW_SPLIT
);
connect
(
m_d
->
m_unsplitAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
unsplit
()));
ActionContainer
*
medit
=
am
->
actionContainer
(
Constants
::
M_EDIT
);
ActionContainer
*
advancedMenu
=
am
->
createMenu
(
Constants
::
M_EDIT_ADVANCED
);
...
...
@@ -328,10 +356,8 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
connect
(
m_d
->
m_view
,
SIGNAL
(
closeRequested
(
Core
::
IEditor
*
)),
this
,
SLOT
(
closeEditor
(
Core
::
IEditor
*
)));
QHBoxLayout
*
l
=
new
QHBoxLayout
(
this
);
l
->
setSpacing
(
0
);
l
->
setMargin
(
0
);
l
->
addWidget
(
m_d
->
m_view
);
m_d
->
m_stackedLayout
=
new
QStackedLayout
(
this
);
m_d
->
m_stackedLayout
->
addWidget
(
m_d
->
m_view
);
updateActions
();
...
...
@@ -1250,8 +1276,6 @@ bool EditorManager::restoreState(const QByteArray &state)
QByteArray
version
;
stream
>>
version
;
qDebug
()
<<
"restore state"
<<
version
;
if
(
version
!=
"EditorManagerV1"
)
return
false
;
...
...
@@ -1271,13 +1295,11 @@ bool EditorManager::restoreState(const QByteArray &state)
int
editorCount
=
0
;
stream
>>
editorCount
;
qDebug
()
<<
"restore editors:"
<<
editorCount
;
while
(
--
editorCount
>=
0
)
{
QString
fileName
;
stream
>>
fileName
;
QByteArray
kind
;
stream
>>
kind
;
qDebug
()
<<
"openEditor"
<<
fileName
<<
kind
;
openEditor
(
fileName
,
kind
,
true
);
}
...
...
@@ -1447,6 +1469,22 @@ QString EditorManager::externalEditor() const
return
m_d
->
m_externalEditor
;
}
void
EditorManager
::
split
()
{
qDebug
()
<<
"split"
;
}
void
EditorManager
::
splitSideBySide
()
{
qDebug
()
<<
"splitSideBySide"
;
}
void
EditorManager
::
unsplit
()
{
qDebug
()
<<
"unsplit"
;
}
//===================EditorClosingCoreListener======================
EditorClosingCoreListener
::
EditorClosingCoreListener
(
EditorManager
*
em
)
...
...
src/plugins/coreplugin/editormanager/editormanager.h
View file @
ed5afa14
...
...
@@ -181,7 +181,6 @@ signals:
void
editorOpened
(
Core
::
IEditor
*
editor
);
void
editorAboutToClose
(
Core
::
IEditor
*
editor
);
void
editorsClosed
(
QList
<
Core
::
IEditor
*>
editors
);
void
editorGroupsChanged
();
public
slots
:
bool
closeAllEditors
(
bool
askAboutModifiedEditors
=
true
);
...
...
@@ -201,6 +200,9 @@ private slots:
void
goBackInNavigationHistory
();
void
goForwardInNavigationHistory
();
void
makeCurrentEditorWritable
();
void
split
();
void
splitSideBySide
();
void
unsplit
();
private:
QList
<
IFile
*>
filesForEditors
(
QList
<
IEditor
*>
editors
)
const
;
...
...
src/plugins/coreplugin/editormanager/editorsplitter.cpp
View file @
ed5afa14
...
...
@@ -76,6 +76,7 @@ void EditorSplitter::registerActions()
ActionContainer
*
mwindow
=
am
->
actionContainer
(
Constants
::
M_WINDOW
);
Command
*
cmd
;
#if 0
//Horizontal Action
m_horizontalSplitAction = new QAction(tr("Split Left/Right"), this);
cmd = am->registerAction(m_horizontalSplitAction, Constants::HORIZONTAL, editorManagerContext);
...
...
@@ -97,6 +98,8 @@ void EditorSplitter::registerActions()
connect(m_unsplitAction, SIGNAL(triggered()),
this, SLOT(unsplit()));
#endif
//Default Layout menu
ActionContainer
*
mLayout
=
am
->
createMenu
(
"QtCreator.Menu.Window.Layout"
);
mwindow
->
addMenu
(
mLayout
,
Constants
::
G_WINDOW_SPLIT
);
...
...
src/plugins/coreplugin/editormanager/editorview.cpp
View file @
ed5afa14
...
...
@@ -176,7 +176,6 @@ void EditorModel::itemChanged()
EditorView
::
EditorView
(
EditorModel
*
model
,
QWidget
*
parent
)
:
QWidget
(
parent
),
m_toplevel
(
new
QWidget
),
m_toolBar
(
new
QWidget
),
m_container
(
new
QStackedWidget
(
this
)),
m_editorList
(
new
QComboBox
),
...
...
@@ -186,7 +185,7 @@ EditorView::EditorView(EditorModel *model, QWidget *parent) :
m_infoWidget
(
new
QFrame
(
this
)),
m_editorForInfoWidget
(
0
)
{
QVBoxLayout
*
tl
=
new
QVBoxLayout
(
m_toplevel
);
QVBoxLayout
*
tl
=
new
QVBoxLayout
(
this
);
tl
->
setSpacing
(
0
);
tl
->
setMargin
(
0
);
{
...
...
@@ -272,11 +271,6 @@ EditorView::EditorView(EditorModel *model, QWidget *parent) :
}
tl
->
addWidget
(
m_container
);
QHBoxLayout
*
l
=
new
QHBoxLayout
;
l
->
setSpacing
(
0
);
l
->
setMargin
(
0
);
l
->
addWidget
(
m_toplevel
);
setLayout
(
l
);
}
void
EditorView
::
showEditorInfoBar
(
const
QString
&
kind
,
...
...
@@ -343,6 +337,11 @@ void EditorView::insertEditor(int index, IEditor *editor)
// emit editorAdded(editor);
}
bool
EditorView
::
hasEditor
(
IEditor
*
editor
)
const
{
return
(
m_container
->
indexOf
(
editor
->
widget
())
!=
-
1
);
}
void
EditorView
::
sendCloseRequest
()
{
emit
closeRequested
(
currentEditor
());
...
...
@@ -367,7 +366,6 @@ void EditorView::removeEditor(IEditor *editor)
toolBar
->
setVisible
(
false
);
toolBar
->
setParent
(
0
);
}
// emit editorRemoved(editor);
}
}
...
...
@@ -387,10 +385,9 @@ void EditorView::setCurrentEditor(IEditor *editor)
QTC_ASSERT
(
idx
>=
0
,
return
);
if
(
m_container
->
currentIndex
()
!=
idx
)
{
m_container
->
setCurrentIndex
(
idx
);
const
bool
block
=
m_editorList
->
blockSignals
(
true
);
disconnect
(
m_editorList
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
listSelectionChanged
(
int
)));
m_editorList
->
setCurrentIndex
(
qobject_cast
<
EditorModel
*>
(
m_editorList
->
model
())
->
indexOf
(
editor
->
file
()
->
fileName
()).
row
());
m_editorList
->
blockSignals
(
block
);
connect
(
m_editorList
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
listSelectionChanged
(
int
))
);
}
setEditorFocus
(
idx
);
...
...
src/plugins/coreplugin/editormanager/editorview.h
View file @
ed5afa14
...
...
@@ -41,6 +41,7 @@
#include <QtGui/QWidget>
#include <QtGui/QAction>
#include <QtGui/QSplitter>
#include <QtGui/QStackedLayout>
#include <coreplugin/icontext.h>
...
...
@@ -104,6 +105,9 @@ public:
void
removeEditor
(
IEditor
*
editor
);
IEditor
*
currentEditor
()
const
;
void
setCurrentEditor
(
IEditor
*
editor
);
bool
hasEditor
(
IEditor
*
editor
)
const
;
QList
<
IEditor
*>
editors
()
const
;
void
showEditorInfoBar
(
const
QString
&
kind
,
const
QString
&
infoText
,
...
...
@@ -128,7 +132,6 @@ private:
void
updateToolBar
(
IEditor
*
editor
);
void
checkProjectLoaded
(
IEditor
*
editor
);
QWidget
*
m_toplevel
;
QWidget
*
m_toolBar
;
QToolBar
*
m_activeToolBar
;
QStackedWidget
*
m_container
;
...
...
src/plugins/coreplugin/editormanager/openeditorsview.cpp
View file @
ed5afa14
...
...
@@ -89,6 +89,7 @@ void OpenEditorsWidget::updateCurrentItem(Core::IEditor *editor)
return
;
}
EditorManager
*
em
=
EditorManager
::
instance
();
m_ui
.
editorList
->
clearSelection
();
//we are in extended selectionmode
m_ui
.
editorList
->
setCurrentIndex
(
em
->
openedEditorsModel
()
->
indexOf
(
editor
));
m_ui
.
editorList
->
scrollTo
(
m_ui
.
editorList
->
currentIndex
());
}
...
...
src/plugins/coreplugin/editormanager/openeditorswindow.cpp
View file @
ed5afa14
...
...
@@ -84,8 +84,6 @@ OpenEditorsWindow::OpenEditorsWindow(QWidget *parent) :
this
,
SLOT
(
updateEditorList
()));
connect
(
em
,
SIGNAL
(
editorsClosed
(
QList
<
Core
::
IEditor
*>
)),
this
,
SLOT
(
updateEditorList
()));
connect
(
em
,
SIGNAL
(
editorGroupsChanged
()),
this
,
SLOT
(
updateEditorList
()));
connect
(
em
,
SIGNAL
(
currentEditorChanged
(
Core
::
IEditor
*
)),
this
,
SLOT
(
updateEditorList
()));
}
...
...
src/plugins/projectexplorer/projecttreewidget.cpp
View file @
ed5afa14
...
...
@@ -165,7 +165,7 @@ ProjectTreeWidget::ProjectTreeWidget(Core::ICore *core, QWidget *parent)
m_toggleSync
->
setToolTip
(
tr
(
"Synchronize with Editor"
));
connect
(
m_toggleSync
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toggleAutoSynchronization
()));
//
setAutoSynchronization(true);
setAutoSynchronization
(
true
);
}
QToolButton
*
ProjectTreeWidget
::
toggleSync
()
...
...
@@ -216,25 +216,20 @@ void ProjectTreeWidget::setCurrentItem(Node *node, Project *project)
qDebug
()
<<
"ProjectTreeWidget::setCurrentItem("
<<
(
project
?
project
->
name
()
:
"0"
)
<<
", "
<<
(
node
?
node
->
path
()
:
"0"
)
<<
")"
;
if
(
!
project
)
{
m_view
->
selectionModel
()
->
reset
();
return
;
}
const
QModelIndex
mainIndex
=
m_model
->
indexForNode
(
node
);
if
(
!
mainIndex
.
isValid
())
{
if
(
debug
)
qDebug
()
<<
"no main index, clear selection"
;
m_view
->
selectionModel
()
->
clearSelection
();
}
else
if
(
mainIndex
!=
m_view
->
selectionModel
()
->
currentIndex
())
{
QItemSelectionModel
*
selections
=
m_view
->
selectionModel
();
if
(
debug
)
qDebug
()
<<
"ProjectTreeWidget - changing selection"
;
selections
->
setCurrentIndex
(
mainIndex
,
QItemSelectionModel
::
SelectCurrent
|
QItemSelectionModel
::
Clear
);
if
(
mainIndex
.
isValid
()
&&
mainIndex
!=
m_view
->
selectionModel
()
->
currentIndex
())
{
m_view
->
setCurrentIndex
(
mainIndex
);
m_view
->
scrollTo
(
mainIndex
);
}
else
{
if
(
debug
)
qDebug
()
<<
"clear selection"
;
m_view
->
clearSelection
();
}
}
void
ProjectTreeWidget
::
handleCurrentItemChange
(
const
QModelIndex
&
current
)
...
...
src/plugins/projectexplorer/projectwindow.cpp
View file @
ed5afa14
...
...
@@ -216,22 +216,7 @@ void ProjectWindow::updateTreeWidget()
m_treeWidget
->
addTopLevelItem
(
item
);
if
(
m_projectExplorer
->
currentProject
()
==
project
)
{
m_treeWidget
->
setCurrentItem
(
item
,
0
,
QItemSelectionModel
::
SelectCurrent
|
QItemSelectionModel
::
Rows
);
}
}
if
(
!
m_treeWidget
->
currentItem
())
{
if
(
m_treeWidget
->
topLevelItemCount
()
>
0
)
m_treeWidget
->
setCurrentItem
(
m_treeWidget
->
topLevelItem
(
0
),
0
,
QItemSelectionModel
::
SelectCurrent
|
QItemSelectionModel
::
Rows
);
else
handleCurrentItemChanged
(
0
);
}
// Hack around Qt bug
m_treeWidget
->
viewport
()
->
update
();
}
...
...
@@ -255,10 +240,6 @@ void ProjectWindow::handleCurrentItemChanged(QTreeWidgetItem *current)
return
;
}
}
// we only get here if either current is zero or we didn't find a project for the path
m_projectExplorer
->
setCurrentFile
(
0
,
QString
());
showProperties
(
0
,
QModelIndex
());
}
...
...
Write
Preview
Markdown
is supported
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