#ifndef _MAINWDGT_H_ #define _MAINWDGT_H_ #include #include #include #include #include //#include "hubwdgt.h" //#include "debugdlg.h" class preview_dialog; class transfer_widget; class QAction; class QNetworkOperation; class QUrlOperator; class QProgressBar; class QProgressDialog; class HubWdgt; class QPushButton; class MainWdgt : public QMainWindow { Q_OBJECT public: MainWdgt( QWidget* parent = 0, const char* name = 0 ); /// Returns a pointer to the instance of MainWdgt. static const MainWdgt& getInstance(); /// Returns the number of connected hubs. int getNumConnections() const; public slots: /*! Slot that displays a simplae dialog with info about the application */ void displayAbout(); /*! Slot that displays the about qt dialog. */ void displayAboutQt(); /// Slot for showing the online help void displayHelp(); /*! Slot for making a search in all hubs that we are connected to. Retreives the search string and then emits a search signal with the search string so the hub widgets can perform the search. */ void search(){} /*! Slot for creating a new hub ta // DA EViL MiGTHY AUTOCONNECT for(int i=0;i < settings.num_favourites();i++) { QString name,pwd,ip,prof; bool autoc=false; settings.get_favourite(i,name,ip,pwd,autoc,prof); if(autoc) { HubWdgt *h = newHubTab(); h->connect(ip,pwd,prof); } } b, used to connet to a hub. */ HubWdgt* newHubTab(); /*! Slot for removing a hub tab when the user has pressed the close button */ void closeHubTab( ); /*! Brings up the preferences dialog. */ void showPreferences(); /*! Brings up the preview dialog. */ void show_preview_dialog(); void setHubName(const QString &name, QWidget *wdgt); /// Connects the current hub void connectHub(); /// Disconnects the current hub void disHub(); /// Brings up the search dialog void searchHub(); void selectHub(QWidget*); // Slot for handling multihub searh results void dispatchSearchResult(const QString& u,const QString& f,const QString& s,const QString& sl,const QString& hubname); void hubDisconnected(int id); void hubConnected(int id); // Version retrieval slots, and registering online // These are now used as (general) www-transfer slots void checkVersion(); void register_installation(); void register_session(); void wwwxfer_incoming(const QByteArray &data, QNetworkOperation *op); void wwwxfer_finished(QNetworkOperation *op); void dctcOutputReady(); /// Shows a message in the status bar void showStatus(const QString&); /// Shows some progrss in the status bar void showProgress(const QString&,const QString&); /// Enables or disables the actions void enableActions(bool yes); /// Rebuilds the shared database void reshare(); void doAutoConnect(); void sendDCTCCommand(); signals: /*! Signal that is emitted when a user wants to search the hubs we are connected to at the moment */ void search( const QString& str ); // signals to status monitor mainly void sig_hub_opened(); void sig_hub_closed(); private: /*! Line edit for entering search strings */ QLineEdit* searchEdit; /*! The tab widget that holds our hub tabs */ QTabWidget* hubTabs; /*! The transfer dialog */ // TransferDlg* transferWin; /*! The new and improved transfer widget. */ transfer_widget* transferWidget; /*! A preview dialog, contains preview widget. */ preview_dialog *preview_dlg; virtual void closeEvent( QCloseEvent *e); bool checkDCTCVersion(); void cleanDCTCDir(); QAction *aNewHub; QAction *aCloseHub; QAction *aConnect; QAction *aDisconnect; QAction *aSearch; QAction *aConfig; QAction *aExit; QAction *aReshare; QAction *aMinimode; QAction *aPreview; // getting stuff from WWW (version control, online registration) enum www_operation {NONE, VERSION_CHECK, USER_REG, SESSION_REG}; www_operation current_op; QUrlOperator *urlop; QByteArray recvData; QString dctcVersion; QProgressDialog *progressDlg; QSplitter *mainbox; static MainWdgt* instance; }; #endif