change traffic spinbox to editable combobox
This commit is contained in:
+13
-20
@@ -250,11 +250,12 @@ void MainTray::showAbout()
|
||||
aboutWindow->setStandardButtons(QMessageBox::Ok);
|
||||
aboutWindow->setText(tr("<h1>NEU-Monitor</h1>"
|
||||
"<h3>Version: 1.4.1</h3>"
|
||||
"<p>Based on Qt ")+getQtVersion()+ tr("(GCC ")+
|
||||
getGccVersion()+
|
||||
tr(
|
||||
"<p>Based on Qt ")+getQtVersion() + tr("(") +
|
||||
getCompilerVersion() +
|
||||
tr(
|
||||
")</p>"
|
||||
"Source Code: <a href=\"https://github.com/c-my/NEU-Monitor\">https://github.com/c-my/NEU-Monitor</a><br/>"
|
||||
"Configuration file path: <a href = \"") + settings.fileName() +
|
||||
tr("\">") + settings.fileName() + tr("</a><br/>Source Code: <a href=\"https://github.com/c-my/NEU-Monitor\">https://github.com/c-my/NEU-Monitor</a><br/>"
|
||||
"Email: <address>"
|
||||
"<a href=\"mailto:cmy1113@yeah.net?subject=Neu-Monitor-v1.4.1 Feedback\">Cai.MY</a>"
|
||||
"</address>"));
|
||||
@@ -319,24 +320,16 @@ QString MainTray::getQtVersion()
|
||||
return QString::number(QT_VERSION_MAJOR)+tr(".")+QString::number(QT_VERSION_MINOR)+tr(".")+QString::number(QT_VERSION_PATCH);
|
||||
}
|
||||
|
||||
QString MainTray::getGccVersion()
|
||||
QString MainTray::getCompilerVersion()
|
||||
{
|
||||
return *(new QString());
|
||||
// return QString::number(__GNUC__)+tr(".")+QString::number(__GNUC_MINOR__)+tr(".")+QString::number(__GNUC_PATCHLEVEL__);
|
||||
}
|
||||
#ifdef __GNUC__
|
||||
return tr("GCC ")QString::number(__GNUC__)+tr(".")+QString::number(__GNUC_MINOR__)+tr(".")+QString::number(__GNUC_PATCHLEVEL__);
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
return tr("MSVC ") + QString::number(_MSC_FULL_VER);
|
||||
#endif
|
||||
|
||||
//void MainTray::openLogFile()
|
||||
//{
|
||||
// if (!logFile.open(QIODevice::Append | QIODevice::Text))
|
||||
// {
|
||||
// if (!muteAction->isChecked())
|
||||
// {
|
||||
// showMessage(tr("警告"), tr("日志文件打开失败"));
|
||||
// }
|
||||
// // return;
|
||||
// }
|
||||
// logFile.close();
|
||||
//}
|
||||
}
|
||||
|
||||
void MainTray::updateUserInfo(QByteArray id, QByteArray pass, int traffic) //pass为未加密的密码
|
||||
{
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ private:
|
||||
int checkInterval = 1000; //查询状态定时器周期
|
||||
|
||||
inline QString getQtVersion();
|
||||
inline QString getGccVersion();
|
||||
inline QString getCompilerVersion();
|
||||
signals:
|
||||
void exit();
|
||||
|
||||
|
||||
+11
-5
@@ -26,16 +26,22 @@ OptionsWindow::OptionsWindow(QByteArray id, QByteArray pass, int traffic, QWidge
|
||||
// mobileCheck->setChecked(isMobile);
|
||||
// mobileCheck->setToolTip(tr("实现PC多终端在线"));
|
||||
|
||||
trafficSpin = new QSpinBox(this);
|
||||
trafficSpin->setValue(traffic);
|
||||
trafficSpin->setToolTip(tr("0为无限制"));
|
||||
trafficBox = new QComboBox(this);
|
||||
trafficBox->setEditable(true);
|
||||
trafficBox->setCurrentText(QString::number(traffic));
|
||||
trafficBox->setValidator(new QIntValidator(0, INT_MAX));
|
||||
trafficBox->setToolTip(tr("0为无限制"));
|
||||
trafficBox->addItem(tr("5"));
|
||||
trafficBox->addItem(tr("25"));
|
||||
trafficBox->addItem(tr("60"));
|
||||
|
||||
|
||||
trafficLabel = new QLabel(tr("流量(G)"), this);
|
||||
trafficLabel->setToolTip(tr("在流量将要用尽时进行提醒"));
|
||||
|
||||
layout->addRow(tr("用户名"), idEdit);
|
||||
layout->addRow(tr("密码"), passwordEdit);
|
||||
layout->addRow(trafficLabel, trafficSpin);
|
||||
layout->addRow(trafficLabel, trafficBox);
|
||||
layout->setSpacing(20);
|
||||
|
||||
saveButton = new QPushButton("确定", this);
|
||||
@@ -58,7 +64,7 @@ OptionsWindow::OptionsWindow(QByteArray id, QByteArray pass, int traffic, QWidge
|
||||
connect(saveButton, &QPushButton::clicked, this, [this]() {
|
||||
emit saveSettings(idEdit->text().toUtf8(),
|
||||
passwordEdit->text().toUtf8(),
|
||||
trafficSpin->value());
|
||||
trafficBox->currentText().toInt());
|
||||
});
|
||||
connect(cancleButton, &QPushButton::clicked, this, &OptionsWindow::hide);
|
||||
}
|
||||
|
||||
+2
-2
@@ -9,12 +9,12 @@
|
||||
#include <QWidget>
|
||||
#include <QTabWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QPushButton>
|
||||
#include <QFormLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QSettings>
|
||||
|
||||
class OptionsWindow : public QMainWindow
|
||||
@@ -27,12 +27,12 @@ private:
|
||||
QTabWidget *tabWidget;
|
||||
QWidget *page1;
|
||||
QLineEdit *idEdit, *passwordEdit;
|
||||
QSpinBox *trafficSpin;
|
||||
QPushButton *saveButton, *cancleButton;
|
||||
QFormLayout *layout;
|
||||
QVBoxLayout *vlayout;
|
||||
QHBoxLayout *hlayout;
|
||||
QCheckBox *mobileCheck;
|
||||
QComboBox *trafficBox;
|
||||
|
||||
QLabel *trafficLabel;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user