/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ /* * GeneralInfoNoteBookTab.cc * Copyright (C) 2007 Fernando TarĂ­n Morales * icemanf@gmail.com * * GeneralInfoNoteBookTab.cc is free software. * * You may redistribute it and/or modify it under the terms of the * GNU General Public License, as published by the Free Software * Foundation; either version 3 of the License, or (at your option) * any later version. * * GeneralInfoNoteBookTab.cc 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 GeneralInfoNoteBookTab.cc. If not, write to: * The Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301, USA. */ #ifndef _GENERALINFONOTEBOOKTAB_H_ #define _GENERALINFONOTEBOOKTAB_H_ #include "gtkmm.h" #include "Utils.h" #include "Lince/Torrent.h" class TorrentInfoTab; class GraphicBar : public Gtk::DrawingArea { public: GraphicBar(); virtual ~GraphicBar(); void setPercentage(float value) { percentageMode = true; percentage = value; }; void setCurrentPieces(int value) { percentageMode = false; currentPieces = value; }; void setTotalPieces(int value) { totalPieces = value; }; void setValues(const libtorrent::bitfield &v) { values = v; }; bool redraw(); protected: // Override default signal handler virtual bool on_draw(const Cairo::RefPtr& cr); private: int currentPieces, totalPieces; float percentage; bool percentageMode; libtorrent::bitfield values; }; class GeneralInfoNoteBookTab{ private: Glib::ustring nameTab; Gtk::VBox vbox; // Downloaded row Gtk::Label downloadedLabel; Gtk::Label downloadedPercentageLabel; GraphicBar gb; // Used to update graphic bar just when needed int downloadedPieces; // Availability rows Gtk::Label availabilityLabel; Gtk::Label availabilityValue; // TransferenceFrame Gtk::Label timeLabel, restLabel, hashsLabel; Gtk::Label dlLabel, downSpeedLabel, seedersLabel; Gtk::Label sentLabel, upSpeedLabel, clientsLabel; Gtk::Label timeValueLabel, restValueLabel, hashsValueLabel; Gtk::Label dlValueLabel, downSpeedValueLabel, seedersValueLabel; Gtk::Label sentValueLabel, upSpeedValueLabel, clientsValueLabel; // InformationFrame Gtk::Label nameLabel, statusLabel; Gtk::Label storeLabel, sizeLabel; Gtk::Label partsLabel, hashLabel; Gtk::Label trackerLabel, partSizeLabel; Gtk::Label updateLabel, createdLabel; Gtk::Label nameValueLabel, statusValueLabel; Gtk::Label storeValueLabel, sizeValueLabel; Gtk::Label partsValueLabel, hashValueLabel; Gtk::Label trackerValueLabel, partSizeValueLabel; Gtk::Label updateValueLabel, createdValueLabel; Gtk::Label commentLabel; Glib::RefPtr commentContent; bool isStaticDataAdded; void addStaticData(Lince::Torrent *); void onChangeStoreValueButtonSignalClicked(); sigc::signal sig_to_change_torrent_save_path; public: GeneralInfoNoteBookTab(TorrentInfoTab *); ~GeneralInfoNoteBookTab(); const Glib::ustring & getNameTab() { return nameTab; }; void updateGeneralInfoNoteBookTab(Lince::Torrent *); virtual Gtk::Widget * getTabChild(void) { return & vbox; }; }; #endif // _GENERALINFONOTEBOOKTAB_H_