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
99c9e29f
Vérifiée
Valider
99c9e29f
rédigé
Il y a 3 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
UI: Small theme selector at compile time
parent
c069b6f1
Branches
Branches contenant la validation
Étiquettes
Étiquettes contenant la validation
1 requête de fusion
!11
Change a bit the UI + Add simple scripts support
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
src/UI/ScriptViews/ScriptEditor.cc
+11
-2
11 ajouts, 2 suppressions
src/UI/ScriptViews/ScriptEditor.cc
src/VivyApplication.cc
+21
-7
21 ajouts, 7 suppressions
src/VivyApplication.cc
src/VivyApplication.hh
+7
-0
7 ajouts, 0 suppression
src/VivyApplication.hh
avec
39 ajouts
et
9 suppressions
src/UI/ScriptViews/ScriptEditor.cc
+
11
−
2
Voir le fichier @
99c9e29f
...
@@ -29,13 +29,22 @@ ScriptEditor::LineNumberArea::paintEvent(QPaintEvent *event) noexcept
...
@@ -29,13 +29,22 @@ ScriptEditor::LineNumberArea::paintEvent(QPaintEvent *event) noexcept
ScriptEditor
::
ScriptEditor
(
QWidget
*
parent
)
noexcept
ScriptEditor
::
ScriptEditor
(
QWidget
*
parent
)
noexcept
:
QPlainTextEdit
(
parent
)
:
QPlainTextEdit
(
parent
)
{
{
setStyleSheet
(
QStringLiteral
(
"* { font-family:
\"
FiraCode
\"
; font-size: 10pt}"
));
setStyleSheet
(
QStringLiteral
(
"* {"
" background-color: #232629;"
" font-family:
\"
FiraCode
\"
;"
" font-size: 10pt"
"}"
));
lineNumberArea
=
new
LineNumberArea
(
this
);
lineNumberArea
=
new
LineNumberArea
(
this
);
setFrameShape
(
QFrame
::
NoFrame
);
setFrameShape
(
QFrame
::
NoFrame
);
connect
(
this
,
&
ScriptEditor
::
blockCountChanged
,
this
,
&
ScriptEditor
::
updateLineNumberAreaWidth
);
connect
(
this
,
&
ScriptEditor
::
blockCountChanged
,
this
,
&
ScriptEditor
::
updateLineNumberAreaWidth
);
connect
(
this
,
&
ScriptEditor
::
updateRequest
,
this
,
&
ScriptEditor
::
updateLineNumberArea
);
connect
(
this
,
&
ScriptEditor
::
updateRequest
,
this
,
&
ScriptEditor
::
updateLineNumberArea
);
QTextCharFormat
textFormat
;
textFormat
.
setForeground
(
QBrush
(
Qt
::
white
));
mergeCurrentCharFormat
(
textFormat
);
setBackgroundVisible
(
true
);
updateLineNumberAreaWidth
(
0
);
updateLineNumberAreaWidth
(
0
);
}
}
...
@@ -99,7 +108,7 @@ void
...
@@ -99,7 +108,7 @@ void
ScriptEditor
::
lineNumberAreaPaintEvent
(
QPaintEvent
*
event
)
noexcept
ScriptEditor
::
lineNumberAreaPaintEvent
(
QPaintEvent
*
event
)
noexcept
{
{
QPainter
painter
(
lineNumberArea
);
QPainter
painter
(
lineNumberArea
);
painter
.
fillRect
(
event
->
rect
(),
QColor
::
fromRgb
(
6
9
,
83
,
100
));
painter
.
fillRect
(
event
->
rect
(),
QColor
::
fromRgb
(
4
9
,
54
,
59
));
QTextBlock
block
=
firstVisibleBlock
();
QTextBlock
block
=
firstVisibleBlock
();
int
blockNumber
=
block
.
blockNumber
();
int
blockNumber
=
block
.
blockNumber
();
int
top
=
qRound
(
blockBoundingGeometry
(
block
).
translated
(
contentOffset
()).
top
());
int
top
=
qRound
(
blockBoundingGeometry
(
block
).
translated
(
contentOffset
()).
top
());
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/VivyApplication.cc
+
21
−
7
Voir le fichier @
99c9e29f
...
@@ -12,6 +12,25 @@ VivyApplication::VivyApplication(int &argc, char **argv)
...
@@ -12,6 +12,25 @@ VivyApplication::VivyApplication(int &argc, char **argv)
{
{
}
}
void
VivyApplication
::
setTheme
(
Theme
theme
)
noexcept
{
if
(
theme
==
Theme
::
System
)
return
;
const
QString
sheet
=
theme
==
Theme
::
Dark
?
QStringLiteral
(
":qdarkstyle/dark/style.qss"
)
:
QStringLiteral
(
":qdarkstyle/light/style.qss"
);
QFile
stylesheet
(
sheet
);
if
(
!
stylesheet
.
exists
())
{
qFatal
(
"Missing stylesheet"
);
}
else
{
stylesheet
.
open
(
QFile
::
ReadOnly
|
QFile
::
Text
);
QTextStream
stylesheetStream
(
&
stylesheet
);
setStyleSheet
(
stylesheetStream
.
readAll
());
}
}
int
int
VivyApplication
::
exec
()
noexcept
VivyApplication
::
exec
()
noexcept
{
{
...
@@ -27,13 +46,8 @@ VivyApplication::exec() noexcept
...
@@ -27,13 +46,8 @@ VivyApplication::exec() noexcept
setAttribute
(
Qt
::
AA_DontShowIconsInMenus
,
false
);
setAttribute
(
Qt
::
AA_DontShowIconsInMenus
,
false
);
setAttribute
(
Qt
::
AA_DontShowShortcutsInContextMenus
,
false
);
setAttribute
(
Qt
::
AA_DontShowShortcutsInContextMenus
,
false
);
setFont
(
getApplicationFont
(
Font
::
Default
));
setFont
(
getApplicationFont
(
Font
::
Default
));
QFile
stylesheet
(
":qdarkstyle/dark/style.qss"
);
setTheme
(
Theme
::
Dark
);
// TODO: Set system theme for now (because we
if
(
!
stylesheet
.
exists
())
{
// don't have a central theme provider).
qFatal
(
"Missing stylesheet"
);
}
stylesheet
.
open
(
QFile
::
ReadOnly
|
QFile
::
Text
);
QTextStream
stylesheetStream
(
&
stylesheet
);
setStyleSheet
(
stylesheetStream
.
readAll
());
// Cursor blinking
// Cursor blinking
setCursorFlashTime
(
0
);
setCursorFlashTime
(
0
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/VivyApplication.hh
+
7
−
0
Voir le fichier @
99c9e29f
...
@@ -44,6 +44,12 @@ public:
...
@@ -44,6 +44,12 @@ public:
DefaultBoldItalic
,
DefaultBoldItalic
,
};
};
enum
class
Theme
{
System
,
Dark
,
Light
,
};
private
:
private
:
int
fontIdMonospace
;
int
fontIdMonospace
;
int
fontIdMonospaceBold
;
int
fontIdMonospaceBold
;
...
@@ -58,6 +64,7 @@ public:
...
@@ -58,6 +64,7 @@ public:
int
exec
()
noexcept
;
int
exec
()
noexcept
;
QFont
getApplicationFont
(
Font
)
const
noexcept
;
QFont
getApplicationFont
(
Font
)
const
noexcept
;
void
setTheme
(
Theme
)
noexcept
;
};
};
}
}
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