Vidalia 0.2.15
UpdatesAvailableDialog.h
Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file UpdatesAvailableDialog.h
00013 ** \brief Displays a list of available updates and details, such as release
00014 ** notes. The user can choose to either install the updates now or later, or
00015 ** skip the updates entirely.
00016 */
00017 
00018 #ifndef _UpdatesAvailableDialog_H
00019 #define _UpdatesAvailableDialog_H
00020 
00021 #include "ui_UpdatesAvailableDialog.h"
00022 #include "PackageInfo.h"
00023 
00024 #include <QDialog>
00025 #include <QShowEvent>
00026 #include <QTreeWidgetItem>
00027 
00028 
00029 class UpdatesAvailableDialog : public QDialog
00030 {
00031   Q_OBJECT
00032 
00033 public:
00034   enum UpdatesAvailableDialogExitCode {
00035     InstallUpdatesNow   = 100,
00036     InstallUpdatesLater = 101,
00037   };
00038 
00039   /** Constructor. */
00040   UpdatesAvailableDialog(const PackageList &packageList, QWidget *parent = 0);
00041 
00042 protected:
00043   /** Called when the dialog receives a QShowEvent. This simply adjusts
00044    * the column widths to something close to sane and forwards the event
00045    * to the parent.
00046    */
00047   virtual void showEvent(QShowEvent *e);
00048 
00049 private slots:
00050   /** Called when the user selects a different package in the list. The widget
00051    * displaying details on the selected package will be updated.
00052    */
00053   void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
00054 
00055   /** Called when the user opts to install the displayed software updates
00056    * immediately.
00057    */
00058   void installUpdatesNow();
00059 
00060   /** Called when the user opts to install the display software updates at
00061    * a later time.
00062    */
00063   void installUpdatesLater();
00064 
00065 private:
00066   /** Populates the table of available updates with package information
00067    * from <b>packageList</b>.
00068    */
00069   void loadPackagesTable(const PackageList &packageList);
00070 
00071   Ui::UpdatesAvailableDialog ui; /**< Qt Designer generated object. */
00072 };
00073 
00074 #endif
00075