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
87b05311
Vérifiée
Valider
87b05311
rédigé
1 sept. 2021
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
LOG: Use the new logging API with the MainWindow
parent
a67b15d3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/UI/MainWindow.cc
+16
-16
16 ajouts, 16 suppressions
src/UI/MainWindow.cc
src/UI/MainWindow.hh
+7
-2
7 ajouts, 2 suppressions
src/UI/MainWindow.hh
avec
23 ajouts
et
18 suppressions
src/UI/MainWindow.cc
+
16
−
16
Voir le fichier @
87b05311
...
...
@@ -164,7 +164,7 @@ MainWindow::MainWindow() noexcept
void
MainWindow
::
closeEvent
(
QCloseEvent
*
event
)
noexcept
{
q
Debug
()
<<
"Closing the main window!"
;
log
Debug
()
<<
"Closing the main window!"
;
forEachViews
<
VivyDocumentView
>
([](
VivyDocumentView
*
view
,
int
)
{
view
->
closeDocument
();
});
QMainWindow
::
closeEvent
(
event
);
}
...
...
@@ -191,7 +191,7 @@ MainWindow::openProperties(int index) noexcept
return
;
}
q
Debug
()
.
nospace
()
<<
"Tab n°"
<<
index
<<
" was double clicked"
;
log
Debug
()
<<
"Tab n°"
<<
index
<<
" was double clicked"
;
AbstractDocumentView
*
current
=
getTab
(
index
);
current
->
openProperties
();
}
...
...
@@ -226,7 +226,7 @@ MainWindow::saveFile() noexcept
}
catch
(
const
std
::
runtime_error
&
e
)
{
qCritical
()
<<
"Failed to save current document:"
<<
e
.
what
();
logError
()
<<
"Failed to save current document:
"
<<
e
.
what
();
}
}
...
...
@@ -248,7 +248,7 @@ MainWindow::renameFile() noexcept
}
catch
(
const
std
::
runtime_error
&
e
)
{
qCritical
()
<<
"Failed to save current document:"
<<
e
.
what
();
logError
()
<<
"Failed to save current document:
"
<<
e
.
what
();
}
}
...
...
@@ -270,7 +270,7 @@ MainWindow::saveFileAs() noexcept
}
catch
(
const
std
::
runtime_error
&
e
)
{
qCritical
()
<<
"Failed to save current document:"
<<
e
.
what
();
logError
()
<<
"Failed to save current document:
"
<<
e
.
what
();
}
}
...
...
@@ -300,7 +300,7 @@ MainWindow::closeDocument(int index) noexcept
&
MainWindow
::
documentViewActionsChanged
);
if
(
documentToClose
)
{
q
Debug
()
<<
"Delete document view"
<<
documentToClose
->
getDocumentTabName
();
log
Debug
()
<<
"Delete document view
"
<<
documentToClose
->
getDocumentTabName
();
documentToClose
->
closeDocument
();
delete
documentToClose
;
}
...
...
@@ -313,7 +313,7 @@ MainWindow::newDocument() noexcept
addTab
(
new
VivyDocumentView
(
vivyApp
->
documentStore
.
newDocument
(
VivyDocument
::
UntouchedByDefault
),
documents
));
}
catch
(
const
std
::
runtime_error
&
e
)
{
qCritical
()
<<
"Failed to create a new empty document:"
<<
e
.
what
();
logError
()
<<
"Failed to create a new empty document:
"
<<
e
.
what
();
}
}
...
...
@@ -323,7 +323,7 @@ MainWindow::openDocument() noexcept
const
QString
filename
=
dialogOpenFileName
(
"Select a document to open"
,
QDir
::
homePath
(),
Utils
::
getAnyTopLevelDocumentFileSuffixFilter
());
if
(
filename
.
isEmpty
())
{
qWarnin
g
()
<<
"Found an empty filename, don't open a file"
;
logDebu
g
()
<<
"Found an empty filename, don't open a file"
;
return
;
}
...
...
@@ -331,7 +331,7 @@ MainWindow::openDocument() noexcept
Utils
::
DocumentType
fileType
;
if
(
!
Utils
::
detectDocumentType
(
fileInfo
,
&
fileType
))
{
q
Warning
()
<<
"Failed to detect file type for"
<<
filename
;
log
Warning
()
<<
"Failed to detect file type for
"
<<
filename
;
return
;
}
...
...
@@ -353,7 +353,7 @@ MainWindow::openDocument() noexcept
addTab
(
newView
);
}
}
catch
(
const
std
::
runtime_error
&
e
)
{
qCritical
()
<<
"Failed to load document"
<<
filename
<<
"with error:"
<<
e
.
what
();
logError
()
<<
"Failed to load document
"
<<
filename
<<
"
with error:
"
<<
e
.
what
();
}
}
...
...
@@ -420,7 +420,7 @@ MainWindow::addTab(AbstractDocumentView *const tab)
}
});
documentViewActionsChanged
();
q
Debug
()
<<
"View constructed successfully"
;
log
Debug
()
<<
"View constructed successfully"
;
}
int
...
...
@@ -487,19 +487,19 @@ MainWindow::findFirstUntouchedDocument() const noexcept
void
MainWindow
::
documentViewActionsChanged
()
noexcept
{
qInfo
()
<<
"Document view action changed"
;
logDebug
()
<<
"Document view action changed"
;
viewMenu
->
clear
();
// Change document view menu if we have a document
try
{
viewMenu
->
addActions
(
getCurrentDocumentView
()
->
getViewsActions
());
}
catch
(
const
std
::
runtime_error
&
e
)
{
qInfo
()
<<
"No view to display:"
<<
e
.
what
();
logDebug
()
<<
"No view to display:
"
<<
e
.
what
();
}
}
static
inline
QString
executeDialog
(
MainWindow
*
const
self
,
QFileDialog
*
const
dialog
)
noexcept
QString
MainWindow
::
executeDialog
(
MainWindow
*
const
self
,
QFileDialog
*
const
dialog
)
noexcept
{
bool
dialogAccepted
=
false
;
std
::
unique_ptr
<
VivyFileIconProvider
>
iconProvider
(
new
VivyFileIconProvider
());
...
...
@@ -515,7 +515,7 @@ executeDialog(MainWindow *const self, QFileDialog *const dialog) noexcept
const
QStringList
resList
=
dialog
->
selectedFiles
();
if
(
resList
.
size
()
!=
1
)
{
qCritical
()
<<
"You must select only one file"
;
self
->
logError
()
<<
"You must select only one file"
;
return
QStringLiteral
(
""
);
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/UI/MainWindow.hh
+
7
−
2
Voir le fichier @
87b05311
...
...
@@ -4,7 +4,9 @@
#error "This is a C++ header"
#endif
#include
"../VivyApplication.hh"
#include
"../Lib/Utils.hh"
#include
"../Lib/Log.hh"
#include
"../Lib/AbstractDocument.hh"
#include
"../Lib/Document/VivyDocumentStore.hh"
#include
"DocumentViews/AudioVisualizer.hh"
...
...
@@ -17,6 +19,7 @@ class AboutWindow;
class
MainWindow
final
:
public
QMainWindow
{
Q_OBJECT
VIVY_APP_LOGGABLE_OBJECT
(
MainWindow
,
logger
)
QTabWidget
*
documents
{
nullptr
};
QMenu
*
viewMenu
{
nullptr
};
...
...
@@ -54,6 +57,8 @@ private:
QString
dialogSaveFileName
(
const
QString
&
title
,
const
QString
&
folder
,
const
QString
&
filter
)
noexcept
;
QString
executeDialog
(
MainWindow
*
const
self
,
QFileDialog
*
const
dialog
)
noexcept
;
// Do an action with the selected filename. The 'call' variable must be
// callable like this: call(DocumentView, Document, QString)
template
<
typename
DV
,
typename
D
>
...
...
@@ -62,7 +67,7 @@ private:
const
QString
filename
=
dialogOpenFileName
(
title
,
QDir
::
homePath
(),
filter
);
if
(
filename
.
isEmpty
())
{
q
Warning
()
<<
"Found an empty filename, don't open a file"
;
log
Warning
()
<<
"Found an empty filename, don't open a file"
;
return
;
}
...
...
@@ -74,7 +79,7 @@ private:
call
(
view
,
doc
,
filename
);
}
}
catch
(
const
std
::
runtime_error
&
e
)
{
qCritical
()
<<
"Operation failed with:"
<<
e
.
what
();
logError
()
<<
"Operation failed with:
"
<<
e
.
what
();
}
}
...
...
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