星小夜的登录器  v1.0
atoken.cpp
浏览该文件的文档.
1 
11 #include "atoken.h"
12 #include "ui_atoken.h"
18 Atoken::Atoken(QWidget *parent) :
19  QWidget(parent),
20  ui(new Ui::Atoken)
21 {
22  ui->setupUi(this);
23  setAttribute(Qt::WA_QuitOnClose,false);
24  QSettings *configIniWrite = new QSettings(allpath+"/set.ini", QSettings::IniFormat);
25 
26  //向ini文件中写入内容,setValue函数的两个参数是键值对
27  uu=configIniWrite->value("agree").toString();
28  if(configIniWrite->value("agree").toString()!="true")
29  {
30  ui->pushButton->setEnabled(false);
31  }else
32  ui->pushButton->setEnabled(true);
33  delete configIniWrite;
34 
35  time = new QTime();
36  timer = new QTimer();
37 
38  connect(timer,SIGNAL(timeout()),this,SLOT(slot_timer_timeout()));
39  connect(ui->pushButton,SIGNAL(clicked(bool)),this,SLOT(slot_agree()));
40  time->start();
41  timer->start(1000);
42  Qt::WindowFlags m_flags = windowFlags();
43  setWindowFlags(m_flags | Qt::WindowStaysOnTopHint);
44  show();
45 }
51 {
52  delete ui;
53  delete time;
54  delete timer;
55 }
61 void Atoken::closeEvent(QCloseEvent *event)
62 {
63  //QMessageBox::about(NULL,"tip","本窗口禁止关闭哦");
64  show();
65  qDebug()<<"???";
66 }
73  int firetime=30-(time->elapsed()/1000);
74  //qDebug()<<firetime;
75  //qDebug()<<firetime_sec;
76  //qDebug()<<tmp;
77 
78  if(firetime<3){
79  ui->pushButton->setEnabled(true);
80  setAttribute(Qt::WA_DeleteOnClose);
81  }else if(firetime>=3 && uu!="true"){
82  Qt::WindowFlags m_flags = windowFlags();
83  setWindowFlags(m_flags | Qt::WindowStaysOnTopHint);
84  show();
85  }
86  ui->label->setText("等待"+QString::number(firetime)+"s后才能确认");
87 }
94  this->hide();
95  QSettings *configIniWrite = new QSettings(allpath+"/set.ini", QSettings::IniFormat);
96  //向ini文件中写入内容,setValue函数的两个参数是键值对
97  configIniWrite->setValue("agree", "true");
98  delete configIniWrite;
99 
100 }
Atoken::slot_timer_timeout
void slot_timer_timeout()
免责协议窗口槽函数-定时器处理内容
Definition: atoken.cpp:72
atoken.h
免责协议窗口头文件
Atoken::time
QTime * time
Definition: atoken.h:34
Atoken::~Atoken
~Atoken()
免责协议窗口析构函数
Definition: atoken.cpp:50
Atoken::Atoken
Atoken(QWidget *parent=0)
免责协议窗口构造函数
Definition: atoken.cpp:18
Atoken::timer
QTimer * timer
Definition: atoken.h:35
Atoken::closeEvent
void closeEvent(QCloseEvent *event)
免责协议窗口关闭重载函数
Definition: atoken.cpp:61
allpath
QString allpath
登录器运行目录
Definition: ext.cpp:45
Atoken::uu
QString uu
Definition: atoken.h:37
Atoken::slot_agree
void slot_agree()
免责协议窗口槽函数-同意按钮按下处理内容
Definition: atoken.cpp:93
Ui
Definition: atoken.h:17
Atoken
免责协议窗口类 免责协议窗口这个类相关的函数
Definition: atoken.h:26
Atoken::ui
Ui::Atoken * ui
Definition: atoken.h:43