cMainWidget.h: ------------------------ #ifndef CMAINWIDGET_H #define CMAINWIDGET_H #include #include class cMainWidget : public QWidget { Q_OBJECT private: QGridLayout* m_topLayout; QPushButton* m_Create; QLineEdit* m_tPic; QLineEdit* m_tTime; QLineEdit* m_tCodec; QLineEdit* m_tSize; QTextEdit* m_tDesc; QTextEdit* m_tLinks; public: cMainWidget( QWidget* parent = 0 ); bool checkWidgets( void ); void createThreadCode( void ); protected: void initLayout( void ); void initSignals( void ); protected slots: void createThread( void ); }; #endif cMainWidget.h End --------------------- cMainWidget.c ------------------------- #include "cMainWidget.h" cMainWidget::cMainWidget( QWidget* parent ) : QWidget( parent ) { this->m_topLayout = new QGridLayout; this->m_Create = new QPushButton( QString("Erstellen") ); this->m_tPic = new QLineEdit; this->m_tCodec = new QLineEdit; this->m_tTime = new QLineEdit; this->m_tSize = new QLineEdit; this->m_tDesc = new QTextEdit; this->m_tLinks = new QTextEdit; this->initLayout(); this->initSignals(); } void cMainWidget::initLayout( void ) { this->m_topLayout->addWidget( new QLabel( QString( "Bild" ) ), 0, 0 ); this->m_topLayout->addWidget( new QLabel( QString( "Beschreibung\n\n" ) ), 1, 0 ); this->m_topLayout->addWidget( new QLabel( QString( "Dauer" ) ), 3, 0 ); this->m_topLayout->addWidget( new QLabel( QString( "Format" ) ), 4, 0 ); this->m_topLayout->addWidget( new QLabel( QString( "Größe" ) ), 5, 0 ); this->m_topLayout->addWidget( new QLabel( QString( "Links" ) ), 6, 0 ); this->m_topLayout->addWidget( this->m_tPic, 0, 1 ); this->m_topLayout->addWidget( this->m_tDesc, 1, 1 ); this->m_topLayout->addWidget( this->m_tTime, 3, 1 ); this->m_topLayout->addWidget( this->m_tCodec, 4, 1 ); this->m_topLayout->addWidget( this->m_tSize, 5, 1 ); this->m_topLayout->addWidget( this->m_tLinks, 6, 1 ); this->m_topLayout->addWidget( this->m_Create, 7, 1 ); this->m_tDesc->setMaximumHeight( 75 ); this->m_tLinks->setMaximumHeight( 75 ); setLayout( this->m_topLayout ); } void cMainWidget::initSignals( void ) { connect( this->m_Create, SIGNAL( clicked() ), this, SLOT( createThread() ) ); } void cMainWidget::createThread( void ) { if(!this->checkWidgets()) { QMessageBox::information( this, QString("Error"), QString("Du musst alle Felder ausfüllen!"), 0 ); return; } this->createThreadCode(); return; } bool cMainWidget::checkWidgets( void ) { if( this->m_tCodec->text().count() == 0 ) { return false; } if( this->m_tPic->text().count() == 0 ) { return false; } if( this->m_tCodec->text().count() == 0 ) { return false; } if( this->m_tSize->text().count() == 0 ) { return false; } if( this->m_tDesc->toPlainText().count() == 0 ) { return false; } if( this->m_tLinks->toPlainText().count() == 0 ) { return false; } return true; } void cMainWidget::createThreadCode( void ) { QStringList splittedDownloads = this->m_tLinks->toPlainText().split( '\n', QString::SkipEmptyParts ); QString threadContent; threadContent.append( QString( "[img]%1[/img]\n" ).arg( this->m_tPic->text() ) ); threadContent.append( QString("%1\n\n\n").arg( this->m_tDesc->toPlainText() ) ); threadContent.append( QString( "%1%2 | %3%4 | %5%6\n\n" ).arg( "[b]Dauer:[/b] " ).arg( this->m_tTime->text() ).arg( "[b]Format:[/b] ").arg( this->m_tCodec->text() ).arg("[b]Größe:[/b] ").arg( this->m_tSize->text() ) ); /* b]Download #1:[/b] [url href = "http://moviespot.kuba.to/download/f-d618b73b0cb1bdcd/rc_ichbineinfile.html"]Rapidshare.com[/url]*/ for( int i=0; isetPlainText( threadContent ); threadCode->setGeometry( QRect( 500, 500, 500, 500 ) ); threadCode->show(); } cMainWidget.h End -----------------------