57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
|
#include "settingsscreen.h"
|
|||
|
#include "config.h"
|
|||
|
#include <QCryptographicHash>
|
|||
|
#include "netio.h"
|
|||
|
SettingsScreen::SettingsScreen(QWidget *parent)
|
|||
|
: QWidget(parent)
|
|||
|
{
|
|||
|
ui.setupUi(this);
|
|||
|
autoStart = new SwitchButton(ADD_AUTOSTART,this);
|
|||
|
addDesktopLink = new QPushButton(this);
|
|||
|
addDesktopLink->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD>ʽ"));
|
|||
|
connect(addDesktopLink, &QPushButton::pressed, this, &SettingsScreen::createShortCut);
|
|||
|
layout = new QHBoxLayout(this);
|
|||
|
left = new QVBoxLayout(this);
|
|||
|
addDesktopLink_label = new QLabel(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD>ʽ"),this);
|
|||
|
autoStart_label = new QLabel(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),this);
|
|||
|
autoStart->setMaximumSize(100, 50);
|
|||
|
autoStart->setMinimumSize(50, 25);
|
|||
|
left->addWidget(autoStart_label);
|
|||
|
left->addWidget(autoStart);
|
|||
|
left->addWidget(addDesktopLink_label);
|
|||
|
left->addWidget(addDesktopLink);
|
|||
|
left->setAlignment(Qt::AlignCenter);
|
|||
|
left->setMargin(0);
|
|||
|
layout->addLayout(left);
|
|||
|
information = new QLabel;
|
|||
|
QString device_id = QCryptographicHash::hash(getMachineGUID().toUtf8(), QCryptographicHash::Md5).toHex();
|
|||
|
QString inf_str = QString::fromLocal8Bit("Ӳ<EFBFBD><EFBFBD>ID:\n");
|
|||
|
inf_str += device_id;
|
|||
|
information->setText(inf_str);
|
|||
|
layout->addWidget(information);
|
|||
|
}
|
|||
|
|
|||
|
void SettingsScreen::createShortCut() {
|
|||
|
QString deskTopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
|||
|
deskTopPath = deskTopPath + QString::fromLocal8Bit("/<2F>칫<EFBFBD><ECB9AB><EFBFBD><EFBFBD>.lnk");
|
|||
|
QString srcFile = QApplication::applicationFilePath();
|
|||
|
QFile::link(srcFile, deskTopPath);
|
|||
|
}
|
|||
|
|
|||
|
SettingsScreen::~SettingsScreen()
|
|||
|
{
|
|||
|
left->removeWidget(autoStart);
|
|||
|
left->removeWidget(addDesktopLink);
|
|||
|
left->removeWidget(addDesktopLink_label);
|
|||
|
left->removeWidget(autoStart_label);
|
|||
|
delete autoStart;
|
|||
|
delete addDesktopLink;
|
|||
|
delete addDesktopLink_label;
|
|||
|
delete autoStart_label;
|
|||
|
layout->removeItem(left);
|
|||
|
delete left;
|
|||
|
layout->removeWidget(information);
|
|||
|
delete information;
|
|||
|
delete layout;
|
|||
|
}
|