summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 01:19:37 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 01:19:37 +0000
commitace60a4b0e75dafa8bdf3df50915999dd283d6de (patch)
tree64427cba841f561de14516d55044004d6e644505 /src
downloadknetstats-ace60a4b0e75dafa8bdf3df50915999dd283d6de.tar.gz
knetstats-ace60a4b0e75dafa8bdf3df50915999dd283d6de.zip
Added KDE3 version of knetstats
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knetstats@1091565 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src')
-rw-r--r--src/.svnignore2
-rw-r--r--src/CHANGELOG69
-rw-r--r--src/COPYING-DOCS397
-rw-r--r--src/Doxyfile266
-rw-r--r--src/Makefile.am5
-rw-r--r--src/doc/Makefile.am1
-rw-r--r--src/doc/en/Makefile.am2
-rw-r--r--src/doc/en/index.docbook130
-rw-r--r--src/doc/man/Makefile.am4
-rw-r--r--src/doc/man/manpage.xml142
-rw-r--r--src/hi16-app-knetstats.pngbin0 -> 1964 bytes
-rw-r--r--src/hi32-app-knetstats.pngbin0 -> 2648 bytes
-rw-r--r--src/hi48-app-knetstats.pngbin0 -> 12510 bytes
-rw-r--r--src/knetstats.desktop32
-rw-r--r--src/src/Makefile.am22
-rw-r--r--src/src/chart.cpp65
-rw-r--r--src/src/chart.h43
-rw-r--r--src/src/configure.cpp161
-rw-r--r--src/src/configure.h65
-rw-r--r--src/src/configurebase.ui684
-rw-r--r--src/src/interface.cpp57
-rw-r--r--src/src/interface.h51
-rw-r--r--src/src/knetstats.cpp191
-rw-r--r--src/src/knetstats.h93
-rw-r--r--src/src/knetstatsview.cpp402
-rw-r--r--src/src/knetstatsview.h258
-rw-r--r--src/src/main.cpp66
-rw-r--r--src/src/pics/Makefile.am5
-rw-r--r--src/src/pics/icon_pci.pngbin0 -> 835 bytes
-rw-r--r--src/src/pics/theme0_both.pngbin0 -> 1652 bytes
-rw-r--r--src/src/pics/theme0_error.pngbin0 -> 1773 bytes
-rw-r--r--src/src/pics/theme0_none.pngbin0 -> 1618 bytes
-rw-r--r--src/src/pics/theme0_rx.pngbin0 -> 1657 bytes
-rw-r--r--src/src/pics/theme0_tx.pngbin0 -> 1626 bytes
-rw-r--r--src/src/pics/theme1_both.pngbin0 -> 1298 bytes
-rw-r--r--src/src/pics/theme1_error.pngbin0 -> 641 bytes
-rw-r--r--src/src/pics/theme1_none.pngbin0 -> 587 bytes
-rw-r--r--src/src/pics/theme1_rx.pngbin0 -> 980 bytes
-rw-r--r--src/src/pics/theme1_tx.pngbin0 -> 1021 bytes
-rw-r--r--src/src/pics/theme2_both.pngbin0 -> 1416 bytes
-rw-r--r--src/src/pics/theme2_error.pngbin0 -> 745 bytes
-rw-r--r--src/src/pics/theme2_none.pngbin0 -> 849 bytes
-rw-r--r--src/src/pics/theme2_rx.pngbin0 -> 1121 bytes
-rw-r--r--src/src/pics/theme2_tx.pngbin0 -> 1164 bytes
-rw-r--r--src/src/pics/theme3_both.pngbin0 -> 1152 bytes
-rw-r--r--src/src/pics/theme3_error.pngbin0 -> 472 bytes
-rw-r--r--src/src/pics/theme3_none.pngbin0 -> 461 bytes
-rw-r--r--src/src/pics/theme3_rx.pngbin0 -> 799 bytes
-rw-r--r--src/src/pics/theme3_tx.pngbin0 -> 943 bytes
-rw-r--r--src/src/pics/theme4_both.pngbin0 -> 1033 bytes
-rw-r--r--src/src/pics/theme4_error.pngbin0 -> 1328 bytes
-rw-r--r--src/src/pics/theme4_none.pngbin0 -> 999 bytes
-rw-r--r--src/src/pics/theme4_rx.pngbin0 -> 1036 bytes
-rw-r--r--src/src/pics/theme4_tx.pngbin0 -> 1033 bytes
-rw-r--r--src/src/statistics.cpp79
-rw-r--r--src/src/statistics.h66
-rw-r--r--src/src/statisticsbase.ui480
57 files changed, 3838 insertions, 0 deletions
diff --git a/src/.svnignore b/src/.svnignore
new file mode 100644
index 0000000..896d115
--- /dev/null
+++ b/src/.svnignore
@@ -0,0 +1,2 @@
+Makefile.in
+*Makefile.in
diff --git a/src/CHANGELOG b/src/CHANGELOG
new file mode 100644
index 0000000..befd2c5
--- /dev/null
+++ b/src/CHANGELOG
@@ -0,0 +1,69 @@
+v1.6.1
+
+- Fixed crash when discovering a new interface.
+
+v1.6.0.1
+
+- Disable the -ansi flag to avoid compile problems.
+
+v1.6
+
+- More user-friendly, try to detect some things and start without importune the user with configuration dialogs.
+
+v1.5
+
+- Added "Chart view".
+- New Statistics dialog (show IP address, MAC address, etc).
+- Using bksys as building tool.
+- Carrier on/off detection.
+- Reading interface date from /sys/class/net/INTERFACE/statistics instead of parse /proc/dev/net.
+- New translation to romanian
+
+Note to BSD users: This version is not compatible with BSD, it uses some linux-only stuff. A BSD-compatible version is plained in a near future.
+
+v1.3.1
+
+- Minor fix for Mandriva Linux (former Mandrake Linux). Env is now set for uic during build.
+
+v1.3
+
+- New configuration dialog.
+- Support to multiple interfaces.
+- Is possible change the colors in the text mode view.
+- Is possible change the icon theme of in icon mode.
+- Added smooth speed meter.
+
+v1.2.1
+
+- Added Russian translation (Edward Romantsov).
+- Added Polish translation (Wiktor Wandachowicz).
+
+v1.2
+
+- Now using SCons as building and install tool, so you will need to have Python installed in your distro to run SCons scripts and compile/install KNetStats.
+- Added Brazilian portuguese translation (me).
+- Added Kirghiz translation (Ilyas Bakirov).
+- Added Italian translation (Roberto Leandrini).
+- Added Spanish translation (Carlos Ortiz).
+- Added Deutsch translation (Henrik Gebauer).
+- Bug Fix: When network interface in changed, the Statistics window caption is changed too.
+- Bug Fix: Statistics window now correctly format Download/Upload Speed.
+- Bug Fix: When start KNetstats with a unavaliable interface, now upload speed is equals to 0pkts/s (not -2pkts/s)
+- Bug Fix: When knetstats starts and statistics windows is hidden it is not updated.
+
+v1.1.2
+
+- Build system now uses kde-config instead $KDEDIR env. variable. This will solve problems when compiling KNetstats on some distros (Suse 9.1, Fedora).
+
+v1.1.1
+
+- Clicking on trayicon show/hide statistics window (suggestion by Fredy Yanardi).
+- All dialogs now show the KNetStats icon on windows decoration.
+- It's possible to change the font used in textmode (suggestion by Vik).
+
+
+v1.1
+
+- Bug Fix: Not saving UpdateInterval when the network interface is not changed.
+- Litle optimizations
+- Support to IconMode (Activity Led's) or TextMode (showing rx/tx transfer rate) \ No newline at end of file
diff --git a/src/COPYING-DOCS b/src/COPYING-DOCS
new file mode 100644
index 0000000..4a0fe1c
--- /dev/null
+++ b/src/COPYING-DOCS
@@ -0,0 +1,397 @@
+ GNU Free Documentation License
+ Version 1.2, November 2002
+
+
+ Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+0. PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document "free" in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of "copyleft", which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+
+1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The "Document", below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as "you". You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A "Modified Version" of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of
+the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall subject
+(or to related matters) and contains nothing that could fall directly
+within that overall subject. (Thus, if the Document is in part a
+textbook of mathematics, a Secondary Section may not explain any
+mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The "Cover Texts" are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A "Transparent" copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not "Transparent" is called "Opaque".
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input format, SGML
+or XML using a publicly available DTD, and standard-conforming simple
+HTML, PostScript or PDF designed for human modification. Examples of
+transparent image formats include PNG, XCF and JPG. Opaque formats
+include proprietary formats that can be read and edited only by
+proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the
+machine-generated HTML, PostScript or PDF produced by some word
+processors for output purposes only.
+
+The "Title Page" means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, "Title Page" means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+A section "Entitled XYZ" means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as "Acknowledgements",
+"Dedications", "Endorsements", or "History".) To "Preserve the Title"
+of such a section when you modify the Document means that it remains a
+section "Entitled XYZ" according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+
+2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+
+3. COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+
+4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct
+ from that of the Document, and from those of previous versions
+ (which should, if there were any, be listed in the History section
+ of the Document). You may use the same title as a previous version
+ if the original publisher of that version gives permission.
+B. List on the Title Page, as authors, one or more persons or entities
+ responsible for authorship of the modifications in the Modified
+ Version, together with at least five of the principal authors of the
+ Document (all of its principal authors, if it has fewer than five),
+ unless they release you from this requirement.
+C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+D. Preserve all the copyright notices of the Document.
+E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+F. Include, immediately after the copyright notices, a license notice
+ giving the public permission to use the Modified Version under the
+ terms of this License, in the form shown in the Addendum below.
+G. Preserve in that license notice the full lists of Invariant Sections
+ and required Cover Texts given in the Document's license notice.
+H. Include an unaltered copy of this License.
+I. Preserve the section Entitled "History", Preserve its Title, and add
+ to it an item stating at least the title, year, new authors, and
+ publisher of the Modified Version as given on the Title Page. If
+ there is no section Entitled "History" in the Document, create one
+ stating the title, year, authors, and publisher of the Document as
+ given on its Title Page, then add an item describing the Modified
+ Version as stated in the previous sentence.
+J. Preserve the network location, if any, given in the Document for
+ public access to a Transparent copy of the Document, and likewise
+ the network locations given in the Document for previous versions
+ it was based on. These may be placed in the "History" section.
+ You may omit a network location for a work that was published at
+ least four years before the Document itself, or if the original
+ publisher of the version it refers to gives permission.
+K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the section all
+ the substance and tone of each of the contributor acknowledgements
+ and/or dedications given therein.
+L. Preserve all the Invariant Sections of the Document,
+ unaltered in their text and in their titles. Section numbers
+ or the equivalent are not considered part of the section titles.
+M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+N. Do not retitle any existing section to be Entitled "Endorsements"
+ or to conflict in title with any Invariant Section.
+O. Preserve any Warranty Disclaimers.
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled "Endorsements", provided it contains
+nothing but endorsements of your Modified Version by various
+parties--for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+
+5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled "History"
+in the various original documents, forming one section Entitled
+"History"; likewise combine any sections Entitled "Acknowledgements",
+and any sections Entitled "Dedications". You must delete all sections
+Entitled "Endorsements".
+
+
+6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+
+7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an "aggregate" if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+
+8. TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled "Acknowledgements",
+"Dedications", or "History", the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+
+9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License. Any other attempt to
+copy, modify, sublicense or distribute the Document is void, and will
+automatically terminate your rights under this License. However,
+parties who have received copies, or rights, from you under this
+License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+
+10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License "or any later version" applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+
+
+ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+ Copyright (c) YEAR YOUR NAME.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+ A copy of the license is included in the section entitled "GNU
+ Free Documentation License".
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with the
+ Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
diff --git a/src/Doxyfile b/src/Doxyfile
new file mode 100644
index 0000000..c09648d
--- /dev/null
+++ b/src/Doxyfile
@@ -0,0 +1,266 @@
+# Doxyfile 1.3.7-KDevelop
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = knetstats.kdevelop
+PROJECT_NUMBER = 0.1
+OUTPUT_DIRECTORY =
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = /home/hugo/
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = /home/hugo/src/knetstats
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.idl \
+ *.odl \
+ *.cs \
+ *.php \
+ *.php3 \
+ *.inc \
+ *.m \
+ *.mm \
+ *.C \
+ *.CC \
+ *.C++ \
+ *.II \
+ *.I++ \
+ *.H \
+ *.HH \
+ *.H++ \
+ *.CS \
+ *.PHP \
+ *.PHP3 \
+ *.M \
+ *.MM \
+ *.C \
+ *.H \
+ *.tlh \
+ *.diff \
+ *.patch \
+ *.moc \
+ *.xpm \
+ *.dox
+RECURSIVE = yes
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = YES
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = yes
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE = knetstats.tag
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = NO
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 1000
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..66b3066
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = src doc
+
+xdg_apps_DATA = knetstats.desktop
+
+KDE_ICON = knetstats
diff --git a/src/doc/Makefile.am b/src/doc/Makefile.am
new file mode 100644
index 0000000..81fee21
--- /dev/null
+++ b/src/doc/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = en
diff --git a/src/doc/en/Makefile.am b/src/doc/en/Makefile.am
new file mode 100644
index 0000000..8f050ec
--- /dev/null
+++ b/src/doc/en/Makefile.am
@@ -0,0 +1,2 @@
+KDE_LANG = en
+KDE_DOCS = knetstats
diff --git a/src/doc/en/index.docbook b/src/doc/en/index.docbook
new file mode 100644
index 0000000..36815bb
--- /dev/null
+++ b/src/doc/en/index.docbook
@@ -0,0 +1,130 @@
+<?xml version="1.0" ?>
+<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
+ <!ENTITY knetstats "<application>KNetStats 1&#46;5</application>">
+ <!ENTITY kappname "&knetstats;"><!-- Do *not* replace kappname-->
+ <!ENTITY package "kde-network"><!-- kdebase, kdeadmin, etc -->
+ <!ENTITY % addindex "IGNORE">
+ <!ENTITY % English "INCLUDE"><!-- change language only here -->
+
+
+ <!-- Do not define any other entities; instead, use the entities
+ from kde-genent.entities and $LANG/user.entities. -->
+]>
+<!-- kdoctemplate v0.8 October 1 1999
+ Minor update to "Credits and Licenses" section on August 24, 2000
+ Removed "Revision history" section on 22 January 2001
+ Changed to Installation/Help menu entities 18 October 2001
+ Other minor cleanup and changes 18 October 2001 -->
+
+
+<!-- The language must NOT be changed here. -->
+
+<book lang="&language;">
+
+<!-- This header contains all of the meta-information for the document such
+as Authors, publish date, the abstract, and Keywords -->
+
+<bookinfo>
+<title>The &knetstats; Handbook</title>
+
+<authorgroup>
+<author>
+<firstname>Hugo Parente Lima</firstname>
+<othername></othername>
+ <surname></surname>
+<affiliation>
+ <address><email>hugo_pl@users.sourceforge.net</email></address>
+</affiliation>
+</author>
+</authorgroup>
+
+<!-- TRANS:ROLES_OF_TRANSLATORS -->
+
+<copyright>
+<year>2004-2005</year>
+<holder>Hugo Parente Lima</holder>
+</copyright>
+<!-- Translators: put here the copyright notice of the translation -->
+<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
+ and in the FDL itself on how to use it. -->
+<legalnotice>&FDLNotice;</legalnotice>
+
+<!-- Date and version information of the documentation
+Don't forget to include this last date and this last revision number, we
+need them for translation coordination !
+Please respect the format of the date (YYYY-MM-DD) and of the version
+(V.MM.LL), it could be used by automation scripts.
+Do NOT change these in the translation. -->
+
+<date>2005-11-14</date>
+<releaseinfo>1&#46;1</releaseinfo>
+
+<!-- Abstract about this handbook -->
+
+<abstract>
+<para>
+&knetstats; Is a simple KDE network monitor that show rx/tx LEDs of any network interface on a system tray icon.
+</para>
+</abstract>
+
+<!-- This is a set of Keywords for indexing by search engines.
+Please at least include KDE, the KDE package it is in, the name
+ of your application, and a few relevant keywords. -->
+
+<keywordset>
+<keyword>KDE</keyword>
+<keyword>knetstats</keyword>
+<keyword>network</keyword>
+<keyword>monitor</keyword>
+<keyword>leds</keyword>
+</keywordset>
+
+</bookinfo>
+
+<!-- The contents of the documentation begin here. Label
+each chapter so with the id attribute. This is necessary for two reasons: it
+allows you to easily reference the chapter from other chapters of your
+document, and if there is no ID, the name of the generated HTML files will vary
+from time to time making it hard to manage for maintainers and for the CVS
+system. Any chapter labelled (OPTIONAL) may be left out at the author's
+discretion. Other chapters should not be left out in order to maintain a
+consistent documentation style across all KDE apps. -->
+
+<chapter id="Using-KnetStats">
+<title>Using &knetstats;</title>
+
+<para>Choose a interface and see the leds :-).</para>
+<!-- This chapter should tell the user how to use your app. You should use as
+many sections (Chapter, Sect1, Sect3, etc...) as is necessary to fully document
+your application. -->
+
+</chapter>
+
+<chapter id="credits">
+
+<!-- Include credits for the programmers, documentation writers, and
+contributors here. The license for your software should then be included below
+the credits with a reference to the appropriate license file included in the KDE
+distribution. -->
+
+<title>Credits and License</title>
+
+<para>
+&knetstats;
+</para>
+<para>Hugo Parente Lima - original author.</para>
+<para>Thomas Windheuser - SCons help, Debian packages, etc.</para>
+<para><ulink url="http://kde-apps.org/content/show.php?content=12956">KNemo</ulink> - Icon themes</para>
+<para>Ilyas Bakirov, Roberto Leandrini, Carlos Ortiz, Henrik Gebauer, Edward Romantsov, Wiktor Wandachowicz, Guillaume Savaton, Petar Toushkov, Liu Di - KNetStats translation to other languages</para>
+
+<para>You can find more info on <ulink url="http://knetstats.sourceforge.net">KNetStats website</ulink>.</para>
+
+<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
+
+&underFDL; <!-- FDL: do not remove -->
+&underGPL; <!-- GPL License -->
+
+</chapter>
+
+&documentation.index;
+</book>
diff --git a/src/doc/man/Makefile.am b/src/doc/man/Makefile.am
new file mode 100644
index 0000000..514c585
--- /dev/null
+++ b/src/doc/man/Makefile.am
@@ -0,0 +1,4 @@
+man_MANS = manpage.xml
+
+EXTRA_DIST = $(man_MANS)
+
diff --git a/src/doc/man/manpage.xml b/src/doc/man/manpage.xml
new file mode 100644
index 0000000..52d305e
--- /dev/null
+++ b/src/doc/man/manpage.xml
@@ -0,0 +1,142 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+
+<!--
+
+Process this file with an XSLT processor: `xsltproc \
+-''-nonet /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
+manpages/docbook.xsl manpage.dbk'. A manual page
+<package>.<section> will be generated. You may view the
+manual page with: nroff -man <package>.<section> | less'. A
+typical entry in a Makefile or Makefile.am is:
+
+DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
+manpages/docbook.xsl
+XP=xsltproc -''-nonet
+
+manpage.1: manpage.dbk
+ $(XP) $(DB2MAN) $<
+
+The xsltproc binary is found in the xsltproc package. The
+XSL files are in docbook-xsl. Please remember that if you
+create the nroff version in one of the debian/rules file
+targets (such as build), you will need to include xsltproc
+and docbook-xsl in your Build-Depends control field.
+
+-->
+
+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+ <!ENTITY dhfirstname "<firstname>Thomas</firstname>">
+ <!ENTITY dhsurname "<surname>Windheuser</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>16 Oct 2005</date>">
+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>1</manvolnum>">
+ <!ENTITY dhemail "<email>thomas@0x5c.net</email>">
+ <!ENTITY dhusername "windheus">
+ <!ENTITY dhucpackage "<refentrytitle>knetstats</refentrytitle>">
+ <!ENTITY dhpackage "knetstats">
+
+ <!ENTITY debian "<productname>Debian</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+ <!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2005</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+ <refmeta>
+ &dhucpackage;
+
+ &dhsection;
+ </refmeta>
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+
+ <refpurpose>A system tray icon, which indicates network activity</refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+
+ <arg><option>--help <replaceable>Print options to console.</replaceable></option></arg>
+
+ </cmdsynopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>DESCRIPTION</title>
+
+ <para>This manual page documents briefly the
+ <command>&dhpackage;</command>
+ commands.</para>
+
+ <para>This manual page was written for the &debian; distribution.
+ Instead, it has documentation in the &gnu;
+ <application>Info</application> format; see below.</para>
+
+ <para><command>&dhpackage;</command> is a program that provides a system tray icon. This icon provides two
+ LED's, which begin to blink if there is network traffic.</para>
+
+ </refsect1>
+ <refsect1>
+ <title>OPTIONS</title>
+
+ <para>These programs follow the usual &gnu; command line syntax,
+ with long options starting with two dashes (`-'). A summary of
+ options is included below. For a complete description, see the
+ <application>Info</application> files.</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>-h</option>
+ <option>--help</option>
+ </term>
+ <listitem>
+ <para>Show summary of options.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-v</option>
+ <option>--version</option>
+ </term>
+ <listitem>
+ <para>Show version of program.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+ <refsect1>
+ <title>SEE ALSO</title>
+
+ </refsect1>
+ <refsect1>
+ <title>AUTHOR</title>
+
+ <para>This manual page was written by &dhusername; &dhemail; for
+ the &debian; system (but may be used by others). Permission is
+ granted to copy, distribute and/or modify this document under
+ the terms of the &gnu; General Public License, Version 2 any
+ later version published by the Free Software Foundation.
+ </para>
+ <para>
+ On Debian systems, the complete text of the GNU General Public
+ License can be found in /usr/share/common-licenses/GPL.
+ </para>
+
+ </refsect1>
+</refentry>
+
diff --git a/src/hi16-app-knetstats.png b/src/hi16-app-knetstats.png
new file mode 100644
index 0000000..6e7e576
--- /dev/null
+++ b/src/hi16-app-knetstats.png
Binary files differ
diff --git a/src/hi32-app-knetstats.png b/src/hi32-app-knetstats.png
new file mode 100644
index 0000000..3328106
--- /dev/null
+++ b/src/hi32-app-knetstats.png
Binary files differ
diff --git a/src/hi48-app-knetstats.png b/src/hi48-app-knetstats.png
new file mode 100644
index 0000000..869cd7b
--- /dev/null
+++ b/src/hi48-app-knetstats.png
Binary files differ
diff --git a/src/knetstats.desktop b/src/knetstats.desktop
new file mode 100644
index 0000000..69cab53
--- /dev/null
+++ b/src/knetstats.desktop
@@ -0,0 +1,32 @@
+[Desktop Entry]
+Name=KNetStats
+Name[pa]=ਕੇ-ਨੈੱਟ-ਹਾਲਤ
+GenericName=Network monitor
+GenericName[bg]=Наблюдение на мрежа
+GenericName[cs]=Síťový monitor
+GenericName[da]=Netværksovervåger
+GenericName[de]=Netzwerkmonitor
+GenericName[el]=Επόπτης δικτύου
+GenericName[es]=Monitor de red
+GenericName[et]=Võrgumonitor
+GenericName[fr]=Surveillance réseau
+GenericName[ga]=Monatóir líonra
+GenericName[gl]=Monitor da rede
+GenericName[it]=Monitor di rete
+GenericName[ja]=ネットワークモニター
+GenericName[ka]=ქსელის მეთვალყურე
+GenericName[nl]=Netwerkmonitor
+GenericName[pa]=ਨੈੱਟਵਰਕ ਨਿਗਰਾਨ
+GenericName[pt]=Monitor da rede
+GenericName[pt_BR]=Monitor de rede
+GenericName[sk]=Monitor siete
+GenericName[sv]=Nätverksövervakare
+GenericName[tr]=Ağ izleyici
+GenericName[uk]=Монітор мережі
+Exec=knetstats
+Icon=knetstats
+Terminal=false
+Type=Application
+Categories=Qt;KDE;Network;
+X-KDE-StartupNotify=true
+
diff --git a/src/src/Makefile.am b/src/src/Makefile.am
new file mode 100644
index 0000000..fc9c70b
--- /dev/null
+++ b/src/src/Makefile.am
@@ -0,0 +1,22 @@
+INCLUDES = $(all_includes)
+
+SUBDIRS = pics
+
+bin_PROGRAMS = knetstats
+
+knetstats_SOURCES = configurebase.ui configure.cpp statisticsbase.ui main.cpp \
+ knetstats.cpp knetstatsview.cpp statistics.cpp chart.cpp interface.cpp
+knetstats_LDADD = $(LIB_KDEUI)
+knetstats_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+METASOURCES = configure.moc knetstats.moc knetstatsview.moc statistics.moc
+
+# these are the headers for your project
+noinst_HEADERS = chart.h configure.h knetstats.h knetstatsview.h statistics.h \
+ interface.h
+
+messages: rc.cpp
+ $(EXTRACTRC) *.ui >> rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/knetstats.pot
+
+KDE_OPTIONS = nofinal
+
diff --git a/src/src/chart.cpp b/src/src/chart.cpp
new file mode 100644
index 0000000..9f48f14
--- /dev/null
+++ b/src/src/chart.cpp
@@ -0,0 +1,65 @@
+/***************************************************************************
+* Copyright (C) 2005 by Hugo Parente Lima *
+* hugo_pl@users.sourceforge.net *
+* *
+* This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+***************************************************************************/
+
+#include "chart.h"
+#include <qpainter.h>
+#include <qbrush.h>
+
+Chart::Chart(QWidget* parent, const double* uploadBuffer, const double* downloadBuffer, int bufferSize, const int* ptr, const double* maxspeed) : QWidget(parent), mUplBuffer(uploadBuffer), mDldBuffer(downloadBuffer), mBufferSize(bufferSize), mPtr(ptr), mMaxSpeed(maxspeed) {
+ setWFlags(Qt::WNoAutoErase);
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+}
+
+void Chart::paintEvent(QPaintEvent*) {
+ QPainter paint(this);
+ paint.setBackgroundColor(Qt::black);
+ paint.setBackgroundMode(Qt::OpaqueMode);
+ QBrush brush(QColor(0x33, 0x33, 0x33), CrossPattern);
+ paint.fillRect(0, 0, width(), height(), brush);
+
+ const double step = width()/double(mBufferSize);
+ const int HEIGHT = height() - 1;
+
+ int x;
+ int lastX = x = width();
+ int lastRxY = HEIGHT - int(HEIGHT * (mDldBuffer[*mPtr]/(*mMaxSpeed)));
+ int lastTxY = HEIGHT - int(HEIGHT * (mUplBuffer[*mPtr]/(*mMaxSpeed)));
+
+ int count = 0;
+ for (int i = *mPtr; count < mBufferSize; i--) {
+ if (i < 0)
+ i = mBufferSize-1;
+ int rxY = HEIGHT - int(HEIGHT * (mDldBuffer[i]/(*mMaxSpeed)));
+ int txY = HEIGHT - int(HEIGHT * (mUplBuffer[i]/(*mMaxSpeed)));
+ paint.setPen(Qt::green);
+ paint.drawLine(lastX, lastRxY, x, rxY);
+ paint.setPen(Qt::red);
+ paint.drawLine(lastX, lastTxY, x, txY);
+ //qDebug("%d => %d", i, int(mSpeedHistoryRx[i]));
+ lastX = x;
+ lastRxY = rxY;
+ lastTxY = txY;
+
+ count++;
+ x = width() - int(step*(count+1));
+
+ }
+}
+
diff --git a/src/src/chart.h b/src/src/chart.h
new file mode 100644
index 0000000..2e89540
--- /dev/null
+++ b/src/src/chart.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+* Copyright (C) 2005 by Hugo Parente Lima *
+* hugo_pl@users.sourceforge.net *
+* *
+* This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+***************************************************************************/
+
+#ifndef CHART_H
+#define CHART_H
+
+#include <qwidget.h>
+
+class QPaintEvent;
+
+class Chart : public QWidget {
+public:
+ Chart(QWidget* parent, const double* uploadBuffer, const double* downloadBuffer, int bufferSize, const int* ptr, const double* maxspeed);
+ QSize sizeHint() { return QSize(200, 100); }
+protected:
+ void paintEvent( QPaintEvent* ev );
+
+private:
+ const double* mUplBuffer;
+ const double* mDldBuffer;
+ const int mBufferSize;
+ const int* mPtr;
+ const double* mMaxSpeed;
+};
+
+#endif
diff --git a/src/src/configure.cpp b/src/src/configure.cpp
new file mode 100644
index 0000000..4e10636
--- /dev/null
+++ b/src/src/configure.cpp
@@ -0,0 +1,161 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Hugo Parente Lima *
+ * hugo_pl@users.sourceforge.net *
+ * *
+ * This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "configure.h"
+#include "knetstats.h"
+
+// Qt includes
+#include <qstringlist.h>
+#include <qlistbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qwidgetstack.h>
+#include <qpopupmenu.h>
+// Kde includes
+#include <kapplication.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kconfig.h>
+#include <kfontrequester.h>
+#include <knuminput.h>
+#include <kcolorbutton.h>
+#include <kcombobox.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+
+
+Configure::Configure(KNetStats* parent, const InterfaceMap& ifs) : ConfigureBase(parent) {
+ // Load configuration
+ KIconLoader* loader = kapp->iconLoader();
+
+ QPixmap iconPCI = loader->loadIcon("icon_pci.png", KIcon::Small, 16);
+
+ // Clone the configuration.
+ for (InterfaceMap::ConstIterator it = ifs.begin(); it != ifs.end(); ++it) {
+ mInterfaces->insertItem(iconPCI, it.key());
+ mConfig[it.key()] = it.data()->options();
+
+// parent->readInterfaceOptions(*it, &mConfig[*it]);
+ }
+
+ mInterfaces->setCurrentItem(0);
+ changeInterface(mInterfaces->selectedItem());
+
+ connect(mInterfaces, SIGNAL(selectionChanged(QListBoxItem*)), this, SLOT(changeInterface(QListBoxItem*)));
+ connect(mTheme, SIGNAL(activated(int)), this, SLOT(changeTheme(int)));
+ //connect(mInterfaces, SIGNAL(contextMenuRequested(QListBoxItem*, const QPoint&)), this, SLOT(showInterfaceContextMenu(QListBoxItem*, const QPoint&)));
+}
+
+void Configure::changeInterface(QListBoxItem* item) {
+ QString interface = item->text();
+
+ if (!mCurrentItem.isEmpty())
+ {
+ // Salvas as modificações passadas
+ KNetStatsView::Options& oldview = mConfig[mCurrentItem];
+ // general options
+ oldview.mMonitoring = mMonitoring->isChecked();
+ oldview.mUpdateInterval = mUpdateInterval->value();
+ oldview.mViewMode = (KNetStatsView::Mode) mViewMode->currentItem();
+ // txt view options
+ oldview.mTxtUplColor = mTxtUplColor->color();
+ oldview.mTxtDldColor = mTxtDldColor->color();
+ oldview.mTxtFont = mTxtFont->font();
+ // icon view
+ oldview.mTheme = mTheme->currentItem();
+ // chart view
+ oldview.mChartUplColor = mChartUplColor->color();
+ oldview.mChartDldColor = mChartDldColor->color();
+ oldview.mChartBgColor = mChartBgColor->color();
+ oldview.mChartTransparentBackground = mChartTransparentBackground->isChecked();
+ }
+
+ if (interface == mCurrentItem)
+ return;
+ // Carrega as opt. da nova interface
+ KNetStatsView::Options& view = mConfig[interface];
+ // general
+ mMonitoring->setChecked(view.mMonitoring);
+ mUpdateInterval->setValue(view.mUpdateInterval);
+ mViewMode->setCurrentItem(view.mViewMode);
+ mWdgStack->raiseWidget(view.mViewMode);
+ // txt options
+ mTxtUplColor->setColor(view.mTxtUplColor);
+ mTxtDldColor->setColor(view.mTxtDldColor);
+ mTxtFont->setFont( view.mTxtFont );
+ // icon options
+ mTheme->setCurrentItem(view.mTheme);
+ changeTheme(view.mTheme);
+ // chart options
+ mChartUplColor->setColor(view.mChartUplColor);
+ mChartDldColor->setColor(view.mChartDldColor);
+ mChartBgColor->setColor(view.mChartBgColor);
+ mChartTransparentBackground->setChecked(view.mChartTransparentBackground);
+
+ mCurrentItem = interface;
+}
+
+bool Configure::canSaveConfig()
+{
+ // update the options
+ changeInterface(mInterfaces->item( mInterfaces->currentItem() ));
+
+ bool ok = false;
+ for(OptionsMap::ConstIterator i = mConfig.begin(); i != mConfig.end(); ++i)
+ if (i.data().mMonitoring) {
+ ok = true;
+ break;
+ }
+
+ if (!ok)
+ KMessageBox::error(this, i18n("You need to select at least one interface to monitor."));
+ return ok;
+}
+
+void Configure::changeTheme(int theme)
+{
+ KIconLoader* loader = kapp->iconLoader();
+ mIconError->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_error.png",
+ KIcon::Panel, ICONSIZE));
+ mIconNone->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_none.png",
+ KIcon::Panel, ICONSIZE));
+ mIconTx->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_tx.png",
+ KIcon::Panel, ICONSIZE));
+ mIconRx->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_rx.png",
+ KIcon::Panel, ICONSIZE));
+ mIconBoth->setPixmap(loader->loadIcon("theme"+QString::number(theme)+"_both.png",
+ KIcon::Panel, ICONSIZE));
+}
+/*
+void Configure::showInterfaceContextMenu(QListBoxItem* item, const QPoint& point) {
+ if (!item && mConfig.size() == 1)
+ return;
+ QPixmap icon = kapp->iconLoader()->loadIcon("editdelete", KIcon::Small, 16);
+ QPopupMenu* menu = new QPopupMenu(this);
+ menu->insertItem(icon, i18n("Renomve Interface"), this, SLOT(removeInterface()));
+ menu->exec(point);
+}
+
+void Configure::removeInterface() {
+ mConfig.erase(mInterfaces->currentText());
+ mInterfaces->removeItem(mInterfaces->currentItem());
+}
+*/
+#include "configure.moc"
diff --git a/src/src/configure.h b/src/src/configure.h
new file mode 100644
index 0000000..a0098f7
--- /dev/null
+++ b/src/src/configure.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Hugo Parente Lima *
+ * hugo_pl@users.sourceforge.net *
+ * *
+ * This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef CONFIGURE_H
+#define CONFIGURE_H
+
+#include "configurebase.h"
+#include "interface.h"
+#include <qstring.h>
+#include <qmap.h>
+#include <qfont.h>
+#include <qcolor.h>
+#include <qpixmap.h>
+#include <qstringlist.h>
+
+static const int ICONSIZE = 22;
+
+class KNetStats;
+class QListBoxItem;
+
+
+typedef QMap<QString, KNetStatsView::Options> OptionsMap;
+
+
+/**
+* Configure dialog
+*/
+class Configure : public ConfigureBase
+{
+ Q_OBJECT
+public:
+ Configure(KNetStats* parent, const InterfaceMap& ifs);
+
+ const OptionsMap& currentConfig() const { return mConfig; }
+ bool canSaveConfig();
+ const OptionsMap& options() const { return mConfig; }
+private:
+ QString mCurrentItem;
+ OptionsMap mConfig;
+
+protected slots:
+ void changeInterface(QListBoxItem* item);
+ void changeTheme(int theme);
+ //void showInterfaceContextMenu(QListBoxItem* item, const QPoint& point);
+ //void removeInterface();
+};
+
+#endif
diff --git a/src/src/configurebase.ui b/src/src/configurebase.ui
new file mode 100644
index 0000000..4444be0
--- /dev/null
+++ b/src/src/configurebase.ui
@@ -0,0 +1,684 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ConfigureBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ConfigureBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>355</width>
+ <height>307</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>Configure KNetStats</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>Minimum</enum>
+ </property>
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>mSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>120</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>mOk</cstring>
+ </property>
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>mApply</cstring>
+ </property>
+ <property name="text">
+ <string>Apply</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>mCancel</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QListBox" row="0" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>mInterfaces</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="1" column="1">
+ <property name="name">
+ <cstring>mAppearanceGroup</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Appearance</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QWidgetStack" row="0" column="0">
+ <property name="name">
+ <cstring>mWdgStack</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>mIconPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Theme:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Classic</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Modem</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Network</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Wireless</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Kppp</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>mTheme</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mIconError</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mIconNone</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mIconTx</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mIconRx</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mIconBoth</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>mTextPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KColorButton" row="0" column="1">
+ <property name="name">
+ <cstring>mTxtUplColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>mLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Download color:</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="1" column="1">
+ <property name="name">
+ <cstring>mTxtDldColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KFontRequester" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>mTxtFont</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>mLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Upload color:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>mBarsPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>2</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>mChartBgLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Background:</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="0" column="1">
+ <property name="name">
+ <cstring>mChartUplColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>mLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Upload color:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>mLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>Download color:</string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="1" column="1">
+ <property name="name">
+ <cstring>mChartDldColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="2" column="1">
+ <property name="name">
+ <cstring>mChartBgColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>mChartTransparentBackground</cstring>
+ </property>
+ <property name="text">
+ <string>Transparent background</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="0" column="1">
+ <property name="name">
+ <cstring>mConfigurationGroup</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Configuration</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>Icon</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Text</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Chart</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>mViewMode</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>mLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>View mode:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>mLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Update interval:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="1" column="1">
+ <property name="name">
+ <cstring>mUpdateInterval</cstring>
+ </property>
+ <property name="value">
+ <number>300</number>
+ </property>
+ <property name="minValue">
+ <number>100</number>
+ </property>
+ <property name="maxValue">
+ <number>2000</number>
+ </property>
+ <property name="suffix">
+ <string>ms</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>mMonitoring</cstring>
+ </property>
+ <property name="text">
+ <string>To monitor this interface</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>mViewMode</sender>
+ <signal>activated(int)</signal>
+ <receiver>mWdgStack</receiver>
+ <slot>raiseWidget(int)</slot>
+ </connection>
+ <connection>
+ <sender>mChartTransparentBackground</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>mChartBgColor</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>mChartTransparentBackground</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>mChartBgLabel</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>mOk</tabstop>
+ <tabstop>mApply</tabstop>
+ <tabstop>mCancel</tabstop>
+ <tabstop>mInterfaces</tabstop>
+ <tabstop>mMonitoring</tabstop>
+ <tabstop>mUpdateInterval</tabstop>
+ <tabstop>mViewMode</tabstop>
+ <tabstop>mTheme</tabstop>
+ <tabstop>mTxtUplColor</tabstop>
+ <tabstop>mTxtDldColor</tabstop>
+ <tabstop>mTxtFont</tabstop>
+ <tabstop>mChartUplColor</tabstop>
+ <tabstop>mChartDldColor</tabstop>
+ <tabstop>mChartBgColor</tabstop>
+ <tabstop>mChartTransparentBackground</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kfontrequester.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/src/src/interface.cpp b/src/src/interface.cpp
new file mode 100644
index 0000000..26a02a5
--- /dev/null
+++ b/src/src/interface.cpp
@@ -0,0 +1,57 @@
+//
+// C++ Implementation: interface
+//
+// Description:
+//
+//
+// Author: Hugo Parente Lima <hugo.pl@gmail.com>, (C) 2006
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "interface.h"
+#include <kapplication.h>
+#include <kapp.h>
+#include <kconfig.h>
+
+Interface::Interface(KNetStats* parent, const QString& name) : mName(name), mView(0), mParent(parent) {
+ update();
+}
+
+void Interface::update() {
+ bool defaultVisibility = !(mName == "lo" || mName == "sit0");
+
+ KConfig* cfg = kapp->config();
+ KConfigGroupSaver groupSaver(cfg, mName);
+ bool visible = cfg->readBoolEntry("Monitoring", defaultVisibility);
+ if (!visible)
+ setVisible(false);
+ else if (visible && !mView)
+ setVisible(true);
+ else if (visible && mView)
+ mView->updateViewOptions();
+}
+
+void Interface::setVisible(bool visible) {
+ if (!visible) {
+ delete mView;
+ mView = 0;
+ } else if (visible && !mView)
+ mView = new KNetStatsView(mParent, mName);
+}
+
+KNetStatsView::Options Interface::options() {
+ if (mView)
+ return mView->options();
+ else {
+ KNetStatsView::Options opt;
+ KNetStatsView::readOptions(mName, &opt, false);
+ return opt;
+ }
+}
+
+void Interface::say(const QString& message) {
+ if (mView)
+ mView->say(message);
+}
+
diff --git a/src/src/interface.h b/src/src/interface.h
new file mode 100644
index 0000000..71b29f8
--- /dev/null
+++ b/src/src/interface.h
@@ -0,0 +1,51 @@
+//
+// C++ Interface: interface
+//
+// Description:
+//
+//
+// Author: Hugo Parente Lima <hugo.pl@gmail.com>, (C) 2006
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef INTERFACE_H
+#define INTERFACE_H
+
+#include <qstring.h>
+#include "knetstatsview.h"
+class KNetStats;
+
+class Interface {
+ QString mName;
+ KNetStatsView* mView;
+ KNetStats* mParent;
+
+ Interface(const Interface&);
+public:
+ /**
+ * Constructs a new interface.
+ * \param parent parent of the view of this interface.
+ * \param name name of this interface (not the QObject name!!)
+ */
+ Interface(KNetStats* parent, const QString& name);
+
+ /**
+ * Set this interface visible to the user via a KNetStatsView.
+ */
+ void setVisible(bool visible);
+ bool isVisible() { return mView; }
+
+ void update();
+
+ void say(const QString& message);
+
+ KNetStatsView::Options options();
+};
+
+#include <qmap.h>
+typedef QMap<QString, Interface*> InterfaceMap;
+
+
+#endif
diff --git a/src/src/knetstats.cpp b/src/src/knetstats.cpp
new file mode 100644
index 0000000..e02e3f6
--- /dev/null
+++ b/src/src/knetstats.cpp
@@ -0,0 +1,191 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Hugo Parente Lima *
+ * hugo_pl@users.sourceforge.net *
+ * *
+ * This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "knetstats.h"
+#include "knetstatsview.h"
+#include "configure.h"
+#include "interface.h"
+
+// Qt includes
+#include <qstringlist.h>
+#include <qdir.h>
+#include <qtimer.h>
+// KDE includes
+#include <kconfig.h>
+#include <kglobal.h>
+#include <kstandarddirs.h>
+#include <kmessagebox.h>
+#include <kapplication.h>
+#include <kaction.h>
+#include <kactioncollection.h>
+#include <kstdaccel.h>
+#include <kstdaction.h>
+#include <khelpmenu.h>
+#include <kaboutapplication.h>
+#include <kpopupmenu.h>
+#include <kiconloader.h>
+#include <kpushbutton.h>
+
+KNetStats::KNetStats() : QWidget(0, "knetstats"), mConfigure(0), mBoot(true) {
+ setupUi();
+ int count;
+ detectNewInterfaces(&count);
+ if (!count && numInterfaces()) // caos!!! All interfaces are invisible! turn all visible...
+ for(InterfaceMap::Iterator i = mInterfaces.begin(); i != mInterfaces.end(); ++i)
+ i.data()->setVisible(true);
+
+
+ mBoot = false;
+ QTimer* timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(detectNewInterfaces()));
+ timer->start(IF_DETECTION_INTERVAL);
+}
+
+KNetStats::~KNetStats() {
+ for (InterfaceMap::Iterator it = mInterfaces.begin(); it != mInterfaces.end(); ++it)
+ delete it.data();
+}
+
+
+void KNetStats::setupUi() {
+ setIcon(kapp->icon());
+ // Cria o contextMenu
+ mActionCollection = new KActionCollection(this);
+ mContextMenu = new KPopupMenu(this);
+ mContextMenu->insertTitle( kapp->miniIcon(), kapp->caption() );
+ KAction* configure = KStdAction::preferences(this, SLOT(configure()), mActionCollection, "configure");
+ configure->plug(mContextMenu);
+ mContextMenu->insertSeparator();
+ KHelpMenu* helpmenu = new KHelpMenu(this, QString::null, false);
+ mContextMenu->insertItem( i18n("&Help"), helpmenu->menu() );
+
+ mContextMenu->insertSeparator();
+ KAction* quitAction = KStdAction::quit(kapp, SLOT(quit()), mActionCollection);
+ quitAction->plug(mContextMenu);
+
+ connect(helpmenu, SIGNAL(showAboutApplication()), this, SLOT(about()));
+}
+
+QStringList KNetStats::scanInterfaces() {
+ QDir dir("/sys/class/net");
+ if (!dir.exists()) {
+ KMessageBox::error(0, i18n("You need kernel 2.6.x with support to the /sys filesystem."));
+ return QStringList();
+ } else {
+ QStringList list = dir.entryList(QDir::Dirs);
+ list.pop_front(); // removes "." and ".." entries
+ list.pop_front();
+ return list;
+ }
+}
+
+bool KNetStats::configure() {
+ if (mConfigure)
+ mConfigure->show();
+ else {
+/* if (!mInterfaces.size()) {
+ KMessageBox::error(this, i18n("You don't have any network interface.\nKNetStats will quit now."));
+ return false;
+ }*/
+
+ mConfigure = new Configure(this, mInterfaces);
+ connect(mConfigure->mOk, SIGNAL(clicked()), this, SLOT(configOk()));
+ connect(mConfigure->mApply, SIGNAL(clicked()), this, SLOT(configApply()));
+ connect(mConfigure->mCancel, SIGNAL(clicked()), this, SLOT(configCancel()));
+ mConfigure->show();
+ }
+ return true;
+}
+
+void KNetStats::configOk() {
+ if (mConfigure->canSaveConfig()) {
+ saveConfig( mConfigure->options() );
+ delete mConfigure;
+ mConfigure = 0;
+ }
+}
+
+void KNetStats::configApply() {
+ if (mConfigure->canSaveConfig())
+ saveConfig( mConfigure->options() );
+}
+
+void KNetStats::configCancel() {
+ delete mConfigure;
+ mConfigure = 0;
+}
+
+void KNetStats::saveConfig(const OptionsMap& options) {
+ KConfig* cfg = kapp->config();
+
+ for(OptionsMap::ConstIterator i = options.begin(); i != options.end(); ++i) {
+ KConfigGroupSaver groupSaver(cfg, i.key());
+ const KNetStatsView::Options& opt = i.data();
+ // general
+ cfg->writeEntry("UpdateInterval", opt.mUpdateInterval);
+ cfg->writeEntry("ViewMode", opt.mViewMode);
+ cfg->writeEntry("Monitoring", opt.mMonitoring);
+ // txt view
+ cfg->writeEntry("TxtFont", opt.mTxtFont);
+ cfg->writeEntry("TxtUplColor", opt.mTxtUplColor);
+ cfg->writeEntry("TxtDldColor", opt.mTxtDldColor);
+ // IconView
+ cfg->writeEntry("Theme", opt.mTheme);
+ // Graphic view
+ cfg->writeEntry("ChartUplColor", opt.mChartUplColor);
+ cfg->writeEntry("ChartDldColor", opt.mChartDldColor);
+ cfg->writeEntry("ChartBgColor", opt.mChartBgColor);
+ cfg->writeEntry("ChartUseTransparentBackground", opt.mChartTransparentBackground);
+ }
+
+ for (InterfaceMap::ConstIterator i = mInterfaces.begin(); i != mInterfaces.end(); ++i)
+ i.data()->update();
+}
+
+void KNetStats::about() {
+ KAboutApplication dlg(this);
+ dlg.exec();
+}
+
+
+void KNetStats::detectNewInterfaces(int* count_ptr) {
+ int count = 0;
+ const QStringList& interfaces = KNetStats::scanInterfaces();
+ QStringList::ConstIterator i = interfaces.begin();
+ for(; i != interfaces.end(); ++i) {
+ InterfaceMap::Iterator elem = mInterfaces.find(*i);
+ if (elem == mInterfaces.end())
+ if (createInterface(*i))
+ count++;
+ }
+ if (count && count_ptr)
+ *count_ptr = count;
+}
+
+bool KNetStats::createInterface(const QString& name) {
+ // Cria a interface e adiciona em mInterfaces.
+ Interface* interface = new Interface(this, name);
+ mInterfaces.insert(name, interface);
+ if (!mBoot)
+ interface->say(i18n("New interface detected: %1").arg(name));
+ return interface->isVisible();
+}
+
+#include "knetstats.moc"
diff --git a/src/src/knetstats.h b/src/src/knetstats.h
new file mode 100644
index 0000000..4282890
--- /dev/null
+++ b/src/src/knetstats.h
@@ -0,0 +1,93 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Hugo Parente Lima *
+ * hugo_pl@users.sourceforge.net *
+ * *
+ * This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef KNETSTATS_H
+#define KNETSTATS_H
+
+#include <qwidget.h>
+#include <set>
+#include <qstring.h>
+#include "configure.h"
+
+class KNetStatsView;
+class KConfig;
+class KPopupMenu;
+class KActionCollection;
+
+class Interface;
+
+
+class KNetStats : public QWidget
+{
+ Q_OBJECT
+
+ enum {
+ IF_DETECTION_INTERVAL = 5000
+ };
+
+public:
+ /// Constructor
+ KNetStats();
+ ~KNetStats();
+
+ KPopupMenu* const contextMenu() const { return mContextMenu; }
+ /**
+ * \brief Search for network interfaces parsing /proc/net/dev
+ * \return A StringList with the network interface names
+ */
+ static QStringList scanInterfaces();
+ int numInterfaces() const { return mInterfaces.size(); }
+
+
+public slots:
+ /// Display configure the dialog box
+ bool configure();
+ /// Configure dialog OK button
+ void configOk();
+ /// Configure dialog Apply button
+ void configApply();
+ /// Configure dialog Cancel button
+ void configCancel();
+
+ /// Diaplay the about box
+ void about();
+ /**
+ * Search for new interfaces
+ * \param count_ptr Interface count, store the number of new <strong>visible</strong> interfaces found.
+ */
+ void detectNewInterfaces(int* count_ptr = 0);
+private:
+ KPopupMenu* mContextMenu; // help menu usado por todos os tray icons
+ Configure* mConfigure;
+ KActionCollection* mActionCollection;
+ bool mBoot;
+ InterfaceMap mInterfaces;
+
+
+ void readOptions();
+ void saveConfig(const OptionsMap& options);
+ void clearOptions(OptionsMap* options);
+ void setupUi();
+ // Creates a new interface, returns true or false if the new interface is visible or not.
+ bool createInterface(const QString& interface);
+
+};
+
+#endif
diff --git a/src/src/knetstatsview.cpp b/src/src/knetstatsview.cpp
new file mode 100644
index 0000000..ea480ab
--- /dev/null
+++ b/src/src/knetstatsview.cpp
@@ -0,0 +1,402 @@
+/***************************************************************************
+ * Copyright (C) 2004-2005 by Hugo Parente Lima *
+ * hugo_pl@users.sourceforge.net *
+ * *
+ * This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#include "knetstatsview.h"
+#include "knetstats.h"
+
+// KDE headers
+#include <kapplication.h>
+#include <kiconloader.h>
+#include <kpopupmenu.h>
+#include <kmessagebox.h>
+#include <kaboutapplication.h>
+#include <kconfig.h>
+#include <kglobal.h>
+#include <kstandarddirs.h>
+
+#include <kaction.h>
+#include <kstdaccel.h>
+#include <kstdaction.h>
+#include <khelpmenu.h>
+#include <kpassivepopup.h>
+
+// Qt headers
+#include <qtimer.h>
+#include <qfile.h>
+#include <qtooltip.h>
+#include <qcursor.h>
+#include <qevent.h>
+#include <qfont.h>
+#include <qfontmetrics.h>
+#include <qpainter.h>
+
+// C headers
+#include <cstring>
+#include <cstdio>
+
+// Linux headers
+extern "C" {
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <linux/if.h>
+}
+
+#include "configure.h"
+#include "statistics.h"
+
+extern const char* programName;
+
+KNetStatsView::KNetStatsView(KNetStats* parent, const QString& interface)
+: KSystemTray(parent, 0), mSysDevPath("/sys/class/net/"+interface+"/"), mInterface(interface) {
+ mFdSock = 0;
+ mFirstUpdate = true;
+ mMaxSpeedAge = 0;
+ mMaxSpeed = 0.0;
+ mBRx = mBTx = mPRx = mPTx = 0;
+ mConnected = mCarrier = true;
+ mTotalBytesRx = mTotalBytesTx = mTotalPktRx = mTotalPktTx = 0;
+ mSpeedBufferPtr = mSpeedHistoryPtr = 0;
+ mStatistics = 0;
+
+ readOptions(interface, &mOptions, true);
+ resetBuffers();
+ openFdSocket();
+ memset(&mDevInfo, 0, sizeof(mDevInfo));
+ strcpy(mDevInfo.ifr_name, mInterface.latin1());
+
+ setTextFormat(Qt::PlainText);
+ mContextMenu = parent->contextMenu();
+ show();
+
+ // Timer
+ mTimer = new QTimer(this, "timer");
+ connect(mTimer, SIGNAL(timeout()), this, SLOT(updateStats(void)));
+
+ QToolTip::add(this, i18n("Monitoring %1").arg(mInterface));
+ setup();
+ mStatistics = new Statistics(this);
+}
+
+KNetStatsView::~KNetStatsView() {
+ if (mFdSock != -1)
+ shutdown(mFdSock, SHUT_RDWR);
+
+}
+
+void KNetStatsView::setup() {
+ if (mOptions.mViewMode == Text)
+ setFont(mOptions.mTxtFont);
+ else if (mOptions.mViewMode == Icon) {
+ // Load Icons
+ KIconLoader* loader = kapp->iconLoader();
+ mIconError = loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_error.png",
+ KIcon::Panel, ICONSIZE);
+ mIconNone = loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_none.png",
+ KIcon::Panel, ICONSIZE);
+ mIconTx = loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_tx.png",
+ KIcon::Panel, ICONSIZE);
+ mIconRx =loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_rx.png",
+ KIcon::Panel, ICONSIZE);
+ mIconBoth = loader->loadIcon("theme"+QString::number(mOptions.mTheme)+"_both.png",
+ KIcon::Panel, ICONSIZE);
+ mCurrentIcon = &mIconNone;
+ }
+ mTimer->start(mOptions.mUpdateInterval);
+ updateStats();
+ QWidget::update();
+ mFirstUpdate = false;
+}
+
+void KNetStatsView::say(const QString& message) {
+ KPassivePopup::message(programName, message, kapp->miniIcon(), this);
+}
+
+void KNetStatsView::updateViewOptions() {
+ readOptions(mInterface, &mOptions);
+ setup();
+}
+
+void KNetStatsView::updateStats() {
+ FILE* flags_fp = fopen((mSysDevPath+"flags").latin1(), "r");
+ bool currentStatus;
+ if (!flags_fp)
+ currentStatus = false;
+ else {
+ int flags;
+ fscanf(flags_fp, "%Xu", &flags);
+ fclose(flags_fp);
+ currentStatus = IFF_UP & flags;
+ }
+
+ if (!currentStatus && mConnected) { // interface down...
+ mConnected = false;
+ resetBuffers();
+ QWidget::update();
+ say(i18n("%1 is inactive").arg(mInterface));
+ } else if (currentStatus && !mConnected) {
+ mConnected = true;
+ say(i18n("%1 is active").arg(mInterface));
+ }
+
+ // kernel < 2.6.9 (I think) does not have carrier info, considering carrier ever on.
+ FILE* carrier_fp = fopen((mSysDevPath+"carrier").latin1(), "r");
+ char carrierFlag = '1';
+ if (carrier_fp) {
+ carrierFlag = fgetc(carrier_fp);
+ fclose(carrier_fp);
+ }
+
+ if (!mConnected)
+ return;
+ if (carrierFlag == '0') { // carrier down
+ if (mCarrier) {
+ mCarrier = false;
+ QWidget::update();
+ say(i18n("%1 is disconnected").arg(mInterface));
+ }
+ return;
+ } else if (!mCarrier) { // carrier up
+ mCarrier = true;
+ say(i18n("%1 is connected").arg(mInterface));
+ }
+
+ unsigned int brx = readInterfaceNumValue("rx_bytes");
+ unsigned int btx = readInterfaceNumValue("tx_bytes");
+ unsigned int prx = readInterfaceNumValue("rx_packets");
+ unsigned int ptx = readInterfaceNumValue("tx_packets");
+
+
+ if (!mFirstUpdate) { // a primeira velocidade sempre eh absurda, para evitar isso temos o mFirstUpdate
+ if (++mSpeedBufferPtr >= SPEED_BUFFER_SIZE)
+ mSpeedBufferPtr = 0;
+
+ // Calcula as velocidades
+ mSpeedBufferTx[mSpeedBufferPtr] = ((btx - mBTx)*(1000.0f/mOptions.mUpdateInterval));
+ mSpeedBufferRx[mSpeedBufferPtr] = ((brx - mBRx)*(1000.0f/mOptions.mUpdateInterval));
+ mSpeedBufferPTx[mSpeedBufferPtr] = ((ptx - mPTx)*(1000.0f/mOptions.mUpdateInterval));
+ mSpeedBufferPRx[mSpeedBufferPtr] = ((prx - mPRx)*(1000.0f/mOptions.mUpdateInterval));
+
+ if (++mSpeedHistoryPtr >= HISTORY_SIZE)
+ mSpeedHistoryPtr = 0;
+ mSpeedHistoryRx[mSpeedHistoryPtr] = calcSpeed(mSpeedBufferRx);
+ mSpeedHistoryTx[mSpeedHistoryPtr] = calcSpeed(mSpeedBufferTx);
+
+ mMaxSpeedAge--;
+
+ if (mSpeedHistoryTx[mSpeedHistoryPtr] > mMaxSpeed) {
+ mMaxSpeed = mSpeedHistoryTx[mSpeedHistoryPtr];
+ mMaxSpeedAge = HISTORY_SIZE;
+ }
+ if (mSpeedHistoryRx[mSpeedHistoryPtr] > mMaxSpeed) {
+ mMaxSpeed = mSpeedHistoryRx[mSpeedHistoryPtr];
+ mMaxSpeedAge = HISTORY_SIZE;
+ }
+ if (mMaxSpeedAge < 1)
+ calcMaxSpeed();
+ }
+
+ if (mOptions.mViewMode == Icon) {
+ QPixmap* newIcon;
+ if (brx == mBRx) {
+ if (btx == mBTx )
+ newIcon = &mIconNone;
+ else
+ newIcon = &mIconTx;
+ } else {
+ if (btx == mBTx )
+ newIcon = &mIconRx;
+ else
+ newIcon = &mIconBoth;
+ }
+
+ if (newIcon != mCurrentIcon) {
+ mCurrentIcon = newIcon;
+ QWidget::update();
+ }
+ } else if (mOptions.mViewMode == Graphic || (btx != mBTx && brx != mBRx))
+ QWidget::update();
+
+ // Update stats
+ mTotalBytesRx += brx - mBRx;
+ mTotalBytesTx += btx - mBTx;
+ mTotalPktRx += prx - mPRx;
+ mTotalPktTx += ptx - mPTx;
+
+ mBRx = brx;
+ mBTx = btx;
+ mPRx = prx;
+ mPTx = ptx;
+}
+
+unsigned long KNetStatsView::readInterfaceNumValue(const char* name) {
+ // stdio functions appear to be more fast than QFile?
+ FILE* fp = fopen((mSysDevPath+"statistics/"+name).latin1(), "r");
+ long retval;
+ fscanf(fp, "%lu", &retval);
+ fclose(fp);
+ return retval;
+}
+
+QString KNetStatsView::readInterfaceStringValue(const char* name, int maxlength) {
+ QFile macFile(mSysDevPath+name);
+ macFile.open(IO_ReadOnly);
+ QString value;
+ macFile.readLine(value, maxlength);
+ return value;
+}
+
+void KNetStatsView::resetBuffers() {
+ memset(mSpeedHistoryRx, 0, sizeof(double)*HISTORY_SIZE);
+ memset(mSpeedHistoryTx, 0, sizeof(double)*HISTORY_SIZE);
+ memset(mSpeedBufferRx, 0, sizeof(double)*SPEED_BUFFER_SIZE);
+ memset(mSpeedBufferTx, 0, sizeof(double)*SPEED_BUFFER_SIZE);
+ memset(mSpeedBufferPRx, 0, sizeof(double)*SPEED_BUFFER_SIZE);
+ memset(mSpeedBufferPTx, 0, sizeof(double)*SPEED_BUFFER_SIZE);
+}
+
+void KNetStatsView::paintEvent( QPaintEvent* ) {
+ QPainter paint(this);
+ switch(mOptions.mViewMode) {
+ case Icon:
+ if (!mCarrier || !mConnected)
+ mCurrentIcon = &mIconError;
+ paint.drawPixmap(0, 0, *mCurrentIcon);
+ break;
+ case Text:
+ drawText(paint);
+ break;
+ case Graphic:
+ drawGraphic(paint);
+ break;
+ }
+}
+
+void KNetStatsView::drawText(QPainter& paint) {
+ if (!mCarrier || !mConnected) {
+ paint.drawText(rect(), Qt::AlignCenter, "?");
+ } else {
+ paint.setFont( mOptions.mTxtFont );
+ paint.setPen( mOptions.mTxtUplColor );
+ paint.drawText( rect(), Qt::AlignTop, Statistics::byteFormat(byteSpeedTx(), "KB", "MB"));
+ paint.setPen( mOptions.mTxtDldColor );
+ paint.drawText( rect(), Qt::AlignBottom, Statistics::byteFormat(byteSpeedRx(), "KB", "MB"));
+ }
+}
+
+void KNetStatsView::drawGraphic(QPainter& paint) {
+ if (!mCarrier || !mConnected) {
+ paint.drawText(rect(), Qt::AlignCenter, "X");
+ return;
+ }
+
+ QSize size = this->size();
+
+ if (!mOptions.mChartTransparentBackground)
+ paint.fillRect(0, 0, size.width(), size.height(), mOptions.mChartBgColor);
+
+ const int HEIGHT = size.height()-1;
+
+ // qDebug("MaxSpeed: %d, age: %d", int(mMaxSpeed), mMaxSpeedAge);
+ int lastX;
+ int lastRxY = HEIGHT - int(HEIGHT * (mSpeedHistoryRx[mSpeedHistoryPtr]/mMaxSpeed));
+ int lastTxY = HEIGHT - int(HEIGHT * (mSpeedHistoryTx[mSpeedHistoryPtr]/mMaxSpeed));
+ int x = lastX = size.width();
+ int count = 0;
+ for (int i = mSpeedHistoryPtr; count < width(); i--) {
+ if (i < 0)
+ i = HISTORY_SIZE-1;
+
+ int rxY = HEIGHT - int(HEIGHT * (mSpeedHistoryRx[i]/mMaxSpeed));
+ int txY = HEIGHT - int(HEIGHT * (mSpeedHistoryTx[i]/mMaxSpeed));
+ paint.setPen(mOptions.mChartDldColor);
+ paint.drawLine(lastX, lastRxY, x, rxY);
+ paint.setPen(mOptions.mChartUplColor);
+ paint.drawLine(lastX, lastTxY, x, txY);
+ //qDebug("%d => %d", i, int(mSpeedHistoryRx[i]));
+ lastX = x;
+ lastRxY = rxY;
+ lastTxY = txY;
+
+ count++;
+ x = width()-int(count+1);
+ }
+}
+
+void KNetStatsView::mousePressEvent(QMouseEvent* ev) {
+ if (ev->button() == Qt::RightButton )
+ mContextMenu->exec(QCursor::pos());
+ else if (ev->button() == Qt::LeftButton)
+ if (mStatistics->isShown())
+ mStatistics->accept();
+ else
+ mStatistics->show();
+}
+
+bool KNetStatsView::openFdSocket() {
+ if (mFdSock > 0)
+ return true;
+ if ((mFdSock = socket(AF_INET, SOCK_DGRAM, 0)) > 0)
+ return true;
+ return false;
+}
+
+QString KNetStatsView::getIp() {
+ if (mFdSock == -1 && !openFdSocket())
+ return "";
+
+ ioctl(mFdSock, SIOCGIFADDR, &mDevInfo);
+ sockaddr_in sin = ((sockaddr_in&)mDevInfo.ifr_addr);
+ return inet_ntoa(sin.sin_addr);
+}
+
+QString KNetStatsView::getNetmask() {
+ if (mFdSock == -1 && !openFdSocket())
+ return "";
+ ioctl(mFdSock, SIOCGIFNETMASK, &mDevInfo);
+ sockaddr_in mask = ((sockaddr_in&)mDevInfo.ifr_netmask);
+ return inet_ntoa(mask.sin_addr);
+}
+
+void KNetStatsView::readOptions( const QString& name, KNetStatsView::Options* opts, bool defaultVisibility ) {
+ KConfig* cfg = kapp->config();
+ KConfigGroupSaver groupSaver(cfg, name);
+
+ // general
+ opts->mUpdateInterval = cfg->readNumEntry("UpdateInterval", 300);
+ opts->mViewMode = (Mode)cfg->readNumEntry("ViewMode", 0);
+ opts->mMonitoring = cfg->readBoolEntry("Monitoring", defaultVisibility);
+ // txt view
+ opts->mTxtFont = cfg->readFontEntry("TxtFont");
+ opts->mTxtUplColor = cfg->readColorEntry("TxtUplColor", &Qt::red);
+ opts->mTxtDldColor = cfg->readColorEntry("TxtDldColor", &Qt::green);
+ // IconView
+ int defaultTheme = 0;
+ if (name.startsWith("wlan"))
+ defaultTheme = 3; // three... is a magic number... a magic number....
+ opts->mTheme = cfg->readNumEntry("Theme", defaultTheme);
+ // Graphic
+ opts->mChartUplColor = cfg->readColorEntry("ChartUplColor", &Qt::red);
+ opts->mChartDldColor = cfg->readColorEntry("ChartDldColor", &Qt::blue);
+ opts->mChartBgColor = cfg->readColorEntry("ChartBgColor", &Qt::white);
+ opts->mChartTransparentBackground = cfg->readBoolEntry("ChartUseTransparentBackground", true);
+}
+
+
+#include "knetstatsview.moc"
diff --git a/src/src/knetstatsview.h b/src/src/knetstatsview.h
new file mode 100644
index 0000000..4e97392
--- /dev/null
+++ b/src/src/knetstatsview.h
@@ -0,0 +1,258 @@
+/***************************************************************************
+* Copyright (C) 2004-2005 by Hugo Parente Lima *
+* hugo_pl@users.sourceforge.net *
+* *
+* This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+***************************************************************************/
+
+#ifndef KNETSTATSVIEW_H
+#define KNETSTATSVIEW_H
+
+#include <ksystemtray.h>
+#include <qpixmap.h>
+#include <qstringlist.h>
+#include <qcolor.h>
+
+#include <arpa/inet.h>
+#include <linux/netdevice.h>
+
+class QTimer;
+class QMouseEvent;
+class QPainter;
+class QPaintEvent;
+class Statistics;
+class KNetStats;
+
+/**
+* Main class
+*/
+class KNetStatsView : public KSystemTray
+{
+ Q_OBJECT
+
+ enum {
+ HISTORY_SIZE = 50, // Speed history buffer size
+ SPEED_BUFFER_SIZE = 10 // Speed normalization buffer size
+ };
+
+public:
+ /**
+ * KNetstats view mode on system tray.
+ */
+ enum Mode {
+ Icon, Text, Graphic
+ };
+
+ /**
+ * Visualization options.
+ */
+ struct Options {
+ // general
+ int mUpdateInterval;
+ Mode mViewMode;
+ bool mMonitoring;
+ // txt view
+ QFont mTxtFont;
+ QColor mTxtUplColor;
+ QColor mTxtDldColor;
+ // icon view
+ int mTheme;
+ // chart view
+ QColor mChartUplColor;
+ QColor mChartDldColor;
+ QColor mChartBgColor;
+ bool mChartTransparentBackground;
+ };
+
+ KNetStatsView(KNetStats* parent, const QString& interface);
+ ~KNetStatsView();
+
+ void say(const QString& message);
+ void updateViewOptions();
+ // read a value from /sys/class/net/interface/name
+ unsigned long readInterfaceNumValue(const char* name);
+ // read a value from /sys/class/net/interface/name
+ QString readInterfaceStringValue(const char* name, int maxlength);
+ QString getIp();
+ QString getNetmask();
+
+ const double* speedHistoryRx() const { return mSpeedHistoryRx; }
+ const double* speedHistoryTx() const { return mSpeedHistoryTx; }
+ const int historyBufferSize() const { return HISTORY_SIZE; }
+ const int* historyPointer() const { return &mSpeedHistoryPtr; }
+ const double* maxSpeed() const { return &mMaxSpeed; }
+
+ /// Return a copy of the current view options.
+ Options options() const { return mOptions; }
+ /// read the interface view options
+ static void readOptions( const QString& name, Options* opts, bool defaultVisibility = false );
+
+ /// The current monitored network interface
+ inline const QString& interface() const;
+ /// The current Update Interval in miliseconds
+ inline int updateInterval() const;
+ /// We are in textmode?
+ inline Mode viewMode() const;
+
+ /// Total of bytes receiveds
+ inline unsigned int totalBytesRx() const;
+ /// Total of bytes transmitted
+ inline unsigned int totalBytesTx() const;
+ /// Total of packets receiveds
+ inline unsigned int totalPktRx() const;
+ /// Total of packets transmitted
+ inline unsigned int totalPktTx() const;
+ /// RX Speed in bytes per second
+ inline double byteSpeedRx() const;
+ /// TX Speed in bytes per second
+ inline double byteSpeedTx() const;
+ /// RX Speed in packets per second
+ inline double pktSpeedRx() const;
+ /// TX Speed in packets per second
+ inline double pktSpeedTx() const;
+
+protected:
+ void mousePressEvent( QMouseEvent* ev );
+ void paintEvent( QPaintEvent* ev );
+
+private:
+
+ int mFdSock; // Kernel-knetstats socket
+ struct ifreq mDevInfo; // info struct about our interface
+
+
+ QString mSysDevPath; // Path to the device.
+ bool mCarrier; // Interface carrier is on?
+ bool mConnected; // Interface exists?
+
+ KPopupMenu* mContextMenu; // Global ContextMenu
+ Statistics* mStatistics; // Statistics window
+ QString mInterface; // Current interface
+ Options mOptions; // View options
+
+ // Icons
+ QPixmap mIconError, mIconNone, mIconTx, mIconRx, mIconBoth;
+ QPixmap* mCurrentIcon; // Current state
+ QTimer* mTimer; // Timer
+
+ // Rx e Tx to bytes and packets
+ unsigned long mBRx, mBTx, mPRx, mPTx;
+ // Statistics
+ unsigned long mTotalBytesRx, mTotalBytesTx, mTotalPktRx, mTotalPktTx;
+ // Speed buffers
+ double mSpeedBufferRx[SPEED_BUFFER_SIZE], mSpeedBufferTx[SPEED_BUFFER_SIZE];
+ double mSpeedBufferPRx[SPEED_BUFFER_SIZE], mSpeedBufferPTx[SPEED_BUFFER_SIZE];
+ // pointer to current speed buffer position
+ int mSpeedBufferPtr;
+
+ bool mFirstUpdate;
+
+ // History buffer TODO: Make it configurable!
+ double mSpeedHistoryRx[HISTORY_SIZE];
+ double mSpeedHistoryTx[HISTORY_SIZE];
+ int mSpeedHistoryPtr;
+ double mMaxSpeed;
+ int mMaxSpeedAge;
+
+
+ // setup the view.
+ void setup();
+ void drawText(QPainter& paint);
+ void drawGraphic(QPainter& paint);
+ // Reset speed and history buffers
+ void resetBuffers();
+ // calc tha max. speed stored in the history buffer
+ inline void calcMaxSpeed();
+ // calc the speed using a speed buffer
+ inline double calcSpeed(const double* buffer) const;
+
+ bool openFdSocket();
+
+private slots:
+ // Called by the timer to update statistics
+ void updateStats();
+
+};
+
+void KNetStatsView::calcMaxSpeed() {
+ double max = 0.0;
+ int ptr = mSpeedHistoryPtr;
+ for (int i = 0; i < HISTORY_SIZE; ++i) {
+ if (mSpeedHistoryRx[i] > max) {
+ max = mSpeedHistoryRx[i];
+ ptr = i;
+ }
+ if (mSpeedHistoryTx[i] > max) {
+ max = mSpeedHistoryTx[i];
+ ptr = i;
+ }
+ }
+ mMaxSpeed = max;
+ mMaxSpeedAge = (mSpeedHistoryPtr > ptr) ? (mSpeedHistoryPtr - ptr) : (mSpeedHistoryPtr + HISTORY_SIZE - ptr);
+}
+
+double KNetStatsView::calcSpeed(const double* buffer) const {
+ double total = 0.0;
+ for (int i = 0; i < SPEED_BUFFER_SIZE; ++i)
+ total += buffer[i];
+ return total/SPEED_BUFFER_SIZE;
+}
+
+const QString& KNetStatsView::interface() const {
+ return mInterface;
+}
+
+int KNetStatsView::updateInterval() const {
+ return mOptions.mUpdateInterval;
+}
+
+KNetStatsView::Mode KNetStatsView::viewMode() const {
+ return mOptions.mViewMode;
+}
+
+unsigned int KNetStatsView::totalBytesRx() const {
+ return mTotalBytesRx;
+}
+
+unsigned int KNetStatsView::totalBytesTx() const {
+ return mTotalBytesTx;
+}
+
+unsigned int KNetStatsView::totalPktRx() const {
+ return mTotalPktRx;
+}
+
+unsigned int KNetStatsView::totalPktTx() const {
+ return mTotalPktTx;
+}
+
+double KNetStatsView::byteSpeedRx() const {
+ return mSpeedHistoryRx[mSpeedHistoryPtr];
+}
+
+double KNetStatsView::byteSpeedTx() const {
+ return mSpeedHistoryTx[mSpeedHistoryPtr];
+}
+
+double KNetStatsView::pktSpeedRx() const {
+ return calcSpeed(mSpeedBufferPRx);
+}
+
+double KNetStatsView::pktSpeedTx() const {
+ return calcSpeed(mSpeedBufferPTx);
+}
+
+#endif
diff --git a/src/src/main.cpp b/src/src/main.cpp
new file mode 100644
index 0000000..6c00834
--- /dev/null
+++ b/src/src/main.cpp
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2004-2006 by Hugo Parente Lima *
+ * hugo_pl@users.sourceforge.net *
+ * *
+ * This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+#include "knetstats.h"
+
+const char* programName = I18N_NOOP( "KNetStats" );
+
+int main( int argc, char** argv )
+{
+ KAboutData aboutData( "knetstats", programName,
+ "v1.6.1", // version
+ I18N_NOOP( "A network device monitor." ), // description
+ KAboutData::License_GPL, // license
+ "(C) 2004-2005 Hugo Parente Lima", // copyright
+ 0,
+ "http://knetstats.sourceforge.net", // homepage
+ "hugo_pl@users.sourceforge.net"); // bug email address
+ aboutData.setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS"), I18N_NOOP("_: EMAIL OF TRANSLATORS"));
+ aboutData.addAuthor( "Hugo Parente Lima", 0, "hugo_pl@users.sourceforge.net" );
+
+ // Credits
+ aboutData.addCredit( "Thomas Windheuser", I18N_NOOP("SCons help, Debian packages, etc."), 0);
+ aboutData.addCredit( "KNemo", I18N_NOOP("Icon themes"), 0,
+ "http://kde-apps.org/content/show.php?content=12956" );
+ // translators
+ aboutData.addCredit( "Ilyas Bakirov, Roberto Leandrini, Carlos Ortiz, Henrik Gebauer, Edward Romantsov, Wiktor Wandachowicz, Guillaume Savaton, Petar Toushkov, Liu Di", I18N_NOOP("KNetStats translation to other languages"), 0);
+
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KApplication::disableAutoDcopRegistration();
+
+ KApplication app;
+ KNetStats knetstats;
+ if (!knetstats.numInterfaces()) {
+ KMessageBox::error(0, i18n("You don't have any network interface.\nKNetStats will quit now."));
+ return 1;
+ }
+ return app.exec();
+}
+
diff --git a/src/src/pics/Makefile.am b/src/src/pics/Makefile.am
new file mode 100644
index 0000000..fab68d0
--- /dev/null
+++ b/src/src/pics/Makefile.am
@@ -0,0 +1,5 @@
+knetstats_DATA = theme0_none.png theme1_error.png theme2_both.png theme2_tx.png theme3_rx.png theme4_none.png \
+ icon_pci.png theme0_rx.png theme1_none.png theme2_error.png theme3_both.png theme3_tx.png theme4_rx.png \
+ theme0_both.png theme0_tx.png theme1_rx.png theme2_none.png theme3_error.png theme4_both.png theme4_tx.png \
+ theme0_error.png theme1_both.png theme1_tx.png theme2_rx.png theme3_none.png theme4_error.png
+knetstatsdir = $(kde_datadir)/knetstats/pics
diff --git a/src/src/pics/icon_pci.png b/src/src/pics/icon_pci.png
new file mode 100644
index 0000000..07059cc
--- /dev/null
+++ b/src/src/pics/icon_pci.png
Binary files differ
diff --git a/src/src/pics/theme0_both.png b/src/src/pics/theme0_both.png
new file mode 100644
index 0000000..b81da44
--- /dev/null
+++ b/src/src/pics/theme0_both.png
Binary files differ
diff --git a/src/src/pics/theme0_error.png b/src/src/pics/theme0_error.png
new file mode 100644
index 0000000..803c077
--- /dev/null
+++ b/src/src/pics/theme0_error.png
Binary files differ
diff --git a/src/src/pics/theme0_none.png b/src/src/pics/theme0_none.png
new file mode 100644
index 0000000..a8f7c89
--- /dev/null
+++ b/src/src/pics/theme0_none.png
Binary files differ
diff --git a/src/src/pics/theme0_rx.png b/src/src/pics/theme0_rx.png
new file mode 100644
index 0000000..c0a49e1
--- /dev/null
+++ b/src/src/pics/theme0_rx.png
Binary files differ
diff --git a/src/src/pics/theme0_tx.png b/src/src/pics/theme0_tx.png
new file mode 100644
index 0000000..ba442ed
--- /dev/null
+++ b/src/src/pics/theme0_tx.png
Binary files differ
diff --git a/src/src/pics/theme1_both.png b/src/src/pics/theme1_both.png
new file mode 100644
index 0000000..0dce305
--- /dev/null
+++ b/src/src/pics/theme1_both.png
Binary files differ
diff --git a/src/src/pics/theme1_error.png b/src/src/pics/theme1_error.png
new file mode 100644
index 0000000..729f1f9
--- /dev/null
+++ b/src/src/pics/theme1_error.png
Binary files differ
diff --git a/src/src/pics/theme1_none.png b/src/src/pics/theme1_none.png
new file mode 100644
index 0000000..6abcd43
--- /dev/null
+++ b/src/src/pics/theme1_none.png
Binary files differ
diff --git a/src/src/pics/theme1_rx.png b/src/src/pics/theme1_rx.png
new file mode 100644
index 0000000..51d144d
--- /dev/null
+++ b/src/src/pics/theme1_rx.png
Binary files differ
diff --git a/src/src/pics/theme1_tx.png b/src/src/pics/theme1_tx.png
new file mode 100644
index 0000000..751b788
--- /dev/null
+++ b/src/src/pics/theme1_tx.png
Binary files differ
diff --git a/src/src/pics/theme2_both.png b/src/src/pics/theme2_both.png
new file mode 100644
index 0000000..f41a05a
--- /dev/null
+++ b/src/src/pics/theme2_both.png
Binary files differ
diff --git a/src/src/pics/theme2_error.png b/src/src/pics/theme2_error.png
new file mode 100644
index 0000000..5aad370
--- /dev/null
+++ b/src/src/pics/theme2_error.png
Binary files differ
diff --git a/src/src/pics/theme2_none.png b/src/src/pics/theme2_none.png
new file mode 100644
index 0000000..a72c89f
--- /dev/null
+++ b/src/src/pics/theme2_none.png
Binary files differ
diff --git a/src/src/pics/theme2_rx.png b/src/src/pics/theme2_rx.png
new file mode 100644
index 0000000..222d38d
--- /dev/null
+++ b/src/src/pics/theme2_rx.png
Binary files differ
diff --git a/src/src/pics/theme2_tx.png b/src/src/pics/theme2_tx.png
new file mode 100644
index 0000000..fa3b0c5
--- /dev/null
+++ b/src/src/pics/theme2_tx.png
Binary files differ
diff --git a/src/src/pics/theme3_both.png b/src/src/pics/theme3_both.png
new file mode 100644
index 0000000..634b2d3
--- /dev/null
+++ b/src/src/pics/theme3_both.png
Binary files differ
diff --git a/src/src/pics/theme3_error.png b/src/src/pics/theme3_error.png
new file mode 100644
index 0000000..b1da123
--- /dev/null
+++ b/src/src/pics/theme3_error.png
Binary files differ
diff --git a/src/src/pics/theme3_none.png b/src/src/pics/theme3_none.png
new file mode 100644
index 0000000..b7395aa
--- /dev/null
+++ b/src/src/pics/theme3_none.png
Binary files differ
diff --git a/src/src/pics/theme3_rx.png b/src/src/pics/theme3_rx.png
new file mode 100644
index 0000000..7cd6ef5
--- /dev/null
+++ b/src/src/pics/theme3_rx.png
Binary files differ
diff --git a/src/src/pics/theme3_tx.png b/src/src/pics/theme3_tx.png
new file mode 100644
index 0000000..b471965
--- /dev/null
+++ b/src/src/pics/theme3_tx.png
Binary files differ
diff --git a/src/src/pics/theme4_both.png b/src/src/pics/theme4_both.png
new file mode 100644
index 0000000..28e1f24
--- /dev/null
+++ b/src/src/pics/theme4_both.png
Binary files differ
diff --git a/src/src/pics/theme4_error.png b/src/src/pics/theme4_error.png
new file mode 100644
index 0000000..7a64e8a
--- /dev/null
+++ b/src/src/pics/theme4_error.png
Binary files differ
diff --git a/src/src/pics/theme4_none.png b/src/src/pics/theme4_none.png
new file mode 100644
index 0000000..b41880c
--- /dev/null
+++ b/src/src/pics/theme4_none.png
Binary files differ
diff --git a/src/src/pics/theme4_rx.png b/src/src/pics/theme4_rx.png
new file mode 100644
index 0000000..ee2ad1b
--- /dev/null
+++ b/src/src/pics/theme4_rx.png
Binary files differ
diff --git a/src/src/pics/theme4_tx.png b/src/src/pics/theme4_tx.png
new file mode 100644
index 0000000..7851340
--- /dev/null
+++ b/src/src/pics/theme4_tx.png
Binary files differ
diff --git a/src/src/statistics.cpp b/src/src/statistics.cpp
new file mode 100644
index 0000000..efa571e
--- /dev/null
+++ b/src/src/statistics.cpp
@@ -0,0 +1,79 @@
+/***************************************************************************
+* Copyright (C) 2004 by Hugo Parente Lima *
+* hugo_pl@users.sourceforge.net *
+* *
+* This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+***************************************************************************/
+#include "statistics.h"
+#include "chart.h"
+#include "knetstatsview.h"
+
+#include <klocale.h>
+#include <kapplication.h>
+#include <kactivelabel.h>
+#include <qtimer.h>
+#include <qlayout.h>
+
+
+
+Statistics::Statistics( KNetStatsView* parent, const char *name )
+: StatisticsBase( parent, name ), mInterface(parent->interface()), mParent(parent) {
+ setCaption( i18n( "Details of %1" ).arg( mInterface ) );
+
+ QBoxLayout* l = new QHBoxLayout( mChart );
+ l->setAutoAdd( true );
+ Chart* chart = new Chart(mChart, parent->speedHistoryTx(), parent->speedHistoryRx(), parent->historyBufferSize(), parent->historyPointer(), parent->maxSpeed());
+ mMAC->setText(mParent->readInterfaceStringValue("address", 18));
+ mIP->setAlignment(Qt::AlignRight);
+ mMAC->setAlignment(Qt::AlignRight);
+ mNetmask->setAlignment(Qt::AlignRight);
+ update();
+
+ mTimer = new QTimer( this );
+ connect( mTimer, SIGNAL( timeout() ), this, SLOT( update() ) );
+ connect( mTimer, SIGNAL( timeout() ), chart, SLOT( update() ) );
+}
+
+void Statistics::update() {
+ mMaxSpeed->setText(byteFormat( *mParent->maxSpeed() )+"/s");
+ mBRx->setText( byteFormat( mParent->totalBytesRx() ) );
+ mBTx->setText( byteFormat( mParent->totalBytesTx() ) );
+ mByteSpeedRx->setText( byteFormat( mParent->byteSpeedRx() )+"/s" );
+ mByteSpeedTx->setText( byteFormat( mParent->byteSpeedTx() )+"/s" );
+
+ mPRx->setText( QString::number( mParent->totalPktRx() ) );
+ mPTx->setText( QString::number( mParent->totalPktTx() ) );
+ mPktSpeedRx->setText( QString::number( mParent->pktSpeedRx(), 'f', 1 )+"pkts/s" );
+ mPktSpeedTx->setText( QString::number( mParent->pktSpeedTx(), 'f', 1 )+"pkts/s" );
+}
+
+void Statistics::show() {
+ // Update details...
+ mMTU->setText(mParent->readInterfaceStringValue("mtu", 6));
+ mIP->setText( mParent->getIp() );
+ mNetmask->setText( mParent->getNetmask() );
+
+ mTimer->start( mParent->updateInterval() );
+ StatisticsBase::show();
+}
+
+void Statistics::accept() {
+ mTimer->stop();
+ StatisticsBase::accept();
+}
+
+
+#include "statistics.moc"
diff --git a/src/src/statistics.h b/src/src/statistics.h
new file mode 100644
index 0000000..40ba1a0
--- /dev/null
+++ b/src/src/statistics.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+* Copyright (C) 2004 by Hugo Parente Lima *
+* hugo_pl@users.sourceforge.net *
+* *
+* This program 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+***************************************************************************/
+#ifndef STATISTICS_H
+#define STATISTICS_H
+
+#include "statisticsbase.h"
+#include <qstring.h>
+
+class KNetStatsView;
+
+class Statistics : public StatisticsBase
+{
+ Q_OBJECT
+
+public:
+ Statistics( KNetStatsView* parent = 0, const char *name = 0 );
+
+ /**
+ * Formats a numberic byte representation
+ * \param num The numeric representation
+ * \param decimal Decimal digits
+ * \param bytesufix Sufix for bytes
+ * \param ksufix Sufix for kilobytes
+ * \param msufix Sufix for megabytes
+ */
+ static inline QString byteFormat( double num, const char* ksufix = " KB", const char* msufix = " MB");
+
+ void show();
+private:
+ QTimer* mTimer;
+ const QString& mInterface;
+ KNetStatsView* mParent;
+public slots:
+ void accept();
+
+private slots:
+ void update();
+};
+
+QString Statistics::byteFormat( double num, const char* ksufix, const char* msufix ) {
+ const double ONE_KB = 1024.0;
+ const double ONE_MB = ONE_KB*ONE_KB;
+ if ( num >= ONE_MB ) // MB
+ return QString::number( num/(ONE_MB), 'f', 1 ) + msufix;
+ else // Kb
+ return QString::number( num/ONE_KB, 'f', 1 ) + ksufix;
+}
+
+#endif
diff --git a/src/src/statisticsbase.ui b/src/src/statisticsbase.ui
new file mode 100644
index 0000000..d8f0662
--- /dev/null
+++ b/src/src/statisticsbase.ui
@@ -0,0 +1,480 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>StatisticsBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>StatisticsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>261</width>
+ <height>303</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>KNetStats</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>Minimum</enum>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QFrame" row="0" column="1" rowspan="3" colspan="1">
+ <property name="name">
+ <cstring>mChart</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>Panel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>mMaxSpeed</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>7</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>? KB/s</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>7</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>0 KB/s</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Statistics</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>mLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Upload speed:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>mLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Received:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>mLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Download speed:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>mLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Transmited:</string>
+ </property>
+ </widget>
+ <spacer row="0" column="0">
+ <property name="name">
+ <cstring>spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="4" column="2">
+ <property name="name">
+ <cstring>mPktSpeedRx</cstring>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Bytes</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>mPRx</cstring>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1">
+ <property name="name">
+ <cstring>mByteSpeedTx</cstring>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>mBTx</cstring>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>mPTx</cstring>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="2">
+ <property name="name">
+ <cstring>mPktSpeedTx</cstring>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>mBRx</cstring>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>mByteSpeedRx</cstring>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Packets</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Deta&amp;ils</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>IP:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Netmask:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>MAC:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>MTU:</string>
+ </property>
+ </widget>
+ <spacer row="4" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>200</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="0" column="1" rowspan="4" colspan="1">
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>80</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KActiveLabel" row="0" column="2">
+ <property name="name">
+ <cstring>mIP</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="wordWrap">
+ <enum>NoWrap</enum>
+ </property>
+ </widget>
+ <widget class="KActiveLabel" row="1" column="2">
+ <property name="name">
+ <cstring>mNetmask</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="wordWrap">
+ <enum>NoWrap</enum>
+ </property>
+ </widget>
+ <widget class="KActiveLabel" row="2" column="2">
+ <property name="name">
+ <cstring>mMAC</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="wordWrap">
+ <enum>NoWrap</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="2">
+ <property name="name">
+ <cstring>mMTU</cstring>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>mOk</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>O&amp;k</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>mOk</sender>
+ <signal>clicked()</signal>
+ <receiver>StatisticsBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget2</tabstop>
+ <tabstop>mOk</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kactivelabel.h</includehint>
+ <includehint>kactivelabel.h</includehint>
+ <includehint>kactivelabel.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>