change name

This commit is contained in:
2025-10-25 12:07:42 +02:00
parent 94e071b629
commit 434bb556f1
3 changed files with 19 additions and 18 deletions
+9 -9
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(wallpaper_chooser VERSION 0.1 LANGUAGES CXX) project(wallpaper_carousel VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
@@ -23,7 +23,7 @@ set(PROJECT_SOURCES
) )
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(wallpaper-chooser qt_add_executable(wallpaper-carousel
MANUAL_FINALIZATION MANUAL_FINALIZATION
${PROJECT_SOURCES} ${PROJECT_SOURCES}
src/images_carousel.h src/images_carousel.cpp src/designer/images_carousel.ui src/images_carousel.h src/images_carousel.cpp src/designer/images_carousel.ui
@@ -38,22 +38,22 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else() else()
if(ANDROID) if(ANDROID)
add_library(wallpaper-chooser SHARED add_library(wallpaper-carousel SHARED
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
# Define properties for Android with Qt 5 after find_package() calls as: # Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else() else()
add_executable(wallpaper-chooser add_executable(wallpaper-carousel
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
endif() endif()
endif() endif()
target_link_libraries(wallpaper-chooser PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) target_link_libraries(wallpaper-carousel PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
target_include_directories(wallpaper-chooser PRIVATE src) target_include_directories(wallpaper-carousel PRIVATE src)
# if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug") # if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
# target_compile_definitions(wallpaper_chooser PRIVATE # target_compile_definitions(wallpaper_chooser PRIVATE
@@ -68,7 +68,7 @@ if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.wallpaper_chooser) set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.wallpaper_chooser)
endif() endif()
set_target_properties(wallpaper-chooser PROPERTIES set_target_properties(wallpaper-carousel PROPERTIES
${BUNDLE_ID_OPTION} ${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
@@ -77,12 +77,12 @@ set_target_properties(wallpaper-chooser PROPERTIES
) )
include(GNUInstallDirs) include(GNUInstallDirs)
install(TARGETS wallpaper-chooser install(TARGETS wallpaper-carousel
BUNDLE DESTINATION . BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(QT_VERSION_MAJOR EQUAL 6) if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(wallpaper-chooser) qt_finalize_executable(wallpaper-carousel)
endif() endif()
+2 -3
View File
@@ -4,9 +4,8 @@
"~/Pictures/116327446_p0.jpg" "~/Pictures/116327446_p0.jpg"
], ],
"dirs": [ "dirs": [
"~/.config/backgrounds", "~/Pictures/backgrounds",
"/media/Beta/壁纸/库", "/media/Beta/壁纸/库"
"$HOME/.local/share/wallpaper/current"
], ],
"excludes": [ "excludes": [
"~/.config/backgrounds/nao-stars-crop-adjust-flop.jpg", "~/.config/backgrounds/nao-stars-crop-adjust-flop.jpg",
+8 -6
View File
@@ -1,7 +1,7 @@
/* /*
* @Author: Uyanide pywang0608@foxmail.com * @Author: Uyanide pywang0608@foxmail.com
* @Date: 2025-08-05 00:37:58 * @Date: 2025-08-05 00:37:58
* @LastEditTime: 2025-08-08 04:04:17 * @LastEditTime: 2025-10-25 12:04:38
* @Description: MainWindow implementation. * @Description: MainWindow implementation.
*/ */
#include "main_window.h" #include "main_window.h"
@@ -17,12 +17,12 @@
using namespace GeneralLogger; using namespace GeneralLogger;
static QString splitNameFromPath(const QString &path) { static QString splitNameFromPath(const QString& path) {
QFileInfo fileInfo(path); QFileInfo fileInfo(path);
return fileInfo.fileName(); return fileInfo.fileName();
} }
MainWindow::MainWindow(const Config &config, QWidget *parent) MainWindow::MainWindow(const Config& config, QWidget* parent)
: QMainWindow(parent), ui(new Ui::MainWindow), m_config(config) { : QMainWindow(parent), ui(new Ui::MainWindow), m_config(config) {
ui->setupUi(this); ui->setupUi(this);
_setupUI(); _setupUI();
@@ -33,6 +33,8 @@ MainWindow::~MainWindow() {
} }
void MainWindow::_setupUI() { void MainWindow::_setupUI() {
// change window title
setWindowTitle("Wallpaper Carousel");
// create images carousel // create images carousel
m_carousel = new ImagesCarousel( m_carousel = new ImagesCarousel(
m_config.getStyleConfig(), m_config.getStyleConfig(),
@@ -80,7 +82,7 @@ void MainWindow::_setupUI() {
m_carousel->appendImages(m_config.getWallpapers()); m_carousel->appendImages(m_config.getWallpapers());
} }
void MainWindow::keyPressEvent(QKeyEvent *event) { void MainWindow::keyPressEvent(QKeyEvent* event) {
if (event->key() == Qt::Key_Escape) { if (event->key() == Qt::Key_Escape) {
_onCancelPressed(); _onCancelPressed();
return; return;
@@ -194,7 +196,7 @@ void MainWindow::_onConfirmPressed() {
} }
} }
void MainWindow::wheelEvent(QWheelEvent *event) { void MainWindow::wheelEvent(QWheelEvent* event) {
if (m_state != Ready && m_config.getStyleConfig().noLoadingScreen) { if (m_state != Ready && m_config.getStyleConfig().noLoadingScreen) {
event->ignore(); event->ignore();
return; return;
@@ -236,7 +238,7 @@ void MainWindow::onCancel() {
close(); close();
} }
void MainWindow::_onImageFocused(const QString &path, const int index, const int count) { void MainWindow::_onImageFocused(const QString& path, const int index, const int count) {
ui->topLabel->setText(QString("%1 (%2/%3)").arg(splitNameFromPath(path)).arg(index + 1).arg(count)); ui->topLabel->setText(QString("%1 (%2/%3)").arg(splitNameFromPath(path)).arg(index + 1).arg(count));
} }