File tree Expand file tree Collapse file tree 5 files changed +39
-19
lines changed Expand file tree Collapse file tree 5 files changed +39
-19
lines changed Original file line number Diff line number Diff line change 24
24
< li class ="fix "> Fixed plugin loading on linux</ li >
25
25
< li class ="fix "> Fixed dock widget positions save/load</ li >
26
26
< li class ="fix "> Fixed main window title</ li >
27
+ < li class ="fix "> Fixed problems with opening already opened files < p class ="comment "> Now if file already opened, then it makes tab active</ p > </ li >
28
+ < li class ="change "> Change license to MIT</ li >
27
29
28
30
< p class ="header "> SCg-editor</ p >
29
31
< li class ="add "> Added load/save of content state</ li >
38
40
39
41
< p class ="header "> SCs editor</ p >
40
42
< li class ="add "> Added support of scs 0.2.0 standard</ li >
43
+ < li class ="add "> Added new line into the end of file< p class ="comment "> Less lines changes in diff's</ p > </ li >
41
44
< li class ="fix "> Fixed default encoding to utf-8</ li >
42
45
43
46
</ ul >
Original file line number Diff line number Diff line change @@ -79,11 +79,12 @@ bool ExtendedTabWidget::closeWindow(QWidget* wnd)
79
79
" bool ExtendedTabWidget::close(int index)" ,
80
80
" Can't get window" );
81
81
82
- if (emit tabBeforeClose (wnd))
82
+ if (emit tabBeforeClose (wnd))
83
83
{
84
84
wnd->close ();
85
85
removeTab (indexOf (wnd));
86
86
delete wnd;
87
+
87
88
tabsUpdate ();
88
89
return true ;
89
90
}
@@ -95,12 +96,26 @@ QList<QWidget*> ExtendedTabWidget::subWindowList() const
95
96
{
96
97
QList<QWidget*> res;
97
98
int cnt = count ();
98
- for (int i =0 ; i < cnt; ++i)
99
+ for (int i = 0 ; i < cnt; ++i)
99
100
res.push_back (widget (i));
100
101
101
102
return res;
102
103
}
103
104
105
+ bool ExtendedTabWidget::activateTab (QString const & fileName)
106
+ {
107
+ for (int i = 0 ; i < count (); ++i)
108
+ {
109
+ EditorInterface const * editor = qobject_cast<EditorInterface*>(widget (i));
110
+ if (editor && editor->currentFileName () == fileName)
111
+ {
112
+ setCurrentWidget (widget (i));
113
+ return true ;
114
+ }
115
+ }
116
+ return false ;
117
+ }
118
+
104
119
void ExtendedTabWidget::closeOtherDocuments ()
105
120
{
106
121
QWidget* currentWindow = currentWidget ();
Original file line number Diff line number Diff line change @@ -27,9 +27,14 @@ class ExtendedTabWidget : public QTabWidget
27
27
*/
28
28
bool closeWindow (QWidget* wnd);
29
29
30
- // !@return list with tab widgets;
30
+ // ! @return list with tab widgets;
31
31
QList<QWidget*> subWindowList () const ;
32
32
33
+ /* ! Makes tab active by filename
34
+ * @return If specified tab exists, then returns true; otherwise returns false
35
+ */
36
+ bool activateTab (QString const & fileName);
37
+
33
38
protected:
34
39
// ! Watches for all child widgets (windows).
35
40
bool eventFilter (QObject* watched, QEvent* event);
@@ -39,7 +44,7 @@ class ExtendedTabWidget : public QTabWidget
39
44
* @param w Widget in closed tab.
40
45
* @return True, if tab will be closed.
41
46
*/
42
- bool tabBeforeClose (QWidget* w);
47
+ bool tabBeforeClose (QWidget * w);
43
48
44
49
/* ! Tabs updated signal. Calls when new tab added, or any tab removed.
45
50
*/
Original file line number Diff line number Diff line change @@ -388,28 +388,22 @@ void MainWindow::fileOpen(QString fileName)
388
388
mBlurEffect ->setEnabled (true );
389
389
dlg.setDirectory (mLastDir );
390
390
fileName = dlg.getOpenFileName (this ,
391
- tr (" Open file" ),
392
- " " ,
393
- PluginManager::instance ()->openFilters (),
394
- &selectedFilter,
395
- options);
396
- if (!fileName.isEmpty ())
397
- load (fileName);
391
+ tr (" Open file" ),
392
+ " " ,
393
+ PluginManager::instance ()->openFilters (),
394
+ &selectedFilter,
395
+ options);
398
396
mLastDir = QDir (fileName);
399
397
mBlurEffect ->setEnabled (false );
400
- return ;
401
398
}
402
399
403
400
if (!fileName.isEmpty () && QFile::exists (fileName))
404
401
{
405
- load (fileName);
402
+ if (!mTabWidget ->activateTab (fileName))
403
+ load (fileName);
406
404
return ;
407
405
}
408
406
409
- QFileInfo fileInfo (fileName);
410
- EditorInterface* childWindow = createSubWindowByExt (fileInfo.suffix ());
411
- saveWindow (childWindow, fileName, fileInfo.suffix ());
412
-
413
407
}
414
408
415
409
void MainWindow::load (QString fileName)
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ kbe (0.3.1-ubuntu) unstable; urgency=low
7
7
* Fixed dock widget positions save/load
8
8
* Fixed main window title
9
9
* Port code to use qt5
10
+ * Change license to MIT
11
+ * Fixed problems with opening of already opened files
10
12
11
13
* scg. Added load/save of content state
12
14
* scg. Added command to show/hide all contents
@@ -17,8 +19,9 @@ kbe (0.3.1-ubuntu) unstable; urgency=low
17
19
* scg. Fixed visual style of scg-elements
18
20
* scg. Fixed default encoding to utf-8
19
21
20
- * scg. Added support of scs 0.2.0 standard
21
- * scg. Fixed default encoding to utf-8
22
+ * scs. Added support of scs 0.2.0 standard
23
+ * scs. Fixed default encoding to utf-8
24
+ * scs. Added new line into the end of file
22
25
23
26
-- Denis Koronchik <denis.koronchik@gmail.com> Tue, 5 May 2014 01:06:43 +0300
24
27
You can’t perform that action at this time.
0 commit comments