OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
remote_loader.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GUI_REMOTE_LOADER_HH
20 #define OST_GUI_REMOTE_LOADER_HH
21 
22 
23 #include <ost/gfx/gfx_object.hh>
24 #include <ost/gui/module_config.hh>
25 #include <ost/gui/widget.hh>
26 
27 #include <QToolButton>
28 #include <QLineEdit>
29 #include <QKeyEvent>
30 #include <QProgressBar>
31 #include <QActionGroup>
32 namespace ost { namespace gui {
33 
34 
35 
36 
39  Q_OBJECT
40 public:
41  RemoteLoader(QWidget* parent=NULL);
42 
43  virtual bool Save(const QString& prefix);
44  virtual bool Restore(const QString& prefix);
45  virtual ActionList GetActions();
46 protected:
47  virtual void keyPressEvent(QKeyEvent* event);
48 private:
49  void ShowProgressBar(bool visiblility);
50  void BuildMenu(String active_loader=String());
51 private slots:
52  void Clicked();
53  void UrlClick();
54  void DownloadFinished();
55  void UpdateProgress(qint64 read, qint64 total);
56  void RenameButton();
57 
58 private:
59  QLineEdit* line_edit_;
60  QToolButton* button_;
61  QProgressBar* progress_bar_;
62  ActionList action_list_;
63  QMenu* site_loader_menu_;
64  QActionGroup* site_actions_;
65  String selected_site_loader_;
66  bool img_support_;
67 };
68 
69 }}
70 
71 #endif