Mercurial > octave-nkf
annotate gui/src/workspace-view.cc @ 14709:f50591409306 gui
Started to rename class names and methods from camel case to underscore-
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Thu, 31 May 2012 22:59:47 +0200 |
parents | 674740c44c09 |
children | 5cb54cca8a06 |
rev | line source |
---|---|
13504
13e3d60aff2d
Replaced Quint with OctaveGUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
diff
changeset
|
1 /* OctaveGUI - A graphical user interface for Octave |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13577
diff
changeset
|
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) |
13501 | 3 * |
4 * This program is free software: you can redistribute it and/or modify | |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14289
diff
changeset
|
5 * it under the terms of the GNU General Public License as |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13577
diff
changeset
|
6 * published by the Free Software Foundation, either version 3 of the |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13577
diff
changeset
|
7 * License, or (at your option) any later version. |
13501 | 8 * |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14289
diff
changeset
|
12 * GNU General Public License for more details. |
13501 | 13 * |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14289
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13577
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
13501 | 16 */ |
17 | |
14707
674740c44c09
Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14703
diff
changeset
|
18 #include "workspace-view.h" |
13501 | 19 #include <QHBoxLayout> |
20 #include <QVBoxLayout> | |
21 #include <QPushButton> | |
22 | |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
23 workspace_view::workspace_view (QWidget * parent) : QDockWidget |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
24 (parent) |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
25 { |
13683
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13678
diff
changeset
|
26 setObjectName ("WorkspaceView"); |
13523
103b7bebb38f
Moved load/save/clear workspace into main menu.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
27 setWindowTitle (tr ("Workspace")); |
103b7bebb38f
Moved load/save/clear workspace into main menu.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
28 |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
29 m_workspaceTreeView = new QTreeView (this); |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
30 m_workspaceTreeView->setHeaderHidden (false); |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
31 m_workspaceTreeView->setAlternatingRowColors (true); |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
32 m_workspaceTreeView->setAnimated (true); |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
33 m_workspaceTreeView->setModel(octave_link::instance()->workspaceModel()); |
13523
103b7bebb38f
Moved load/save/clear workspace into main menu.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
34 |
103b7bebb38f
Moved load/save/clear workspace into main menu.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
35 setWidget (new QWidget (this)); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
36 QVBoxLayout *layout = new QVBoxLayout (); |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
37 layout->addWidget (m_workspaceTreeView); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
38 layout->setMargin (2); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
39 widget ()->setLayout (layout); |
13501 | 40 |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
41 connect (this, SIGNAL (visibilityChanged (bool)), |
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
42 this, SLOT(handleVisibilityChanged (bool))); |
13501 | 43 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
44 connect (octave_link::instance()->workspaceModel(), SIGNAL(expandRequest()), |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14599
diff
changeset
|
45 m_workspaceTreeView, SLOT(expandAll())); |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
46 } |
13577
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
47 |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
48 void |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
49 workspace_view::handleVisibilityChanged (bool visible) |
13577
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
50 { |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
51 if (visible) |
13683
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13678
diff
changeset
|
52 emit activeChanged (true); |
13577
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
53 } |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
54 |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
55 void |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
56 workspace_view::closeEvent (QCloseEvent *event) |
13577
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
57 { |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
58 emit activeChanged (false); |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
59 QDockWidget::closeEvent (event); |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
60 } |