00001 /* 00002 dvdripbox.h 00003 00004 (c) 2003 Thor Sigvaldason and Isaac Richards 00005 Part of the mythTV project 00006 00007 header for the main interface screen 00008 */ 00009 00010 #ifndef DVDRIPBOX_H_ 00011 #define DVDRIPBOX_H_ 00012 00013 #include <qregexp.h> 00014 #include <qtimer.h> 00015 #include <qptrlist.h> 00016 #include <qthread.h> 00017 #include <qsocket.h> 00018 00019 #include <mythtv/mythwidgets.h> 00020 #include <mythtv/dialogbox.h> 00021 00022 00023 #include "dvdinfo.h" 00024 00025 class MTDJob : public QObject 00026 { 00027 Q_OBJECT 00028 00029 // 00030 // A little class that stores 00031 // data about jobs running on the 00032 // mtd 00033 // 00034 00035 public: 00036 00037 MTDJob(); 00038 MTDJob(const QString &a_name_); 00039 00040 void init(); 00041 00042 // 00043 // Set 00044 // 00045 00046 void setNumber(int a_number){job_number = a_number;} 00047 void SetName(const QString &a_name); 00048 void setActivity(const QString &an_act); 00049 void setOverall(double a_number){overall_progress = a_number;} 00050 void setSubjob(double a_number); 00051 void setCancelled(bool yes_or_no){cancelled = yes_or_no;} 00052 00053 // 00054 // Get 00055 // 00056 00057 int getNumber(){return job_number;} 00058 QString getName(){return job_name;} 00059 QString getActivity(){return current_activity;} 00060 double getOverall(){return overall_progress;} 00061 double getSubjob(){return subjob_progress;} 00062 00063 signals: 00064 00065 void toggledCancelled(); 00066 00067 private: 00068 00069 int job_number; 00070 QString job_name; 00071 QString current_activity; 00072 double overall_progress; 00073 double subjob_progress; 00074 bool cancelled; 00075 }; 00076 00077 class DVDRipBox : public MythThemedDialog 00078 { 00079 00080 Q_OBJECT 00081 00082 public: 00083 00084 typedef QValueVector<int> IntVector; 00085 00086 DVDRipBox(MythMainWindow *parent, QString window_name, 00087 QString dev, QString theme_filename, const char *name = 0); 00088 00089 ~DVDRipBox(void); 00090 00091 void connectToMtd(bool try_to_run_mtd); 00092 void keyPressEvent(QKeyEvent *e); 00093 00094 public slots: 00095 00096 void connectionError(int error_id); 00097 void connectionMade(); 00098 void connectionClosed(); 00099 void readFromServer(); 00100 void parseTokens(QStringList tokens); 00101 void sendToServer(const QString &some_text); 00102 void startStatusPolling(); 00103 void stopStatusPolling(); 00104 void pollStatus(); 00105 void handleStatus(QStringList tokens); 00106 void handleMedia(QStringList tokens); 00107 void setOverallJobStatus(int job_number, double status, QString title); 00108 void setSubJobStatus(int job_number, double status, QString subjob_string); 00109 void adjustJobs(uint new_number); 00110 void nextJob(); 00111 void prevJob(); 00112 void goToJob(int which_job); 00113 void showCurrentJob(); 00114 void goRipScreen(); 00115 void checkDisc(); 00116 void cancelJob(); 00117 void toggleCancel(); 00118 00119 private: 00120 00121 void wireUpTheme(); 00122 void createSocket(); 00123 00124 QSocket *client_socket; 00125 QTimer *status_timer; 00126 bool tried_mtd; 00127 bool connected; 00128 bool first_time_through; 00129 bool have_disc; 00130 bool first_disc_found; 00131 bool block_media_requests; 00132 QPtrList<MTDJob> jobs; 00133 uint numb_jobs; 00134 int current_job; 00135 bool ignore_cancels; 00136 00137 QString m_device; 00138 DVDInfo *dvd_info; 00139 QTimer *disc_checking_timer; 00140 00141 // 00142 // Theme-related "widgets" 00143 // 00144 00145 UITextType *warning_text; 00146 UITextType *overall_text; 00147 UITextType *job_text; 00148 UITextType *numb_jobs_text; 00149 UITextType *nodvd_text; 00150 UIStatusBarType *overall_status; 00151 UIStatusBarType *job_status; 00152 UIPushButtonType *nextjob_button; 00153 UIPushButtonType *prevjob_button; 00154 UITextButtonType *ripscreen_button; 00155 UITextButtonType *cancel_button; 00156 }; 00157 00158 00159 #endif
1.5.5