1-全部表单选
2-取消默认入库UID 3-对DLC信息进行增加
This commit is contained in:
parent
05f8f8a9d3
commit
0b55dfd546
@ -32,6 +32,26 @@ QGroupBox#GAME_INFO_GROUP,QGroupBox#ALL_DLC_GROUP{
|
||||
QTableView#GAME_INFO_TABLE::item:selected {
|
||||
background-color: #0078d4;
|
||||
}
|
||||
|
||||
QMenu {
|
||||
background-color: #444;
|
||||
color: #fff;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
|
||||
QMenu::item {
|
||||
padding: 2px 20px 2px 20px;
|
||||
}
|
||||
|
||||
QMenu::icon:checked {
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:1 #fff, stop:0 #aaa);
|
||||
}
|
||||
|
||||
QMenu::item:selected {
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:1 #ffc, stop:0 #9c9);
|
||||
color: black;
|
||||
}
|
||||
|
||||
/*------------------标题栏样式 最小化 最大化 关闭---------------------*/
|
||||
/*标题栏变量参数值定义*/
|
||||
/*标题栏背景*/
|
||||
@ -75,6 +95,6 @@ QPushButton#min_button:hover,QPushButton#max_button:hover,QPushButton#close_butt
|
||||
}
|
||||
|
||||
QPushButton#min_button:pressed,QPushButton#max_button:pressed,QPushButton#close_button:pressed{
|
||||
padding-left:2px;
|
||||
padding-top:2px;
|
||||
padding-left:1px;
|
||||
padding-top:1px;
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
QWidget#m_widget{
|
||||
background-color: #F3F3F3;
|
||||
color:#2F4F4F;
|
||||
}
|
||||
QWidget#m_widget{
|
||||
border-radius:10px;
|
||||
background-color: #F3F3F3;
|
||||
@ -34,6 +38,7 @@ QGroupBox#GAME_INFO_GROUP,QGroupBox#ALL_DLC_GROUP{
|
||||
QTableView#GAME_INFO_TABLE::item:selected {
|
||||
background-color: #0078d4;
|
||||
}
|
||||
|
||||
/*------------------标题栏样式 最小化 最大化 关闭---------------------*/
|
||||
/*标题栏变量参数值定义*/
|
||||
/*标题栏背景*/
|
||||
@ -77,6 +82,6 @@ QPushButton#min_button:hover,QPushButton#max_button:hover,QPushButton#close_butt
|
||||
}
|
||||
|
||||
QPushButton#min_button:pressed,QPushButton#max_button:pressed,QPushButton#close_button:pressed{
|
||||
padding-left:2px;
|
||||
padding-top:2px;
|
||||
padding-left:1px;
|
||||
padding-top:1px;
|
||||
}
|
||||
|
@ -79,27 +79,27 @@ void xsteam_ui::xsteam_init_mind_layout()
|
||||
ip_uid_tag = new QLabel(tr("游戏UID:"));
|
||||
ip_uid_tag->setObjectName("GAME_UID");
|
||||
|
||||
ip_uid_edit = new QLineEdit("457140");
|
||||
ip_uid_edit = new QLineEdit("");
|
||||
ip_uid_edit->setValidator(new QRegularExpressionValidator(QRegularExpression("[0-9]+$")));
|
||||
ip_uid_edit->setMaxLength(8);
|
||||
ip_layout->addWidget(ip_uid_tag);
|
||||
ip_layout->addWidget(ip_uid_edit);
|
||||
ip_layout->setContentsMargins(2, 2, 2, 2);
|
||||
|
||||
btn_dlc_push = new QPushButton(tr("获取DLC"));
|
||||
btn_dlc_push = new QPushButton(tr("入库信息"));
|
||||
btn_dlc_push->setObjectName("SET_DLC");
|
||||
|
||||
|
||||
ip_iu_layout = new QHBoxLayout();
|
||||
btn_uid_push = new QPushButton(tr("入库"));
|
||||
btn_uid_push->setObjectName("INPUT");
|
||||
|
||||
btn_uid_update=new QPushButton(tr("更新"));
|
||||
|
||||
btn_uid_update = new QPushButton(tr("更新"));
|
||||
btn_uid_update->setObjectName("UPDATE");
|
||||
ip_iu_layout->addWidget(btn_uid_push);
|
||||
ip_iu_layout->addWidget(btn_uid_update);
|
||||
ip_iu_layout->setContentsMargins(2, 2, 2, 2);
|
||||
|
||||
ip_data_layout = new QHBoxLayout();
|
||||
|
||||
ip_data_layout = new QHBoxLayout();
|
||||
// uid info
|
||||
ip_uid_group_layout = new QHBoxLayout();
|
||||
ip_uid_group = new QGroupBox(tr("游戏信息"));
|
||||
@ -115,10 +115,12 @@ void xsteam_ui::xsteam_init_mind_layout()
|
||||
ip_all_dlc_group = new QGroupBox(tr("DLC信息"));
|
||||
ip_all_dlc_group->setObjectName("ALL_DLC_GROUP");
|
||||
ip_all_dlc_table = new xsteam_view();
|
||||
ip_all_dlc_table->setObjectName("ALL_DLC_TABLE");
|
||||
ip_all_dlc_table->init_view(VIEW_MODE::ALL_DLC_INFO);
|
||||
ip_in_dlc_table = new xsteam_view();
|
||||
ip_in_dlc_table->setObjectName("IN_DLC_TABLE");
|
||||
ip_in_dlc_table->init_view(VIEW_MODE::IN_DLC_INFO);
|
||||
|
||||
|
||||
ip_dlc_info_layout->addLayout(ip_layout);
|
||||
ip_dlc_info_layout->addWidget(btn_dlc_push);
|
||||
ip_dlc_info_layout->addWidget(ip_in_dlc_table);
|
||||
@ -130,7 +132,7 @@ void xsteam_ui::xsteam_init_mind_layout()
|
||||
|
||||
ip_data_layout->addWidget(ip_uid_group);
|
||||
ip_data_layout->addWidget(ip_all_dlc_group);
|
||||
|
||||
|
||||
ip_data_layout->setStretch(0, 7);
|
||||
ip_data_layout->setStretch(1, 3);
|
||||
|
||||
@ -178,6 +180,8 @@ void xsteam_ui::xsteam_init_style()
|
||||
void xsteam_ui::xsteam_init_connect()
|
||||
{
|
||||
ip_uid_table->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ip_all_dlc_table->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ip_in_dlc_table->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(btn_server_edit, SIGNAL(clicked()), this, SLOT(slots_open_server_edit()));
|
||||
connect(btn_xs_sets, SIGNAL(clicked()), this, SLOT(slots_open_setting()));
|
||||
connect(btn_run_steam, SIGNAL(clicked()), this, SLOT(slots_run_steam_steamtools()));
|
||||
@ -191,33 +195,145 @@ void xsteam_ui::xsteam_init_connect()
|
||||
connect(xs_git_fetch, SIGNAL(signal_fetch_return_data(UidData)), this, SLOT(slots_table_append(UidData)));
|
||||
connect(ip_uid_table->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(slots_selection_row(const QItemSelection &, const QItemSelection &)));
|
||||
connect(ip_uid_table, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slots_rightMenu(QPoint)));
|
||||
connect(ip_all_dlc_table, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slots_rightMenu(QPoint)));
|
||||
connect(ip_in_dlc_table, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slots_rightMenu(QPoint)));
|
||||
connect(btn_dlc_push, SIGNAL(clicked()), this, SLOT(slots_get_uid_dlcs()));
|
||||
}
|
||||
void xsteam_ui::slots_get_uid_dlcs()
|
||||
{
|
||||
UidData uid_data;
|
||||
slots_msg_text("获取DLC信息...");
|
||||
ip_all_dlc_table->item_clear();
|
||||
if (xsteam_curl_steam_id_app_info(ip_uid_edit->text().toStdString(), uid_data))
|
||||
{
|
||||
ip_all_dlc_table->item_append(uid_data, VIEW_MODE::ALL_DLC_INFO);
|
||||
xs_data = uid_data;
|
||||
slots_msg_text("DLC信息获取完毕");
|
||||
}
|
||||
else
|
||||
{
|
||||
slots_msg_text("获取DLC信息失败!请检查UID是否正确&网络是否畅通");
|
||||
}
|
||||
}
|
||||
void xsteam_ui::slots_rightMenu(const QPoint &pos)
|
||||
{
|
||||
QTableView *signalSrc = (QTableView *)sender(); // 获取到了发送该信号按钮的指针
|
||||
QModelIndex index = signalSrc->indexAt(pos);
|
||||
if (index.row() > -1)
|
||||
if (sender()->objectName() == "GAME_INFO_TABLE")
|
||||
{
|
||||
// 创建菜单对象
|
||||
QMenu *m_menu = new QMenu(this);
|
||||
QAction *delete_task = new QAction(tr("移除入库"), this);
|
||||
QAction *update_task = new QAction(tr("更新入库"), this);
|
||||
delete_task->setData(1);
|
||||
update_task->setData(2);
|
||||
delete_task->setObjectName(signalSrc->objectName());
|
||||
update_task->setObjectName(signalSrc->objectName());
|
||||
// 把QAction对象添加到菜单上
|
||||
m_menu->addAction(delete_task);
|
||||
m_menu->addAction(update_task);
|
||||
// 连接鼠标右键点击信号
|
||||
connect(delete_task, SIGNAL(triggered()), this, SLOT(slots_delete_uid_st()));
|
||||
connect(update_task, SIGNAL(triggered()), this, SLOT(slots_updata_uid_st()));
|
||||
// 在鼠标右键点击的地方显示菜单
|
||||
m_menu->exec(QCursor::pos());
|
||||
QList<QAction *> list = m_menu->actions();
|
||||
foreach (QAction *pAction, list)
|
||||
delete pAction;
|
||||
delete m_menu;
|
||||
if (index.row() > -1)
|
||||
{
|
||||
// 创建菜单对象
|
||||
QMenu *m_menu = new QMenu(this);
|
||||
QAction *delete_task = new QAction(tr("移除入库"), this);
|
||||
delete_task->setData(1);
|
||||
delete_task->setObjectName(signalSrc->objectName());
|
||||
// 把QAction对象添加到菜单上
|
||||
m_menu->addAction(delete_task);
|
||||
// 连接鼠标右键点击信号
|
||||
connect(delete_task, SIGNAL(triggered()), this, SLOT(slots_delete_uid_st()));
|
||||
// 在鼠标右键点击的地方显示菜单
|
||||
m_menu->exec(QCursor::pos());
|
||||
QList<QAction *> list = m_menu->actions();
|
||||
foreach (QAction *pAction, list)
|
||||
{
|
||||
delete pAction;
|
||||
}
|
||||
delete m_menu;
|
||||
}
|
||||
}
|
||||
else if (sender()->objectName() == "ALL_DLC_TABLE")
|
||||
{
|
||||
if (index.row() > -1)
|
||||
{
|
||||
// 创建菜单对象
|
||||
QMenu *m_menu = new QMenu(this);
|
||||
QAction *delete_task = new QAction(tr("增加DLC"), this);
|
||||
delete_task->setData(1);
|
||||
delete_task->setObjectName(signalSrc->objectName());
|
||||
// 把QAction对象添加到菜单上
|
||||
m_menu->addAction(delete_task);
|
||||
// 连接鼠标右键点击信号
|
||||
connect(delete_task, SIGNAL(triggered()), this, SLOT(slots_in_dlc_add()));
|
||||
// 在鼠标右键点击的地方显示菜单
|
||||
m_menu->exec(QCursor::pos());
|
||||
QList<QAction *> list = m_menu->actions();
|
||||
foreach (QAction *pAction, list)
|
||||
{
|
||||
delete pAction;
|
||||
}
|
||||
delete m_menu;
|
||||
}
|
||||
}
|
||||
else if (sender()->objectName() == "IN_DLC_TABLE")
|
||||
{
|
||||
if (index.row() > -1)
|
||||
{
|
||||
// 创建菜单对象
|
||||
QMenu *m_menu = new QMenu(this);
|
||||
QAction *delete_task = new QAction(tr("移除DLC"), this);
|
||||
delete_task->setData(1);
|
||||
delete_task->setObjectName(signalSrc->objectName());
|
||||
// 把QAction对象添加到菜单上
|
||||
m_menu->addAction(delete_task);
|
||||
// 连接鼠标右键点击信号
|
||||
connect(delete_task, SIGNAL(triggered()), this, SLOT(slots_in_dlc_delete()));
|
||||
// 在鼠标右键点击的地方显示菜单
|
||||
m_menu->exec(QCursor::pos());
|
||||
QList<QAction *> list = m_menu->actions();
|
||||
foreach (QAction *pAction, list)
|
||||
{
|
||||
delete pAction;
|
||||
}
|
||||
delete m_menu;
|
||||
}
|
||||
}
|
||||
}
|
||||
void xsteam_ui::slots_in_dlc_delete()
|
||||
{
|
||||
int curRow = ip_in_dlc_table->currentIndex().row();
|
||||
if (curRow > -1)
|
||||
{
|
||||
QAbstractItemModel *modessl = ip_in_dlc_table->model();
|
||||
QModelIndex indextemp = modessl->index(curRow, 0);
|
||||
QString dlc_id = modessl->data(indextemp).value<QString>();
|
||||
modessl->removeRow(curRow);
|
||||
ip_in_dlc_table->setModel(modessl);
|
||||
xs_data.n_dlc.erase(std::remove(xs_data.n_dlc.begin(), xs_data.n_dlc.end(), dlc_id), xs_data.n_dlc.end());
|
||||
for (auto &data : _data.u_data)
|
||||
{
|
||||
if (data.uid == ip_uid_edit->text().toStdString())
|
||||
{
|
||||
for (auto &dlc : data.n_dlc)
|
||||
{
|
||||
if (dlc == dlc_id.toStdString())
|
||||
{
|
||||
data.n_dlc.erase(std::remove(data.n_dlc.begin(), data.n_dlc.end(), dlc_id), data.n_dlc.end());
|
||||
slots_msg_text("删除DLC:"+dlc_id.toStdString()+"成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void xsteam_ui::slots_in_dlc_add()
|
||||
{
|
||||
int curRow = ip_all_dlc_table->currentIndex().row();
|
||||
if (curRow > -1)
|
||||
{
|
||||
QAbstractItemModel *modessl = ip_all_dlc_table->model();
|
||||
QModelIndex indextemp = modessl->index(curRow, 0);
|
||||
QString dlc_id = modessl->data(indextemp).value<QString>();
|
||||
xs_data.n_dlc.push_back(dlc_id.toStdString());
|
||||
ip_in_dlc_table->item_append(xs_data, VIEW_MODE::IN_DLC_INFO);
|
||||
for (auto &x_dlc : _data.u_data)
|
||||
{
|
||||
if (x_dlc.uid == ip_uid_edit->text().toStdString())
|
||||
{
|
||||
x_dlc.n_dlc.push_back(dlc_id.toStdString());
|
||||
slots_msg_text("增加:"+dlc_id.toStdString()+"成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void xsteam_ui::slots_delete_uid_st()
|
||||
@ -231,9 +347,7 @@ void xsteam_ui::slots_delete_uid_st()
|
||||
modessl->removeRow(curRow);
|
||||
ip_uid_table->setModel(modessl);
|
||||
QFuture<void> future = QtConcurrent::run([=]()
|
||||
{
|
||||
xsteam_delete_uid_st(uid.toStdString());
|
||||
});
|
||||
{ xsteam_delete_uid_st(uid.toStdString()); });
|
||||
}
|
||||
}
|
||||
void xsteam_ui::slots_updata_uid_st()
|
||||
@ -274,6 +388,7 @@ void xsteam_ui::slots_selection_row(const QItemSelection ¤t, const QItemSe
|
||||
break;
|
||||
}
|
||||
}
|
||||
ip_uid_edit->setText(QString::fromStdString(u_data.uid));
|
||||
ip_all_dlc_table->item_append(u_data, VIEW_MODE::ALL_DLC_INFO);
|
||||
ip_in_dlc_table->item_append(u_data, VIEW_MODE::IN_DLC_INFO);
|
||||
}
|
||||
@ -314,13 +429,6 @@ void xsteam_ui::table_load_ui_data()
|
||||
ip_uid_table->item_append(x, VIEW_MODE::UID_INFO);
|
||||
}
|
||||
}
|
||||
void xsteam_ui::slots_open_server_edit()
|
||||
{
|
||||
xs_src_edit_ui = xsteam_src_edit_ui::Instance();
|
||||
xs_src_edit_ui->setGeometry(((QWidget *)this->parent())->geometry());
|
||||
connect(xs_src_edit_ui, SIGNAL(signals_update()), this, SLOT(slots_server_combobox_load_data()));
|
||||
xs_src_edit_ui->exec();
|
||||
}
|
||||
void xsteam_ui::slots_run_steam_steamtools()
|
||||
{
|
||||
|
||||
@ -334,15 +442,25 @@ void xsteam_ui::slots_run_steam_steamtools()
|
||||
xsteam_run_steam_steamtools(RUN_MODE::STEAMTOOLS);
|
||||
}
|
||||
}
|
||||
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());
|
||||
connect(xs_src_edit_ui, SIGNAL(signals_update()), this, SLOT(slots_server_combobox_load_data()));
|
||||
xs_src_edit_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->exec();
|
||||
}
|
||||
void xsteam_ui::slots_open_about()
|
||||
{
|
||||
xs_about_ui = xsteam_about_ui::Instance();
|
||||
xs_about_ui->setMaximumSize(660, 580);
|
||||
xs_about_ui->setGeometry(((QWidget *)this->parent())->geometry());
|
||||
xs_about_ui->exec();
|
||||
}
|
||||
@ -360,14 +478,15 @@ void xsteam_ui::slots_table_append(UidData u_data)
|
||||
}
|
||||
void xsteam_ui::slots_imput_uid_push()
|
||||
{
|
||||
|
||||
InputData i_data;
|
||||
UidData u_data;
|
||||
in_data = {};
|
||||
bool steam_ok = false;
|
||||
bool steamtools_ok = false;
|
||||
i_data.t_g_uid = ip_uid_edit->text().toStdString();
|
||||
i_data.t_s_name = server_txt->currentText().toStdString();
|
||||
if (xsteam_uid_exists(i_data.t_g_uid))
|
||||
in_data.t_g_uid = ip_uid_edit->text().toStdString();
|
||||
in_data.t_s_name = server_txt->currentText().toStdString();
|
||||
if(ip_uid_edit->text().toStdString()==""){
|
||||
slots_msg_text("入库UID不能为空");
|
||||
}
|
||||
if (xsteam_uid_exists(in_data.t_g_uid))
|
||||
{
|
||||
slots_msg_text("当前游戏已入库!请勿反复入库");
|
||||
return;
|
||||
@ -377,13 +496,14 @@ void xsteam_ui::slots_imput_uid_push()
|
||||
slots_msg_text("请检查steam和steamtools路径");
|
||||
return;
|
||||
}
|
||||
if(!xsteam_src_data_exists(i_data.t_s_name)){
|
||||
if (!xsteam_src_data_exists(in_data.t_s_name))
|
||||
{
|
||||
slots_msg_text("请先拉取源服务器清单列表到本地");
|
||||
return;
|
||||
}
|
||||
slots_disable_enable_function(false);
|
||||
QFuture<void> future = QtConcurrent::run([=](InputData i_data, UidData u_data)
|
||||
{
|
||||
xs_git_fetch->fecth_uid_to_steam(i_data, u_data);
|
||||
slots_disable_enable_function(true); }, i_data, u_data);
|
||||
xs_git_fetch->fecth_uid_to_steam(in_data, xs_data);
|
||||
slots_disable_enable_function(true); }, in_data, xs_data);
|
||||
}
|
||||
|
@ -80,7 +80,9 @@ private:
|
||||
xsteam_about_ui* xs_about_ui;
|
||||
xsteam_git_fetch* xs_git_fetch;
|
||||
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
//connect
|
||||
|
||||
InputData in_data;
|
||||
UidData xs_data;
|
||||
private slots:
|
||||
void slots_open_server_edit();
|
||||
void slots_open_setting();
|
||||
@ -97,6 +99,9 @@ private slots:
|
||||
void slots_rightMenu(const QPoint &pos);
|
||||
void slots_delete_uid_st();
|
||||
void slots_updata_uid_st();
|
||||
void slots_get_uid_dlcs();
|
||||
void slots_in_dlc_delete();
|
||||
void slots_in_dlc_add();
|
||||
signals:
|
||||
void signals_src_combobox_update();
|
||||
};
|
||||
|
@ -29,6 +29,7 @@ void xsteam_view::init_view(VIEW_MODE view_mode)
|
||||
m_model->setColumnCount(ex_in_dlc_table_head_tips.count());
|
||||
m_model->setHorizontalHeaderLabels(ex_in_dlc_table_head_tips);
|
||||
}
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
|
@ -25,7 +25,6 @@ public:
|
||||
~xsteam_view();
|
||||
void init_view(VIEW_MODE);
|
||||
void item_append(UidData& data,VIEW_MODE mode);
|
||||
private:
|
||||
void item_clear();
|
||||
private:
|
||||
QStandardItemModel* m_model;
|
||||
|
Loading…
Reference in New Issue
Block a user