Files
crown/CrownClient/FollowHandicap.cpp

261 lines
4.5 KiB
C++

#include "FollowHandicap.h"
FollowHandicap::FollowHandicap(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
// 设置窗口图标
this->setWindowIcon(QIcon(":/images/Images/client.ico"));
// 设置窗口标题
this->setWindowTitle("跟单盘口");
// 设置为对话框窗口
setWindowFlags(Qt::Dialog);
// 设置窗口仅有关闭按钮
setWindowFlags(Qt::WindowCloseButtonHint);
// setFixedSize(1188, 711);
}
FollowHandicap::~FollowHandicap()
{}
QMap<QString, QString> FollowHandicap::map()
{
QMap<QString, QString> map;
if (ui.hkCheckBox->isChecked())
{
map["hkEnable"] = "true";
if (ui.hkCombo->currentIndex() == 0)
{
map["hkChange"] = "H";
map["hkType"] = "香港盘";
}
if (ui.hkCombo->currentIndex() == 1)
{
map["hkChange"] = "M";
map["hkType"] = "马来盘";
}
if (ui.hkCombo->currentIndex() == 2)
{
map["hkChange"] = "I";
map["hkType"] = "印尼盘";
}
if (ui.hkCombo->currentIndex() == 3)
{
map["hkChange"] = "E";
map["hkType"] = "欧洲盘";
}
}
else
{
map["hkEnable"] = "false";
map["hkType"] = "香港盘";
}
if (ui.masCheckBox->isChecked())
{
map["masEnable"] = "true";
if (ui.masCombo->currentIndex() == 0)
{
map["masChange"] = "H";
map["masType"] = "香港盘";
}
if (ui.masCombo->currentIndex() == 1)
{
map["masChange"] = "M";
map["masType"] = "马来盘";
}
if (ui.masCombo->currentIndex() == 2)
{
map["masChange"] = "I";
map["masType"] = "印尼盘";
}
if (ui.masCombo->currentIndex() == 3)
{
map["masChange"] = "E";
map["masType"] = "欧洲盘";
}
}
else
{
map["masEnable"] = "false";
map["masType"] = "马来盘";
}
if (ui.idaCheckBox->isChecked())
{
map["idaEnable"] = "true";
if (ui.idaCombo->currentIndex() == 0)
{
map["idaChange"] = "H";
map["idaType"] = "香港盘";
}
if (ui.idaCombo->currentIndex() == 1)
{
map["idaChange"] = "M";
map["idaType"] = "马来盘";
}
if (ui.idaCombo->currentIndex() == 2)
{
map["idaChange"] = "I";
map["idaType"] = "印尼盘";
}
if (ui.idaCombo->currentIndex() == 3)
{
map["idaChange"] = "E";
map["idaType"] = "欧洲盘";
}
}
else
{
map["idaEnable"] = "false";
map["idaType"] = "印尼盘";
}
if (ui.eurCheckBox->isChecked())
{
map["eurEnable"] = "true";
if (ui.eurCombo->currentIndex() == 0)
{
map["eurChange"] = "H";
map["eurType"] = "香港盘";
}
if (ui.eurCombo->currentIndex() == 1)
{
map["eurChange"] = "M";
map["eurType"] = "马来盘";
}
if (ui.eurCombo->currentIndex() == 2)
{
map["eurChange"] = "I";
map["eurType"] = "印尼盘";
}
if (ui.eurCombo->currentIndex() == 3)
{
map["eurChange"] = "E";
map["eurType"] = "欧洲盘";
}
}
else
{
map["eurEnable"] = "false";
map["eurType"] = "欧洲盘";
}
return map;
}
void FollowHandicap::setMap(QMap<QString, QString> map)
{
if (map["hkEnable"] == "true")
{
ui.hkCheckBox->setChecked(true);
}
else
{
ui.hkCheckBox->setChecked(false);
}
if (map["masEnable"] == "true")
{
ui.masCheckBox->setChecked(true);
}
else
{
ui.masCheckBox->setChecked(false);
}
if (map["idaEnable"] == "true")
{
ui.idaCheckBox->setChecked(true);
}
else
{
ui.idaCheckBox->setChecked(false);
}
if (map["eurEnable"] == "true")
{
ui.eurCheckBox->setChecked(true);
}
else
{
ui.eurCheckBox->setChecked(false);
}
if (map["hkChange"] == "H")
{
ui.hkCombo->setCurrentIndex(0);
}
if (map["hkChange"] == "M")
{
ui.hkCombo->setCurrentIndex(1);
}
if (map["hkChange"] == "I")
{
ui.hkCombo->setCurrentIndex(2);
}
if (map["hkChange"] == "E")
{
ui.hkCombo->setCurrentIndex(3);
}
if (map["masChange"] == "H")
{
ui.masCombo->setCurrentIndex(0);
}
if (map["masChange"] == "M")
{
ui.masCombo->setCurrentIndex(1);
}
if (map["masChange"] == "I")
{
ui.masCombo->setCurrentIndex(2);
}
if (map["masChange"] == "E")
{
ui.masCombo->setCurrentIndex(3);
}
if (map["idaChange"] == "H")
{
ui.idaCombo->setCurrentIndex(0);
}
if (map["idaChange"] == "M")
{
ui.idaCombo->setCurrentIndex(1);
}
if (map["idaChange"] == "I")
{
ui.idaCombo->setCurrentIndex(2);
}
if (map["idaChange"] == "E")
{
ui.idaCombo->setCurrentIndex(3);
}
if (map["eurChange"] == "H")
{
ui.eurCombo->setCurrentIndex(0);
}
if (map["eurChange"] == "M")
{
ui.eurCombo->setCurrentIndex(1);
}
if (map["eurChange"] == "I")
{
ui.eurCombo->setCurrentIndex(2);
}
if (map["eurChange"] == "E")
{
ui.eurCombo->setCurrentIndex(3);
}
}
void FollowHandicap::closeEvent(QCloseEvent * event)
{
emit signalUpdateStatus();
}