mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-21 19:35:49 +08:00
4b81d7bdf1
- Updated README.md to include CMake command for installation. - Improved win-deploy.cmake to handle executable path issues and added detailed logging for deployment steps. - Introduced checks for runtime dependencies and optimized DLL copying logic to avoid unnecessary copies. - Added additional MinGW runtime DLLs required for GStreamer and FFmpeg. - Created idescriptor.rc for application versioning and resource management. - Updated resources.qrc to include application icon. - Modified AppsWidget to improve UI for install and download actions. - Adjusted dnssd_service.h to conditionally include headers based on platform. - Enhanced install_ipa.cpp with additional includes for better compatibility. - Updated main.cpp to set up environment variables for GStreamer on Windows. - Improved mainwindow.cpp to add a no devices detected page and integrate dependency checks. - Cleaned up mainwindow.ui by removing unnecessary layout elements. - Implemented check_deps.cpp and check_deps.h for verifying required dependencies on Windows. - Created diagnose_dialog.cpp and diagnose_dialog.h for a dialog to display dependency checks. - Developed diagnose_widget.cpp and diagnose_widget.h to manage and display dependency items. - Enhanced sshterminalwidget.cpp to improve terminal handling on Windows. - Updated welcomewidget.cpp to refine UI layout and spacing for better aesthetics.
120 lines
3.9 KiB
C++
120 lines
3.9 KiB
C++
#include "welcomewidget.h"
|
|
#include "responsiveqlabel.h"
|
|
#include <QApplication>
|
|
#include <QDesktopServices>
|
|
#include <QEvent>
|
|
#include <QFont>
|
|
#include <QMouseEvent>
|
|
#include <QPalette>
|
|
#include <QUrl>
|
|
|
|
WelcomeWidget::WelcomeWidget(QWidget *parent) : QWidget(parent) { setupUI(); }
|
|
|
|
void WelcomeWidget::setupUI()
|
|
{
|
|
// Main layout with proper spacing and margins
|
|
m_mainLayout = new QVBoxLayout(this);
|
|
m_mainLayout->setContentsMargins(5, 5, 5, 5);
|
|
m_mainLayout->setSpacing(0);
|
|
|
|
// Add top stretch
|
|
m_mainLayout->addStretch(1);
|
|
|
|
// Welcome title
|
|
m_titleLabel = createStyledLabel("Welcome to iDescriptor", 28, true);
|
|
m_titleLabel->setAlignment(Qt::AlignCenter);
|
|
m_mainLayout->addWidget(m_titleLabel);
|
|
m_mainLayout->addSpacing(12);
|
|
|
|
// Subtitle
|
|
m_subtitleLabel = createStyledLabel("100% Open-Source & Free", 16, false);
|
|
m_subtitleLabel->setAlignment(Qt::AlignCenter);
|
|
QPalette palette = m_subtitleLabel->palette();
|
|
palette.setColor(QPalette::WindowText,
|
|
palette.color(QPalette::WindowText).lighter(140));
|
|
m_subtitleLabel->setPalette(palette);
|
|
m_mainLayout->addWidget(m_subtitleLabel);
|
|
m_mainLayout->addSpacing(10);
|
|
|
|
m_imageLabel = new ResponsiveQLabel();
|
|
m_imageLabel->setPixmap(QPixmap(":/resources/connect.png"));
|
|
// Let the pixmap scale while preserving aspect ratio
|
|
m_imageLabel->setScaledContents(true);
|
|
// Prefer centered, not full-width expansion
|
|
m_imageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
// Cap size so it stays nicely centered on large windows
|
|
// m_imageLabel->setMaximumSize(480, 320);
|
|
|
|
m_imageLabel->setStyleSheet("background: transparent; border: none;");
|
|
|
|
m_imageLabel->setAlignment(Qt::AlignCenter);
|
|
m_mainLayout->addWidget(m_imageLabel, 0, Qt::AlignHCenter);
|
|
m_mainLayout->addSpacing(10);
|
|
|
|
// Instruction text
|
|
m_instructionLabel = createStyledLabel(
|
|
"Please connect an iOS device to get started", 14, false);
|
|
m_instructionLabel->setAlignment(Qt::AlignCenter);
|
|
QPalette instructionPalette = m_instructionLabel->palette();
|
|
instructionPalette.setColor(
|
|
QPalette::WindowText,
|
|
instructionPalette.color(QPalette::WindowText).lighter(120));
|
|
m_instructionLabel->setPalette(instructionPalette);
|
|
m_mainLayout->addWidget(m_instructionLabel);
|
|
m_mainLayout->addSpacing(10);
|
|
|
|
// GitHub link
|
|
m_githubLabel =
|
|
createStyledLabel("Found an issue? Report it on GitHub", 12, false);
|
|
m_githubLabel->setAlignment(Qt::AlignCenter);
|
|
m_githubLabel->setCursor(Qt::PointingHandCursor);
|
|
|
|
// Make it look like a link
|
|
QPalette githubPalette = m_githubLabel->palette();
|
|
githubPalette.setColor(QPalette::WindowText,
|
|
QColor(0, 122, 255)); // Apple blue
|
|
m_githubLabel->setPalette(githubPalette);
|
|
|
|
// Connect click functionality using installEventFilter
|
|
m_githubLabel->installEventFilter(this);
|
|
|
|
m_mainLayout->addWidget(m_githubLabel);
|
|
|
|
// Add bottom stretch
|
|
m_mainLayout->addStretch(1);
|
|
|
|
// Set minimum size
|
|
setMinimumSize(600, 500);
|
|
}
|
|
|
|
QLabel *WelcomeWidget::createStyledLabel(const QString &text, int fontSize,
|
|
bool isBold)
|
|
{
|
|
QLabel *label = new QLabel(text);
|
|
|
|
QFont font = label->font();
|
|
if (fontSize > 0) {
|
|
font.setPointSize(fontSize);
|
|
}
|
|
if (isBold) {
|
|
font.setWeight(QFont::Medium);
|
|
}
|
|
|
|
label->setFont(font);
|
|
label->setWordWrap(true);
|
|
|
|
return label;
|
|
}
|
|
|
|
bool WelcomeWidget::eventFilter(QObject *watched, QEvent *event)
|
|
{
|
|
if (watched == m_githubLabel && event->type() == QEvent::MouseButtonPress) {
|
|
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
|
if (mouseEvent->button() == Qt::LeftButton) {
|
|
QDesktopServices::openUrl(
|
|
QUrl("https://github.com/uncor3/iDescriptor"));
|
|
return true;
|
|
}
|
|
}
|
|
return QWidget::eventFilter(watched, event);
|
|
} |