00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "ds4clonerestore.h"
00011
00012
00013 DS4CloneRestore::DS4CloneRestore(QWidget* parent, const char* name, WFlags fl)
00014 : mainDlg(parent,name,fl)
00015 {
00016 cloneEnabled = FALSE;
00017 revMounted = FALSE;
00018 serverMounted = FALSE;
00019 }
00020
00021
00022 DS4CloneRestore::~DS4CloneRestore()
00023 {
00024 Close();
00025 }
00026
00027
00028 void DS4CloneRestore::Init(bool cloneVersion, const char version[])
00029 {
00030 this->setCaption(this->caption() + version);
00031
00032 cloneEnabled = cloneVersion;
00033
00034 if (cloneEnabled)
00035 {
00036 cloneWin = new Clone(this,"Clone",TRUE);
00037 }
00038 else
00039 {
00040 btnClone->setEnabled(FALSE);
00041 btnClone->hide();
00042 lblClone->setEnabled(FALSE);
00043 lblClone->hide();
00044
00045
00046 btnRestore->move(btnRestore->x(), btnRestore->y() - 120);
00047 lblRestore->move(lblRestore->x(), lblRestore->y() - 120);
00048
00049
00050 btnRevManager->move(btnRevManager->x(), btnRevManager->y() - 120);
00051 lblRevManager->move(lblRevManager->x(), lblRevManager->y() - 120);
00052
00053
00054 btnConfiguration->move(btnConfiguration->x(), btnConfiguration->y() - 120);
00055 lblNetManager->move(lblNetManager->x(), lblNetManager->y() - 120);
00056
00057
00058 this->setMinimumSize( QSize( this->width(), this->height() - 120 ) );
00059 this->setMaximumSize( QSize( this->width(), this->height() - 120 ) );
00060 this->setSizeIncrement( QSize( 0, 0 ) );
00061 this->setBaseSize( QSize( this->width(), this->height() - 120 ) );
00062 }
00063 restoreWin = new Restore(this,"Restore",TRUE);
00064 revManagerWin = new RevManager(this,"RevManager",TRUE);
00065 configurationWin = new Configuration(this,"Configuration",TRUE);
00066
00067 revMounted = MountRev();
00068 serverMounted = MountServer();
00069 }
00070
00071
00072 void DS4CloneRestore::btnClone_clicked()
00073 {
00074 if (!cloneEnabled)
00075 return;
00076
00077 cloneWin->Init(&revMounted);
00078
00079 CenterWindow(this,cloneWin);
00080
00081 this->setEnabled(FALSE);
00082 cloneWin->setEnabled(TRUE);
00083 cloneWin->show();
00084 }
00085
00086
00087 void DS4CloneRestore::btnRestore_clicked()
00088 {
00089 restoreWin->Init(&revMounted,&serverMounted);
00090
00091 CenterWindow(this,restoreWin);
00092
00093 this->setEnabled(FALSE);
00094 restoreWin->setEnabled(TRUE);
00095 restoreWin->show();
00096 }
00097
00098
00099 void DS4CloneRestore::btnRevManager_clicked()
00100 {
00101 revManagerWin->Init(&revMounted);
00102
00103 CenterWindow(this,revManagerWin);
00104
00105 this->setEnabled(FALSE);
00106 revManagerWin->setEnabled(TRUE);
00107 revManagerWin->show();
00108 }
00109
00110 void DS4CloneRestore::btnConfiguration_clicked()
00111 {
00112 configurationWin->Init();
00113
00114 CenterWindow(this,configurationWin);
00115
00116 this->setEnabled(FALSE);
00117 configurationWin->setEnabled(TRUE);
00118 configurationWin->show();
00119 }
00120
00121
00122 void DS4CloneRestore::closeEvent (QCloseEvent *e)
00123 {
00124 if (this->isEnabled())
00125 {
00126 e->accept();
00127 Close();
00128 }
00129 else
00130 {
00131 e->ignore();
00132 }
00133 }
00134
00135
00136 void DS4CloneRestore::Close()
00137 {
00138 if (cloneEnabled)
00139 {
00140 delete cloneWin;
00141 cloneWin = NULL;
00142 }
00143 delete restoreWin;
00144 restoreWin = NULL;
00145 delete revManagerWin;
00146 revManagerWin = NULL;
00147 delete configurationWin;
00148 configurationWin = NULL;
00149
00150 if (revMounted == TRUE)
00151 UmountRev();
00152 if (serverMounted == TRUE)
00153 UmountServer();
00154 }
00155
00156
00157
00158 #include "ds4clonerestore.moc"