1/* 2 * This file Copyright (C) Mnemosyne LLC 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 6 * as published by the Free Software Foundation. 7 * 8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 9 * 10 * $Id: make-dialog.h 11098 2010-08-02 20:55:11Z charles $ 11 */ 12 13#ifndef MAKE_DIALOG_H 14#define MAKE_DIALOG_H 15 16#include <QDialog> 17#include <QTimer> 18 19struct QAbstractButton; 20struct QPlainTextEdit; 21struct QLineEdit; 22struct QCheckBox; 23struct QLabel; 24struct QPushButton; 25struct QRadioButton; 26struct Session; 27struct QProgressBar; 28struct QDialogButtonBox; 29 30extern "C" 31{ 32 struct tr_metainfo_builder; 33} 34 35class MakeDialog: public QDialog 36{ 37 Q_OBJECT 38 39 private slots: 40 void onSourceChanged( ); 41 void onButtonBoxClicked( QAbstractButton* ); 42 void onNewButtonBoxClicked( QAbstractButton* ); 43 void onNewDialogDestroyed( QObject* ); 44 void onProgress( ); 45 46 void onFolderClicked( ); 47 void onFolderSelected( const QString& ); 48 void onFolderSelected( const QStringList& ); 49 50 void onFileClicked( ); 51 void onFileSelected( const QString& ); 52 void onFileSelected( const QStringList& ); 53 54 void onDestinationClicked( ); 55 void onDestinationSelected( const QString& ); 56 void onDestinationSelected( const QStringList& ); 57 58 private: 59 void makeTorrent( ); 60 QString getSource( ) const; 61 void enableBuddyWhenChecked( QCheckBox *, QWidget * ); 62 void enableBuddyWhenChecked( QRadioButton *, QWidget * ); 63 64 private: 65 Session& mySession; 66 QString myDestination; 67 QString myTarget; 68 QString myFile; 69 QString myFolder; 70 QTimer myTimer; 71 QRadioButton * myFolderRadio; 72 QRadioButton * myFileRadio; 73 QPushButton * myDestinationButton; 74 QPushButton * myFileButton; 75 QPushButton * myFolderButton; 76 QPlainTextEdit * myTrackerEdit; 77 QCheckBox * myCommentCheck; 78 QLineEdit * myCommentEdit; 79 QCheckBox * myPrivateCheck; 80 QLabel * mySourceLabel; 81 QDialogButtonBox * myButtonBox; 82 QProgressBar * myNewProgress; 83 QLabel * myNewLabel; 84 QDialogButtonBox * myNewButtonBox; 85 QDialog * myNewDialog; 86 struct tr_metainfo_builder * myBuilder; 87 88 protected: 89 virtual void dragEnterEvent( QDragEnterEvent * ); 90 virtual void dropEvent( QDropEvent * ); 91 92 public: 93 MakeDialog( Session&, QWidget * parent = 0 ); 94 ~MakeDialog( ); 95}; 96 97#endif 98