1-数据源模式修改为下拉菜单选择
This commit is contained in:
parent
e097174bb9
commit
f8cd167769
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -108,7 +108,8 @@
|
||||
"shared_mutex": "cpp",
|
||||
"qgroupbox": "cpp",
|
||||
"qheaderview": "cpp",
|
||||
"qabstractlistmodel": "cpp"
|
||||
"qabstractlistmodel": "cpp",
|
||||
"qtconcurrentrun": "cpp"
|
||||
},
|
||||
"Codegeex.RepoIndex": true
|
||||
}
|
@ -109,12 +109,12 @@ SET(PROJECT_SOURCES
|
||||
${src}
|
||||
)
|
||||
# 设置消息策略为qFatal来禁用qDebug信息
|
||||
LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
|
||||
#LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
|
||||
|
||||
#资源文件
|
||||
QT6_ADD_RESOURCES(RCFILES res.qrc)
|
||||
#WIN32
|
||||
add_executable(${PROJECT_NAME} WIN32 ${PROJECT_SOURCES} ${RCFILES} xsteam.rc)
|
||||
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${RCFILES} xsteam.rc)
|
||||
|
||||
#安全编译
|
||||
#关闭RPATH特性
|
||||
|
@ -34,14 +34,14 @@ private:
|
||||
const xsteam_about_ui &operator=(const xsteam_about_ui &other);
|
||||
static xsteam_about_ui* _instance;
|
||||
static QMutex mutex;
|
||||
QVBoxLayout* m_Layout=nullptr;
|
||||
QHBoxLayout* f_Layout=nullptr;
|
||||
QTextEdit* info=nullptr;
|
||||
QVBoxLayout* m_Layout={};
|
||||
QHBoxLayout* f_Layout={};
|
||||
QTextEdit* info={};
|
||||
void load_about();
|
||||
QLabel* copyright_tips_txt;
|
||||
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
};
|
||||
xsteam_about_ui *xsteam_about_ui::_instance = nullptr;
|
||||
xsteam_about_ui *xsteam_about_ui::_instance = {};
|
||||
QMutex xsteam_about_ui::mutex;
|
||||
|
||||
#endif
|
@ -32,8 +32,8 @@ private:
|
||||
void free_git_ext();
|
||||
void error_git_ext(int error, QString str);
|
||||
|
||||
git_repository *repo = nullptr;
|
||||
git_remote *remote = nullptr;
|
||||
git_repository *repo = {};
|
||||
git_remote *remote = {};
|
||||
std::string src_name;
|
||||
std::string branch_target_name;
|
||||
std::string tag_target_name;
|
||||
|
@ -44,7 +44,7 @@ private:
|
||||
QVBoxLayout* body_layout;
|
||||
QHBoxLayout* foot_layout;
|
||||
|
||||
QPushButton* _pSaveData=nullptr;
|
||||
QPushButton* _pSaveData={};
|
||||
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
|
||||
QHBoxLayout* steam_layout;
|
||||
@ -75,6 +75,6 @@ private slots:
|
||||
//void clicked_rightMenu(const QPoint &pos); //右键信号槽函数
|
||||
void slotsSaveDone();
|
||||
};
|
||||
xsteam_set_ui *xsteam_set_ui::_instance = nullptr;
|
||||
xsteam_set_ui *xsteam_set_ui::_instance = {};
|
||||
QMutex xsteam_set_ui::mutex;
|
||||
#endif
|
@ -18,6 +18,7 @@ void xsteam_src_edit_ui::init_table_view_style()
|
||||
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->setAlternatingRowColors(true);
|
||||
m_Table->setFrameShape(QFrame::NoFrame);
|
||||
@ -27,7 +28,9 @@ void xsteam_src_edit_ui::init_table_view_style()
|
||||
|
||||
void xsteam_src_edit_ui::init_src_edit_ui()
|
||||
{
|
||||
setWindowTitle(tr("XSteam源数据编辑"));
|
||||
setWindowTitle(tr("XSteam源数据"));
|
||||
src_group = new QGroupBox(tr("数据源信息"));
|
||||
gr_Layout = new QVBoxLayout();
|
||||
main_Layout = new QVBoxLayout;
|
||||
foot_Layout = new QHBoxLayout;
|
||||
m_Table = new QTableView;
|
||||
@ -35,16 +38,18 @@ void xsteam_src_edit_ui::init_src_edit_ui()
|
||||
m_Model->setHorizontalHeaderLabels(ex_src_table_head_tips);
|
||||
m_Table->setModel(m_Model);
|
||||
m_Save_Data = new QPushButton(tr("保存"));
|
||||
m_Update_Src_Data = new QPushButton(tr("更新源数据"));
|
||||
m_Update_Src_Data = new QPushButton(tr("更新"));
|
||||
foot_Layout->addSpacerItem(sparcer_Item);
|
||||
foot_Layout->addWidget(m_Save_Data);
|
||||
foot_Layout->addWidget(m_Update_Src_Data);
|
||||
foot_Layout->addSpacerItem(sparcer_Item);
|
||||
main_Layout->addWidget(m_Table);
|
||||
main_Layout->addLayout(foot_Layout);
|
||||
main_Layout->setStretch(0, 8);
|
||||
main_Layout->setStretch(1, 2);
|
||||
main_Layout->setContentsMargins(2, 2, 2, 2);
|
||||
gr_Layout->addWidget(m_Table);
|
||||
gr_Layout->addLayout(foot_Layout);
|
||||
gr_Layout->setStretch(0, 8);
|
||||
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);
|
||||
init_table_view_style();
|
||||
connect_slots();
|
||||
@ -67,16 +72,17 @@ void xsteam_src_edit_ui::load_src_data_view(std::vector<SrcData> src_data)
|
||||
int x = i++;
|
||||
m_Model->setItem(x, 0, new QStandardItem(QString::fromStdString(k.src_name)));
|
||||
QString g_mode_str;
|
||||
if (k.src_type == GIT_MODE::BRANCH)
|
||||
QComboBox *cmb = new QComboBox();
|
||||
cmb->addItems(src_type);
|
||||
if (k.src_type == GIT_MODE::TAG)
|
||||
{
|
||||
g_mode_str = "BRANCH";
|
||||
cmb->setCurrentIndex(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_mode_str = "TAG";
|
||||
cmb->setCurrentIndex(0);
|
||||
}
|
||||
QStandardItem *t_item = new QStandardItem(g_mode_str);
|
||||
m_Model->setItem(x, 1, t_item);
|
||||
m_Table->setIndexWidget(m_Model->index(x, 1), cmb);
|
||||
m_Model->setItem(x, 2, new QStandardItem(QString::fromStdString(k.src_url)));
|
||||
}
|
||||
m_Table->setModel(m_Model);
|
||||
@ -174,17 +180,17 @@ void xsteam_src_edit_ui::slots_save_done()
|
||||
{
|
||||
SrcData _src_data = {};
|
||||
QString dataTempA = modessl->data(modessl->index(i, 0)).value<QString>();
|
||||
QString dataTempB = modessl->data(modessl->index(i, 1)).value<QString>();
|
||||
QComboBox *cmb = (QComboBox *)m_Table->indexWidget(modessl->index(i, 1));
|
||||
QString dataTempC = modessl->data(modessl->index(i, 2)).value<QString>();
|
||||
_src_data.src_name = dataTempA.toStdString();
|
||||
if (dataTempB == tr("BRANCH"))
|
||||
{
|
||||
_src_data.src_type = GIT_MODE::BRANCH;
|
||||
}
|
||||
else if (dataTempB == tr("TAG"))
|
||||
if (cmb->currentIndex() == GIT_MODE::TAG)
|
||||
{
|
||||
_src_data.src_type = GIT_MODE::TAG;
|
||||
}
|
||||
else
|
||||
{
|
||||
_src_data.src_type = GIT_MODE::BRANCH;
|
||||
}
|
||||
_src_data.src_url = dataTempC.toStdString();
|
||||
_data.s_data.push_back(_src_data);
|
||||
}
|
||||
|
@ -3,7 +3,10 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMutex>
|
||||
#include <QGroupBox>
|
||||
#include <QTableView>
|
||||
#include <QComboBox>
|
||||
#include <QStringList>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
@ -46,12 +49,15 @@ private:
|
||||
void object_add_src();
|
||||
void object_delete_src();
|
||||
void connect_slots();
|
||||
QGroupBox* src_group;
|
||||
QVBoxLayout *gr_Layout;
|
||||
QVBoxLayout *main_Layout;
|
||||
QHBoxLayout *foot_Layout;
|
||||
QStandardItemModel *m_Model = nullptr;
|
||||
QTableView *m_Table = nullptr;
|
||||
QPushButton *m_Save_Data = nullptr;
|
||||
QPushButton *m_Update_Src_Data = nullptr;
|
||||
QStandardItemModel *m_Model = {};
|
||||
QTableView *m_Table = {};
|
||||
QPushButton *m_Save_Data = {};
|
||||
QPushButton *m_Update_Src_Data = {};
|
||||
QStringList src_type={"BRANCH","TAG"};
|
||||
QSpacerItem *sparcer_Item = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
private slots:
|
||||
void slots_rightMenu(const QPoint &pos);
|
||||
@ -61,6 +67,6 @@ private slots:
|
||||
signals:
|
||||
void signals_update();
|
||||
};
|
||||
xsteam_src_edit_ui *xsteam_src_edit_ui::_instance = nullptr;
|
||||
xsteam_src_edit_ui *xsteam_src_edit_ui::_instance = {};
|
||||
QMutex xsteam_src_edit_ui::mutex;
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user