Skip to content

Commit

Permalink
Swap theme from the Adwaita to Fusion (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
gastoner committed Oct 31, 2023
1 parent e713a46 commit 249a969
Show file tree
Hide file tree
Showing 33 changed files with 47 additions and 2,442 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ jobs:
uses: jurplel/install-qt-action@v3
with:
version: ${{env.QT_VERSION}}
- name: Install Adwaita-qt
run: |
git clone https://github.com/FedoraQt/adwaita-qt.git adwaita-qt
cd adwaita-qt
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DUSE_QT6=ON
make -j2
sudo make install

- name: Build
run: |
Expand Down
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ endif()

find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED Core DBus Gui Network Svg Qml Quick QuickControls2 Widgets)

if (UNIX AND NOT APPLE)
find_package(AdwaitaQt6 "1.4.2" REQUIRED)
endif()

add_subdirectory(src)

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
7 changes: 0 additions & 7 deletions dist/fedora/mediawriter.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ BuildRequires: gettext
BuildRequires: cmake
BuildRequires: make
BuildRequires: libappstream-glib
BuildRequires: libadwaita-qt6-devel
BuildRequires: qt6-qtbase-devel
BuildRequires: qt6-qtdeclarative-devel
BuildRequires: xz-devel
Expand Down Expand Up @@ -43,9 +42,6 @@ like flash drives or memory cards.
%prep
%autosetup -p1 -n MediaWriter-%{version}

# Install the theme into correct prefix when building for /app
sed -i 's@\${QT6_INSTALL_QML}@%{_qt6_qmldir}@' src/theme/CMakeLists.txt

%build
%cmake

Expand All @@ -71,9 +67,6 @@ appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/org.fedo
%{_datadir}/icons/hicolor/128x128/apps/org.fedoraproject.MediaWriter.png
%{_datadir}/icons/hicolor/256x256/apps/org.fedoraproject.MediaWriter.png
%{_datadir}/icons/hicolor/512x512/apps/org.fedoraproject.MediaWriter.png
%{_qt6_qmldir}/QtQuick/Controls/org/fedoraproject/AdwaitaTheme/
%{_qt6_qmldir}/org/fedoraproject/AdwaitaTheme/libadwaitathemeplugin.so
%{_qt6_qmldir}/org/fedoraproject/AdwaitaTheme/qmldir

%changelog
* Mon May 09 06 2022 Jan Grulich <[email protected]> - 5.0.0-1
Expand Down
14 changes: 0 additions & 14 deletions dist/flatpak/fmw-paths.patch

This file was deleted.

22 changes: 0 additions & 22 deletions dist/flatpak/org.fedoraproject.MediaWriter.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,6 @@
"/lib/pkgconfig"
],
"modules": [
{
"name": "Adwaita-qt",
"buildsystem": "cmake",
"config-opts": ["-DUSE_QT6=ON"],
"sources": [
{
"type": "git",
"url": "https://github.com/FedoraQt/adwaita-qt.git",
"tag": "1.4.2"
},
{
"type": "shell",
"commands": [
"sed -i 's@add_subdirectory(style)@#add_subdirectory(style)@' src/CMakeLists.txt"
]
}
]
},
{
"name": "MediaWriter",
"buildsystem": "cmake",
Expand All @@ -47,10 +29,6 @@
"type": "git",
"url": "https://github.com/FedoraQt/MediaWriter.git",
"branch": "main"
},
{
"type": "patch",
"path": "fmw-paths.patch"
}
]
}
Expand Down
3 changes: 0 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
add_subdirectory(helper)
add_subdirectory(app)
add_subdirectory(lib)
if (UNIX AND NOT APPLE)
add_subdirectory(theme)
endif()
5 changes: 0 additions & 5 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

include_directories(
${CMAKE_SOURCE_DIR}/src/lib
${CMAKE_SOURCE_DIR}/src/theme
${ADWAITAQT_INCLUDE_DIRS}
)

set(MEDIAWRITER_SRCS
Expand All @@ -17,8 +15,6 @@ set(MEDIAWRITER_SRCS
units.cpp
utilities.cpp
versionchecker.cpp
# From theme
${CMAKE_SOURCE_DIR}/src/theme/icon.cpp
)

if (UNIX AND NOT APPLE)
Expand Down Expand Up @@ -81,7 +77,6 @@ target_link_libraries(mediawriter
if (UNIX AND NOT APPLE)
target_link_libraries(mediawriter
Qt6::DBus
${ADWAITAQT_LIBRARIES}
)
endif()

Expand Down
15 changes: 0 additions & 15 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,11 @@

#include "crashhandler.h"
#include "drivemanager.h"
#include "icon.h"
#include "portalfiledialog.h"
#include "releasemanager.h"
#include "units.h"
#include "versionchecker.h"

#if (defined(__linux))
#include <AdwaitaQt6/adwaitacolors.h>
#endif

#ifdef QT_STATIC
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);

Expand Down Expand Up @@ -74,10 +69,6 @@ int main(int argc, char **argv)
QApplication::setOrganizationName("fedoraproject.org");
QApplication::setApplicationName("MediaWriter");

#if (defined(__linux))
QQuickStyle::setStyle("QtQuick.Controls.org.fedoraproject.AdwaitaTheme");
#endif

QApplication app(argc, argv);
options.parse(app.arguments());

Expand All @@ -87,10 +78,6 @@ int main(int argc, char **argv)
if (translator.load(QLocale(QLocale().language(), QLocale().country()), QLatin1String(), QLatin1String(), ":/translations"))
app.installTranslator(&translator);

#if (defined(__linux))
QPalette adwaitaPalette = Adwaita::Colors::palette();
QGuiApplication::setPalette(adwaitaPalette);
#endif
QGuiApplication::setDesktopFileName("org.fedoraproject.MediaWriter.desktop");

mDebug() << "Injecting QML context properties";
Expand All @@ -109,8 +96,6 @@ int main(int argc, char **argv)
engine.rootContext()->setContextProperty("platformSupportsDelayedWriting", false);
#endif

qmlRegisterType<Icon>("MediaWriter", 1, 0, "Icon");

mDebug() << "Loading the QML source code";

engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
Expand Down
2 changes: 1 addition & 1 deletion src/app/qml/AboutDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ApplicationWindow {
Button {
id: closeButton
onClicked: aboutDialog.close()
text: qsTr("Close")
text: qsTr("&Close")
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/app/qml/CancelDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ApplicationWindow {
Button {
id: continueButton
onClicked: cancelDialog.close()
text: qsTr("Continue")
text: qsTr("C&ontinue")
}

Button {
Expand All @@ -108,13 +108,13 @@ ApplicationWindow {
}
text: {
if (releases.variant.status == Units.DownloadStatus.Downloading || releases.variant.status === Units.DownloadStatus.Download_Verifying)
qsTr("Cancel Download")
qsTr("&Cancel Download")
else if (releases.variant.status == Units.DownloadStatus.Writing)
qsTr("Cancel Writing")
qsTr("&Cancel Writing")
else if (releases.variant.status == Units.DownloadStatus.Write_Verifying)
qsTr("Cancel Verification")
qsTr("&Cancel Verification")
else
qsTr("Cancel")
qsTr("&Cancel")
}
}
}
Expand Down
64 changes: 41 additions & 23 deletions src/app/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ ApplicationWindow {
Button {
id: prevButton
visible: true
text: getPrevButtonText()
}

Item {
Expand All @@ -102,8 +101,7 @@ ApplicationWindow {
Button {
id: nextButton
visible: mainLayout.state != "downloadPage"
enabled: mainLayout.state != "drivePage"
text: getNextButtonText()
enabled: mainLayout.state != "drivePage"
}
}

Expand All @@ -118,7 +116,6 @@ ApplicationWindow {
//When comming back from restore page, after successfull restoring a USB drive
PropertyChanges {
target: prevButton
text: getPrevButtonText()
onClicked: aboutDialog.show()
}
PropertyChanges {
Expand Down Expand Up @@ -151,9 +148,20 @@ ApplicationWindow {
State {
name: "versionPage"
when: selectedPage == Units.Page.VersionPage
PropertyChanges { target: mainWindow; title: qsTr("Select Fedora Version") }
PropertyChanges { target: nextButton; visible: true; onClicked: selectedPage += 1 }
PropertyChanges { target: prevButton; visible: true; onClicked: selectedPage -= 1 }
PropertyChanges {
target: mainWindow
title: qsTr("Select Fedora Version")
}
PropertyChanges {
target: nextButton
visible: true
onClicked: selectedPage += 1
}
PropertyChanges {
target: prevButton
visible: true
onClicked: selectedPage -= 1
}
StateChangeScript {
script: {
//state was pushing same page when returing from drivePage
Expand All @@ -170,7 +178,7 @@ ApplicationWindow {
title: qsTr("Select Drive")
}
PropertyChanges {
target: nextButton;
target: nextButton
visible: true
onClicked: {
selectedPage = Units.Page.DownloadPage
Expand Down Expand Up @@ -269,6 +277,11 @@ ApplicationWindow {
}
}
]

onStateChanged: {
nextButton.text = getNextButtonText()
prevButton.text = getPrevButtonText()
}
}

Units {
Expand All @@ -282,38 +295,43 @@ ApplicationWindow {
CancelDialog {
id: cancelDialog
}



function getNextButtonText() {
var text = ""
if (mainLayout.state == "restorePage") {
if (lastRestoreable && lastRestoreable.restoreStatus == Units.RestoreStatus.Restored)
return qsTr("Finish")
return qsTr("Restore")
text = qsTr("Finish")
text = qsTr("Restore")
} else if (mainLayout.state == "drivePage") {
if (selectedOption == Units.MainSelect.Write || downloadManager.isDownloaded(releases.selected.version.variant.url))
return qsTr("Write")
text = qsTr("Write")
if (Qt.platform.os === "windows" || Qt.platform.os === "osx")
return qsTr("Download && Write")
return qsTr("Download & Write")
text = qsTr("Download && Write")
text = qsTr("Download & Write")
} else if (mainLayout.state == "downloadPage") {
if (releases.variant.status === Units.DownloadStatus.Write_Verifying || releases.variant.status === Units.DownloadStatus.Writing || releases.variant.status === Units.DownloadStatus.Downloading || releases.variant.status === Units.DownloadStatus.Download_Verifying)
return qsTr("Cancel")
text = qsTr("Cancel")
else if (releases.variant.status == Units.DownloadStatus.Ready)
return qsTr("Write")
text = qsTr("Write")
else if (releases.variant.status === Units.DownloadStatus.Finished)
return qsTr("Finish")
text = qsTr("Finish")
else
return qsTr("Retry")
text = qsTr("Retry")
}
return qsTr("Next")
else
text = qsTr("Next")
return "&" + text
}

function getPrevButtonText() {
var text = ""
if (mainLayout.state == "mainPage")
return qsTr("About")
text = qsTr("About")
else if (mainLayout.state == "downloadPage")
return qsTr("Cancel")
return qsTr("Previous")
text = qsTr("Cancel")
else
text = qsTr("Previous")
return "&" + text
}
}

23 changes: 0 additions & 23 deletions src/theme/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 249a969

Please sign in to comment.