-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
237 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
File renamed without changes
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>chatgpt.png</file> | ||
<file>index.html</file> | ||
<file>assets/ChatGPT.svg</file> | ||
<file>assets/doubao.png</file> | ||
<file>assets/gpt.png</file> | ||
<file>assets/tongyi.png</file> | ||
<file>assets/yiyan.png</file> | ||
</qresource> | ||
</RCC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "mainwindow.h" | ||
|
||
#include <QApplication> | ||
#include <QtWebEngineWidgets/QWebEngineView> | ||
#include <QUrl> | ||
#include <QIcon> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication a(argc, argv); | ||
a.setWindowIcon(QIcon(":/assets/gpt.png")); | ||
|
||
MainWindow w; | ||
w.resize(1024,768); | ||
w.show(); | ||
|
||
//https://chat.openai.com | ||
//https://yiyan.baidu.com | ||
//https://tongyi.aliyun.com/qianwen | ||
//https://www.doubao.com | ||
|
||
// QWebEngineView view; | ||
// view.setUrl(QUrl("https://chat.openai.com")); | ||
// view.resize(1024, 768); | ||
// view.show(); | ||
|
||
return a.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "mainwindow.h" | ||
#include "./ui_mainwindow.h" | ||
|
||
#include <QtWebEngineWidgets/QWebEngineView> | ||
#include <QUrl> | ||
#include <QIcon> | ||
|
||
#define CHATGPT_URL "https://chat.openai.com" | ||
#define YIYAN_URL "https://yiyan.baidu.com" | ||
#define TONGYI_URL "https://tongyi.aliyun.com/qianwen" | ||
#define DOUBAO_URL "https://www.doubao.com" | ||
|
||
MainWindow::MainWindow(QWidget *parent) | ||
: QMainWindow{parent} | ||
, ui(new Ui::MainWindow) | ||
, view(new QWebEngineView) | ||
{ | ||
ui->setupUi(this); | ||
show_web_view(CHATGPT_URL); | ||
setCentralWidget(view); | ||
} | ||
|
||
MainWindow::~MainWindow() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void MainWindow::show_web_view(QString url) | ||
{ | ||
view->load(QUrl(url)); | ||
QString script = R"( | ||
document.documentElement.style.overflow = 'hidden'; | ||
document.documentElement.style.height = '100vh'; | ||
document.documentElement.style.margin = 0; | ||
document.body.style.overflow = 'hidden'; | ||
document.body.style.height = '100vh'; | ||
document.body.style.margin = 0; | ||
)"; | ||
|
||
view->page()->runJavaScript(script); | ||
} | ||
|
||
void MainWindow::on_actChatGPT_triggered() | ||
{ | ||
show_web_view(CHATGPT_URL); | ||
} | ||
|
||
|
||
void MainWindow::on_actYiyan_triggered() | ||
{ | ||
show_web_view(YIYAN_URL); | ||
} | ||
|
||
|
||
void MainWindow::on_actTongyi_triggered() | ||
{ | ||
show_web_view(TONGYI_URL); | ||
} | ||
|
||
|
||
void MainWindow::on_actDoubao_triggered() | ||
{ | ||
show_web_view(DOUBAO_URL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef MAINWINDOW_H | ||
#define MAINWINDOW_H | ||
|
||
#include <QMainWindow> | ||
|
||
class QWebEngineView; | ||
|
||
QT_BEGIN_NAMESPACE | ||
namespace Ui { | ||
class MainWindow; | ||
} | ||
QT_END_NAMESPACE | ||
|
||
class MainWindow : public QMainWindow | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit MainWindow(QWidget *parent = nullptr); | ||
~MainWindow(); | ||
|
||
private slots: | ||
void on_actChatGPT_triggered(); | ||
|
||
void on_actYiyan_triggered(); | ||
|
||
void on_actTongyi_triggered(); | ||
|
||
void on_actDoubao_triggered(); | ||
|
||
private: | ||
void show_web_view(QString url); | ||
|
||
private: | ||
Ui::MainWindow *ui; | ||
QWebEngineView *view; | ||
}; | ||
|
||
#endif // MAINWINDOW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>MainWindow</class> | ||
<widget class="QMainWindow" name="MainWindow"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>725</width> | ||
<height>600</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>MainWindow</string> | ||
</property> | ||
<widget class="QWidget" name="centralwidget"/> | ||
<widget class="QMenuBar" name="menubar"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>725</width> | ||
<height>24</height> | ||
</rect> | ||
</property> | ||
<widget class="QMenu" name="menuSwitch_GPT"> | ||
<property name="title"> | ||
<string>Switch GPT</string> | ||
</property> | ||
<addaction name="actChatGPT"/> | ||
<addaction name="actYiyan"/> | ||
<addaction name="actTongyi"/> | ||
<addaction name="actDoubao"/> | ||
</widget> | ||
<addaction name="menuSwitch_GPT"/> | ||
</widget> | ||
<action name="actChatGPT"> | ||
<property name="icon"> | ||
<iconset> | ||
<normaloff>:/assets/ChatGPT.svg</normaloff>:/assets/ChatGPT.svg</iconset> | ||
</property> | ||
<property name="text"> | ||
<string>ChatGPT</string> | ||
</property> | ||
</action> | ||
<action name="actYiyan"> | ||
<property name="icon"> | ||
<iconset> | ||
<normaloff>:/assets/yiyan.png</normaloff>:/assets/yiyan.png</iconset> | ||
</property> | ||
<property name="text"> | ||
<string>文心一言</string> | ||
</property> | ||
<property name="iconText"> | ||
<string>文心一言</string> | ||
</property> | ||
</action> | ||
<action name="actTongyi"> | ||
<property name="icon"> | ||
<iconset> | ||
<normaloff>:/assets/tongyi.png</normaloff>:/assets/tongyi.png</iconset> | ||
</property> | ||
<property name="text"> | ||
<string>通义千问</string> | ||
</property> | ||
</action> | ||
<action name="actDoubao"> | ||
<property name="icon"> | ||
<iconset> | ||
<normaloff>:/assets/doubao.png</normaloff>:/assets/doubao.png</iconset> | ||
</property> | ||
<property name="text"> | ||
<string>字节豆包</string> | ||
</property> | ||
</action> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |