Skip to content

Commit

Permalink
Merge branch 'dev/develop' of https://github.com/Librum-Reader/Librum
Browse files Browse the repository at this point in the history
…into dev/develop
  • Loading branch information
DavidLazarescu committed Feb 26, 2024
2 parents 4db9c69 + e4e91ba commit 95c8f64
Show file tree
Hide file tree
Showing 30 changed files with 3,672 additions and 1,245 deletions.
1 change: 0 additions & 1 deletion scripts/update_translations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ TRANSLATION_FILES=$(find "$SCRIPT_DIR/../src/presentation/translations" -name "l

# Use lupdate with the list of translation files
lupdate "$SCRIPT_DIR/../src/presentation" -ts $TRANSLATION_FILES

4 changes: 1 addition & 3 deletions src/adapters/controllers/app_info_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ bool AppInfoController::switchToLanguage(const QString& language)
return false;
}


emit languageChanged();

// Use "English" for all kinds of English variants like American English
if(QLocale(language).language() == QLocale::Language::English)
m_language = "English";
Expand All @@ -170,6 +167,7 @@ bool AppInfoController::switchToLanguage(const QString& language)
settings.setValue("language", language);

m_engine->retranslate();
emit languageChanged();
return true;
}

Expand Down
1 change: 1 addition & 0 deletions src/presentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(translation_files
translations/librum_it.ts
translations/librum_ru.ts
translations/librum_ko.ts
translations/librum_ar.ts
translations/librum_zh.ts
translations/librum_uk.ts
translations/librum_pt.ts
Expand Down
4 changes: 4 additions & 0 deletions src/presentation/TranslationsModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ ListModel {
text: "Italiano"
code: "it"
}
ListElement {
text: "العربية"
code: "ar"
}
ListElement {
text: "Русский"
code: "ru"
Expand Down
3 changes: 3 additions & 0 deletions src/presentation/feature/arabic-translation
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS/>
3 changes: 3 additions & 0 deletions src/presentation/freeBooksPage/MFreeBooksPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ Page {
cellHeight: internal.bookHeight + internal.verticalBookSpacing
// Negative margin removes the extra spacing at the right of the grid
rightMargin: -internal.horizontalBookSpacing
layoutDirection: Qt.LeftToRight
LayoutMirroring.enabled: false
LayoutMirroring.childrenInherit: true
interactive: true
boundsBehavior: Flickable.StopAtBounds
flickDeceleration: 19500
Expand Down
5 changes: 5 additions & 0 deletions src/presentation/homePage/MHomePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Page {
id: root
rightPadding: 70
bottomPadding: 20
LayoutMirroring.enabled: baseRoot.rightAlign
LayoutMirroring.childrenInherit: true
background: Rectangle {
anchors.fill: parent
color: Style.colorPageBackground
Expand Down Expand Up @@ -229,6 +231,9 @@ Page {
cellWidth: internal.bookWidth + internal.horizontalBookSpacing
cellHeight: internal.bookHeight + internal.verticalBookSpacing
rightMargin: -internal.horizontalBookSpacing
layoutDirection: Qt.LeftToRight
LayoutMirroring.enabled: false
LayoutMirroring.childrenInherit: true
interactive: true
boundsBehavior: Flickable.StopAtBounds
flickDeceleration: 15000
Expand Down
3 changes: 3 additions & 0 deletions src/presentation/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ApplicationWindow {
property int sidebarOpenedMinWidth: 810
property int readingPageMinWidth: 550
property bool notifyAboutUpdates: true
property bool rightAlign: AppInfoController.language === "العربية"

minimumHeight: 400
minimumWidth: 650
Expand All @@ -39,6 +40,8 @@ ApplicationWindow {
id: mainlayout
anchors.fill: parent
spacing: 0
LayoutMirroring.enabled: baseRoot.rightAlign
LayoutMirroring.childrenInherit: true

MSidebar {
id: sidebar
Expand Down
3 changes: 3 additions & 0 deletions src/presentation/modules/CustomComponents/MBaseListItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Item {

Component.onCompleted: root.completed(model.index, root.actualWidth)

LayoutMirroring.enabled: baseRoot.rightAlign
LayoutMirroring.childrenInherit: true

Pane {
id: container
property bool renameable: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ Popup {
Label {
id: infoText
Layout.topMargin: 20
Layout.leftMargin: 52
Layout.leftMargin: baseRoot.rightAlign ? 0 : 52
Layout.rightMargin: baseRoot.rightAlign ? 52 : 0
Layout.fillWidth: true
wrapMode: Text.WordWrap
textFormat: Text.RichText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ Item {

RowLayout {
id: layout
width: parent.width
spacing: root.spacing
LayoutMirroring.enabled: baseRoot.rightAlign
LayoutMirroring.childrenInherit: true

MCheckBox {
id: checkBox
Expand Down
3 changes: 3 additions & 0 deletions src/presentation/modules/CustomComponents/buttons/MButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Item {
property bool centerContentVertically: true
property bool centerContentHorizontally: true

LayoutMirroring.enabled: baseRoot.rightAlign
LayoutMirroring.childrenInherit: true

implicitHeight: 30
implicitWidth: layout.implicitWidth + 2 * horizontalMargins

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Item {
implicitHeight: 32
implicitWidth: 100

LayoutMirroring.enabled: baseRoot.rightAlign
LayoutMirroring.childrenInherit: true

onVisibleChanged: selected = false

Pane {
Expand Down
4 changes: 4 additions & 0 deletions src/presentation/readingPage/MReadingPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Page {
color: Style.colorPageBackground
}

// Prevent right-alignment
LayoutMirroring.enabled: false
LayoutMirroring.childrenInherit: true

Component.onCompleted: root.forceActiveFocus()
Component.onDestruction: internal.saveCurrentPage()

Expand Down
5 changes: 2 additions & 3 deletions src/presentation/settings/MAboutPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ MFlickWrapper {
id: heartRow
Layout.fillWidth: true
Layout.topMargin: 40
spacing: 0
spacing: 22

Image {
id: heartImage
Expand All @@ -278,8 +278,7 @@ MFlickWrapper {

Label {
id: thisAppText
Layout.fillWidth: true
Layout.leftMargin: 22
Layout.alignment: baseRoot.rightAlign ? Qt.AlignRight : Qt.AlignLeft
text: qsTr("Librum is here for everyone who just wants to enjoy a good book.\n" + "We hope you have a great time using it! Feel free to leave us a rating and some feedback.")
wrapMode: Text.WordWrap
color: Style.colorText
Expand Down
3 changes: 3 additions & 0 deletions src/presentation/settings/MSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Page {
property alias storagePage: storagePage
property alias supportUsPage: supportUsPage

LayoutMirroring.enabled: baseRoot.rightAlign
LayoutMirroring.childrenInherit: true

background: Rectangle {
anchors.fill: parent
color: Style.colorPageBackground
Expand Down
4 changes: 4 additions & 0 deletions src/presentation/settings/shortcutsPage/MShortcutsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ Page {
anchors.fill: parent
spacing: 0

// Prevent right-alignment
LayoutMirroring.enabled: false
LayoutMirroring.childrenInherit: true


/*
The shortcuts header labeling the different columns
Expand Down
1 change: 1 addition & 0 deletions src/presentation/settings/updatesPage/MUpToDate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Item {
Label {
Layout.fillWidth: true
text: AppInfoController.currentVersion
horizontalAlignment: Text.AlignLeft
wrapMode: Text.WordWrap
color: Style.colorBasePurple
font.pointSize: Fonts.size14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Item {
Label {
Layout.fillWidth: true
text: AppInfoController.newestVersion
horizontalAlignment: Text.AlignLeft
wrapMode: Text.WordWrap
color: Style.colorLightText
font.pointSize: Fonts.size14
Expand Down
7 changes: 6 additions & 1 deletion src/presentation/sidebar/MSidebar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ Item {
*/
MProfilePopup {
id: profilePopup
x: 12
x: {
if (baseRoot.rightAlign)
return -106
else
return 12
}
y: profileBox.y - implicitHeight + 6
}
}
Expand Down
Loading

0 comments on commit 95c8f64

Please sign in to comment.