00001 /* 00002 Copyright 2010 Pierre SCHWARTZ 00003 00004 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 00005 documentation files (the "Software"), to deal in the Software without restriction, including without 00006 limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 00007 of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following 00008 conditions: The above copyright notice and this permission notice shall be included in all copies or 00009 substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00010 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 00011 PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00012 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 00013 OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00014 */ 00015 00023 #ifndef H__network_iput__ 00024 #define H__network_iput__ 00025 00026 #include <QtGui/QWidget> 00027 #include <QtGui/QLabel> 00028 #include <QtGui/QLineEdit> 00029 #include <QtNetwork/QNetworkReply> 00030 #include <QtCore/QTimer> 00031 00032 00036 class NetworkInput : public QWidget{ 00037 Q_OBJECT 00038 00039 public : 00040 NetworkInput(); 00041 ~NetworkInput(){}; 00042 QString getUrl(); 00043 void setUrl(QString); 00044 bool isReady(); 00045 00046 signals: 00047 void message(const QString&); 00048 00049 00050 public slots : 00051 void s_checkReady(); 00052 void s_onReceiveReady(QNetworkReply*); 00053 private: 00054 QLineEdit *edit; 00055 QLabel *img; 00056 void checkIfReady(); 00057 void setGreen(); 00058 void setOrange(); 00059 void setRed(); 00060 00061 bool ready; 00062 QTimer *timer; 00063 }; 00064 00065 #endif