mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
implement WelcomeWidget , fix bugs , add tutorial videos
- Introduced WelcomeWidget to display a welcome message when no devices are connected, replacing the previous "No devices detected" page in MainWindow. - Replaced ClickableLabel with ZLabel in ifusewidget.h for improved UI consistency. - Removed PCFileExplorerWidget and its associated header file, streamlining the codebase. - Updated PhotoImportDialog to improve server start process and UI elements, including renaming buttons and adjusting labels. - Modified RealtimeScreenWidget to increase delay before initializing screenshot service for better reliability. - Enhanced SimpleHttpServer to include a method for retrieving the JSON file name. - Updated ToolboxWidget to integrate WirelessPhotoImportWidget, allowing for wireless photo imports. - Added WirelessPhotoImportWidget to facilitate the selection and import of photos, including a tutorial video feature. - Created a new WelcomeWidget to guide users on connecting their iOS devices.
This commit is contained in:
+32
-52
@@ -13,19 +13,19 @@
|
||||
PhotoImportDialog::PhotoImportDialog(const QStringList &files,
|
||||
bool hasDirectories, QWidget *parent)
|
||||
: QDialog(parent), selectedFiles(files),
|
||||
containsDirectories(hasDirectories), httpServer(nullptr)
|
||||
containsDirectories(hasDirectories), m_httpServer(nullptr)
|
||||
{
|
||||
setupUI();
|
||||
setModal(true);
|
||||
resize(600, 500);
|
||||
setWindowTitle("Import Photos to iOS");
|
||||
setWindowTitle("Import Photos to iDevice - iDescriptor");
|
||||
}
|
||||
|
||||
PhotoImportDialog::~PhotoImportDialog()
|
||||
{
|
||||
if (httpServer) {
|
||||
httpServer->stop();
|
||||
delete httpServer;
|
||||
if (m_httpServer) {
|
||||
m_httpServer->stop();
|
||||
delete m_httpServer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,6 @@ void PhotoImportDialog::setupUI()
|
||||
new QLabel("⚠️ Warning: Selected items contain directories. All "
|
||||
"gallery-compatible files will be included.",
|
||||
this);
|
||||
warningLabel->setStyleSheet(
|
||||
"color: orange; font-weight: bold; padding: 10px; "
|
||||
"background-color: #fff3cd; border: 1px solid #ffeaa7; "
|
||||
"border-radius: 5px;");
|
||||
warningLabel->setWordWrap(true);
|
||||
mainLayout->addWidget(warningLabel);
|
||||
}
|
||||
@@ -65,19 +61,11 @@ void PhotoImportDialog::setupUI()
|
||||
qrCodeLabel = new QLabel(this);
|
||||
qrCodeLabel->setAlignment(Qt::AlignCenter);
|
||||
qrCodeLabel->setMinimumSize(200, 200);
|
||||
qrCodeLabel->setStyleSheet(
|
||||
"border: 1px solid #ccc; background-color: white;");
|
||||
qrCodeLabel->setText("QR Code will appear here after starting server");
|
||||
mainLayout->addWidget(qrCodeLabel);
|
||||
|
||||
// Instructions
|
||||
instructionLabel = new QLabel(
|
||||
"1. Click 'Start Server' to begin\n2. Scan the QR code to open the web "
|
||||
"interface\n3. Copy the server address and download the shortcut\n4. "
|
||||
"Run the shortcut on your iOS device to import photos",
|
||||
this);
|
||||
instructionLabel->setStyleSheet(
|
||||
"padding: 10px; background-color: #f8f9fa; border-radius: 5px;");
|
||||
instructionLabel = new QLabel("Loading", this);
|
||||
mainLayout->addWidget(instructionLabel);
|
||||
|
||||
// Progress tracking
|
||||
@@ -92,61 +80,56 @@ void PhotoImportDialog::setupUI()
|
||||
|
||||
// Buttons
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
||||
confirmButton = new QPushButton("Start Server", this);
|
||||
cancelButton = new QPushButton("Cancel", this);
|
||||
m_cancelButton = new QPushButton("Cancel", this);
|
||||
|
||||
buttonLayout->addStretch();
|
||||
buttonLayout->addWidget(confirmButton);
|
||||
buttonLayout->addWidget(cancelButton);
|
||||
buttonLayout->addWidget(m_cancelButton);
|
||||
|
||||
mainLayout->addLayout(buttonLayout);
|
||||
|
||||
connect(confirmButton, &QPushButton::clicked, this,
|
||||
&PhotoImportDialog::onConfirmImport);
|
||||
connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
|
||||
connect(m_cancelButton, &QPushButton::clicked, this, &QDialog::reject);
|
||||
|
||||
QTimer::singleShot(0, this, &PhotoImportDialog::init);
|
||||
}
|
||||
|
||||
void PhotoImportDialog::onConfirmImport()
|
||||
void PhotoImportDialog::init()
|
||||
{
|
||||
confirmButton->setEnabled(false);
|
||||
confirmButton->setText("Starting Server...");
|
||||
progressBar->setVisible(true);
|
||||
progressBar->setRange(0, 0); // Indeterminate progress
|
||||
|
||||
// Create and start HTTP server
|
||||
httpServer = new SimpleHttpServer(this);
|
||||
connect(httpServer, &SimpleHttpServer::serverStarted, this,
|
||||
m_httpServer = new SimpleHttpServer(this);
|
||||
connect(m_httpServer, &SimpleHttpServer::serverStarted, this,
|
||||
&PhotoImportDialog::onServerStarted);
|
||||
connect(httpServer, &SimpleHttpServer::serverError, this,
|
||||
connect(m_httpServer, &SimpleHttpServer::serverError, this,
|
||||
&PhotoImportDialog::onServerError);
|
||||
connect(httpServer, &SimpleHttpServer::downloadProgress, this,
|
||||
connect(m_httpServer, &SimpleHttpServer::downloadProgress, this,
|
||||
&PhotoImportDialog::onDownloadProgress);
|
||||
|
||||
httpServer->start(selectedFiles);
|
||||
m_httpServer->start(selectedFiles);
|
||||
}
|
||||
|
||||
void PhotoImportDialog::onServerStarted()
|
||||
{
|
||||
progressBar->setVisible(false);
|
||||
confirmButton->setText("Server Running");
|
||||
|
||||
QString localIP = getLocalIP();
|
||||
int port = httpServer->getPort();
|
||||
int port = m_httpServer->getPort();
|
||||
QString jsonFileName = m_httpServer->getJsonFileName();
|
||||
|
||||
// Generate QR code for the web interface
|
||||
QString webUrl = QString("http://%1:%2/").arg(localIP).arg(port);
|
||||
// generateQRCode(webUrl);
|
||||
generateQRCode(QString("shortcuts://import-shortcut?url=%1/import.shortcut")
|
||||
.arg(webUrl));
|
||||
|
||||
instructionLabel->setText(
|
||||
QString("✅ Server started at %1:%2\n\n1. Scan the QR code to open the "
|
||||
"web interface\n2. Copy the server address and download the "
|
||||
"shortcut\n3. Run the shortcut on your iOS device\n\nWeb "
|
||||
"Interface: %3")
|
||||
generateQRCode(
|
||||
QString("http://192.168.1.149:5173/?local=%1&port=%2&file=%3")
|
||||
// QString("https://uncor3.github.io/test-2?local=%1&port=%2&file=%3")
|
||||
.arg(localIP)
|
||||
.arg(port)
|
||||
.arg(webUrl));
|
||||
.arg(jsonFileName));
|
||||
|
||||
instructionLabel->setText(
|
||||
QString("Server started at %1:%2\n\n1. Scan the QR code to open the "
|
||||
"web interface\n2. Copy the server address and download the "
|
||||
"shortcut\n3. Run the shortcut on your iOS device")
|
||||
.arg(localIP)
|
||||
.arg(port));
|
||||
|
||||
progressLabel->setVisible(true);
|
||||
progressLabel->setText("Waiting for downloads...");
|
||||
@@ -158,19 +141,16 @@ void PhotoImportDialog::onDownloadProgress(const QString &fileName,
|
||||
progressLabel->setText(QString("Downloaded: %1 (%2 KB)")
|
||||
.arg(fileName)
|
||||
.arg(bytesDownloaded / 1024));
|
||||
|
||||
// You could implement more sophisticated progress tracking here
|
||||
// For now, just show which file was downloaded
|
||||
}
|
||||
|
||||
void PhotoImportDialog::onServerError(const QString &error)
|
||||
{
|
||||
progressBar->setVisible(false);
|
||||
confirmButton->setEnabled(true);
|
||||
confirmButton->setText("Start Server");
|
||||
m_cancelButton->setEnabled(true);
|
||||
|
||||
QMessageBox::critical(this, "Server Error",
|
||||
QString("Failed to start server: %1").arg(error));
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void PhotoImportDialog::generateQRCode(const QString &url)
|
||||
|
||||
Reference in New Issue
Block a user