命名规范
This commit is contained in:
@@ -9,82 +9,82 @@
|
||||
#include "../BaseWidget.h"
|
||||
|
||||
|
||||
ServerSettingWidget::ServerSettingWidget(QWidget *parent) : QWidget(parent) {
|
||||
Server_Setting_Widget::Server_Setting_Widget(QWidget *parent) : QWidget(parent) {
|
||||
|
||||
|
||||
setObjectName("服务端设置界面");
|
||||
hide();
|
||||
auto mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setAlignment(Qt::AlignTop);
|
||||
mRigNameLabel = createLabel("Rig Name");
|
||||
mUserNameLabel = createLabel("User Name");
|
||||
mPasswordLabel = createLabel("Password");
|
||||
mCtrlPortLabel = createLabel("Ctrl Port");
|
||||
mCivPortLabel = createLabel("Civ Port");
|
||||
mAudioPortLabel = createLabel("Audio Port");
|
||||
auto main_layout = new QVBoxLayout(this);
|
||||
main_layout->setAlignment(Qt::AlignTop);
|
||||
rig_name_label = create_label("Rig Name");
|
||||
user_name_label = create_label("User Name");
|
||||
password_label = create_label("Password");
|
||||
ctrl_port_label = create_label("Ctrl Port");
|
||||
civ_port_label = create_label("Civ Port");
|
||||
audio_port_label = create_label("Audio Port");
|
||||
|
||||
mRigNameEdit = new ExpandInput();
|
||||
mUserNameEdit = new ExpandInput();
|
||||
mPasswordEdit = new ExpandInput();
|
||||
mCtrlPortEdit = new ExpandInput();
|
||||
mCivPortEdit = new ExpandInput();
|
||||
mAudioPortEdit = new ExpandInput();
|
||||
rig_name_edit = new Expand_Input();
|
||||
user_name_edit = new Expand_Input();
|
||||
password_edit = new Expand_Input();
|
||||
ctrl_port_edit = new Expand_Input();
|
||||
civ_port_edit = new Expand_Input();
|
||||
audio_port_edit = new Expand_Input();
|
||||
|
||||
mainLayout->addLayout(createHBoxLayout({mRigNameLabel, mRigNameEdit}), 1);
|
||||
mainLayout->addLayout(createHBoxLayout({mUserNameLabel, mUserNameEdit}), 1);
|
||||
mainLayout->addLayout(createHBoxLayout({mPasswordLabel, mPasswordEdit}), 1);
|
||||
mainLayout->addLayout(createHBoxLayout({mCtrlPortLabel, mCtrlPortEdit}), 1);
|
||||
mainLayout->addLayout(createHBoxLayout({mCivPortLabel, mCivPortEdit}), 1);
|
||||
mainLayout->addLayout(createHBoxLayout({mAudioPortLabel, mAudioPortEdit}), 1);
|
||||
mShowHelpInfo = new ShowHelpInfo;
|
||||
mShowHelpInfo->mFont.setPixelSize(40);
|
||||
mainLayout->addWidget(mShowHelpInfo, 3);
|
||||
int fontSize = 40;
|
||||
mStartButton = createClickButton("Start", fontSize, [&]() {
|
||||
mShowHelpInfo->setText("Start 帮助信息");
|
||||
mShowHelpInfo->update();
|
||||
}, &mRollObject);
|
||||
mDefaultButton = createClickButton("Default", fontSize, [&]() {
|
||||
mShowHelpInfo->setText("Default 帮助信息");
|
||||
mShowHelpInfo->update();
|
||||
}, &mRollObject);
|
||||
mClearButton = createClickButton("Clear", fontSize, [&]() {
|
||||
mShowHelpInfo->setText("Clear 帮助信息");
|
||||
mShowHelpInfo->update();
|
||||
}, &mRollObject);
|
||||
mSaveButton = createClickButton("Save", fontSize, [&]() {
|
||||
mShowHelpInfo->setText("Save 帮助信息");
|
||||
mShowHelpInfo->update();
|
||||
}, &mRollObject);
|
||||
mExitButton = createClickButton("Exit", fontSize, [&]() {
|
||||
MainWidget::instance()->hideCurHoverWidget();
|
||||
MainWidget::instance()->getCurrentBaseWidget()->setFocus();
|
||||
}, &mRollObject);
|
||||
mRollObject.mWidgets = {mStartButton, mDefaultButton, mClearButton, mSaveButton, mExitButton};
|
||||
mRollObject.mEnterFunc = [](QPushButton* btn){
|
||||
main_layout->addLayout(create_hbox_layout({rig_name_label, rig_name_edit}), 1);
|
||||
main_layout->addLayout(create_hbox_layout({user_name_label, user_name_edit}), 1);
|
||||
main_layout->addLayout(create_hbox_layout({password_label, password_edit}), 1);
|
||||
main_layout->addLayout(create_hbox_layout({ctrl_port_label, ctrl_port_edit}), 1);
|
||||
main_layout->addLayout(create_hbox_layout({civ_port_label, civ_port_edit}), 1);
|
||||
main_layout->addLayout(create_hbox_layout({audio_port_label, audio_port_edit}), 1);
|
||||
show_help_info = new Show_Help_Info;
|
||||
show_help_info->font.setPixelSize(40);
|
||||
main_layout->addWidget(show_help_info, 3);
|
||||
int font_size = 40;
|
||||
start_button = create_click_button("Start", font_size, [&]() {
|
||||
show_help_info->setText("Start 帮助信息");
|
||||
show_help_info->update();
|
||||
}, &roll_object);
|
||||
default_button = create_click_button("Default", font_size, [&]() {
|
||||
show_help_info->setText("Default 帮助信息");
|
||||
show_help_info->update();
|
||||
}, &roll_object);
|
||||
clear_button = create_click_button("Clear", font_size, [&]() {
|
||||
show_help_info->setText("Clear 帮助信息");
|
||||
show_help_info->update();
|
||||
}, &roll_object);
|
||||
save_button = create_click_button("Save", font_size, [&]() {
|
||||
show_help_info->setText("Save 帮助信息");
|
||||
show_help_info->update();
|
||||
}, &roll_object);
|
||||
exit_button = create_click_button("Exit", font_size, [&]() {
|
||||
Main_Widget::instance()->hide_cur_hover_widget();
|
||||
Main_Widget::instance()->get_current_base_widget()->setFocus();
|
||||
}, &roll_object);
|
||||
roll_object.widgets = {start_button, default_button, clear_button, save_button, exit_button};
|
||||
roll_object.enter_func = [](QPushButton* btn){
|
||||
btn->setChecked(true);
|
||||
};
|
||||
mRollObject.mLeaveFunc = [](QPushButton* btn){
|
||||
roll_object.leave_func = [](QPushButton* btn){
|
||||
btn->setChecked(false);
|
||||
};
|
||||
mainLayout->addLayout(mRollObject.hBoxLayout(8), 2);
|
||||
main_layout->addLayout(roll_object.hbox_layout(8), 2);
|
||||
}
|
||||
|
||||
void ServerSettingWidget::paintEvent(QPaintEvent *event) {
|
||||
void Server_Setting_Widget::paintEvent(QPaintEvent *event) {
|
||||
QPainter painter(this);
|
||||
painter.setPen(Qt::NoPen);
|
||||
QPalette palette = QApplication::style()->standardPalette();
|
||||
const QBrush& base1Brush = palette.brush(QPalette::Window);
|
||||
painter.setBrush(base1Brush);
|
||||
const QBrush& base1_brush = palette.brush(QPalette::Window);
|
||||
painter.setBrush(base1_brush);
|
||||
painter.drawRect(rect());
|
||||
painter.end();
|
||||
}
|
||||
|
||||
QLabel *ServerSettingWidget::createLabel(const QString& text) {
|
||||
QLabel *Server_Setting_Widget::create_label(const QString& text) {
|
||||
auto ret = new QLabel(text);
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
font.setPixelSize(Global::instance()->adaptHeight(50));
|
||||
font.setPixelSize(Global::instance()->adapt_height(50));
|
||||
ret->setFont(font);
|
||||
QPalette pe;
|
||||
pe.setColor(QPalette::WindowText, Qt::black);
|
||||
@@ -92,22 +92,22 @@ QLabel *ServerSettingWidget::createLabel(const QString& text) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ServerSettingWidget::keyPressEvent(QKeyEvent *event) {
|
||||
void Server_Setting_Widget::keyPressEvent(QKeyEvent *event) {
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
BackEnd* g = BackEnd::instance();
|
||||
auto *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
||||
if(g->match(keyEvent, "左移")){
|
||||
mRollObject.rollLeft();
|
||||
Back_End* g = Back_End::instance();
|
||||
auto *key_event = dynamic_cast<QKeyEvent *>(event);
|
||||
if(g->match(key_event, "左移")){
|
||||
roll_object.roll_left();
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
if(g->match(keyEvent, "右移")){
|
||||
mRollObject.rollRight();
|
||||
if(g->match(key_event, "右移")){
|
||||
roll_object.roll_right();
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
if(g->match(keyEvent, "确定")){
|
||||
mRollObject.cur()->emit clicked();
|
||||
if(g->match(key_event, "确定")){
|
||||
roll_object.cur()->emit clicked();
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
@@ -115,8 +115,8 @@ void ServerSettingWidget::keyPressEvent(QKeyEvent *event) {
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void ServerSettingWidget::showEvent(QShowEvent *event) {
|
||||
mRollObject.mEnterFunc(mRollObject.cur());
|
||||
void Server_Setting_Widget::showEvent(QShowEvent *event) {
|
||||
roll_object.enter_func(roll_object.cur());
|
||||
event->accept();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user