change name
This commit is contained in:
+9
-9
@@ -1,6 +1,6 @@
|
||||
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_AUTOMOC ON)
|
||||
@@ -23,7 +23,7 @@ set(PROJECT_SOURCES
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
qt_add_executable(wallpaper-chooser
|
||||
qt_add_executable(wallpaper-carousel
|
||||
MANUAL_FINALIZATION
|
||||
${PROJECT_SOURCES}
|
||||
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
|
||||
else()
|
||||
if(ANDROID)
|
||||
add_library(wallpaper-chooser SHARED
|
||||
add_library(wallpaper-carousel SHARED
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
|
||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||
else()
|
||||
add_executable(wallpaper-chooser
|
||||
add_executable(wallpaper-carousel
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
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")
|
||||
# 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)
|
||||
endif()
|
||||
|
||||
set_target_properties(wallpaper-chooser PROPERTIES
|
||||
set_target_properties(wallpaper-carousel PROPERTIES
|
||||
${BUNDLE_ID_OPTION}
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
@@ -77,12 +77,12 @@ set_target_properties(wallpaper-chooser PROPERTIES
|
||||
)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS wallpaper-chooser
|
||||
install(TARGETS wallpaper-carousel
|
||||
BUNDLE DESTINATION .
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
if(QT_VERSION_MAJOR EQUAL 6)
|
||||
qt_finalize_executable(wallpaper-chooser)
|
||||
qt_finalize_executable(wallpaper-carousel)
|
||||
endif()
|
||||
|
||||
+2
-3
@@ -4,9 +4,8 @@
|
||||
"~/Pictures/116327446_p0.jpg"
|
||||
],
|
||||
"dirs": [
|
||||
"~/.config/backgrounds",
|
||||
"/media/Beta/壁纸/库",
|
||||
"$HOME/.local/share/wallpaper/current"
|
||||
"~/Pictures/backgrounds",
|
||||
"/media/Beta/壁纸/库"
|
||||
],
|
||||
"excludes": [
|
||||
"~/.config/backgrounds/nao-stars-crop-adjust-flop.jpg",
|
||||
|
||||
+8
-6
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Author: Uyanide pywang0608@foxmail.com
|
||||
* @Date: 2025-08-05 00:37:58
|
||||
* @LastEditTime: 2025-08-08 04:04:17
|
||||
* @LastEditTime: 2025-10-25 12:04:38
|
||||
* @Description: MainWindow implementation.
|
||||
*/
|
||||
#include "main_window.h"
|
||||
@@ -17,12 +17,12 @@
|
||||
|
||||
using namespace GeneralLogger;
|
||||
|
||||
static QString splitNameFromPath(const QString &path) {
|
||||
static QString splitNameFromPath(const QString& path) {
|
||||
QFileInfo fileInfo(path);
|
||||
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) {
|
||||
ui->setupUi(this);
|
||||
_setupUI();
|
||||
@@ -33,6 +33,8 @@ MainWindow::~MainWindow() {
|
||||
}
|
||||
|
||||
void MainWindow::_setupUI() {
|
||||
// change window title
|
||||
setWindowTitle("Wallpaper Carousel");
|
||||
// create images carousel
|
||||
m_carousel = new ImagesCarousel(
|
||||
m_config.getStyleConfig(),
|
||||
@@ -80,7 +82,7 @@ void MainWindow::_setupUI() {
|
||||
m_carousel->appendImages(m_config.getWallpapers());
|
||||
}
|
||||
|
||||
void MainWindow::keyPressEvent(QKeyEvent *event) {
|
||||
void MainWindow::keyPressEvent(QKeyEvent* event) {
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
_onCancelPressed();
|
||||
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) {
|
||||
event->ignore();
|
||||
return;
|
||||
@@ -236,7 +238,7 @@ void MainWindow::onCancel() {
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user