00001 #include "tcpplugin.h" 00002 00003 00004 /** List of menu commands - 00005 ** Text shown in menu and in dock titlebar. 00006 **/ 00007 QStringList TcpPlugin::commands() const 00008 { 00009 return QStringList() << tr("Tcp") << tr("Client") << tr("Server"); 00010 } 00011 00012 /** Displayable widget - 00013 ** Creates Dialog and connects signals/slots. Then creates QDockWidget so dock options can be set, 00014 ** then it's passed to BCore which can pass to the MainWindow. 00015 **/ 00016 QDockWidget* TcpPlugin::getDock(const QString &command) 00017 { 00018 QDialog* dialog = 0; 00019 00020 if ( command == commands()[2] ) 00021 { 00022 ServerDlog = new ServerDialog(); 00023 dialog = ServerDlog; 00024 } 00025 else if ( command == commands()[1] ) 00026 { 00027 ClientDlog = new ClientDialog(); 00028 dialog = ClientDlog; 00029 } 00030 00031 QDockWidget* dock = new QDockWidget("Tcp " + command); 00032 00033 dock->setAllowedAreas(Qt::AllDockWidgetAreas); 00034 dock->setWidget(dialog); 00035 bcore->addDock(dock); 00036 00037 return 0; 00038 } 00039