Skip to content

Commit

Permalink
feat: 完成更新程序,在下载器主界面增加更新按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramCX committed Aug 15, 2024
1 parent b58d236 commit 1df46f1
Show file tree
Hide file tree
Showing 80 changed files with 55,698 additions and 148 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ temp/
*.pem
*.zip


*.pfx
Binary file modified src/Plugin/Chrome/SecondDownloader.zip
Binary file not shown.
41 changes: 41 additions & 0 deletions src/SecondDownloader/cpp/frmextention.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "ui_frmextention.h"
#include "QDesktopServices"
#include "downloadmessagewindow.h"
#include <dialogcrtinf.h>
frmExtention::frmExtention(QWidget *parent)
: QWidget(parent)
, ui(new Ui::frmExtention)
Expand Down Expand Up @@ -29,3 +30,43 @@ void frmExtention::on_btnCrx_clicked()
dm->show();
}


void frmExtention::on_btnchrome_clicked()
{
DialogCrtInf da;
QString title="暂时不受支持";
QString text="暂时不支持谷歌浏览器,未来将添加支持!";
da.setTitle(title);
da.setText(text);
da.exec();
}


void frmExtention::on_btn360_clicked()
{
DialogCrtInf da;
QString title="暂时不能很好兼容";
QString text="暂时不支持360浏览器,未来将尽力兼容!";
da.setTitle(title);
da.setText(text);
da.exec();
}


void frmExtention::on_btnMolizza_clicked()
{
DialogCrtInf da;
QString title="暂时不受支持";
QString text="暂时不支持火狐浏览器,未来将添加支持!";
da.setTitle(title);
da.setText(text);
da.exec();
}


void frmExtention::on_btnmsedge_clicked()
{
QString videoBilibili="https://www.bilibili.com/video/BV1ecete1Eim/?vd_source=1f53d50e4c3a6bc4aae303ad114ef2c0";
QDesktopServices::openUrl(QUrl(videoBilibili));
}

35 changes: 35 additions & 0 deletions src/SecondDownloader/cpp/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "QRegularExpression"
#include "downloadmessagewindow.h"
#include "QSettings"

MainWindow::MainWindow(int mode, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
Expand Down Expand Up @@ -84,6 +85,8 @@ MainWindow::MainWindow(int mode, QWidget *parent)
connect(ui->toolDonate,&QToolButton::clicked,this,&MainWindow::on_toolDonate_clicked);
connect(ui->toolSettings,&QToolButton::clicked,this,&MainWindow::on_toolSettings_clicked);
connect(ui->toolFeedback,&QToolButton::clicked,this,&MainWindow::on_toolFeedback_clicked);
connect(ui->toolUpdate,&QToolButton::clicked,this,&MainWindow::on_toolUpdate_clicked);
pro=new QProcess(this);



Expand Down Expand Up @@ -172,6 +175,8 @@ void MainWindow::setClassToolButtonStyle()
ui->toolSettings->setIcon(QIcon(":/MainWindow/res/Settings_dark.png"));
ui->toolMenu->setIcon(QIcon(":/MainWindow/res/Menu_dark.png"));
ui->toolFeedback->setIcon(QIcon(":/MainWindow/res/feedback_dark.png"));


}else{
ui->toolMain->setIcon(QIcon(":/MainWindow/res/Main-Page_white.png"));
ui->toolDownload->setIcon(QIcon(":/MainWindow/res/Download-Content_white.png"));
Expand All @@ -180,6 +185,7 @@ void MainWindow::setClassToolButtonStyle()
ui->toolFeedback->setIcon(QIcon(":/MainWindow/res/feedback_white.png"));
ui->toolMenu->setIcon(QIcon(":/MainWindow/res/Menu_white.png"));
}
ui->toolUpdate->setIcon(QIcon(":/frmmain/res/update.png"));

QSettings settings("Pinsoft","SecondDownloader");
bool maxed=settings.value("MainWindow/ToolbarMaxed",0).toBool();
Expand All @@ -189,6 +195,8 @@ void MainWindow::setClassToolButtonStyle()
ui->toolDonate->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui->toolSettings->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui->toolFeedback->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui->toolUpdate->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

ui->toolMain->setMinimumWidth(201);
ui->toolMain->setFixedWidth(201);

Expand All @@ -204,12 +212,17 @@ void MainWindow::setClassToolButtonStyle()
ui->toolFeedback->setMinimumWidth(201);
ui->toolFeedback->setFixedWidth(201);

ui->toolUpdate->setMinimumWidth(201);
ui->toolUpdate->setFixedWidth(201);

}else{
ui->toolMain->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui->toolDownload->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui->toolDonate->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui->toolSettings->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui->toolFeedback->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui->toolUpdate->setToolButtonStyle(Qt::ToolButtonIconOnly);

ui->toolMain->setMinimumWidth(35);
ui->toolMain->setFixedWidth(35);

Expand All @@ -225,6 +238,9 @@ void MainWindow::setClassToolButtonStyle()
ui->toolFeedback->setMinimumWidth(35);
ui->toolFeedback->setFixedWidth(35);

ui->toolUpdate->setMinimumWidth(35);
ui->toolUpdate->setFixedWidth(35);

}
ui->toolMenu->setChecked(!maxed);
}
Expand All @@ -246,6 +262,8 @@ void MainWindow::on_toolMenu_clicked()
ui->toolDonate->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui->toolSettings->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui->toolFeedback->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui->toolUpdate->setToolButtonStyle(Qt::ToolButtonIconOnly);

ui->toolMain->setMinimumWidth(35);
ui->toolMain->setFixedWidth(35);

Expand All @@ -261,6 +279,9 @@ void MainWindow::on_toolMenu_clicked()
ui->toolFeedback->setMinimumWidth(35);
ui->toolFeedback->setFixedWidth(35);

ui->toolUpdate->setMinimumWidth(35);
ui->toolUpdate->setFixedWidth(35);



}else{
Expand All @@ -269,6 +290,8 @@ void MainWindow::on_toolMenu_clicked()
ui->toolDonate->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui->toolSettings->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui->toolFeedback->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui->toolUpdate->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

ui->toolMain->setMinimumWidth(201);
ui->toolMain->setFixedWidth(201);

Expand All @@ -284,6 +307,9 @@ void MainWindow::on_toolMenu_clicked()
ui->toolFeedback->setMinimumWidth(201);
ui->toolFeedback->setFixedWidth(201);

ui->toolUpdate->setMinimumWidth(201);
ui->toolUpdate->setFixedWidth(201);


}

Expand Down Expand Up @@ -488,3 +514,12 @@ void MainWindow::on_toolFeedback_clicked()
setCommonStyle();
}


void MainWindow::on_toolUpdate_clicked()
{


pro->start("Update.exe");

}

8 changes: 8 additions & 0 deletions src/SecondDownloader/header/frmextention.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ private slots:

void on_btnCrx_clicked();

void on_btnchrome_clicked();

void on_btn360_clicked();

void on_btnMolizza_clicked();

void on_btnmsedge_clicked();

private:
Ui::frmExtention *ui;
};
Expand Down
5 changes: 5 additions & 0 deletions src/SecondDownloader/header/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "frmdonate.h"
#include "frmfeedback.h"
#include <downloadwindow.h>
#include<QProcess>
namespace Ui {
class MainWindow;
}
Expand All @@ -30,6 +31,8 @@ class MainWindow : public QMainWindow
QTimer *tmGetClipUrl;
QTimer *tmNeedLaunchGetUrl;
QStringList LastUrlList;

QProcess *pro;
void addToLastUrlList();
private slots:
void on_toolMenu_clicked();
Expand All @@ -48,6 +51,8 @@ private slots:

void on_toolFeedback_clicked();

void on_toolUpdate_clicked();

private:
Ui::MainWindow *ui;
bool isDownloading();
Expand Down
1 change: 1 addition & 0 deletions src/SecondDownloader/qrc/qss.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<file>res/Main-Page_dark.png</file>
<file>res/Menu_dark.png</file>
<file>res/Settings_dark.png</file>
<file>res/update.png</file>
</qresource>
<qresource prefix="/common">
<file>qss/white_base.qss</file>
Expand Down
Binary file added src/SecondDownloader/qrc/res/update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions src/SecondDownloader/ui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,54 @@ QProgressBar::chunk {
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolUpdate">
<property name="minimumSize">
<size>
<width>201</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>201</width>
<height>35</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string> 检查更新</string>
</property>
<property name="iconSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRepeat">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
<property name="popupMode">
<enum>QToolButton::DelayedPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolFeedback">
<property name="minimumSize">
Expand Down
Binary file not shown.
Binary file not shown.
72 changes: 72 additions & 0 deletions src/Setup/packages/TaskScheduler.2.11.0/TaskService.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
## About
The original and most popular .NET wrapper for the [Windows Task Scheduler](https://docs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page). It provides functionally complete classes that cover all development aspects related to system tasks.

More information can be found on the [project page on GitHub](https://github.com/dahall/taskscheduler).

## Support
Below are links to sites that provide in-depth examples, documentation and discussions. Please go here first with your questions as the community has been active for over a decade.
* [Wiki](https://github.com/dahall/TaskScheduler/wiki) - Sample code, library how-to, troubleshooting, etc.
* [API documentation](https://dahall.github.io/TaskScheduler) - Class/method/property documentation and examples
* [Full Issues Log](https://github.com/dahall/TaskScheduler/issues?q=) - Use the search box to see if your question may already be answered.
* [Discussion Forum](https://github.com/dahall/TaskScheduler/discussions) - Users helping users, enhancement requests, Q&A (retired Google forum [here](https://groups.google.com/forum/#!forum/taskscheduler))
* [Troubleshooting Tool](https://github.com/dahall/TaskSchedulerConfig) - Tool to help identify and fix configuration and connectivity issues. (ClickOnce installer [here](https://github.com/dahall/TaskSchedulerConfig/blob/master/publish/setup.exe?raw=true))

## Key Features
Microsoft introduced version 2.0 (internally version 1.2) with a completely new object model with Windows Vista. The managed assembly closely resembles the new object model but allows the 1.0 (internally version 1.1) COM objects to be manipulated. It will automatically choose the most recent version of the library found on the host system (up through 1.4). Core features include:

* Separate, functionally identical, libraries for .NET 2.0, 3.5, 4.0, 4.52, 5.0, 6.0, .NET Standard 2.0, .NET Core 2.0, 2.1, 3.0, 3.1.
* Unlike the base COM libraries, this wrapper accommodates creating and viewing tasks up and down stream.
* Supports all V2 native properties, even under V1 tasks.
* Maintain EmailAction and ShowMessageAction using PowerShell scripts for systems after Win8 where these actions have been deprecated.
* Supports all action types (not just ExecAction) on V1 systems (XP/WS2003) and earlier (if PowerShell is installed).
* Supports multiple actions on V1 systems (XP/WS2003). Native library only supports a single action.
* Supports serialization to XML for both 1.0 and 2.0 tasks (base library only supports 2.0)
* Supports task validation for targeted version.
* Supports secure task reading and maintenance.
* Fluent methods for task creation.
* Cron syntax for trigger creation.

The currently supported localizations include: English, Spanish, Italian, French, Chinese (Simplified), German, Polish and Russian.

## Usage
You can perform several actions in a single line of code:
```C#
// Run a program every day on the local machine
TaskService.Instance.AddTask("Test", QuickTriggerType.Daily, "myprogram.exe", "-a arg");

// Run a custom COM handler on the last day of every month
TaskService.Instance.AddTask("Test", new MonthlyTrigger { RunOnLastDayOfMonth = true },
new ComHandlerAction(new Guid("{CE7D4428-8A77-4c5d-8A13-5CAB5D1EC734}")));
```

For many more options, use the library classes to build a complex task. Below is a brief example of how to use the library from C#.
```C#
using System;
using Microsoft.Win32.TaskScheduler;

class Program
{
static void Main()
{
// Get the service on the remote machine
using (TaskService ts = new TaskService(@"\\RemoteServer", "username", "domain", "password"))
{
// Create a new task definition and assign properties
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "Does something";

// Create a trigger that will fire the task at this time every other day
td.Triggers.Add(new DailyTrigger { DaysInterval = 2 });

// Create an action that will launch Notepad whenever the trigger fires
td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null));

// Register the task in the root folder.
// (Use the username here to ensure remote registration works.)
ts.RootFolder.RegisterTaskDefinition(@"Test", td, TaskCreation.CreateOrUpdate, "username");
}
}
}
```

For extended examples on how to the use the library, look at the [Examples Page](https://github.com/dahall/TaskScheduler/wiki/Examples).
Loading

0 comments on commit 1df46f1

Please sign in to comment.