sui界面采用继承方式呈现,铺设整个软件GUI样式
This commit is contained in:
parent
3c8b1c2e8e
commit
537944bf0c
Binary file not shown.
Before Width: | Height: | Size: 314 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 76 KiB |
@ -1,63 +0,0 @@
|
||||
repo_path = ex_base_exe_ex.toStdString() + target_name;
|
||||
std::cout << "target_name: " << target_name << std::endl;
|
||||
std::cout << "repo_path: " << repo_path << std::endl;
|
||||
std::cout << "src_name: " << src_name << std::endl;
|
||||
std::cout << "remote_url: " << remote_url << std::endl;
|
||||
/*
|
||||
if (git_mode == GIT_MODE::BRANCH)
|
||||
{
|
||||
clone_branch();
|
||||
}
|
||||
else if (git_mode == GIT_MODE::TAG)
|
||||
{
|
||||
clone_tag();
|
||||
}
|
||||
*/
|
||||
git_libgit2_init();
|
||||
// create a bare local repository
|
||||
git_repository_init(&repo, repo_path.c_str(), false);
|
||||
// set remote url
|
||||
git_remote_create(&remote, repo, "origin", remote_url.c_str());
|
||||
// generate refspec
|
||||
// http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions
|
||||
std::string refspec; // for git fetch
|
||||
std::string revspec; // for git checkout
|
||||
/*
|
||||
if (branch_name.size())
|
||||
{
|
||||
refspec = "+refs/heads/" + branch_name + ":refs/remotes/origin/" + branch_name;
|
||||
revspec = "refs/remotes/origin/" + branch_name;
|
||||
}
|
||||
*/
|
||||
std::string target_name="457140_457141_5898877434354585407";
|
||||
if (target_name.size())
|
||||
{
|
||||
refspec = "+refs/tags/" + target_name + ":refs/tags/" + target_name;
|
||||
revspec = "refs/tags/"+target_name;
|
||||
}
|
||||
// construct fetch_opts and run fetch
|
||||
// for libgit:v1.7.0 the GIT_FETCH_OPTIONS_INIT was
|
||||
// missing some field, so we must assign then manually.
|
||||
char *refspec_addr[] = {refspec.data()};
|
||||
git_strarray refspecs{refspec_addr, 1};
|
||||
|
||||
git_fetch_options fetch_opt = GIT_FETCH_OPTIONS_INIT;
|
||||
fetch_opt.proxy_opts.type = GIT_PROXY_AUTO;
|
||||
fetch_opt.depth = 1;
|
||||
fetch_opt.follow_redirects = GIT_REMOTE_REDIRECT_INITIAL;
|
||||
fetch_opt.custom_headers = git_strarray{nullptr, 0};
|
||||
git_remote_fetch(remote, &refspecs, &fetch_opt, NULL);
|
||||
|
||||
// find revision
|
||||
git_object *rev;
|
||||
git_revparse_single(&rev, repo, revspec.c_str());
|
||||
|
||||
// git checkout $branch
|
||||
// git checkout tags/$tag
|
||||
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
|
||||
git_reset(repo, rev, GIT_RESET_HARD, &checkout_opts);
|
||||
|
||||
// finally close
|
||||
git_remote_free(remote);
|
||||
git_repository_free(repo);
|
@ -1,5 +1,5 @@
|
||||
#include <QApplication>
|
||||
#include "sui.h"
|
||||
#include "xsteam_ui.h"
|
||||
#include <QTranslator>
|
||||
#include "xsteam_base_ex.h"
|
||||
|
||||
@ -15,7 +15,9 @@ int main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
a.installTranslator(&qtBaseTranslator);
|
||||
sui x;
|
||||
xsteam_init_opts();
|
||||
xsteam_ui x;
|
||||
x.xsteam_init_layout();
|
||||
x.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
19
src/sui.cpp
19
src/sui.cpp
@ -1,27 +1,25 @@
|
||||
#include "sui.h"
|
||||
sui::sui(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_widget(new QWidget),
|
||||
sui::sui(QDialog *parent)
|
||||
: QDialog(parent),
|
||||
m_widget(new QDialog),
|
||||
m_layout(new QVBoxLayout),
|
||||
m_press(false),
|
||||
m_border_width(5)
|
||||
{
|
||||
QFuture<void> future = QtConcurrent::run([=]()
|
||||
{ xsteam_init_opts();});
|
||||
|
||||
init_layout();
|
||||
}
|
||||
sui::~sui()
|
||||
{
|
||||
|
||||
}
|
||||
void sui::init_layout()
|
||||
{
|
||||
m_title=new sui_title(this);
|
||||
m_title->set_title_txt(tr("XSteam"));
|
||||
m_qwidget=new xsteam_ui(m_title);
|
||||
setObjectName(tr("m_widget"));
|
||||
m_layout->addWidget(m_title);
|
||||
m_title->setMouseTracking(true);
|
||||
m_layout->addWidget(m_qwidget);
|
||||
m_layout->setContentsMargins(5, 5, 5, 5);
|
||||
m_layout->setSpacing(0);
|
||||
setWindowFlags(Qt::FramelessWindowHint);
|
||||
@ -30,8 +28,11 @@ void sui::init_layout()
|
||||
setBaseSize(800, 600);
|
||||
resize(800, 600);
|
||||
setLayout(m_layout);
|
||||
connect(m_title, SIGNAL(signals_close()), this, SLOT(slots_close()));
|
||||
}
|
||||
void sui::slots_close(){
|
||||
this->close();
|
||||
}
|
||||
|
||||
void sui::showEvent(QShowEvent *event)
|
||||
{
|
||||
this->setAttribute(Qt::WA_Mapped);
|
||||
@ -76,7 +77,7 @@ void sui::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
||||
bool sui::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
|
||||
{
|
||||
Q_UNUSED(eventType)
|
||||
//Q_UNUSED(eventType)
|
||||
|
||||
MSG *param = static_cast<MSG *>(message);
|
||||
|
||||
|
11
src/sui.h
11
src/sui.h
@ -9,17 +9,15 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
#endif
|
||||
#include "sui_title.h"
|
||||
#include "xsteam_ui.h"
|
||||
class sui : public QWidget
|
||||
class sui : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit sui(QWidget *parent = 0);
|
||||
explicit sui(QDialog *parent = 0);
|
||||
~sui();
|
||||
|
||||
sui_title* title() { return m_title; }
|
||||
private:
|
||||
void init_layout();
|
||||
|
||||
private:
|
||||
QVBoxLayout *m_layout;
|
||||
QWidget *m_widget;
|
||||
@ -27,7 +25,8 @@ private:
|
||||
bool m_press;
|
||||
int m_border_width;
|
||||
sui_title* m_title;
|
||||
xsteam_ui* m_qwidget;
|
||||
public slots:
|
||||
void slots_close();
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void showEvent(QShowEvent *event);
|
||||
|
@ -6,6 +6,7 @@ sui_title::sui_title(QWidget *parent)
|
||||
f_menu(nullptr)
|
||||
{
|
||||
m_parent = parent;
|
||||
m_type=QD_TYPE::QD_EXIT;
|
||||
// 给成员变量申请内存
|
||||
m_icon_button = new QPushButton(/*this*/);
|
||||
m_min_button = new QPushButton(this);
|
||||
@ -56,7 +57,7 @@ sui_title::sui_title(QWidget *parent)
|
||||
m_layout->addWidget(m_max_button);
|
||||
m_layout->addWidget(m_close_button);
|
||||
m_layout->setSpacing(5);
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
m_layout->setContentsMargins(5, 0, 5, 0);
|
||||
setFixedHeight(40);
|
||||
setLayout(m_layout);
|
||||
QFontDatabase database;
|
||||
@ -73,6 +74,7 @@ sui_title::sui_title(QWidget *parent)
|
||||
sui_title::~sui_title()
|
||||
{
|
||||
}
|
||||
|
||||
void sui_title::connect_slots()
|
||||
{
|
||||
// 连接三个按钮的信号槽3
|
||||
@ -231,12 +233,19 @@ void sui_title::on_clicked()
|
||||
pWindow->isFullScreen() ? pWindow->showNormal() : pWindow->showFullScreen();
|
||||
}
|
||||
else if (pButton == m_close_button)
|
||||
{
|
||||
if (m_type == QD_TYPE::QD_CLOSE)
|
||||
{
|
||||
emit signals_close();
|
||||
}
|
||||
else if (m_type == QD_TYPE::QD_EXIT)
|
||||
{
|
||||
xsteam_save_data_write();
|
||||
QApplication::quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 最大化/还原
|
||||
void sui_title::up_maximize()
|
||||
{
|
||||
@ -261,6 +270,10 @@ void sui_title::up_maximize()
|
||||
m_max_button->setStyle(QApplication::style());
|
||||
}
|
||||
}
|
||||
void sui_title::set_type(QD_TYPE _type)
|
||||
{
|
||||
m_type = _type;
|
||||
}
|
||||
void sui_title::set_title_txt(QString str)
|
||||
{
|
||||
m_title_label->setText(str);
|
||||
|
@ -18,6 +18,12 @@
|
||||
#include <QFontDatabase>
|
||||
#include <QStyleFactory>
|
||||
#include "xsteam_ex.h"
|
||||
|
||||
typedef enum{
|
||||
QD_CLOSE,
|
||||
QD_EXIT
|
||||
} QD_TYPE;
|
||||
|
||||
class sui_title: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -25,6 +31,7 @@ public:
|
||||
explicit sui_title(QWidget *parent = nullptr);
|
||||
~sui_title();
|
||||
void set_title_txt(QString str);
|
||||
void set_type(QD_TYPE _type);
|
||||
protected:
|
||||
//双击标题栏进行界面的最大化/还原
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
@ -50,9 +57,12 @@ private:
|
||||
QMenu* f_menu;
|
||||
QStringList style_table;
|
||||
QStringList font_table;
|
||||
QD_TYPE m_type;
|
||||
public slots:
|
||||
void slots_ico_menu();
|
||||
void slots_set_style_change();
|
||||
void slots_set_font_change();
|
||||
signals:
|
||||
void signals_close();
|
||||
};
|
||||
#endif
|
@ -9,30 +9,13 @@ xsteam_src_edit_ui::xsteam_src_edit_ui()
|
||||
xsteam_src_edit_ui::~xsteam_src_edit_ui()
|
||||
{
|
||||
}
|
||||
void xsteam_src_edit_ui::init_table_view_style()
|
||||
{
|
||||
m_Table->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_Table->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_Table->setSortingEnabled(false);
|
||||
m_Table->verticalHeader()->hide();
|
||||
m_Table->setWordWrap(false);
|
||||
m_Table->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_Table->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_Table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
m_Table->setShowGrid(false);
|
||||
m_Table->setFrameShape(QFrame::NoFrame);
|
||||
m_Table->horizontalHeader()->setStretchLastSection(true);
|
||||
m_Table->setColumnWidth(0, m_Table->width() / 5);
|
||||
}
|
||||
|
||||
void xsteam_src_edit_ui::init_src_edit_ui()
|
||||
{
|
||||
setWindowTitle(tr("XSteam源数据"));
|
||||
src_group = new QGroupBox(tr("源信息表"));
|
||||
src_group->setObjectName("SRC_GROUP");
|
||||
|
||||
gr_Layout = new QVBoxLayout();
|
||||
main_Layout = new QVBoxLayout;
|
||||
foot_Layout = new QHBoxLayout;
|
||||
m_Table = new QTableView;
|
||||
m_Model = new QStandardItemModel();
|
||||
@ -50,11 +33,25 @@ void xsteam_src_edit_ui::init_src_edit_ui()
|
||||
gr_Layout->setStretch(1, 2);
|
||||
gr_Layout->setContentsMargins(2, 2, 2, 2);
|
||||
src_group->setLayout(gr_Layout);
|
||||
main_Layout->addWidget(src_group);
|
||||
setLayout(main_Layout);
|
||||
layout()->addWidget(src_group);
|
||||
init_table_view_style();
|
||||
connect_slots();
|
||||
}
|
||||
void xsteam_src_edit_ui::init_table_view_style()
|
||||
{
|
||||
m_Table->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_Table->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_Table->setSortingEnabled(false);
|
||||
m_Table->verticalHeader()->hide();
|
||||
m_Table->setWordWrap(false);
|
||||
m_Table->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_Table->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_Table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
m_Table->setShowGrid(false);
|
||||
m_Table->setFrameShape(QFrame::NoFrame);
|
||||
m_Table->horizontalHeader()->setStretchLastSection(true);
|
||||
m_Table->setColumnWidth(0, m_Table->width() / 5);
|
||||
}
|
||||
void xsteam_src_edit_ui::connect_slots()
|
||||
{
|
||||
m_Table->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
@ -17,8 +17,9 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include "xsteam_git.h"
|
||||
#include "sui.h"
|
||||
|
||||
class xsteam_src_edit_ui : public QDialog
|
||||
class xsteam_src_edit_ui : public sui
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -31,6 +32,7 @@ public:
|
||||
if (!_instance)
|
||||
{
|
||||
_instance = new xsteam_src_edit_ui();
|
||||
_instance->title()->set_type(QD_CLOSE);
|
||||
}
|
||||
mutex.unlock();
|
||||
}
|
||||
@ -51,7 +53,6 @@ private:
|
||||
void connect_slots();
|
||||
QGroupBox* src_group;
|
||||
QVBoxLayout *gr_Layout;
|
||||
QVBoxLayout *main_Layout;
|
||||
QHBoxLayout *foot_Layout;
|
||||
QStandardItemModel *m_Model = {};
|
||||
QTableView *m_Table = {};
|
||||
|
@ -1,14 +1,15 @@
|
||||
#include "xsteam_ui.h"
|
||||
xsteam_ui::xsteam_ui(QWidget *parent) : QWidget(parent),
|
||||
main_layout(new QVBoxLayout),
|
||||
info_layout(new QHBoxLayout),
|
||||
mind_layout(new QVBoxLayout),
|
||||
foot_layout(new QHBoxLayout)
|
||||
xsteam_ui::xsteam_ui()
|
||||
{
|
||||
|
||||
}
|
||||
xsteam_ui::~xsteam_ui()
|
||||
{
|
||||
}
|
||||
void xsteam_ui::xsteam_init_layout(){
|
||||
xsteam_init_info_layout();
|
||||
xsteam_init_mind_layout();
|
||||
xsteam_init_foot_layout();
|
||||
xsteam_init_style();
|
||||
xsteam_init_main_layout();
|
||||
xsteam_init_connect();
|
||||
slots_disable_enable_function(false);
|
||||
@ -26,19 +27,17 @@ xsteam_ui::xsteam_ui(QWidget *parent) : QWidget(parent),
|
||||
btn_uid_push->setEnabled(false);
|
||||
} });
|
||||
}
|
||||
xsteam_ui::~xsteam_ui()
|
||||
{
|
||||
}
|
||||
void xsteam_ui::xsteam_init_main_layout()
|
||||
{
|
||||
main_layout->addLayout(mind_layout);
|
||||
main_layout->addLayout(foot_layout);
|
||||
setLayout(main_layout);
|
||||
layout()->addWidget(mind_widget);
|
||||
layout()->addWidget(foot_widget);
|
||||
layout()->setSpacing(0);
|
||||
layout()->setContentsMargins(5, 5, 5, 5);
|
||||
}
|
||||
void xsteam_ui::xsteam_init_info_layout()
|
||||
{
|
||||
info_layout = new QHBoxLayout();
|
||||
info_txt_tag = new QLabel(tr("本工具建议配合SteamTools和Steam++使用"));
|
||||
info_txt_tag = new QLabel();
|
||||
info_txt_tag->setObjectName("INFO");
|
||||
info_layout->addItem(sparcer_item);
|
||||
info_layout->addWidget(info_txt_tag);
|
||||
@ -46,6 +45,8 @@ void xsteam_ui::xsteam_init_info_layout()
|
||||
}
|
||||
void xsteam_ui::xsteam_init_mind_layout()
|
||||
{
|
||||
mind_widget=new QWidget();
|
||||
mind_layout=new QVBoxLayout();
|
||||
server_layout = new QHBoxLayout();
|
||||
server_tag = new QLabel(tr("源数据:"));
|
||||
server_tag->setObjectName("SRC_SERVER");
|
||||
@ -143,15 +144,19 @@ void xsteam_ui::xsteam_init_mind_layout()
|
||||
mind_layout->addLayout(server_layout);
|
||||
mind_layout->addLayout(info_layout);
|
||||
mind_layout->addLayout(ip_data_layout);
|
||||
mind_layout->setContentsMargins(5, 0, 5, 0);
|
||||
mind_widget->setLayout(mind_layout);
|
||||
}
|
||||
void xsteam_ui::xsteam_init_foot_layout()
|
||||
{
|
||||
foot_widget=new QWidget();
|
||||
foot_layout=new QHBoxLayout();
|
||||
foot_status_data_layout = new QHBoxLayout();
|
||||
version_tips = new QLabel(tr("version:"));
|
||||
version_tips->setObjectName("VERSION_TIPS");
|
||||
version_tips_txt = new QLabel(PROJECT_VERSION);
|
||||
version_tips_txt->setObjectName("VERSION_TIPS_TXT");
|
||||
state_tips_txt = new QLabel();
|
||||
state_tips_txt = new QLabel(tr("本工具建议配合SteamTools和Steam++使用"));
|
||||
state_tips_txt->setObjectName("STATE_TIPS");
|
||||
state_tips_txt->setAlignment(Qt::AlignCenter);
|
||||
|
||||
@ -178,15 +183,10 @@ void xsteam_ui::xsteam_init_foot_layout()
|
||||
foot_status_data_layout->addWidget(btn_xs_update);
|
||||
foot_status_data_layout->addWidget(btn_xs_about);
|
||||
foot_layout->addLayout(foot_status_data_layout);
|
||||
foot_layout->setContentsMargins(10, 0, 10, 0);
|
||||
foot_widget->setLayout(foot_layout);
|
||||
xs_git_fetch = new xsteam_git_fetch();
|
||||
}
|
||||
void xsteam_ui::xsteam_init_style()
|
||||
{
|
||||
main_layout->setStretch(0, 1);
|
||||
main_layout->setStretch(1, 7);
|
||||
main_layout->setStretch(2, 1);
|
||||
main_layout->setContentsMargins(5, 5, 5, 5);
|
||||
}
|
||||
void xsteam_ui::xsteam_init_connect()
|
||||
{
|
||||
ip_uid_table->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
@ -485,15 +485,15 @@ void xsteam_ui::slots_run_steam_steamtools()
|
||||
void xsteam_ui::slots_push_manifest()
|
||||
{
|
||||
xs_push_manifest = xsteam_push_manifest::Instance();
|
||||
xs_push_manifest->setMaximumSize(((QWidget *)this->parent())->width(), ((QWidget *)this->parent())->height() - 25);
|
||||
xs_push_manifest->setGeometry(((QWidget *)this->parent())->geometry());
|
||||
xs_push_manifest->setMaximumSize(width(),height() - 25);
|
||||
xs_push_manifest->setGeometry(geometry());
|
||||
xs_push_manifest->exec();
|
||||
}
|
||||
void xsteam_ui::slots_open_server_edit()
|
||||
{
|
||||
xs_src_edit_ui = xsteam_src_edit_ui::Instance();
|
||||
xs_src_edit_ui->setMaximumSize(660, 580);
|
||||
xs_src_edit_ui->setGeometry(((QWidget *)this->parent())->geometry());
|
||||
xs_src_edit_ui->setGeometry(geometry());
|
||||
connect(xs_src_edit_ui, SIGNAL(signals_update()), this, SLOT(slots_server_combobox_load_data()));
|
||||
xs_src_edit_ui->exec();
|
||||
}
|
||||
@ -501,21 +501,21 @@ void xsteam_ui::slots_open_update()
|
||||
{
|
||||
xs_update_ui = xsteam_update_ui::Instance();
|
||||
xs_update_ui->setMaximumSize(440, 580);
|
||||
xs_update_ui->setGeometry(((QWidget *)this->parent())->geometry());
|
||||
xs_update_ui->setGeometry(geometry());
|
||||
xs_update_ui->exec();
|
||||
}
|
||||
void xsteam_ui::slots_open_setting()
|
||||
{
|
||||
xs_sets_ui = xsteam_set_ui::Instance();
|
||||
xs_sets_ui->setMaximumSize(660, 580);
|
||||
xs_sets_ui->setGeometry(((QWidget *)this->parent())->geometry());
|
||||
xs_sets_ui->setGeometry(geometry());
|
||||
xs_sets_ui->exec();
|
||||
}
|
||||
void xsteam_ui::slots_open_about()
|
||||
{
|
||||
xs_about_ui = xsteam_about_ui::Instance();
|
||||
xs_about_ui->setMaximumSize(440, 580);
|
||||
xs_about_ui->setGeometry(((QWidget *)this->parent())->geometry());
|
||||
xs_about_ui->setGeometry(geometry());
|
||||
xs_about_ui->exec();
|
||||
}
|
||||
|
||||
|
@ -19,25 +19,28 @@
|
||||
#include "xsteam_git_fetch.h"
|
||||
#include "xsteam_push_manifest.h"
|
||||
#include <version.h>
|
||||
#include "sui.h"
|
||||
|
||||
class xsteam_ui:public QWidget{
|
||||
class xsteam_ui:public sui{
|
||||
Q_OBJECT
|
||||
public:
|
||||
xsteam_ui(QWidget* parent=nullptr);
|
||||
explicit xsteam_ui();
|
||||
~xsteam_ui();
|
||||
void xsteam_init_layout();
|
||||
private:
|
||||
void xsteam_init_main_layout();
|
||||
void xsteam_init_info_layout();
|
||||
void xsteam_init_mind_layout();
|
||||
void xsteam_init_foot_layout();
|
||||
void xsteam_init_style();
|
||||
void xsteam_init_connect();
|
||||
private:
|
||||
void table_load_ui_data();
|
||||
private:
|
||||
QVBoxLayout* main_layout;
|
||||
QHBoxLayout* info_layout;
|
||||
QVBoxLayout* mind_layout;
|
||||
QHBoxLayout* foot_layout;
|
||||
|
||||
QWidget* mind_widget;
|
||||
QWidget* foot_widget;
|
||||
//托管服务器选择
|
||||
QHBoxLayout* server_layout;
|
||||
QLabel* server_tag;
|
||||
|
Loading…
Reference in New Issue
Block a user