cpuload/0000755000175000017500000000000011271565420012050 5ustar alexeyalexeycpuload/Makefile0000644000175000017500000000032211114346460013502 0ustar alexeyalexeyclean: rm -Rf build all: mkdir -p build cd build ; cmake .. -DCMAKE_INSTALL_PREFIX=/usr cd build ; make install: cd build ; sudo make install @echo "> Run 'kquitapp plasma && plasma' to restart plasma" cpuload/CMakeLists.txt0000644000175000017500000000015411270400023014572 0ustar alexeyalexeyfind_package(KDE4 REQUIRED) include(KDE4Defaults) add_subdirectory(plasmoid) add_subdirectory(data_engine) cpuload/data_engine/0000755000175000017500000000000011270403010014267 5ustar alexeyalexeycpuload/data_engine/cpu_load.cpp0000644000175000017500000001501711051106472016576 0ustar alexeyalexey/*********************************************************************************** * System Monitor: Plasmoid and data engines to monitor CPU/Memory/Swap Usage. * Copyright (C) 2008 Matthew Dawson * * 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 "cpu_load.h" #include #include #include #include struct cpu_jiffies{ unsigned long user; unsigned long sys; unsigned long nice; unsigned long disk; unsigned long idle; ///Simply 0 inits all values. cpu_jiffies():user(0),sys(0),nice(0),disk(0),idle(0){} }; CPUMonitor::CPUMonitor(QObject* parent, const QVariantList& args): Plasma::DataEngine(parent), average(new cpu_jiffies()), procstat(new QFile("/proc/stat")), m_numcpus(1){ Q_UNUSED(args) setMinimumPollingInterval(500); } CPUMonitor::~CPUMonitor(){ cpuTimeVector.clear(); delete average; } void CPUMonitor::init(){ setData("Average CPU Usage", DataEngine::Data()); setData("Number of CPUs", m_numcpus); cpuTimeVector.push_back(cpu_jiffies()); } bool CPUMonitor::sourceRequestEvent(const QString &proc){ // setData(proc, DataEngine::Data()); /// @todo:When solid gets proc support, use that bool ok; int procNum = proc.toInt(&ok); kDebug() << ok << " " << proc; if(!ok){ if(proc == "Average CPU Usage"){ /* setData(proc, "User", 0.0); setData(proc, "Sys", 0.0); setData(proc, "Nice", 0.0); setData(proc, "Disk", 0.0); setData(proc, "Idle", 0.0);*/ setData(proc, "iIdle", 0); setData(proc, "iSys", 0); setData(proc, "iNice", 0); setData(proc, "iDisk", 0); setData(proc, "iLoad", 0); return true; }else if(proc == "Number of CPUs"){ setData(proc, m_numcpus); return true; }else { return false; } }else if(procNum < m_numcpus){ if(cpuTimeVector.count() < procNum){cpuTimeVector.resize(procNum + 1);} /*setData(proc, "User", 0.0); setData(proc, "Sys", 0.0); setData(proc, "Nice", 0.0); setData(proc, "Disk", 0.0); setData(proc, "Idle", 0.0);*/ setData(proc, "iIdle", 0); setData(proc, "iSys", 0); setData(proc, "iNice", 0); setData(proc, "iDisk", 0); setData(proc, "iLoad", 0); return true; }else{ return false; } } bool CPUMonitor::updateProc(QString ProcessorNumber, cpu_jiffies &old_jiffies, cpu_jiffies &diff){ cpu_jiffies temp; bool ok; QString input; QTextStream readin; if(procstat->openMode() == QIODevice::NotOpen){ if(!procstat->open(QIODevice::ReadOnly | QIODevice::Text)){ return false; } } readin.setDevice(procstat); readin.seek(0); do { readin >> input; if(input == QString("cpu%1").arg(ProcessorNumber) ){ break; } }while(!readin.atEnd()); if(readin.status() & QTextStream::ReadPastEnd){ return false; } readin >> input; temp.user = input.toLong(); readin >> input; temp.nice = input.toLong(); readin >> input; temp.sys = input.toLong(); readin >> input; temp.idle = input.toLong(); readin >> input; temp.disk = input.toLong(&ok); ///Neccessary as some kernels may not support IOWait. if(!ok){ temp.disk = 0; } diff.user = temp.user - old_jiffies.user; diff.sys = temp.sys - old_jiffies.sys; diff.nice = temp.nice - old_jiffies.nice; diff.disk = temp.disk - old_jiffies.disk; diff.idle = temp.idle - old_jiffies.idle; old_jiffies = temp; return true; } bool CPUMonitor::updateProcessor(QString ProcessorNumber, cpu_jiffies &diff){ if(ProcessorNumber.toInt() >= cpuTimeVector.count()){ cpuTimeVector.resize(ProcessorNumber.toInt() + 1); } if(!updateProc(ProcessorNumber, cpuTimeVector[ProcessorNumber.toInt()], diff)){ return false; }else { return true; } } bool CPUMonitor::updateSourceEvent(const QString& source){ unsigned long total_diff; cpu_jiffies diff; bool ok; int procNumber = source.toInt(&ok); if(ok){ if(procNumber < cpuTimeVector.count()){ if(!updateProcessor(source, diff)){ return false; } total_diff = diff.user + diff.sys + diff.nice + diff.disk + diff.idle; if(total_diff == 0){ total_diff = 1; } /*setData(source, "User", (double)diff.user / (double)total_diff); setData(source, "Sys", diff.sys / (double)total_diff); setData(source, "Nice", diff.nice / (double)total_diff); setData(source, "Disk", diff.disk / (double)total_diff); setData(source, "Idle", diff.idle / (double)total_diff);*/ setData(source, "iIdle", (int)(diff.idle*100 / (double)total_diff)); setData(source, "iSys", (int)(diff.sys*100 / (double)total_diff)); setData(source, "iNice", (int)((diff.sys+diff.nice)*100 / (double)total_diff)); setData(source, "iDisk", (int)((diff.sys+diff.nice+diff.disk)*100 / (double)total_diff)); setData(source, "iLoad", 100-(int)(diff.idle*100 / (double)total_diff) ); return true; }else{ return false; } }else if(source == "Number of CPUs"){ setData(source, m_numcpus); return true; }else if(source == "Average CPU Usage"){ ///@todo Implement Properly cpu_jiffies diff; updateProc("", *average, diff); total_diff = diff.user + diff.sys + diff.nice + diff.disk + diff.idle; if(total_diff == 0){ total_diff = 1; } /* setData(source, "User", (double)diff.user / (double)total_diff); setData(source, "Sys", diff.sys / (double)total_diff); setData(source, "Nice", diff.nice / (double)total_diff); setData(source, "Disk", diff.disk / (double)total_diff); setData(source, "Idle", diff.idle / (double)total_diff);*/ setData(source, "iIdle", (int)(diff.idle*100 / (double)total_diff)); setData(source, "iSys", (int)(diff.sys*100 / (double)total_diff)); setData(source, "iNice", (int)((diff.sys+diff.nice)*100 / (double)total_diff)); setData(source, "iDisk", (int)((diff.sys+diff.nice+diff.disk)*100 / (double)total_diff)); setData(source, "iLoad", 100-(int)(diff.idle*100 / (double)total_diff) ); return true; } return false; } #include "cpu_load.moc" cpuload/data_engine/CMakeLists.txt0000644000175000017500000000112111270377735017052 0ustar alexeyalexeyproject(plasma-cpuload) # We add our source code here set(cpu_load_SRCS cpu_load.cpp) add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) include_directories(${KDE4_INCLUDES}) # Now make sure all files get to the right place kde4_add_plugin(plasma_engine_cpuload ${cpu_load_SRCS}) target_link_libraries(plasma_engine_cpuload ${KDE4_PLASMA_LIBS} ${KDE4_SOLID_LIBS} ${KDE4_KDEUI_LIBS}) install(TARGETS plasma_engine_cpuload DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES plasma-dataengine-cpu_load.desktop DESTINATION ${SERVICES_INSTALL_DIR}) cpuload/data_engine/cpu_load.h0000644000175000017500000000337611047364573016265 0ustar alexeyalexey/*********************************************************************************** * System Monitor: Plasmoid and data engines to monitor CPU/Memory/Swap Usage. * Copyright (C) 2008 Matthew Dawson * * 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 CPU_MONITOR_H #define CPU_MONITOR_H #include class QFile; template class QList; template class QVector; struct cpu_jiffies; struct cpu_usage; class CPUMonitor : public Plasma::DataEngine{ Q_OBJECT public: CPUMonitor(QObject* parent, const QVariantList& args); ~CPUMonitor(); protected: void init(); bool sourceRequestEvent(const QString &name); bool updateSourceEvent(const QString& source); private: QVector cpuTimeVector; cpu_jiffies *average; QFile *procstat; int m_numcpus; bool updateProc(QString ProcessorNumber, cpu_jiffies &old_jiffies, cpu_jiffies &diff); bool updateProcessor(QString ProcessorNumber, cpu_jiffies &old_jiffies); }; K_EXPORT_PLASMA_DATAENGINE(cpumonitor, CPUMonitor) #endif cpuload/data_engine/COPYING0000644000175000017500000004311011044214542015332 0ustar alexeyalexey GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program 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. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public 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. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cpuload/data_engine/plasma-dataengine-cpu_load.desktop0000644000175000017500000000066511270403010023027 0ustar alexeyalexey[Desktop Entry] Name=CPU Monitor Engine X-KDE-ServiceTypes=Plasma/DataEngine Type=Service Icon=widgets/toolbox-button X-KDE-Library=plasma_engine_cpuload X-Plasma-EngineName=cpuload X-KDE-PluginInfo-Author=Alexey Tyapkin X-KDE-PluginInfo-Email= X-KDE-PluginInfo-Name=cpuload X-KDE-PluginInfo-Version=0.3.2 X-KDE-PluginInfo-Website= X-KDE-PluginInfo-Category= X-KDE-PluginInfo-Depends= X-Ubuntu-Gettext-Domain=desktop_kdebase-workspace cpuload/plasmoid/0000755000175000017500000000000011271561763013666 5ustar alexeyalexeycpuload/plasmoid/plasma-applet.png0000644000175000017500000002323111047364566017140 0ustar alexeyalexeyPNG  IHDRΜ/ pHYs+&KIDATx]iŕ̮Kft !ncas,mC &?Ʊ w͹{m6,`aBt4CݕUfgfeeMLw0R̛̬|y"D"LA*Cߪ" %&Sqb$ *J_e *`V OS@xoՑqơ_/*-3kxk^ $\'&a|'zw1^,=B, 4,ԤOT]p+)d qf:fA) iI0 ܾנ" #GN&]enӑgҺ3/94؋]&.B9g2Btk< 1Q'fѰpӑHz'3ϗД4-|+mBl%wRV(oGF,Q,2Ǐ?~qp-\o\"D KYwKvNJa3[{#q1e@ժ$&*BJ w'@&q(14t{C9ಢ蜿3@&pQgf(b3ۈTlET;P-m7g P&-ğB. #`Jd}{,9 0‘<`BAoyPpEp"*(k%&mC<9C+3- YAbi S7t% rjLIǓK:yBHQd2*?jMeM:4!y#X86LioD,< E`,kk9tCThuslJ&9HBQu@gIPlSҊD LMtIPlgB55 8fE_5_`G 1P>PL͑! pl!? 3g(f*]{OUI E8*?`P0EtqD#7[DuL1cObFX>ӰN8wI*shUf)#)U֨S6p4`ΙmZ8T*ޞ8'þ;e1ӒKcccP ȩbDd}8յd/߾}{ :sVI}batz…BQ϶ %6vrb3򣮮NƮN:-#k ^ˆvrD^3fH4hw!‚{8!=qjh"PM۾[lqT@$# nk GKKR5Y*"$PXFж\g#50N-`"qo@H=+N$XH!566Κ5K63(rVtH&d Y뫥<*1Pi"^mAEfsΝ3g\aLUc~dj@CU[6s3H=D eJ… ;;;gϞ!9b/%m`ꖸx≨سg`-4P^wG |:ҲtիW#C,6B=9$?+BYB-Zpb",  >upW%N;4D&ԑ6 G9x t!H @И|+ljjf˖-lDs8u|Vxy&+/0+jФ0Ad߿߃-r&*YCw5^fʕ+C'Qbl7QE hC*T,6H f3hNܸb--YUhՖ,Yxb䤷ÐVQ0$d !,2gr[\jL1T{܀bbfT`| {zsGǎGX[XGd?dٍ$%lWb f Tedѣx 2# 34+̾}6/?XrrB6z]}w|th䓁ё`fe9M-u3L:Ix/j?d(,8:"5I\=Z[[1AƅUL\}zs?y0֧hs>_` >I'Iʡ.;ͭT G7dVNfEPC8V NJ>D- nf1Uċu68{mX0)T;cE88{hѱBL?3x%s[38BĘ/2^)Simg.Iɜ tHpy\4j-#Uo>kF2x1ȍw mkX#ch{nopމVϧM  Ul tS5F#Ȝlp8_uNqRnzs9eRI]غRI%joNϟ]$ )t+2 \˹8qh!U(ej9oXqG4(}ʶtcodvp֪$)61(ဣ fdl%bCEFhB5u~Gن4)c0]8m*,TRM8l>3~ԌLpJ7rDDs?iстm4AJ(ՆXj=HN*y*XkMxBAo\8L#nÁARq]m;(bHši\ UNTt53ӗ0|3A}UZ)6Ѣe&0P+L]rz4{IZ9fEDq>r q$OI;N{w]yܶ;]6ִT + l0qͭ'E5HaMbb<ÒwdR,]p,{ψC|>cL=6<郤u9k01l:T mC͟Y R(ۀNiG f鹺H tũ6ideguu1@6G/njip>QJ竀Qro}?Ǣ/pBGúEh)v!-$,3§1Gˡ?;U?L!guTm@#]ΒS4/$;?$hs88ܟԈgIyGpģĢ`gDhզEf-bmDxw#uъvig̫)MbZSUJDlSҚ/I"4Grz9 LgnMkgKoզL&FT[I,rx8#8x>jsVqBsCRΣ>wHD#ǢGIs;(&A'-gЁx6.}>rX[iQ̫aąk\poHbSI4E <0Q,< u_;ap2>3ƦJhJ4ʼnWt蟾[3|^bdLNNx\"r~zsgh8ܖ4@S`&D8 Gjg" 4gRb '>#2&Ci~Nx%9-rlѪILrj~5^Zƀ)(JVmW4K> Z[8%fz7LiFE՘xkHtȑ"lެ5 2ul6ClP+b,;iz8jR(#y _aXd!_lVlq Ҳ@O;jHł׎tGK]0ZpDǏ] p,89)#yn9+:3@J$*le טUHlwhd#V-_p1A39Yy"lG)6c d*OCgYۚRLf亮 8Ǹ5Z&&nԵkaRm:Xh kll՞I/R[MIГ.ɪˀlz,TKж5t\%QS?r`T#!ilx 툀Mq[Mm;~. Pa3oagJ)TJdTIX2$Cvp-LV)]60Rd :(7OZΉ,[;`HFsM (2r5NQY]#W6Ӷw`)ֳ~Ś5 J"0H7/0#O#]51bDboCrFV$lN|{o`?Du6^wnG{ L0X$y_~y˖-*#"@1 |3k(QN/cRqjՀc:mGv .%e43SWqb&eK/}G"\"VeVXEtj8d0' r!cH*{D%;.mhI79 -3p(q8x:ͅ0oV ͸ /ҩr}+17kDcAY@W;X"VXD c-.lP2aP[K ͅNdwf0d#m4 74C‚f2SGKpXb?< -|gZl[gh wp )* `3:g`5(&f˗#y`G) R.! /''R1GTܢ@>va(RgϖfPT{&cΝpdY4cB& ^0:9c^O鮛=M*0pϼB_Az:5 Ecf6l|!~ucϓQyҌJv֔lC9=! 1F{]vAclpq({ =1W^-h(R8dB<ϳ1K0hԘ86kON@ENMC3à<̢)7 c= X+EI  OD@  Z$&fP?U-W_m#H_ ג` o(=Swyg v[\&UT 7nEgJӟ ~ /vyMTJ 1I´oQ\+ɽR6阜3Nj͈$x`=?iORC~\B\T: e!Sg9 ``+}w=cD=qB^ x!Z T'1D1PuwCh7tЙ5 ~*5A<UӤ"z P@2Ģ:+ l/WP:hWM`C=Dq}аA~dK*+_ʅ^[o8aCs%(הbbWEh,GsO~}ϾYbzGMMc2I,vRUWr7dXi(L5!> M5̍նP3*?f2 J_oۙUMZ1!xdզv ЂqV:&Dn3y狼BHmU2P`*2T\T2zn`FmHغP ߁̏IRia61WsF1@=:z[8[:۠$ӑhɫ[W+͋6l>>CP)4ISX-U_RwiinpqKU:l _&W:xZȳtJNk }Gtl5ʸhT H,XqbeV+^4&65?qY7AH@$ L8Ո\ N鴵->z9Ͻx?Ձ~ɄQ(g;2 Ie  LMI|ŗqQ~hWn2*)Lz'ZloZ|qJ ĄA{<ο[ fR6Bpf ~Wۭf lO IJ{SH`$W黈O)R (DEoȞyEoLolb:jF 'Sw'xΛt -uFۘmY fβmS+oWA@9Ndvju|R;M3GHdl"7ungիN_75Uy϶_9V1ؗb%bՙs;L!rN緯m_ ؐiXܼp .s$2 dX$da5uFθx$TEXܧ.XR0!.-pq|"a=8Qxuҹ\YBMY&[Wwtĥ!L*-r R|mIJ%Ulo2E1=(r*rZN"y+as0$(3vH0|zZ aT#MHuX&yD'f,ѰGW|Ey Ipatx`=ߞ]2$ڜ+A~2t}9KT}~&,E,ƒvkQm}D(ա4(0bUILR4# 硸wJ=!& ajW9qIENDB`cpuload/plasmoid/CMakeLists.txt0000644000175000017500000000142411270400033016404 0ustar alexeyalexey# Project Needs a name ofcourse project(plasma-cpuload) # Find the required Libaries find_package(KDE4 REQUIRED) include(KDE4Defaults) add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ) # We add our source code here set(cpuload_SRCS cpuload.cpp) kde4_add_ui_files(cpuload_SRCS cpuLoadSettings.ui ) # Now make sure all files get to the right place kde4_add_plugin(plasma_applet_cpuload ${cpuload_SRCS}) target_link_libraries(plasma_applet_cpuload ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS}) install(TARGETS plasma_applet_cpuload DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES plasma-applet-cpuload.desktop DESTINATION ${SERVICES_INSTALL_DIR}) cpuload/plasmoid/cpuload.h0000644000175000017500000001055111271132670015457 0ustar alexeyalexey/*********************************************************************************** * CPU Load: Plasmoid to monitor CPU Load. * Copyright (C) 2008 Alexey Tyapkin * * 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. * ***********************************************************************************/ // Here we avoid loading the header multiple times #ifndef CPULOAD_HEADER #define CPULOAD_HEADER // We need the Plasma Applet headers #include #include #include #include #include #include #include #include #include #include #include #include #include "ui_cpuLoadSettings.h" class QSizeF; // Define our plasma Applet class cpuload : public Plasma::Applet { Q_OBJECT public: enum { columns = 31, rows = 10, cellWidth = 10, cellHeight = 10, cUser = 0x000000, cSystem = 0x585858, cDisk = 0xffffff, cNice = 0xa0a0a0, cGrid = 0xc3c3c3, cCPULoadLabel = 0x585858, cCPULoadValue = 0x585858, cCPUName = 0x585858, CPULoadLabelFontSize = 20, CPULoadValueFontSize = 16, CPUNameFontSize = 8, GraphInfoFontSize = 8 }; static const QString defaultFontFamily; // Basic Create/Destroy cpuload(QObject *parent, const QVariantList &args); ~cpuload(); // The paintInterface procedure paints the applet to screen void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect& contentsRect); void init(); QSizeF contentSizeHint() const; protected: inline bool test(int ifcpu1, int ifcpu2, int ifcpu3, int iscpu1, int iscpu2, int iscpu3) { if (((int)(ifcpu1 != iscpu1) + (int)(ifcpu2 != iscpu2) + (int)(ifcpu3 != iscpu3)) > 0) { return true; } return false; } int computeHeight3(QFont f, int height, int ystep, int infoSize, int loadSize); void readConfig(); void writeConfig(); void defaultsToCfg(); void plasmoidToCfg(); void DrawText(QPainter *p, int iCols, int iRows, int iCellWidth, int iCellHeight, int iInfoWidth, int iInfoHeight, int iNameHeight, QColor cUser, QColor cSystem, QColor cDisk, QColor cNice, QColor cCpuLoadLabel, QColor cCpuName, QFont font, int szInfo, int szCpuLoadLabel, int szCpuName); void DrawGrid(QPainter *p, int iCols, int iRows, int iCellWidth, int iCellHeight, int iInfoWidth, int iInfoHeight, QColor cGridColor); public slots: void showConfigurationInterface(); void updatePreview(); void cfgToPlasmoid(); void clicked ( QAbstractButton *button); protected slots: void dataUpdated(const QString& source, const Plasma::DataEngine::Data &data); private: KIcon m_icon; int iXCount; int iYCount; int iXStep; int iYStep; int iWidth, iWidth1, iWidth2, iWidth3; int iHeight, iHeight1, iHeight3; int iCPU, iCPU1, iCPU2, iCpuLoad; int iSCPU, iSCPU1, iSCPU2; int iNCPU, iNCPU1, iNCPU2; int iDCPU, iDCPU1, iDCPU2; int iCPULoadLabel, iCPULoadValue, iCPUName, iGraphInfo; QPixmap *pm; QPixmap *dpm; QBitmap *mask; QRect rCPUValue; QRect rGraphErase; QString cpuInfo[4]; QPen pens[4]; QPixmap *preview; QPainterPath cpuNiceGraph; QPainterPath cpuDiskGraph; QPainterPath cpuSysGraph; QPainterPath cpuGraph; QColor userColor; QColor diskColor; QColor niceColor; QColor systemColor; QColor gridColor; QColor cpuLoadLabelColor; QColor cpuLoadValueColor; QColor cpuNameColor; QFont plasmoidFont; QString sCpuModel; QDialog *cfg_dialog; Ui_cpuLoadSettings cfg; QVector vIdle; QVector vLoad; QLabel previewLabel; }; const QString cpuload::defaultFontFamily="DejaVu Sans"; // This is the command that links your applet to the .desktop file K_EXPORT_PLASMA_APPLET(cpuload, cpuload) #endif cpuload/plasmoid/cpuload.cpp0000644000175000017500000006161211271561763016027 0ustar alexeyalexey/*********************************************************************************** * CPU Load: Plasmoid to monitor CPU Load. * Copyright (C) 2008 Alexey Tyapkin * * 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 "cpuload.h" #include #include #include #include #include #include #include #include cpuload::cpuload ( QObject *parent, const QVariantList &args ) : Plasma::Applet ( parent, args ), m_icon ( "document" ) { iXCount=cpuload::columns; iYCount=cpuload::rows; iXStep=cpuload::cellWidth; iYStep=cpuload::cellHeight; userColor=QColor ( cpuload::cUser ); diskColor=QColor ( cpuload::cDisk ); niceColor=QColor ( cpuload::cNice ); systemColor=QColor ( cpuload::cSystem ); gridColor= QColor( cpuload::cGrid ); cpuLoadLabelColor= QColor(cpuload::cCPULoadLabel); cpuLoadValueColor= QColor(cpuload::cCPULoadValue); cpuNameColor= QColor(cpuload::cCPUName); iCpuLoad=0; iCPULoadLabel=cpuload::CPULoadLabelFontSize; iCPULoadValue=cpuload::CPULoadValueFontSize; iCPUName=cpuload::CPUNameFontSize; iGraphInfo=cpuload::GraphInfoFontSize; plasmoidFont=QFont(cpuload::defaultFontFamily); readConfig(); iWidth=iXCount*iXStep; iHeight=iYCount*iYStep; iWidth1=iWidth-2; iWidth2=iWidth-4; cfg_dialog=NULL; preview=NULL; vIdle=QVector(101); vLoad=QVector(101); cpuInfo[0]="User"; cpuInfo[1]="System"; cpuInfo[2]="Nice"; cpuInfo[3]="Disk"; for (int i=0; i < vIdle.size(); i++) { vIdle.replace(i, (int)(i * iHeight / 100)); vLoad.replace(i, (int)(iHeight - i * iHeight/100)); } QFile file ( "/proc/cpuinfo" ); if ( file.open ( QIODevice::ReadOnly ) ) { QTextStream t ( &file ); QString buf; while ( (buf=t.readLine()) != NULL ) { if ( buf.startsWith ( "model name" ) ) { sCpuModel=buf.split(":")[1]; break; } } }else sCpuModel=""; if (file.isOpen()) { file.close(); } setHasConfigurationInterface( true ); plasmoidFont.setBold ( true ); plasmoidFont.setPointSize ( iGraphInfo ); iWidth3=QFontMetrics(plasmoidFont).width( QString ( "System" ) )+6; plasmoidFont.setPointSize ( iCPULoadValue ); if (iWidth3 < QFontMetrics(plasmoidFont).width( QString ( "100%" ) )+6 ) { iWidth3=QFontMetrics(plasmoidFont).width( QString ( "100%" ) )+6; } plasmoidFont.setPointSize ( iCPUName ); iHeight1=(QFontMetrics(plasmoidFont).width ( sCpuModel ) / (iWidth+iWidth3) + 1)*QFontMetrics(plasmoidFont).height(); rGraphErase=QRect(iWidth-2,0,2,iHeight); iHeight3=computeHeight3(plasmoidFont, iHeight, iYStep, iGraphInfo, iCPULoadValue); rCPUValue=QRect(iWidth+1,iHeight3+1,iWidth3-3,iHeight-iHeight3-2); setCacheMode(QGraphicsItem::NoCache); resize ( contentSizeHint()); prepareGeometryChange(); updateGeometry(); update(); } int cpuload::computeHeight3(QFont f, int height, int ystep, int infoSize, int loadSize) { QFont pFont=f; int tmpHeight, bufHeight; pFont.setBold ( true ); pFont.setPointSize ( infoSize ); tmpHeight=(pFont.pointSize())*4+2; pFont.setPointSize ( loadSize ); bufHeight=pFont.pointSize()+2; if (tmpHeight <= height/2 && bufHeight <= height/2) { tmpHeight = height/2; }else { if ( bufHeight > height/2 ) { tmpHeight=height-bufHeight; }else{ int tmp=tmpHeight/ystep+1; if ((tmp*ystep) < (height-bufHeight)) { tmpHeight=tmp*ystep; } } } if (tmpHeight > (height-bufHeight)) { tmpHeight=height-bufHeight; } return tmpHeight; } void cpuload::clicked ( QAbstractButton *button) { if (cfg.buttonBox->buttonRole(button) == QDialogButtonBox::ResetRole) { defaultsToCfg(); updatePreview(); } } void cpuload::defaultsToCfg() { cfg.iColumns->setValue(cpuload::columns); cfg.iRows->setValue(cpuload::rows); cfg.iCellWidth->setValue(cpuload::cellWidth); cfg.iCellHeight->setValue(cpuload::cellHeight); cfg.cUser->setColor(QColor ( cpuload::cUser )); cfg.cSystem->setColor(QColor ( cpuload::cSystem )); cfg.cDisk->setColor(QColor ( cpuload::cDisk )); cfg.cNice->setColor(QColor ( cpuload::cNice )); cfg.cGrid->setColor(QColor( cpuload::cGrid )); cfg.cCPULoadLabel->setColor( cpuload::cCPULoadLabel ); cfg.cCPULoadValue->setColor( cpuload::cCPULoadValue ); cfg.cCPUName->setColor( cpuload::cCPUName ); cfg.iCPULoadLabel->setValue( cpuload::CPULoadLabelFontSize ); cfg.iCPULoadValue->setValue( cpuload::CPULoadValueFontSize ); cfg.iCPUName->setValue( cpuload::CPUNameFontSize ); cfg.iGraphInfo->setValue( cpuload::GraphInfoFontSize ); cfg.font->setCurrentFont( cpuload::defaultFontFamily ); } void cpuload::plasmoidToCfg() { cfg.iColumns->setValue(iXCount); cfg.iRows->setValue(iYCount); cfg.iCellWidth->setValue(iXStep); cfg.iCellHeight->setValue(iYStep); cfg.cUser->setColor(userColor); cfg.cSystem->setColor(systemColor); cfg.cDisk->setColor(diskColor); cfg.cNice->setColor(niceColor); cfg.cGrid->setColor(gridColor); cfg.cCPULoadLabel->setColor(cpuLoadLabelColor); cfg.cCPULoadValue->setColor(cpuLoadValueColor); cfg.cCPUName->setColor(cpuNameColor); cfg.iCPULoadLabel->setValue(iCPULoadLabel); cfg.iCPULoadValue->setValue(iCPULoadValue); cfg.iCPUName->setValue(iCPUName); cfg.iGraphInfo->setValue(iGraphInfo); cfg.font->setCurrentFont(plasmoidFont); } void cpuload::readConfig() { KConfigGroup cg = config(); if (cg.hasKey("iXCount")) iXCount=cg.readEntry("iXCount", iXCount); if (cg.hasKey("iYCount")) iYCount=cg.readEntry("iYCount", iYCount); if (cg.hasKey("iXStep")) iXStep=cg.readEntry("iXStep", iXStep); if (cg.hasKey("iYStep")) iYStep=cg.readEntry("iYStep", iYStep); if (cg.hasKey("userColor")) userColor=QColor(cg.readEntry("userColor", userColor.name())); if (cg.hasKey("systemColor")) systemColor=QColor(cg.readEntry("systemColor", systemColor.name())); if (cg.hasKey("diskColor")) diskColor=QColor(cg.readEntry("diskColor", diskColor.name())); if (cg.hasKey("niceColor")) niceColor=QColor(cg.readEntry("niceColor", niceColor.name())); if (cg.hasKey("gridColor")) gridColor=QColor(cg.readEntry("gridColor", gridColor.name())); if (cg.hasKey("cpuLoadLabelColor")) cpuLoadLabelColor=QColor(cg.readEntry("cpuLoadLabelColor", cpuLoadLabelColor.name())); if (cg.hasKey("cpuLoadValueColor")) cpuLoadValueColor=QColor(cg.readEntry("cpuLoadValueColor", cpuLoadValueColor.name())); if (cg.hasKey("cpuNameColor")) cpuNameColor=QColor(cg.readEntry("cpuNameColor", cpuNameColor.name())); if (cg.hasKey("iCPULoadLabel")) iCPULoadLabel=cg.readEntry("iCPULoadLabel", iCPULoadLabel); if (cg.hasKey("iCPULoadValue")) iCPULoadValue=cg.readEntry("iCPULoadValue", iCPULoadValue); if (cg.hasKey("iCPUName")) iCPUName=cg.readEntry("iCPUName", iCPUName); if (cg.hasKey("iGraphInfo")) iGraphInfo=cg.readEntry("iGraphInfo", iGraphInfo); if (cg.hasKey("plasmoidFont")) plasmoidFont=QFont(cg.readEntry("plasmoidFont", plasmoidFont.family())); } void cpuload::writeConfig() { KConfigGroup cg = config(); cg.writeEntry("iXCount", iXCount); cg.writeEntry("iYCount", iYCount); cg.writeEntry("iXStep", iXStep); cg.writeEntry("iYStep", iYStep); cg.writeEntry("userColor", userColor.name()); cg.writeEntry("systemColor", systemColor.name()); cg.writeEntry("diskColor", diskColor.name()); cg.writeEntry("niceColor", niceColor.name()); cg.writeEntry("gridColor", gridColor.name()); cg.writeEntry("cpuLoadLabelColor", cpuLoadLabelColor.name()); cg.writeEntry("cpuLoadValueColor", cpuLoadValueColor.name()); cg.writeEntry("cpuNameColor", cpuNameColor.name()); cg.writeEntry("iCPULoadLabel", iCPULoadLabel); cg.writeEntry("iCPULoadValue", iCPULoadValue); cg.writeEntry("iCPUName", iCPUName); cg.writeEntry("iGraphInfo", iGraphInfo); cg.writeEntry("plasmoidFont", plasmoidFont.family()); emit configNeedsSaving(); } void cpuload::cfgToPlasmoid() { iXCount=cfg.iColumns->value(); iYCount=cfg.iRows->value(); iXStep=cfg.iCellWidth->value(); iYStep=cfg.iCellHeight->value(); userColor=cfg.cUser->color(); systemColor=cfg.cSystem->color(); diskColor=cfg.cDisk->color(); niceColor=cfg.cNice->color(); gridColor=cfg.cGrid->color(); cpuLoadLabelColor=cfg.cCPULoadLabel->color(); cpuLoadValueColor=cfg.cCPULoadValue->color(); cpuNameColor=cfg.cCPUName->color(); iCPULoadLabel=cfg.iCPULoadLabel->value(); iCPULoadValue=cfg.iCPULoadValue->value(); iCPUName=cfg.iCPUName->value(); iGraphInfo=cfg.iGraphInfo->value(); plasmoidFont=cfg.font->currentFont(); writeConfig(); iWidth=iXCount*iXStep; iHeight=iYCount*iYStep; iWidth1=iWidth-2; iWidth2=iWidth-4; for (int i=0; i < vIdle.size(); i++) { vIdle.replace(i, (int)(i * iHeight / 100)); vLoad.replace(i, (int)(iHeight - i * iHeight/100)); } plasmoidFont.setBold ( true ); plasmoidFont.setPointSize ( iGraphInfo ); iWidth3=QFontMetrics(plasmoidFont).width( QString ( "System" ) )+6; plasmoidFont.setPointSize ( iCPULoadValue ); if (iWidth3 < QFontMetrics(plasmoidFont).width( QString ( "100%" ) )+6 ) { iWidth3=QFontMetrics(plasmoidFont).width( QString ( "100%" ) )+6; } plasmoidFont.setPointSize ( iCPUName ); iHeight1=(QFontMetrics(plasmoidFont).width ( sCpuModel ) / (iWidth+iWidth3) + 1)*QFontMetrics(plasmoidFont).height(); rGraphErase=QRect(iWidth-2,0,2,iHeight); iHeight3=computeHeight3(plasmoidFont, iHeight, iYStep, iGraphInfo, iCPULoadValue); rCPUValue=QRect(iWidth+1,iHeight3+1,iWidth3-3,iHeight-iHeight3-2); if (pm != NULL) delete pm; if (dpm != NULL) delete dpm; if (mask != NULL) delete mask; pm=new QPixmap ( QSize ( iWidth+iWidth3,iHeight+iHeight1+1 ) ); dpm=new QPixmap ( QSize ( iWidth+iWidth3,iHeight+iHeight1+1 ) ); mask=new QBitmap ( QSize ( iWidth+iWidth3,iHeight+iHeight1+1 ) ); pm->fill ( Qt::transparent ); dpm->fill ( Qt::transparent ); mask->fill ( Qt::color0 ); QPainter p; iCPU=iCPU1=iCPU2=99*iHeight/100; iSCPU=iSCPU1=iSCPU2=iHeight; iNCPU=iNCPU1=iNCPU2=iHeight; iDCPU=iDCPU1=iDCPU2=iHeight; p.begin ( dpm ); DrawGrid(&p, iXCount, iYCount, iXStep, iYStep, iWidth3, iHeight3, gridColor); DrawText(&p, iXCount, iYCount, iXStep, iYStep, iWidth3, iHeight3, iHeight1, userColor, systemColor, diskColor, niceColor, cpuLoadLabelColor, cpuNameColor, plasmoidFont, iGraphInfo, iCPULoadLabel, iCPUName); plasmoidFont.setPointSize ( iCPULoadValue ); p.setPen ( cpuLoadValueColor ); p.drawText ( rCPUValue, Qt::AlignRight | Qt::AlignVCenter, "0%"); p.end(); resize ( contentSizeHint()); prepareGeometryChange(); updateGeometry(); update(); } void cpuload::DrawText(QPainter *p, int iCols, int iRows, int iCellWidth, int iCellHeight, int iInfoWidth, int iInfoHeight, int iNameHeight, QColor cUser, QColor cSystem, QColor cDisk, QColor cNice, QColor cCpuLoadLabel, QColor cCpuName, QFont font, int szInfo, int szCpuLoadLabel, int szCpuName) { int i=0; int iiWidth,iiHeight; QFont pFont=font; iiWidth=iCols*iCellWidth; iiHeight=iRows*iCellHeight; int iStep=(iInfoHeight-2)/4; int iStep2=iStep*2; pFont.setBold ( true ); pFont.setPointSize ( szInfo ); pens[0]=QPen( cUser ); pens[1]=QPen( cSystem ); pens[2]=QPen( cNice ); pens[3]=QPen( cDisk ); p->setFont ( pFont ); for (i=0; i<4 ;i++) { p->setPen ( pens[i] ); p->drawText ( iiWidth+1,1+iStep*i, iInfoWidth-2, iStep2, Qt::AlignHCenter|Qt::AlignTop, cpuInfo[i] ); } pFont.setPointSize ( szCpuLoadLabel ); p->setFont ( pFont ); p->setPen ( cCpuLoadLabel ); p->drawText ( 0, 0, iiWidth, iiHeight, Qt::AlignCenter, QString ( "CPU Load" ) ); pFont.setPointSize ( szCpuName ); p->setFont ( pFont ); p->setPen ( cCpuName ); p->drawText ( 0, iiHeight+1, iiWidth+iInfoWidth, iNameHeight-2, Qt::AlignCenter | Qt::TextWordWrap, QString ( sCpuModel ) ); } void cpuload::DrawGrid(QPainter *p, int iCols, int iRows, int iCellWidth, int iCellHeight, int iInfoWidth, int iInfoHeight, QColor cGridColor) { int i=0; int iiWidth,iiHeight; iiWidth=iCols*iCellWidth; iiHeight=iRows*iCellHeight; p->setPen ( cGridColor ); for ( i=0;i<=iCols;i++ ) p->drawLine ( i*iCellWidth,1,i*iCellWidth,iiHeight ); for ( i=0;i<=iRows;i++ ) p->drawLine ( 1,i*iCellHeight,iiWidth,i*iCellHeight ); p->drawRect (iiWidth,0,iInfoWidth-1,iiHeight); p->drawLine ( iiWidth,iInfoHeight,iiWidth+iInfoWidth-1,iInfoHeight ); } void cpuload::showConfigurationInterface() { if (cfg_dialog == 0) { cfg_dialog = new QDialog; cfg.setupUi(cfg_dialog); connect( cfg.iColumns, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()) ); connect( cfg.iRows, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()) ); connect( cfg.iCellWidth, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()) ); connect( cfg.iCellHeight, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()) ); connect( cfg.font, SIGNAL(currentFontChanged (const QFont &)), this, SLOT(updatePreview()) ); connect( cfg.iCPUName, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()) ); connect( cfg.iCPULoadLabel, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()) ); connect( cfg.iCPULoadValue, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()) ); connect( cfg.iGraphInfo, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()) ); connect( cfg.cGrid, SIGNAL(changed(const QColor&)), this, SLOT(updatePreview()) ); connect( cfg.cUser, SIGNAL(changed(const QColor&)), this, SLOT(updatePreview()) ); connect( cfg.cSystem, SIGNAL(changed(const QColor&)), this, SLOT(updatePreview()) ); connect( cfg.cDisk, SIGNAL(changed(const QColor&)), this, SLOT(updatePreview()) ); connect( cfg.cNice, SIGNAL(changed(const QColor&)), this, SLOT(updatePreview()) ); connect( cfg.cCPULoadLabel, SIGNAL(changed(const QColor&)), this, SLOT(updatePreview()) ); connect( cfg.cCPULoadValue, SIGNAL(changed(const QColor&)), this, SLOT(updatePreview()) ); connect( cfg.cCPUName, SIGNAL(changed(const QColor&)), this, SLOT(updatePreview()) ); connect( cfg.buttonBox, SIGNAL(accepted()), this, SLOT(cfgToPlasmoid()) ); connect( cfg.buttonBox, SIGNAL(clicked ( QAbstractButton *)), this, SLOT(clicked ( QAbstractButton *)) ); } plasmoidToCfg(); if (preview == 0) { preview=new QPixmap ( QSize ( iWidth+iWidth3,iHeight+iHeight1+1 ) ); preview->fill ( Qt::transparent ); QPainter p; p.begin ( preview ); DrawGrid(&p, iXCount, iYCount, iXStep, iYStep, iWidth3, iHeight/2, Qt::red); p.end(); cfg.label->setPixmap(*preview); cfg.label->setFixedSize(preview->size()); cfg.label->adjustSize(); cfg_dialog->adjustSize(); } updatePreview(); cfg_dialog->show(); } void cpuload::updatePreview() { int iiWidth, iiHeight, iiWidth3, iiHeight1, iiHeight3; QVector fakeUserLoad; QVector fakeSysLoad; QVector fakeNiceLoad; QVector fakeDiskLoad; QPainterPath fakeUserPath; QPainterPath fakeSysPath; QPainterPath fakeNicePath; QPainterPath fakeDiskPath; fakeUserLoad << 100 << 100 << 100 << 9 << 3 << 3 << 8 << 8 << 27 << 27 << 29 << 29 << 9 << 9 << 6 << 6 << 7 << 7 << 7 << 7 << 7 << 12 << 12 << 7 << 8 << 8 << 8 << 4 << 9 << 5 << 5 << 7 << 7 << 7 << 7 << 7 << 7 << 12 << 12 << 8 << 8 << 12 << 12 << 5 << 5 << 5 << 5 << 7 << 7 << 6 << 6 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 15 << 9 << 9 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 4 << 4 << 5 << 6 << 6 << 6 << 6 << 13 << 13 << 5 << 5 << 6 << 6 << 5 << 5 << 5 << 5 << 4 << 4 << 5 << 5 << 6 << 6 << 5 << 6 << 6 << 11 << 7 << 7 << 55 << 55 << 55 << 55 << 58 << 58 << 18 << 18 << 58 << 58 << 71 << 53 << 53 << 53 << 54 << 54 << 52 << 52 << 78 << 78 << 83 << 83 << 12 << 12 << 55 << 55 << 55 << 19 << 19 << 5 << 5 << 14 << 5 << 5 << 6 << 6 << 6 << 14 << 3 << 3 << 6 << 6 << 6 << 5 << 6 << 5 << 5 << 5 << 5 << 7 << 7 << 5 << 5 << 5 << 7 << 4 << 4 << 12 << 4 << 4 << 7 << 3 << 3 << 5 << 5 << 5 << 5 << 6 << 6 << 6 << 2 << 2 << 15 << 15 << 7 << 7 << 9 << 9 << 15 << 4 << 4 << 10 << 10 << 9 << 3 << 3 << 7 << 6 << 6 << 100 << 100 << 100 ; fakeSysLoad << 1 << 5 << 5 << 3 << 1 << 5 << 4 << 0 << 4 << 0 << 0 << 3 << 2 << 1 << 4 << 2 ; fakeNiceLoad << 30 << 33 << 30 << 45 << 0 << 15 << 35 << 30 << 20 << 0 << 0 << 20 << 22 << 25 << 24 << 30 ; fakeDiskLoad << 12 << 26 << 26 << 9 << 3 << 3 << 8 << 8 << 27 << 27 << 29 << 29 << 9 << 9 << 6 << 6 << 7 << 7 << 7 << 7 << 7 << 12 << 12 << 7 << 8 << 8 << 8 << 4 << 9 << 5 << 5 << 7 << 7 << 7 << 7 << 7 << 7 << 12 << 12 << 8 << 8 << 12 << 12 << 5 << 5 << 5 << 5 << 7 << 7 << 6 << 6 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 15 << 9 << 9 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 4 << 4 << 5 << 6 << 6 << 6 << 6 << 13 << 13 << 5 << 5 << 6 << 6 << 5 << 5 << 5 << 5 << 4 << 4 << 5 << 5 << 6 << 6 << 5 << 6 << 6 << 11 << 7 << 7 << 35 << 35 << 35 << 35 << 28 << 28 << 18 << 18 << 28 << 28 << 21 << 33 << 33 << 23 << 24 << 24 << 32 << 32 << 48 << 48 << 53 << 23 << 12 << 12 << 25 << 25 << 25 << 9 << 9 << 5 << 5 << 4 << 5 << 5 << 6 << 6 << 3 << 4 << 3 << 3 << 6 << 6 << 6 << 5 << 6 << 5 << 5 << 5 << 5 << 7 << 7 << 5 << 5 << 5 << 7 << 4 << 4 << 12 << 4 << 4 << 7 << 3 << 3 << 5 << 5 << 5 << 5 << 6 << 6 << 6 << 2 << 2 << 15 << 15 << 7 << 7 << 9 << 9 << 15 << 4 << 4 << 10 << 10 << 9 << 3 << 3 << 7 << 6 << 6 << 6 << 6 << 6 ; if (preview != NULL) { delete preview; } iiWidth=cfg.iColumns->value()*cfg.iCellWidth->value(); iiHeight=cfg.iRows->value()*cfg.iCellHeight->value(); int i; for (i=0; icurrentFont(); pFont.setBold ( true ); pFont.setPointSize ( cfg.iGraphInfo->value() ); iiWidth3=QFontMetrics(pFont).width( QString ( "System" ) )+6; pFont.setPointSize ( cfg.iCPULoadValue->value() ); if (iiWidth3 < QFontMetrics(pFont).width( QString ( "100%" ) )+6 ) { iiWidth3=QFontMetrics(pFont).width( QString ( "100%" ) )+6; } iiHeight3=computeHeight3(pFont, iiHeight, cfg.iCellHeight->value(), cfg.iGraphInfo->value(), cfg.iCPULoadValue->value()); pFont.setPointSize ( cfg.iCPUName->value() ); iiHeight1=(QFontMetrics(pFont).width ( sCpuModel ) / (iiWidth+iiWidth3) + 1)*QFontMetrics(pFont).height(); preview=new QPixmap ( QSize ( iiWidth+iiWidth3,iiHeight+iiHeight1+1 ) ); preview->fill ( Qt::transparent ); QPainter p; p.begin ( preview ); DrawGrid(&p, cfg.iColumns->value(), cfg.iRows->value(), cfg.iCellWidth->value(), cfg.iCellHeight->value(), iiWidth3, iiHeight3, cfg.cGrid->color()); DrawText(&p, cfg.iColumns->value(), cfg.iRows->value(), cfg.iCellWidth->value(), cfg.iCellHeight->value(), iiWidth3, iiHeight3, iiHeight1, cfg.cUser->color(), cfg.cSystem->color(), cfg.cDisk->color(), cfg.cNice->color(), cfg.cCPULoadLabel->color(), cfg.cCPUName->color(), cfg.font->currentFont(), cfg.iGraphInfo->value(), cfg.iCPULoadLabel->value(), cfg.iCPUName->value()); pFont.setPointSize ( cfg.iCPULoadValue->value() ); p.setFont(pFont); p.setPen ( cfg.cCPULoadValue->color() ); p.drawText ( iiWidth+1,iiHeight3+1,iiWidth3-3,iiHeight-iiHeight3-2, Qt::AlignRight | Qt::AlignVCenter, "100%"); p.setPen ( QPen ( cfg.cDisk->color(), 1 ) ); p.drawPath ( fakeDiskPath ) ; p.setPen ( QPen ( cfg.cSystem->color(), 1 ) ); p.drawPath ( fakeSysPath ) ; p.setPen ( QPen ( cfg.cUser->color(), 1 ) ); p.drawPath ( fakeUserPath ) ; p.end(); cfg.label->setPixmap(*preview); cfg.label->setFixedSize(preview->size()); cfg.label->adjustSize(); QString tmp; cfg.plasmoidSize->setText("Plasmoid size will be "+tmp.sprintf("%d x %d",(iiWidth+iiWidth3), (iiHeight+iiHeight1))); cfg_dialog->adjustSize(); } cpuload::~cpuload() { if (pm != NULL) delete pm; if (dpm != NULL) delete dpm; if (mask != NULL) delete mask; if (cfg_dialog != NULL) delete cfg_dialog; if (preview != NULL) delete preview; if ( hasFailedToLaunch() ) { // Do some cleanup here } else { // Save settings } } void cpuload::init() { pm=new QPixmap ( QSize ( iWidth+iWidth3,iHeight+iHeight1+1 ) ); dpm=new QPixmap ( QSize ( iWidth+iWidth3,iHeight+iHeight1+1 ) ); mask=new QBitmap ( QSize ( iWidth+iWidth3,iHeight+iHeight1+1 ) ); pm->fill ( Qt::transparent ); dpm->fill ( Qt::transparent ); mask->fill ( Qt::color0 ); QPainter p; iCPU=iCPU1=iCPU2=99*iHeight/100; iSCPU=iSCPU1=iSCPU2=iHeight; iNCPU=iNCPU1=iNCPU2=iHeight; iDCPU=iDCPU1=iDCPU2=iHeight; p.begin ( dpm ); DrawGrid(&p, iXCount, iYCount, iXStep, iYStep, iWidth3, iHeight3, gridColor); DrawText(&p, iXCount, iYCount, iXStep, iYStep, iWidth3, iHeight3, iHeight1, userColor, systemColor, diskColor, niceColor, cpuLoadLabelColor, cpuNameColor, plasmoidFont, iGraphInfo, iCPULoadLabel, iCPUName); p.end(); Plasma::DataEngine *cpu = dataEngine ( "cpuload" ); cpu->connectSource ( "Average CPU Usage", this, 500 ); setBackgroundHints(TranslucentBackground); resize ( contentSizeHint()); prepareGeometryChange(); updateGeometry(); update(); } QSizeF cpuload::contentSizeHint() const { QSizeF sizeHint = QSizeF(iWidth+iWidth3 +30,iHeight+ iHeight1 +30); return sizeHint; } void cpuload::paintInterface ( QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect ) { p->setRenderHint ( QPainter::SmoothPixmapTransform ); p->setRenderHint ( QPainter::Antialiasing ); p->drawPixmap ( 15,15,*dpm ); p->drawPixmap ( 15,15,*pm ); } void cpuload::dataUpdated ( const QString& source, const Plasma::DataEngine::Data &data ) { if ( source == "0" || source == "Average CPU Usage" ) { iCPU2=iCPU1; iCPU1=iCPU; iCPU= vIdle.at(data["iIdle"].toInt()); iSCPU2=iSCPU1; iSCPU1=iSCPU; iSCPU= vLoad.at(data["iSys"].toInt()); iNCPU2=iNCPU1; iNCPU1=iNCPU; iNCPU= vLoad.at(data["iNice"].toInt()); iDCPU2=iDCPU1; iDCPU1=iDCPU; iDCPU= vLoad.at(data["iDisk"].toInt()); QPixmap tmp=QPixmap ( *pm ); QPainter p; p.begin ( pm ); p.drawPixmap ( -2,0,tmp ); if ( cpuload::test ( iSCPU,iSCPU1, iSCPU2, iNCPU, iNCPU1, iNCPU2 ) ) { cpuNiceGraph = QPainterPath() ; p.setPen ( QPen ( niceColor, 1 ) ); cpuNiceGraph.moveTo ( QPointF ( iWidth2, iNCPU2 ) ) ; cpuNiceGraph.lineTo ( iWidth1, iNCPU1 ) ; cpuNiceGraph.lineTo ( iWidth, iNCPU ) ; p.drawPath ( cpuNiceGraph ) ; } if ( cpuload::test ( iNCPU, iNCPU1, iNCPU2, iDCPU, iDCPU1, iDCPU2 ) ) { cpuDiskGraph = QPainterPath() ; p.setPen ( QPen ( diskColor, 1 ) ); cpuDiskGraph.moveTo ( QPointF ( iWidth2, iDCPU2 ) ) ; cpuDiskGraph.lineTo ( iWidth1, iDCPU1 ) ; cpuDiskGraph.lineTo ( iWidth, iDCPU ) ; p.drawPath ( cpuDiskGraph ) ; } cpuSysGraph = QPainterPath() ; p.setPen ( QPen ( systemColor, 1 ) ); cpuSysGraph.moveTo ( QPointF ( iWidth2, iSCPU2 ) ) ; cpuSysGraph.lineTo ( iWidth1, iSCPU1 ) ; cpuSysGraph.lineTo ( iWidth, iSCPU ) ; p.drawPath ( cpuSysGraph ) ; cpuGraph = QPainterPath() ; p.setPen ( QPen ( userColor, 1 ) ); cpuGraph.moveTo ( QPointF ( iWidth2, iCPU2 ) ) ; cpuGraph.lineTo ( iWidth1, iCPU1 ) ; cpuGraph.lineTo ( iWidth, iCPU ) ; p.drawPath ( cpuGraph ) ; p.end(); QBitmap tmpMask=QBitmap ( *mask ); mask->fill ( Qt::color0 ); p.begin ( mask ); p.drawPixmap ( -2,0,tmpMask ); p.setPen ( QPen ( Qt::color1,1 ) ); if ( cpuload::test ( iSCPU,iSCPU1, iSCPU2, iNCPU, iNCPU1, iNCPU2 ) ) { p.drawPath ( cpuNiceGraph ) ; } if ( cpuload::test ( iNCPU, iNCPU1, iNCPU2, iDCPU, iDCPU1, iDCPU2 ) ) { p.drawPath ( cpuDiskGraph ) ; } p.drawPath ( cpuSysGraph ) ; p.drawPath ( cpuGraph ) ; p.end(); pm->setMask ( *mask ); if (iCpuLoad != data["iLoad"].toInt()) { p.begin(dpm); p.setCompositionMode(QPainter::CompositionMode_Clear); p.fillRect ( rCPUValue, Qt::transparent ); plasmoidFont.setBold ( true ); plasmoidFont.setPointSize ( iCPULoadValue ); p.setFont(plasmoidFont); p.setPen ( cpuLoadValueColor ); p.drawText ( rCPUValue, Qt::AlignRight | Qt::AlignVCenter, data["iLoad"].toString()+"%"); p.end(); } iCpuLoad=data["iLoad"].toInt(); update(); } } #include "cpuload.moc" cpuload/plasmoid/cpuLoadSettings.ui0000644000175000017500000035664711055051442017346 0ustar alexeyalexey cpuLoadSettings 0 0 556 466 CPU Load settings 0 0 210 230 2 0 0 538 292 Background grid settings 100 50 Columns 1 100 50 Rows 1 100 50 Cell width 1 100 50 Cell height 1 Qt::Vertical 20 40 Qt::Horizontal 40 20 0 0 538 292 Font settings 100 50 CPU Load Label 1 Qt::Horizontal 40 20 100 50 Graph Info 1 100 50 CPU Name 1 100 50 CPU Load Value 1 Qt::Vertical 20 40 Sans Serif Serif Monospace AlArabiya AlBattar AlHor AlManzomah AlMateen AlMohanad AlMothnna AlYarmook Andale Mono AnjaliOldLipi Arab Arial Arial Black AR PL UKai CN AR PL UKai HK AR PL UKai TW AR PL UKai TW MBE AR PL UMing CN AR PL UMing HK AR PL UMing TW AR PL UMing TW MBE Bitstream Charter Bitstream Vera Sans Bitstream Vera Sans Mono Bitstream Vera Serif Century Schoolbook L Comic Sans MS Cortoba Courier 10 Pitch Courier New DejaVu Sans DejaVu Sans Mono DejaVu Serif Dimnah Dingbats Electron FreeMono FreeSans FreeSerif Furat Garuda Georgia Granada Graph Hani Haramain Hor Impact Japan Jet Kayrawan Khalid Kochi Gothic Kochi Mincho Lohit Gujarati Lohit Hindi Lohit Punjabi Lohit Tamil Loma Mallige MalOtf Mashq Metal Mukti Narrow Nada Nagham Nice Nimbus Mono L Nimbus Roman No9 L Nimbus Sans L Norasi OpenSymbol ori1Uni Ostorah Ouhod Petra Phetsarath OT Purisa Rachana_w01 Rasheeq Rehan Salem Sawasdee Shado Sharjah Sindbad Standard Symbols L Tarablus Tholoth Times New Roman TlwgMono TlwgTypewriter Tlwg Typist Trebuchet MS UnBatang UnDotum URW Bookman L URW Chancery L URW Gothic L URW Palladio L Vemana2000 Verdana Waree Webdings Sans Serif Serif Monospace AlArabiya AlBattar AlHor AlManzomah AlMateen AlMohanad AlMothnna AlYarmook Andale Mono AnjaliOldLipi Arab Arial Arial Black AR PL UKai CN AR PL UKai HK AR PL UKai TW AR PL UKai TW MBE AR PL UMing CN AR PL UMing HK AR PL UMing TW AR PL UMing TW MBE Bitstream Charter Bitstream Vera Sans Bitstream Vera Sans Mono Bitstream Vera Serif Century Schoolbook L Comic Sans MS Cortoba Courier 10 Pitch Courier New DejaVu Sans DejaVu Sans Mono DejaVu Serif Dimnah Dingbats Electron FreeMono FreeSans FreeSerif Furat Garuda Georgia Granada Graph Hani Haramain Hor Impact Japan Jet Kayrawan Khalid Kochi Gothic Kochi Mincho Lohit Gujarati Lohit Hindi Lohit Punjabi Lohit Tamil Loma Mallige MalOtf Mashq Metal Mukti Narrow Nada Nagham Nice Nimbus Mono L Nimbus Roman No9 L Nimbus Sans L Norasi OpenSymbol ori1Uni Ostorah Ouhod Petra Phetsarath OT Purisa Rachana_w01 Rasheeq Rehan Salem Sawasdee Shado Sharjah Sindbad Standard Symbols L Tarablus Tholoth Times New Roman TlwgMono TlwgTypewriter Tlwg Typist Trebuchet MS UnBatang UnDotum URW Bookman L URW Chancery L URW Gothic L URW Palladio L Vemana2000 Verdana Waree Webdings Sans Serif Serif Monospace AlArabiya AlBattar AlHor AlManzomah AlMateen AlMohanad AlMothnna AlYarmook Andale Mono AnjaliOldLipi Arab Arial Arial Black AR PL UKai CN AR PL UKai HK AR PL UKai TW AR PL UKai TW MBE AR PL UMing CN AR PL UMing HK AR PL UMing TW AR PL UMing TW MBE Bitstream Charter Bitstream Vera Sans Bitstream Vera Sans Mono Bitstream Vera Serif Century Schoolbook L Comic Sans MS Cortoba Courier 10 Pitch Courier New DejaVu Sans DejaVu Sans Mono DejaVu Serif Dimnah Dingbats Electron FreeMono FreeSans FreeSerif Furat Garuda Georgia Granada Graph Hani Haramain Hor Impact Japan Jet Kayrawan Khalid Kochi Gothic Kochi Mincho Lohit Gujarati Lohit Hindi Lohit Punjabi Lohit Tamil Loma Mallige MalOtf Mashq Metal Mukti Narrow Nada Nagham Nice Nimbus Mono L Nimbus Roman No9 L Nimbus Sans L Norasi OpenSymbol ori1Uni Ostorah Ouhod Petra Phetsarath OT Purisa Rachana_w01 Rasheeq Rehan Salem Sawasdee Shado Sharjah Sindbad Standard Symbols L Tarablus Tholoth Times New Roman TlwgMono TlwgTypewriter Tlwg Typist Trebuchet MS UnBatang UnDotum URW Bookman L URW Chancery L URW Gothic L URW Palladio L Vemana2000 Verdana Waree Webdings Sans Serif Serif Monospace AlArabiya AlBattar AlHor AlManzomah AlMateen AlMohanad AlMothnna AlYarmook Andale Mono AnjaliOldLipi Arab Arial Arial Black AR PL UKai CN AR PL UKai HK AR PL UKai TW AR PL UKai TW MBE AR PL UMing CN AR PL UMing HK AR PL UMing TW AR PL UMing TW MBE Bitstream Charter Bitstream Vera Sans Bitstream Vera Sans Mono Bitstream Vera Serif Century Schoolbook L Comic Sans MS Cortoba Courier 10 Pitch Courier New DejaVu Sans DejaVu Sans Mono DejaVu Serif Dimnah Dingbats Electron FreeMono FreeSans FreeSerif Furat Garuda Georgia Granada Graph Hani Haramain Hor Impact Japan Jet Kayrawan Khalid Kochi Gothic Kochi Mincho Lohit Gujarati Lohit Hindi Lohit Punjabi Lohit Tamil Loma Mallige MalOtf Mashq Metal Mukti Narrow Nada Nagham Nice Nimbus Mono L Nimbus Roman No9 L Nimbus Sans L Norasi OpenSymbol ori1Uni Ostorah Ouhod Petra Phetsarath OT Purisa Rachana_w01 Rasheeq Rehan Salem Sawasdee Shado Sharjah Sindbad Standard Symbols L Tarablus Tholoth Times New Roman TlwgMono TlwgTypewriter Tlwg Typist Trebuchet MS UnBatang UnDotum URW Bookman L URW Chancery L URW Gothic L URW Palladio L Vemana2000 Verdana Waree Webdings Sans Serif Serif Monospace AlArabiya AlBattar AlHor AlManzomah AlMateen AlMohanad AlMothnna AlYarmook Andale Mono AnjaliOldLipi Arab Arial Arial Black AR PL UKai CN AR PL UKai HK AR PL UKai TW AR PL UKai TW MBE AR PL UMing CN AR PL UMing HK AR PL UMing TW AR PL UMing TW MBE Bitstream Charter Bitstream Vera Sans Bitstream Vera Sans Mono Bitstream Vera Serif Century Schoolbook L Comic Sans MS Cortoba Courier 10 Pitch Courier New DejaVu Sans DejaVu Sans Mono DejaVu Serif Dimnah Dingbats Electron FreeMono FreeSans FreeSerif Furat Garuda Georgia Granada Graph Hani Haramain Hor Impact Japan Jet Kayrawan Khalid Kochi Gothic Kochi Mincho Lohit Gujarati Lohit Hindi Lohit Punjabi Lohit Tamil Loma Mallige MalOtf Mashq Metal Mukti Narrow Nada Nagham Nice Nimbus Mono L Nimbus Roman No9 L Nimbus Sans L Norasi OpenSymbol ori1Uni Ostorah Ouhod Petra Phetsarath OT Purisa Rachana_w01 Rasheeq Rehan Salem Sawasdee Shado Sharjah Sindbad Standard Symbols L Tarablus Tholoth Times New Roman TlwgMono TlwgTypewriter Tlwg Typist Trebuchet MS UnBatang UnDotum URW Bookman L URW Chancery L URW Gothic L URW Palladio L Vemana2000 Verdana Waree Webdings Sans Serif Serif Monospace AlArabiya AlBattar AlHor AlManzomah AlMateen AlMohanad AlMothnna AlYarmook AnjaliOldLipi Arab AR PL UKai CN AR PL UKai HK AR PL UKai TW AR PL UKai TW MBE AR PL UMing CN AR PL UMing HK AR PL UMing TW AR PL UMing TW MBE Bitstream Charter Bitstream Vera Sans Bitstream Vera Sans Mono Bitstream Vera Serif Century Schoolbook L Cortoba Courier 10 Pitch DejaVu Sans DejaVu Sans Mono DejaVu Serif Dimnah Dingbats Electron FreeMono FreeSans FreeSerif Furat Garuda Granada Graph Hani Haramain Hor Japan Jet Kayrawan Khalid Kochi Gothic Kochi Mincho Lohit Gujarati Lohit Hindi Lohit Punjabi Lohit Tamil Loma Mallige MalOtf Mashq Metal Mukti Narrow Nada Nagham Nice Nimbus Mono L Nimbus Roman No9 L Nimbus Sans L Norasi OpenSymbol ori1Uni Ostorah Ouhod Petra Phetsarath OT Purisa Rachana_w01 Rasheeq Rehan Salem Sawasdee Shado Sharjah Sindbad Standard Symbols L Tarablus Tholoth TlwgMono TlwgTypewriter Tlwg Typist UnBatang UnDotum URW Bookman L URW Chancery L URW Gothic L URW Palladio L Vemana2000 Waree Sans Serif Serif Monospace AlArabiya AlBattar AlHor AlManzomah AlMateen AlMohanad AlMothnna AlYarmook AnjaliOldLipi Arab AR PL UKai CN AR PL UKai HK AR PL UKai TW AR PL UKai TW MBE AR PL UMing CN AR PL UMing HK AR PL UMing TW AR PL UMing TW MBE Bitstream Charter Bitstream Vera Sans Bitstream Vera Sans Mono Bitstream Vera Serif Century Schoolbook L Cortoba Courier 10 Pitch DejaVu Sans DejaVu Sans Mono DejaVu Serif Dimnah Dingbats Electron FreeMono FreeSans FreeSerif Furat Garuda Granada Graph Hani Haramain Hor Japan Jet Kayrawan Khalid Kochi Gothic Kochi Mincho Lohit Gujarati Lohit Hindi Lohit Punjabi Lohit Tamil Loma Mallige MalOtf Mashq Metal Mukti Narrow Nada Nagham Nice Nimbus Mono L Nimbus Roman No9 L Nimbus Sans L Norasi OpenSymbol ori1Uni Ostorah Ouhod Petra Phetsarath OT Purisa Rachana_w01 Rasheeq Rehan Salem Sawasdee Shado Sharjah Sindbad Standard Symbols L Tarablus Tholoth TlwgMono TlwgTypewriter Tlwg Typist UnBatang UnDotum URW Bookman L URW Chancery L URW Gothic L URW Palladio L Vemana2000 Waree Sans Serif Serif Monospace AlArabiya AlBattar AlHor AlManzomah AlMateen AlMohanad AlMothnna AlYarmook AnjaliOldLipi Arab AR PL UKai CN AR PL UKai HK AR PL UKai TW AR PL UKai TW MBE AR PL UMing CN AR PL UMing HK AR PL UMing TW AR PL UMing TW MBE Bitstream Charter Bitstream Vera Sans Bitstream Vera Sans Mono Bitstream Vera Serif Century Schoolbook L Cortoba Courier 10 Pitch DejaVu Sans DejaVu Sans Mono DejaVu Serif Dimnah Dingbats Electron FreeMono FreeSans FreeSerif Furat Garuda Granada Graph Hani Haramain Hor Japan Jet Kayrawan Khalid Kochi Gothic Kochi Mincho Lohit Gujarati Lohit Hindi Lohit Punjabi Lohit Tamil Loma Mallige MalOtf Mashq Metal Mukti Narrow Nada Nagham Nice Nimbus Mono L Nimbus Roman No9 L Nimbus Sans L Norasi OpenSymbol ori1Uni Ostorah Ouhod Petra Phetsarath OT Purisa Rachana_w01 Rasheeq Rehan Salem Sawasdee Shado Sharjah Sindbad Standard Symbols L Tarablus Tholoth TlwgMono TlwgTypewriter Tlwg Typist UnBatang UnDotum URW Bookman L URW Chancery L URW Gothic L URW Palladio L Vemana2000 Waree 0 0 538 292 Color settings 92 24 User Load 92 24 User Load 92 24 System Load 92 24 User Load 92 0 CPU Load Label 92 24 User Load 92 0 CPU Name 92 24 User Load 92 24 Disk Load 92 24 User Load 92 24 Nice Load 92 24 User Load 92 0 CPU Load % 92 24 User Load 92 0 Grid 92 24 User Load Qt::Horizontal 40 20 Qt::Vertical 20 40 QLayout::SetNoConstraint Plasmoid size will be ... Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults plasmoidSize buttonBox toolBox KColorButton QPushButton
kcolorbutton.h
KFontComboBox KComboBox
kfontcombobox.h
KIntNumInput QWidget
knuminput.h
buttonBox accepted() cpuLoadSettings accept() 248 254 157 274 buttonBox rejected() cpuLoadSettings reject() 316 260 286 274
cpuload/plasmoid/plasma-applet-cpuload.desktop0000644000175000017500000000122211047364566021446 0ustar alexeyalexey[Desktop Entry] Name=cpuload Name[x-test]=xxcpuloadxx Comment=Plasma cpuload Comment[km]=ប្លាស្មា cpuload Comment[sr]=Плазмин cpuload Comment[sr@latin]=Plasmin cpuload Comment[uk]=Плазма cpuload Comment[x-test]=xxPlasma cpuloadxx Type=Service X-KDE-ServiceTypes=Plasma/Applet X-KDE-Library=plasma_applet_cpuload X-KDE-PluginInfo-Author=Alexey Tyapkin X-KDE-PluginInfo-Email=tyapkin.alexey@gmail.com X-KDE-PluginInfo-Name=cpuload X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-Website=http://plasma.kde.org/ X-KDE-PluginInfo-Category= X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true cpuload/COPYING0000644000175000017500000004311011044214542013074 0ustar alexeyalexey GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program 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. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public 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. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.