Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Vivy
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
Vivy
Validations
fc2271fe
Vérifiée
Valider
fc2271fe
rédigé
Il y a 4 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
UI: The user can now close documents
parent
43a7c05f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!3
Add documents
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
src/MainWindow.cc
+28
-2
28 ajouts, 2 suppressions
src/MainWindow.cc
src/MainWindow.h
+5
-1
5 ajouts, 1 suppression
src/MainWindow.h
src/MainWindow.xdef
+6
-6
6 ajouts, 6 suppressions
src/MainWindow.xdef
avec
39 ajouts
et
9 suppressions
src/MainWindow.cc
+
28
−
2
Voir le fichier @
fc2271fe
...
@@ -14,11 +14,24 @@
...
@@ -14,11 +14,24 @@
#include
<QMenuBar>
#include
<QMenuBar>
#include
<QImage>
#include
<QImage>
#include
<QToolBar>
#include
<QToolBar>
#include
<QTabWidget>
MainWindow
::
MainWindow
(
QWidget
*
parent
)
noexcept
MainWindow
::
MainWindow
(
QWidget
*
parent
)
noexcept
:
QMainWindow
(
parent
)
:
QMainWindow
(
parent
)
{
{
/* Some ugly stuff going on here with the toolbars and the menues */
#include
"MainWindow.xdef"
#include
"MainWindow.xdef"
/* Setup the tabs to display the documents */
documents
=
new
QTabWidget
(
this
);
documents
->
setMovable
(
true
);
documents
->
setTabsClosable
(
true
);
documents
->
setElideMode
(
Qt
::
ElideRight
);
documents
->
setUsesScrollButtons
(
true
);
connect
(
documents
,
&
QTabWidget
::
tabCloseRequested
,
this
,
&
MainWindow
::
closeDocument
);
setCentralWidget
(
documents
);
/* Main window has finished its construction */
statusBar
()
->
showMessage
(
"QSimulate has started"
);
statusBar
()
->
showMessage
(
"QSimulate has started"
);
}
}
...
@@ -40,7 +53,20 @@ MainWindow::saveFileAs() noexcept
...
@@ -40,7 +53,20 @@ MainWindow::saveFileAs() noexcept
}
}
void
void
MainWindow
::
openAudioFile
()
noexcept
MainWindow
::
closeDocument
(
int
index
)
noexcept
{
const
QWidget
*
widgetToClose
=
documents
->
widget
(
index
);
const
VivyDocumentView
*
documentToClose
=
reinterpret_cast
<
const
VivyDocumentView
*>
(
widgetToClose
);
const
QString
documentName
=
documentToClose
->
getDocument
()
->
getName
();
qDebug
()
<<
"Request to close the document "
<<
documentName
<<
" with tab position "
<<
index
;
documents
->
removeTab
(
index
);
documentStore
.
closeDocument
(
documentName
);
}
void
MainWindow
::
openDocument
()
noexcept
{
{
QString
filename
=
QFileDialog
::
getOpenFileName
(
this
,
"Select a file"
);
QString
filename
=
QFileDialog
::
getOpenFileName
(
this
,
"Select a file"
);
if
(
filename
.
isEmpty
())
{
if
(
filename
.
isEmpty
())
{
...
@@ -61,7 +87,7 @@ MainWindow::openAudioFile() noexcept
...
@@ -61,7 +87,7 @@ MainWindow::openAudioFile() noexcept
VivyDocumentView
*
documentView
=
documentStore
.
getDocumentView
(
document
->
getName
());
VivyDocumentView
*
documentView
=
documentStore
.
getDocumentView
(
document
->
getName
());
if
(
documentView
!=
nullptr
)
{
if
(
documentView
!=
nullptr
)
{
qDebug
()
<<
"View constructed successfully"
;
qDebug
()
<<
"View constructed successfully"
;
setCentralWidget
(
documentView
);
documents
->
addTab
(
documentView
,
document
->
getName
()
);
}
else
{
}
else
{
qCritical
()
<<
"Failed to create the document view for "
<<
document
->
getName
();
qCritical
()
<<
"Failed to create the document view for "
<<
document
->
getName
();
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/MainWindow.h
+
5
−
1
Voir le fichier @
fc2271fe
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
class
QMenu
;
class
QMenu
;
class
QAction
;
class
QAction
;
class
QTabWidget
;
class
VivyApplication
;
class
VivyApplication
;
class
MainWindow
final
:
public
QMainWindow
{
class
MainWindow
final
:
public
QMainWindow
{
...
@@ -18,6 +19,7 @@ class MainWindow final : public QMainWindow {
...
@@ -18,6 +19,7 @@ class MainWindow final : public QMainWindow {
VivyDocumentStore
documentStore
{};
VivyDocumentStore
documentStore
{};
VivyApplication
*
application
{
nullptr
};
VivyApplication
*
application
{
nullptr
};
QTabWidget
*
documents
{
nullptr
};
public
:
public
:
explicit
MainWindow
(
QWidget
*
parent
=
nullptr
)
noexcept
;
explicit
MainWindow
(
QWidget
*
parent
=
nullptr
)
noexcept
;
...
@@ -26,7 +28,9 @@ public:
...
@@ -26,7 +28,9 @@ public:
void
registerApplication
(
VivyApplication
*
)
noexcept
;
void
registerApplication
(
VivyApplication
*
)
noexcept
;
private
slots
:
private
slots
:
void
openAudioFile
()
noexcept
;
void
openDocument
()
noexcept
;
void
closeDocument
(
int
index
)
noexcept
;
void
openDialogHelp
()
noexcept
;
void
openDialogHelp
()
noexcept
;
void
saveFile
()
noexcept
;
void
saveFile
()
noexcept
;
void
saveFileAs
()
noexcept
;
void
saveFileAs
()
noexcept
;
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/MainWindow.xdef
+
6
−
6
Voir le fichier @
fc2271fe
...
@@ -45,17 +45,17 @@ MAIN_WINDOW_MENU(help, "&Help")
...
@@ -45,17 +45,17 @@ MAIN_WINDOW_MENU(help, "&Help")
MAIN_WINDOW_TOOLBAR
(
file
,
"File"
)
MAIN_WINDOW_TOOLBAR
(
file
,
"File"
)
MAIN_WINDOW_TOOLBAR
(
other
,
"Other"
)
MAIN_WINDOW_TOOLBAR
(
other
,
"Other"
)
MAIN_WINDOW_ACTION_ICON
(
open
AudioFile
,
"&Open audio"
,
"Open a
n
a
udio file
"
,
file
,
"document-open"
)
MAIN_WINDOW_ACTION_ICON
(
open
Document
,
"&Open document"
,
"Open a a
document
"
,
file
,
"document-open"
)
MAIN_WINDOW_ACTION_ICON
(
saveFile
,
"&Save file"
,
"Save the current document"
,
file
,
"document-save"
)
MAIN_WINDOW_ACTION_ICON
(
saveFile
,
"&Save file"
,
"Save the current document"
,
file
,
"document-save"
)
MAIN_WINDOW_ACTION_ICON
(
saveFileAs
,
"&Save file as"
,
"Save the current document as"
,
file
,
"document-save-as"
)
MAIN_WINDOW_ACTION_ICON
(
saveFileAs
,
"&Save file as"
,
"Save the current document as"
,
file
,
"document-save-as"
)
MAIN_WINDOW_ACTION_ICON
(
openDialogHelp
,
"&About"
,
"Open the help dialog"
,
help
,
"help-about"
)
MAIN_WINDOW_ACTION_ICON
(
openDialogHelp
,
"&About"
,
"Open the help dialog"
,
help
,
"help-about"
)
MAIN_WINDOW_TOOLBAR_ADD_ACTION
(
file
,
open
AudioFile
)
MAIN_WINDOW_TOOLBAR_ADD_ACTION
(
file
,
open
Document
)
MAIN_WINDOW_TOOLBAR_ADD_ACTION
(
file
,
saveFile
)
MAIN_WINDOW_TOOLBAR_ADD_ACTION
(
file
,
saveFile
)
MAIN_WINDOW_TOOLBAR_ADD_ACTION
(
file
,
saveFileAs
)
MAIN_WINDOW_TOOLBAR_ADD_ACTION
(
file
,
saveFileAs
)
MAIN_WINDOW_TOOLBAR_ADD_ACTION
(
other
,
openDialogHelp
)
MAIN_WINDOW_TOOLBAR_ADD_ACTION
(
other
,
openDialogHelp
)
MAIN_WINDOW_ACTION_ADD_SHORTCUT
(
open
AudioFile
,
QKeySequence
::
Open
)
MAIN_WINDOW_ACTION_ADD_SHORTCUT
(
open
Document
,
QKeySequence
::
Open
)
MAIN_WINDOW_ACTION_ADD_SHORTCUT
(
saveFile
,
QKeySequence
::
Save
)
MAIN_WINDOW_ACTION_ADD_SHORTCUT
(
saveFile
,
QKeySequence
::
Save
)
// vim: ft=c
// vim: ft=c
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter