Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in / Register
Toggle navigation
J
jami-client-windows
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Security & Compliance
Security & Compliance
Dependency List
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
savoirfairelinux
jami-client-windows
Commits
af00f1be
Commit
af00f1be
authored
Feb 24, 2020
by
Ming Rui Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: move scaling ratio into utils
Change-Id: Iead560e5fb38981ce899532577e5b7e4cba24f22
parent
f66deea3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
24 additions
and
21 deletions
+24
-21
src/accountitemdelegate.cpp
src/accountitemdelegate.cpp
+1
-2
src/callwidget.cpp
src/callwidget.cpp
+1
-2
src/contactpickeritemdelegate.cpp
src/contactpickeritemdelegate.cpp
+3
-4
src/conversationitemdelegate.cpp
src/conversationitemdelegate.cpp
+2
-3
src/currentaccountcombobox.cpp
src/currentaccountcombobox.cpp
+1
-2
src/mainwindow.cpp
src/mainwindow.cpp
+1
-6
src/mainwindow.h
src/mainwindow.h
+0
-2
src/utils.cpp
src/utils.cpp
+12
-0
src/utils.h
src/utils.h
+3
-0
No files found.
src/accountitemdelegate.cpp
View file @
af00f1be
...
...
@@ -26,7 +26,6 @@
#include "accountlistmodel.h"
#include "ringthemeutils.h"
#include "lrcinstance.h"
#include "mainwindow.h"
#undef REGISTERED
...
...
@@ -71,7 +70,7 @@ AccountItemDelegate::paint(QPainter* painter,
QFont
fontPrimary
=
painter
->
font
();
QFont
fontSecondary
=
painter
->
font
();
fontPrimary
.
setWeight
(
QFont
::
ExtraLight
);
auto
scalingRatio
=
MainWindow
::
instance
().
getCurrentScalingRatio
();
auto
scalingRatio
=
Utils
::
getCurrentScalingRatio
();
if
(
scalingRatio
>
1.0
)
{
fontPrimary
.
setPointSize
(
fontSize_
-
1
);
fontSecondary
.
setPointSize
(
fontSize_
-
2
);
...
...
src/callwidget.cpp
View file @
af00f1be
...
...
@@ -290,13 +290,12 @@ CallWidget::navigated(bool to)
void
CallWidget
::
updateCustomUI
()
{
auto
scalingRatio
=
MainWindow
::
instance
().
getCurrentScalingRatio
();
auto
scalingRatio
=
Utils
::
getCurrentScalingRatio
();
if
(
scalingRatio
>
1.0
)
{
ui
->
messageView
->
setZoomFactor
(
1.15
);
}
else
{
ui
->
messageView
->
setZoomFactor
(
1.0
);
}
}
void
...
...
src/contactpickeritemdelegate.cpp
View file @
af00f1be
...
...
@@ -27,7 +27,6 @@
#include "ringthemeutils.h"
#include "utils.h"
#include "lrcinstance.h"
#include "mainwindow.h"
#include <ciso646>
...
...
@@ -64,7 +63,7 @@ ContactPickerItemDelegate::paint(QPainter* painter
painter
->
fillRect
(
option
.
rect
,
RingTheme
::
lightGrey_
);
QFont
font
(
painter
->
font
());
QPen
pen
(
painter
->
pen
());
auto
scalingRatio
=
MainWindow
::
instance
().
getCurrentScalingRatio
();
auto
scalingRatio
=
Utils
::
getCurrentScalingRatio
();
if
(
scalingRatio
>
1.0
)
{
font
.
setPointSize
(
fontSize_
-
2
);
}
else
{
...
...
@@ -156,7 +155,7 @@ ContactPickerItemDelegate::paintRingContactItem(QPainter* painter,
QFont
font
(
painter
->
font
());
QPen
pen
(
painter
->
pen
());
auto
scalingRatio
=
MainWindow
::
instance
().
getCurrentScalingRatio
();
auto
scalingRatio
=
Utils
::
getCurrentScalingRatio
();
if
(
scalingRatio
>
1.0
)
{
font
.
setPointSize
(
fontSize_
-
2
);
}
else
{
...
...
@@ -217,7 +216,7 @@ ContactPickerItemDelegate::paintSIPContactItem(QPainter* painter,
QPen
pen
(
painter
->
pen
());
painter
->
setPen
(
pen
);
auto
scalingRatio
=
MainWindow
::
instance
().
getCurrentScalingRatio
();
auto
scalingRatio
=
Utils
::
getCurrentScalingRatio
();
if
(
scalingRatio
>
1.0
)
{
font
.
setPointSize
(
fontSize_
-
2
);
}
else
{
...
...
src/conversationitemdelegate.cpp
View file @
af00f1be
...
...
@@ -29,7 +29,6 @@
#include "ringthemeutils.h"
#include "utils.h"
#include "lrcinstance.h"
#include "mainwindow.h"
#include <ciso646>
...
...
@@ -186,7 +185,7 @@ ConversationItemDelegate::paintConversationItem(QPainter* painter,
int
infoTextWidthModifier
=
0
;
int
infoText2HeightModifier
=
0
;
auto
scalingRatio
=
MainWindow
::
instance
().
getCurrentScalingRatio
();
auto
scalingRatio
=
Utils
::
getCurrentScalingRatio
();
if
(
scalingRatio
>
1.0
)
{
font
.
setPointSize
(
fontSize_
-
2
);
infoTextWidthModifier
=
12
;
...
...
@@ -361,7 +360,7 @@ ConversationItemDelegate::paintInvitationItem(QPainter* painter,
auto
leftMargin
=
dx_
+
sizeImage_
+
dx_
;
auto
rightMargin
=
dx_
;
auto
scalingRatio
=
MainWindow
::
instance
().
getCurrentScalingRatio
();
auto
scalingRatio
=
Utils
::
getCurrentScalingRatio
();
font
.
setPointSize
(
scalingRatio
>
1.0
?
fontSize_
-
2
:
fontSize_
);
if
(
option
.
state
&
QStyle
::
State_MouseOver
)
{
...
...
src/currentaccountcombobox.cpp
View file @
af00f1be
...
...
@@ -24,7 +24,6 @@
#include "utils.h"
#include "ringthemeutils.h"
#include "lrcinstance.h"
#include "mainwindow.h"
#include <QPixmap>
#include <QMessageBox>
...
...
@@ -133,7 +132,7 @@ CurrentAccountComboBox::paintEvent(QPaintEvent* e)
QFont
fontPrimary
=
QFont
(
QStringLiteral
(
"Segoe UI Emoji"
));
QFont
fontSecondary
=
painter
.
font
();
fontPrimary
.
setWeight
(
QFont
::
ExtraLight
);
auto
scalingRatio
=
MainWindow
::
instance
().
getCurrentScalingRatio
();
auto
scalingRatio
=
Utils
::
getCurrentScalingRatio
();
fontPrimary
.
setPointSize
(
scalingRatio
>
1.0
?
10
:
11
);
fontSecondary
.
setPointSize
(
scalingRatio
>
1.0
?
9
:
10
);
...
...
src/mainwindow.cpp
View file @
af00f1be
...
...
@@ -400,7 +400,7 @@ void MainWindow::show()
void
MainWindow
::
slotScreenChanged
(
QScreen
*
screen
)
{
currentScalingRatio_
=
screen
->
logicalDotsPerInchX
()
/
96
;
Utils
::
setCurrentScalingRatio
(
screen
->
logicalDotsPerInchX
()
/
96
)
;
qobject_cast
<
NavWidget
*>
(
ui
->
navStack
->
currentWidget
())
->
updateCustomUI
();
adjustSize
();
updateGeometry
();
...
...
@@ -412,11 +412,6 @@ void MainWindow::resizeEvent(QResizeEvent* event)
qobject_cast
<
NavWidget
*>
(
ui
->
navStack
->
currentWidget
())
->
updateCustomUI
();
}
float
MainWindow
::
getCurrentScalingRatio
()
{
return
currentScalingRatio_
;
}
void
MainWindow
::
keyReleaseEvent
(
QKeyEvent
*
ke
)
{
emit
keyReleased
(
ke
);
...
...
src/mainwindow.h
View file @
af00f1be
...
...
@@ -52,7 +52,6 @@ public:
}
bool
init
();
void
show
();
float
getCurrentScalingRatio
();
void
showWindow
();
void
darken
();
void
lighten
();
...
...
@@ -88,7 +87,6 @@ private:
ScreenEnum
lastScr_
;
int
lastAccountCount_
;
Qt
::
WindowFlags
flags_
;
float
currentScalingRatio_
;
Qt
::
WindowState
currentWindowState_
{
Qt
::
WindowState
::
WindowNoState
};
void
readSettingsFromRegistry
();
...
...
src/utils.cpp
View file @
af00f1be
...
...
@@ -757,6 +757,18 @@ Utils::setupQRCode(QString ringID, int margin)
return
result
;
}
float
Utils
::
getCurrentScalingRatio
()
{
return
CURRENT_SCALING_RATIO
;
}
void
Utils
::
setCurrentScalingRatio
(
float
ratio
)
{
CURRENT_SCALING_RATIO
=
ratio
;
}
QString
Utils
::
formattedTime
(
int
duration
)
{
...
...
src/utils.h
View file @
af00f1be
...
...
@@ -48,6 +48,7 @@
#include "api/contact.h"
static
const
QSize
IMAGE_SIZE
{
128
,
128
};
static
float
CURRENT_SCALING_RATIO
{
1.0
};
#ifdef BETA
static
constexpr
bool
isBeta
=
true
;
...
...
@@ -75,6 +76,8 @@ void showSystemNotification(QWidget* widget, const QString& sender, const QStrin
QSize
getRealSize
(
QScreen
*
screen
);
void
forceDeleteAsync
(
const
QString
&
path
);
QString
getChangeLog
();
float
getCurrentScalingRatio
();
void
setCurrentScalingRatio
(
float
ratio
);
// updates
void
cleanUpdateFiles
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment