traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src/traverso dialogs/RestoreProjectBac...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/traverso dialogs/RestoreProjectBac...
Date: Sat, 06 Oct 2007 14:18:31 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/10/06 14:18:31

Added files:
        src/traverso/dialogs: RestoreProjectBackupDialog.cpp 
                              RestoreProjectBackupDialog.h 
        src/traverso/ui: RestoreProjectBackupDialog.ui 

Log message:
        * Added somewhat more sophisticated backup solution

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/RestoreProjectBackupDialog.cpp?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/RestoreProjectBackupDialog.h?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/ui/RestoreProjectBackupDialog.ui?cvsroot=traverso&rev=1.1

Patches:
Index: dialogs/RestoreProjectBackupDialog.cpp
===================================================================
RCS file: dialogs/RestoreProjectBackupDialog.cpp
diff -N dialogs/RestoreProjectBackupDialog.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ dialogs/RestoreProjectBackupDialog.cpp      6 Oct 2007 14:18:31 -0000       
1.1
@@ -0,0 +1,93 @@
+/*
+    Copyright (C) 2007 Remon Sijrier
+ 
+    This file is part of Traverso
+ 
+    Traverso is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+ 
+*/
+
+#include "RestoreProjectBackupDialog.h"
+#include "ProjectManager.h"
+#include <QTreeWidgetItem>
+#include <QDateTime>
+
+#include "Information.h"
+
+RestoreProjectBackupDialog::RestoreProjectBackupDialog(QWidget * parent)
+       : QDialog(parent)
+{
+       setupUi(this);
+}
+
+
+void RestoreProjectBackupDialog::accept()
+{
+       QTreeWidgetItem* item = dateTreeWidget->currentItem();
+       
+       if (!item) {
+               reject();
+               return;
+       }
+       
+       uint restoretime = item->data(0, Qt::UserRole).toUInt();
+       int sucess = pm().restore_project_from_backup(m_projectname, 
restoretime);
+       
+       if (sucess) {
+               pm().load_project(m_projectname);
+               info().information(tr("Succesfully restored backup from 
%1").arg(QDateTime::fromTime_t(restoretime).toString()));
+               hide();
+       }
+       
+}
+
+void RestoreProjectBackupDialog::reject()
+{
+       hide();
+}
+
+void RestoreProjectBackupDialog::populate_treeview()
+{
+       dateTreeWidget->clear();
+       
+       currentDateLable->setText(QDateTime::currentDateTime 
().toString("dd-MM-yy hh:mm:ss"));
+       
+       QList<uint> list = pm().get_backup_date_times(m_projectname);
+       QDateTime datetime;
+       foreach(uint time, list) {
+               QTreeWidgetItem* item = new QTreeWidgetItem(dateTreeWidget);
+               datetime.setTime_t(time);
+               item->setText(0, datetime.toString("dd-MM-yy"));
+               item->setText(1, datetime.toString("hh:mm:ss"));
+               item->setData(0, Qt::UserRole, time);
+       }
+       
+       dateTreeWidget->sortItems(0, Qt::DescendingOrder);
+       
+       if (list.size()) {
+               QTreeWidgetItem* item = 
dateTreeWidget->invisibleRootItem()->child(0);
+               dateTreeWidget->setCurrentItem(item);
+               lastBackupLable->setText(item->text(0) + " " + item->text(1));
+       } else {
+               lastBackupLable->setText(tr("No backup(s) available!"));
+       }
+}
+
+void RestoreProjectBackupDialog::set_project_name(const QString & projectname)
+{
+       m_projectname = projectname;
+       populate_treeview();
+}
+

Index: dialogs/RestoreProjectBackupDialog.h
===================================================================
RCS file: dialogs/RestoreProjectBackupDialog.h
diff -N dialogs/RestoreProjectBackupDialog.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ dialogs/RestoreProjectBackupDialog.h        6 Oct 2007 14:18:31 -0000       
1.1
@@ -0,0 +1,49 @@
+/*
+    Copyright (C) 2007 Remon Sijrier 
+ 
+    This file is part of Traverso
+ 
+    Traverso is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+ 
+*/
+
+#ifndef RESTORE_PROJECT_BACKUP_DIALOG_H
+#define RESTORE_PROJECT_BACKUP_DIALOG_H
+
+#include "ui_RestoreProjectBackupDialog.h"
+#include <QDialog>
+
+class Project;
+
+class RestoreProjectBackupDialog : public QDialog, protected 
Ui::RestoreProjectBackupDialog
+{
+       Q_OBJECT
+
+public:
+       RestoreProjectBackupDialog(QWidget* parent = 0);
+       ~RestoreProjectBackupDialog() {};
+       
+       void set_project_name(const QString& projectname);
+       
+private:
+       QString m_projectname;
+       void accept();
+       void reject();
+       void populate_treeview();
+};
+
+#endif
+
+//eof

Index: ui/RestoreProjectBackupDialog.ui
===================================================================
RCS file: ui/RestoreProjectBackupDialog.ui
diff -N ui/RestoreProjectBackupDialog.ui
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ ui/RestoreProjectBackupDialog.ui    6 Oct 2007 14:18:31 -0000       1.1
@@ -0,0 +1,124 @@
+<ui version="4.0" >
+ <class>RestoreProjectBackupDialog</class>
+ <widget class="QDialog" name="RestoreProjectBackupDialog" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>323</width>
+    <height>358</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Restore from backup </string>
+  </property>
+  <layout class="QVBoxLayout" >
+   <item>
+    <widget class="QLabel" name="label" >
+     <property name="text" >
+      <string>Set the date to restore the selected backup.</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <item>
+      <layout class="QVBoxLayout" >
+       <item>
+        <widget class="QLabel" name="label_2" >
+         <property name="text" >
+          <string>Current date and time:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLabel" name="label_3" >
+         <property name="text" >
+          <string>Last backup:</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" >
+       <item>
+        <widget class="QLabel" name="currentDateLable" >
+         <property name="text" >
+          <string>-</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLabel" name="lastBackupLable" >
+         <property name="text" >
+          <string>-</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QTreeWidget" name="dateTreeWidget" >
+     <column>
+      <property name="text" >
+       <string>Date</string>
+      </property>
+     </column>
+     <column>
+      <property name="text" >
+       <string>Time</string>
+      </property>
+     </column>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox" >
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons" >
+      
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>RestoreProjectBackupDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>RestoreProjectBackupDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]