dialog.h
#ifndef DIALOG_H #define DIALOG_H #include <QDialog> #include <QTcpSocket> #include <QtSql> #include <QSqlDatabase> #include <QTextEdit> #include <QTime> #include <QFile> #include <QDir> #include <QTimer> class QDialogButtonBox; class QLabel; class QLineEdit; class QPushButton; class QTcpSocket; class QTextEdit; class QSqlDatabase; class QSqlQuery; class QTime; class QDate; class Dialog : public QDialog { Q_OBJECT public: Dialog(QWidget *parent = 0); void getip(); void log(QByteArray); void copy(); //备份 private: //图形界面 QLabel *serverLabel; QLabel *ipInfoLabel; QLabel *sqlipLabel; QLabel *databaseLabel; QLabel *sqluserLabel; QLabel *sqlpassLabel; QLabel *startdateLabel; QLabel *starttimeLabel; QComboBox *ComboBox; QLineEdit *ipInfoLineEdit; QLineEdit *sqlipLineEdit; QLineEdit *databaseLineEdit; QLineEdit *sqluserLineEdit; QLineEdit *sqlpassLineEdit; QLineEdit *startdateLineEdit; QLineEdit *starttimeLineEdit; QPushButton *beginButton; QPushButton *quitButton; QDialogButtonBox *buttonBox; QTextEdit display; //存储服务器信息 int port; QString host; QString filepath; QDir dir; QByteArray fortune[5]; QTimer *timer1; // QTimer *timer2; QTcpSocket *tcpSocket; QSqlDatabase db; long numflag; public slots: //从套接字读数据,并存于数据库中 void sendFortune(); //创建数据库连接,开始定时 void begin(); }; #endif
main.c
原文地址:http://www.cnblogs.com/tuotuteng/p/3883612.html