commit ee0c9d4bc3e25a409b3127be2876079f69719978 Author: Slávek Banko Date: Sat Apr 9 15:59:57 2016 +0200 Initial import of qalculate-kde 0.9.7 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..c4682cc --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Niklas Knutsson diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..5b6e7c6 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + 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. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..042a3df --- /dev/null +++ b/ChangeLog @@ -0,0 +1,477 @@ +2009-01-05 Jonathan Stickel + + * General build updates and bug fixes, including the ability to + build against cln >= 1.2. + +2007-08-07 Niklas Knutsson + + * New Simplified Chinese translation (Roy Qu ) + +2007-04-26 Niklas Knutsson + + * Fix equals sign for comparison with approximately displayed value + +2007-04-16 Niklas Knutsson + + * Always input decimal separator sign on keypad separator press + +2007-03-21 Niklas Knutsson + + * Minor documentation fixes + +2006-12-16 Niklas Knutsson + + * New French translation (Nicolas Laug ) + +2006-11-18 Niklas Knutsson + + * Update Swedish translation + +2006-11-07 Niklas Knutsson + + * Update Dutch translation (Jaap Woldringh ) + +2006-11-02 Niklas Knutsson + + * Connect "Exp" button Exp RPN operation and add Ctrl+Shift+E shortcut + +2006-09-10 Niklas Knutsson + + * Ability to set shortcuts for meta modes + +2006-09-05 Niklas Knutsson + + * Integer factorization + +2006-07-19 Niklas Knutsson + + * "Include headings" -> "Includes headings" + +2006-07-14 Niklas Knutsson + + * Fix set unknowns in RPN mode + +2006-07-12 Niklas Knutsson + + * Fixes for old KDE and Qt version + +2006-07-02 Niklas Knutsson + + * Global shortcut for show/hide + * Add "Engineering" to popup menu + * Make separate options for "Sort Minus Last" and "Negative Exponents" in numerical display menu + * Save history in a generic format as in qalculate-gtk + * Add "Edit Expression", "Edit Result", and "Insert Result Variable" to history context menu + * Do not put numerator in parenthesis in (1/2)/m, with "Place Units Separately" activated + * Increment version number + +2006-06-20 Niklas Knutsson + + * Select text when editing matrix with F2 or Tab + +2006-06-19 Niklas Knutsson + + * Use localized comma for insert matrix/vector + * Display parentheses correctly with flat division when "Place units separately" is activated + +2006-06-16 Niklas Knutsson + + * Fix add/modify series on Enter in expression field + +2006-06-10 Niklas Knutsson + + * Add "Engineering" display mode + +2006-06-01 Niklas Knutsson + + * Polishing before 0.9.4 release + +2006-05-20 Niklas Knutsson + + * Use icon buttons by default + +2006-05-09 Niklas Knutsson + + * Use KLocale functions for decimal signs as, kde sets LC_NUMERIC to "C" + +2006-04-30 Niklas Knutsson + + * "Convert to Best Unit" and "Convert to Base Units" was swapped + +2006-04-28 Niklas Knutsson + + * Fix function editing with subfunctions + +2006-04-23 Niklas Knutsson + + * Update documentation + * Update Swedish translation + +2006-04-10 Niklas Knutsson + + * Align all matrix/vector table items right + * Do not calculate twice when dialog pops up + * Remember visible tab with rpn mode on and off + * Enhance matrix/vector dialogs + +2006-04-09 Niklas Knutsson + + * Do not add empty expressions to expression entry history + * Fix keyboard input with focus on stack list + * Add buttons and switch single selection for the stack list + * Show default value of arguments in function description + +2006-04-08 Niklas Knutsson + + * Improve RPN mode + * "Use only keypad keys for RPN operations" option + * Redirect all unused input to expression entry + * Tooltips on configure dialog + * Localize expressions in unit manager + * Options to use dot as thousands separator when it is not the default decimal sign + +2006-04-06 Niklas Knutsson + + * Finish RPN mode + +2006-04-04 Niklas Knutsson + + * True RPN mode + +2006-04-02 Niklas Knutsson + + * Documentation updates + +2006-04-01 Niklas Knutsson + + * Handle custom condition in edit argument dialog + +2006-03-29 Niklas Knutsson + + * Focus text field that caused error after error message + * Fix edit dataset name + * Clear description and object list on data set deletion + +2006-03-28 Niklas Knutsson + + * New icons + +2006-03-27 Niklas Knutsson + + * Check capitalization + * Dutch translation + * Do not enable system tray icon by default + +2006-03-23 Niklas Knutsson + + * Put selection of number base in result and expression in the same dialog + +2006-03-20 Niklas Knutsson + + * Calculate selection (-clipboard, -c) command line option + +2006-03-19 Niklas Knutsson + + * Use Escape key to hide window when tray icon is on + +2006-03-18 Niklas Knutsson + + * Fix session management + * Enable system tray icon by default + +2006-03-13 Niklas Knutsson + + * Do not do any unnecessary result updates when loading meta mode + * Show original parsed precision of enetered numbers + +2006-02-11 Niklas Knutsson + + * Do not use "Read Precision" in plot + +2006-02-07 Niklas Knutsson + + * "RPN Mode" -> "RPN Syntax" + +2006-02-01 Niklas Knutsson + + * When in RPN mode, do not put selection in parenthesis and place operator after + +2005-12-20 Niklas Knutsson + + * Warn about denominators assumed non-zero option + +2005-12-19 Niklas Knutsson + + * Update Swedish translation + * Update documentation + +2005-12-13 Niklas Knutsson + + * Set minimum with for entries in units dialog + +2005-12-13 Niklas Knutsson + + * Display AND and OR with lower-case letters + +2005-12-11 Niklas Knutsson + + * No double quotes in in history from set unknowns + +2005-12-03 Niklas Knutsson + + * Display "x < 3 && x > 1" as "1 < x < 3" + +2005-11-29 Niklas Knutsson + + * Do not display (x)(y)^z with multiplication sign + * No double quotes in set unknowns dialog + * Set max precision to 100000 + +2005-11-27 Niklas Knutsson + + * Update assumption menu items and combo boxes (in edit unknown variable dialog) + after setting sign or type (ex. setting sign to positive makes type at least real) + +2005-11-26 Niklas Knutsson + + * Do not start command thread more than once + +2005-11-24 Niklas Knutsson + + * Never display 1/x as (1)/x no matter how deeply nested + +2005-11-22 Niklas Knutsson + + * Factorize and simplify in a separate thread that can be stopped and show progress dialog + * Clear history action and history popup menu item + * Allow factorization print option (for (3/4*(x+1))/(y+1)) + * Fix cancel command called from popup menu (using QTimer::singleShot()) + +2005-11-19 Niklas Knutsson + + * Do not display colon when argument description is empty + +2005-11-17 Niklas Knutsson + + * Simplify menu item + * Algebraic mode -- simplify, factorize, or none + +2005-11-07 Niklas Knutsson + + * Do not remove white spaces from expression history + * Do not add plot expression with only white space + * Do not automatically add plot expression when applying appearance or function range + +2005-11-06 Niklas Knutsson + + * Fix completion with or after unicode signs + +2005-11-05 Niklas Knutsson + + * Fix parenthesis for division in division + +2005-11-04 Niklas Knutsson + + * Fix compilation with --enable-final + +2005-11-01 Niklas Knutsson + + * History enhancements + +2005-10-31 Niklas Knutsson + + * Remove word wrap in result display + * Fix scaling (font size were replaced in the wrong order) + * Polishing + +2005-10-30 Niklas Knutsson + + * Finish documentation updates + * Completion fixes + +2005-10-29 Niklas Knutsson + + * Update parse status display of to unit expression and parse display in history + * Nicer history display with separating horizontal lines and italic parsed expression + +2005-10-28 Niklas Knutsson + + * Update documentation + * Use option to reduce transformation when parsing and print formating for parse status + * Update recalculation behaviour on mode change + * Support for binary and other prefixes + +2005-10-26 Niklas Knutsson + + * Add unit selector to convert to unit dialog + * Update Swedish translation + * Fix window height with menubar in window by making the minimum window size equal to the one line menubar width + * Reduce result display size on startup and expand history on resize + * Fix display of long parsed expression + +2005-10-25 Niklas Knutsson + + * Completion fixes and enhancements + * Match against Calculator's item lists directly instead of passing names to KCompletion + * Completion for all names + * Disable completion for disabled object types (functions, variables and units) + * Show alternative names in cursive style after default in completion list + * Make suffixes in completion list smaller + * Option to disable completion + * Remove details buttons from variable edit dialog and instead hide value entry, + exact button and names details in variable edit dialog in store mode + * Use variables edit dialog also for storing matrix/vector results + * Fill in forgotten new data set function (for File->New->Data Set) + +2005-10-24 Niklas Knutsson + + * Fix for QT_NO_STL + * Tweak layout and show functions button again, with italic f(x) + * Remove automatic accelerators from buttons in main window + * Remove mod button and move f(x) button to keypad + * Add option to enable/disable icon buttons + * Add apply button to preferences dialog + +2005-10-23 Niklas Knutsson + + * QalculateButton class for smaller buttons and markup + * GUI redesign along the lines of redesigned the GTK+ GUI + * Fix tab order and use lower case letters for function buttons + * Use text instead of pixmaps for top-right buttons if not icons on buttons KDE option is turned on + * Polishing + +2005-10-20 Niklas Knutsson + + * had_warnings_before = had_errors => had_warnings_before = had_warnings + * Configuration of status warning and error colors + * Split settings dialog in two tabs + +2005-10-19 Niklas Knutsson + + * Ability to save different modes + * Update documentation + * Fix as-you-type function hints when unlimited number of arguments + * Increase max value length in variables dialog + * Font selection for status label + * Choice to disable as-you-type expression status + +2005-10-18 Niklas Knutsson + + * Fix as-you-type parsing with " to " in expression + * Display as-you-type parsing with warnings in blue + +2005-10-17 Niklas Knutsson + + * Display parsing and function hints under the expression entry to the left + * Fix recovery of expression after closed completion list + +2005-10-11 Niklas Knutsson + + * Change alignment in entries in convert number bases dialog + +2005-09-30 Niklas Knutsson + + * Fix round halfway numbers to even menu item + +2005-09-25 Niklas Knutsson + + * Also process operators entered with keypad (ButtonState) + * Default to no system tray icon + +2005-06-16 Niklas Knutsson + + * System tray icon and close to system tray option + +2005-06-10 Niklas Knutsson + + * Add glib-2.0 and libxml-2.0 to PKG_CHECK_MODULES + * Display prefix in object info + * Check that prefix name can be displayed + * Right align equals label in units dialog + * Confirm overwriting result and plot image files + * Use KIO instead of wget for fetching exchange rates + * Close gnuplot and disable save button when no series defined + * Compile with kdelibs < 3.4 + * Compile with Qt 3.1 and 3.2 + +2005-06-09 Niklas Knutsson + + * Use KLineEdit's popup menu and disable completion menu by temporarily setting the completion object to NULL + * Enable click-to-focus for result display + * Focus expression entry on most key events + * Focus expression entry on set result + * Act also on base combo activated + * Do not open matrix result twice + * Set close button default and focus in result matrix/vector dialog + * Insert selection button in matrix/vector dialog + * Use number base for expression parsing when printing parsed expression + * Add "No Prefix" to set prefix menu + * Support for "e" instead of "E" in result + * Enhance progress dialogs + +2005-06-08 Niklas Knutsson + + * Combo box simple numerical display activated normal display + * Do not cover function arguments by function anchor to avoid formatting problems + * Display correct equals in history on updated display format + * Add space also around SIGN_DIVISION_SLASH as it seems to look best for most fonts (except Bitstream Cyberbit) + * Use the QalculateExpressionEdit widget in the plot dialog + * Place reference to MathStructure in anchor instead of object name + * Add show parsed expression and show object info to result display context menu + * Insert matrix/vector dialog from menu and result display + * Double click action in result display + * Matrix and vector buttons in insert function dialog + * Open selected expression in insert matrix/vector dialog + +2005-06-07 Niklas Knutsson + + * Hide completion when expression is empty + * Handle input keys ^+digit as "^"+digit + * Handle input keys ^+0 as degree sign + * Update screenshots in documentation + * Convert button behaviour should depend on keyboard focus + * Let return/enter activate convert instead of a default button + +2005-06-06 Niklas Knutsson + + * Do not recreate the division line image every time + * Add web address to about data and change bug address + +2005-06-05 Niklas Knutsson + + * Disable list view sorting correctly + * Set name in argument edit dialog + * Align yes/no columns center + * Add list items add the end of the list to get the right order + * Add tooltips + * There is really no reason to untoggle hyp and inv automatically + * Use qalculate_kde instead of qalculate-kde for everything but the binary to please kde + * Reload also recent composite units and getActive... + * Result display is more efficient than in qalculate-gtk so no need for "result is too long" + * Do not put extra space a the top of result is more than one row + * Bitwise NOT (~) + * xor() and bitXor() + +2005-06-04 Niklas Knutsson + + * Update base menu when opening other base dialog even when the spinbox value equals the current base + * Base and numeric mode combo boxes should not be editable + * Make set other base non-radio action and use listBox()->selected() for + base in keypad to get signal on reselection of other base + * Put object creation in slotOk() instead of using exec() in a loop + +2005-06-03 Niklas Knutsson + + * Assume that QT does not have STL support -- always use c_str() and ascii() + * Bitwise AND (&), OR (|), XOR + * Remove old giac stuff + * Use KUniqueApplication + * Shift GUI vertical orientation and increase right display margin + * stripWhiteSpace() returns a new string! + +2005-06-02 Niklas Knutsson + + * Clean up plot dialog on finished() instead of hidden() + * Try to align the result vertically more in the middle + * Display ampersands in menus for categorys and titles + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..02a4a07 --- /dev/null +++ b/INSTALL @@ -0,0 +1,167 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..8a2284f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,22 @@ +SUBDIRS = $(TOPSUBDIRS) + +$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; + +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 + +MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files + +package-messages: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common package-messages + $(MAKE) -C po merge + +EXTRA_DIST = admin COPYING configure.in.in + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs diff --git a/Makefile.cvs b/Makefile.cvs new file mode 100644 index 0000000..4c0afd1 --- /dev/null +++ b/Makefile.cvs @@ -0,0 +1,10 @@ +all: + @echo "This Makefile is only for the CVS repository" + @echo "This will be deleted before making the distribution" + @echo "" + $(MAKE) -f admin/Makefile.common cvs + +dist: + $(MAKE) -f admin/Makefile.common dist + +.SILENT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/TODO b/TODO new file mode 100644 index 0000000..e69de29 diff --git a/configure.in.in b/configure.in.in new file mode 100644 index 0000000..e44a80c --- /dev/null +++ b/configure.in.in @@ -0,0 +1,20 @@ +#MIN_CONFIG(3.1.0) + +AM_INIT_AUTOMAKE(qalculate_kde, 0.9.7) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"]) + +AC_LANG([C++]) + +PKG_CHECK_MODULES(QALCULATE, [ + libqalculate >= 0.9.7 + ]) +AC_SUBST(QALCULATE_CFLAGS) +AC_SUBST(QALCULATE_LIBS) + +LIBS="$LIBS $QALCULATE_LIBS" +CFLAGS="$CFLAGS $QALCULATE_CFLAGS" +CPPFLAGS="$CPPFLAGS $QALCULATE_CFLAGS" +CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS" diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..b2f80e3 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,4 @@ +# the SUBDIRS is filled automatically by am_edit. If files are +# in this directory they are installed into the english dir + +SUBDIRS = en diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am new file mode 100644 index 0000000..d7d3706 --- /dev/null +++ b/doc/en/Makefile.am @@ -0,0 +1,4 @@ +# the SUBDIRS is filled automatically by am_edit. If files are +# in this directory they are installed into the english dir + +SUBDIRS = qalculate_kde diff --git a/doc/en/qalculate_kde/Makefile.am b/doc/en/qalculate_kde/Makefile.am new file mode 100644 index 0000000..e97402c --- /dev/null +++ b/doc/en/qalculate_kde/Makefile.am @@ -0,0 +1,2 @@ +KDE_DOCS = AUTO +KDE_LANG = en diff --git a/doc/en/qalculate_kde/calculation-history.png b/doc/en/qalculate_kde/calculation-history.png new file mode 100644 index 0000000..976cc59 Binary files /dev/null and b/doc/en/qalculate_kde/calculation-history.png differ diff --git a/doc/en/qalculate_kde/calculator-buttons.png b/doc/en/qalculate_kde/calculator-buttons.png new file mode 100644 index 0000000..81b6f74 Binary files /dev/null and b/doc/en/qalculate_kde/calculator-buttons.png differ diff --git a/doc/en/qalculate_kde/completion.png b/doc/en/qalculate_kde/completion.png new file mode 100644 index 0000000..38d4a0b Binary files /dev/null and b/doc/en/qalculate_kde/completion.png differ diff --git a/doc/en/qalculate_kde/convert-number-bases.png b/doc/en/qalculate_kde/convert-number-bases.png new file mode 100644 index 0000000..6a72102 Binary files /dev/null and b/doc/en/qalculate_kde/convert-number-bases.png differ diff --git a/doc/en/qalculate_kde/convert-unit.png b/doc/en/qalculate_kde/convert-unit.png new file mode 100644 index 0000000..c341f9a Binary files /dev/null and b/doc/en/qalculate_kde/convert-unit.png differ diff --git a/doc/en/qalculate_kde/edit-function.png b/doc/en/qalculate_kde/edit-function.png new file mode 100644 index 0000000..5e017e6 Binary files /dev/null and b/doc/en/qalculate_kde/edit-function.png differ diff --git a/doc/en/qalculate_kde/edit-matrix.png b/doc/en/qalculate_kde/edit-matrix.png new file mode 100644 index 0000000..a8277f5 Binary files /dev/null and b/doc/en/qalculate_kde/edit-matrix.png differ diff --git a/doc/en/qalculate_kde/edit-unit.png b/doc/en/qalculate_kde/edit-unit.png new file mode 100644 index 0000000..823d771 Binary files /dev/null and b/doc/en/qalculate_kde/edit-unit.png differ diff --git a/doc/en/qalculate_kde/edit-variable.png b/doc/en/qalculate_kde/edit-variable.png new file mode 100644 index 0000000..80fbe5a Binary files /dev/null and b/doc/en/qalculate_kde/edit-variable.png differ diff --git a/doc/en/qalculate_kde/function-manager.png b/doc/en/qalculate_kde/function-manager.png new file mode 100644 index 0000000..ab64676 Binary files /dev/null and b/doc/en/qalculate_kde/function-manager.png differ diff --git a/doc/en/qalculate_kde/functions.docbook b/doc/en/qalculate_kde/functions.docbook new file mode 100644 index 0000000..777fa4e --- /dev/null +++ b/doc/en/qalculate_kde/functions.docbook @@ -0,0 +1,3570 @@ + +Function List + +Algebra + + +Find Linear Function + +linearfunction(x1, y1, x2, y2) +Finds the linear function for the straight line between two distinct points. + +Arguments +x1: a free value +y1: a free value +x2: a free value +y2: a free value + + + + + +Product + +product(Factor expression, Lower limit (i), Upper limit (n)[, Index variable]) +ΠCorresponds to the product symbol. Multiplies factors for each x ranging from the lower to the upper limit. + +Arguments +Factor expression: a free value +Lower limit (i): an integer +Upper limit (n): an integer +Index variable: an unknown variable/symbol (optional, default: x) + + + +Requirement +"Upper limit (n)" >= "Lower limit (i)" + + + + + +Solve equation + +solve(Equation[, With respect to]) + +Arguments +Equation: a free value +With respect to: an unknown variable/symbol (optional, default: x) + + + + + +Solve for multiple variables + +multisolve(Equation vector, Variable vector) + +Arguments +Equation vector: a vector +Variable vector: a vector with an unknown variable/symbol, ... + + + +Requirement +dimension("Equation vector")=dimension("Variable vector") + + + + + +Solve for two variables + +solve2(Equation 1, Equation 2[, Variable 1][, Variable 2]) +Solves two equations with two unknown variables. Returns the value of the first variable. + +Arguments +Equation 1: a free value +Equation 2: a free value +Variable 1: an unknown variable/symbol (optional, default: x) +Variable 2: an unknown variable/symbol (optional, default: y) + + + + + +Sum + +sum(Term expression, Lower limit (i), Upper limit (n)[, Index variable]) +ΣCorresponds to the sum symbol. Adds terms for each x ranging from the lower to the upper limit. + +Arguments +Term expression: a free value +Lower limit (i): an integer +Upper limit (n): an integer +Index variable: an unknown variable/symbol (optional, default: x) + + + +Requirement +"Upper limit (n)" >= "Lower limit (i)" + + + + + + + +Analysis + + +Beta Function + +beta(argument 1, argument 2) + +Arguments +1: an integer +2: an integer + + + + + +Gamma Function + +gamma(argument 1) + +Arguments +1: a number + + + + + +Imaginary Part + +im(Complex number) + +Arguments +Complex number: a number + + + + + +Real Part + +re(Complex number) + +Arguments +Complex number: a number + + + + + + + +Calculus + + +Derive + +diff(Function[, With respect to][, Order]) + +Arguments +Function: a free value +With respect to: an unknown variable/symbol (optional, default: x) +Order: an integer >= 1 (optional, default: 1) + + + + + +Extreme Values + +extremum(Function[, With respect to]) + +Arguments +Function: a free value +With respect to: an unknown variable/symbol (optional, default: x) + + + + + +Integrate + +integrate(Function[, Variable of integration][, Lower limit][, Upper limit]) + +Arguments +Function: a free value +Variable of integration: an unknown variable/symbol (optional, default: x) +Lower limit: a free value (optional, default: undefined) +Upper limit: a free value (optional, default: undefined) + + + + + + + +Combinatorics + + +Binomial Coefficient + +binomial(Exponent, Index) + +Arguments +Exponent: an integer >= 1 +Index: an integer >= 0 + + + +Requirement +"Exponent">="Index" + + + + + +Combinations + +comb(Objects, Size) +Returns the number of possible arrangements of an unordered list with a number of objects to choose from and a list size. If there are three objects (1, 2 and 3) that is put in a list with place for two, the alternatives are [1, 2], [1, 3], and [2, 3], and thus the number of combinations is 3. + +Arguments +Objects: a free value +Size: a free value + + + + + +Derangements + +derangements(Number of elements) +Returns the number of possible rearrangements of an ordered list, of a certain size, where none of the objects are on their original position. If the original list is [1, 2, 3], the possible derangements is [2, 3, 1] and [3, 1, 2], and thus the number of derangements is 2. + +Arguments +Number of elements: an integer >= 1 + + + + + +Double Factorial + +factorial2(Value) +Calculates the doublefactorial of an integer. Mulitplies the argument with every second lesser positive integer (n(n-2)(n-4)...). Can also be entered as a number followed by two exclamation marks.ex. factorial2(5) = 5!! = 5 * 3 * 1 = 15 + +Arguments +Value: an integer >= -1 + + + + + +Factorial + +factorial(Value) +Calculates the factorial of an integer. Mulitplies the argument with every lesser positive integer (n(n-1)(n-2)...2*1). Can also be entered as a number followed by one exclamation mark.ex. factorial(5) = 5! = 5 * 4 * 3 * 2 * 1 = 120 + +Arguments +Value: an integer + + + + + +Hyperfactorial + +hyperfactorial(Value) +Calculates the hyperfactorial of an integer. Mulitplies the argument raised by itself with every lesser positive integer raised by themselves (1^1 * 2^2 ... n^n). ex. hyperfactorial(3) = (3^3) * (2^2) * (1^1) = 108 + +Arguments +Value: an integer >= 1 + + + + + +Multifactorial + +multifactorial(Value, Factorial) +Calculates the multifactorial of an integer. Mulitplies the argument with every x lesser positive integer (n(n-x)(n-2x)...). Can also be entered as a number followed by three or more exclamation marks.ex. multifactorial(18, 4) = 18!!!! = 18 * 14 * 10 * 6 * 2 = 30 240 + +Arguments +Value: an integer >= 0 +Factorial: an integer >= 1 + + + + + +Permutations + +perm(Objects, Size) +Returns the number of possible arrangements of an ordered list with a number of objects to choose from and a list size. If there are three objects (1, 2 and 3) that is put in a list with two positions, the alternatives are [1, 2], [2, 1], [1, 3], [3, 1], [2, 3] and [3, 2], and thus the number of permutations is 6. + +Arguments +Objects: a free value +Size: a free value + + + + + +Superfactorial + +superfactorial(Value) +Calculates the superfactorial of an integer. Mulitplies the factorial of the argument with the factorial of every lesser positive integer (1! * 2! ... n!). ex. superfactorial(5) = 5! * 4! * 3! * 2! * 1! = 34 560 + +Arguments +Value: an integer >= 0 + + + + + + + +Data Sets + + +Elements + +atom(Element[, Property]) +Retrieves data from the Elements data set for a given object and property. If "info" is typed as property, all properties of the object will be listed. +Arguments +Element: an object from "Elements" (use symbol, number, or name) +Property: name of a data property (symbol, number, name, class, or weight) (optional, default: info) + + + +Properties +Symbol: symbol (key) +Number: number (key) +Name: name (key) +Classification: classA number representing an element group:1 Alkali Metal2 Alkaline-Earth Metal3 Lanthanide4 Actinide5 Transition Metal6 Metal7 Metalloid8 Non-Metal9 Halogen10 Noble Gas11 Transactinide +Weight: weight, mass + + + + + +Planets + +planet(Planet[, Property]) +Retrieves data from the Planets data set for a given object and property. If "info" is typed as property, all properties of the object will be listed.This data uses material from the Wikipedia articles"Earth" (http://www.wikipedia.org/wiki/Earth),"Jupiter (planet)" (http://www.wikipedia.org/wiki/Jupiter_(planet)),"Mars (planet)" (http://www.wikipedia.org/wiki/Mars_(planet)),"Mercury (planet)" (http://www.wikipedia.org/wiki/Mercury_(planet)),"Neptune (planet)" (http://www.wikipedia.org/wiki/Neptune_(planet)),"Pluto (planet)" (http://www.wikipedia.org/wiki/Pluto_(planet)),"Saturn (planet)" (http://www.wikipedia.org/wiki/Saturn_(planet)),"Uranus (planet)" (http://www.wikipedia.org/wiki/Uranus_(planet)), and"Venus (planet)" (http://en.wikipedia.org/wiki/Venus_(planet)),licensed under the GNU Free Documentation License (http://www.gnu.org/copyleft/fdl.html) + +Arguments +Planet: an object from "Planets" (use name) +Property: name of a data property (name, year, speed, eccentricity, inclination, satellites, mass, density, area, gravity, or temperature) (optional, default: info) + + + +Properties +Name: name (key) +Orbital Period (Year): year +Average Orbital Speed: speed +Eccentricity: eccentricity +Inclination: inclination +Number of Satellites: satellites +Mass: mass +Mean Density: density +Surface Area: area +Equatorial Gravity: gravity +Mean Surface Temperature: temperature + + + + + + + +Date & Time + + +Current Time + +time() + + + +Date to Unix Timestamp + +timestamp([Date]) + +Arguments +Date: a date (optional, default: now) + + + + + +Day of Month + +day([Date]) + +Arguments +Date: a date (optional, default: today) + + + + + +Day of Week + +weekday([Date][, Week begins on Sunday]) + +Arguments +Date: a date (optional, default: today) +Week begins on Sunday: a boolean (0 or 1) (optional, default: 0) + + + + + +Day of Year + +yearday([Date]) + +Arguments +Date: a date (optional, default: today) + + + + + +Days between two dates + +days(First date, Second date[, Day counting basis][, Financial function mode]) +Returns the number of days between two dates.Basis is the type of day counting you want to use: 0: US 30/360, 1: real days (default), 2: real days/360, 3: real days/365 or 4: European 30/360. + +Arguments +First date: a date +Second date: a date +Day counting basis: an integer >= 0 and <= 4 (optional, default: 1) +Financial function mode: a boolean (0 or 1) (optional, default: 0) + + + + + +Local Date Format + +localdate([Date]) + +Arguments +Date: a date (optional, default: today) + + + + + +Month + +month([Date]) + +Arguments +Date: a date (optional, default: today) + + + + + +Standard Date Format + +isodate([Date]) + +Arguments +Date: a date (optional, default: today) + + + + + +Unix Timestamp to Date + +stamptodate(Timestamp) + +Arguments +Timestamp: an integer + + + + + +Week of Year + +week([Date][, Week begins on Sunday]) + +Arguments +Date: a date (optional, default: today) +Week begins on Sunday: a boolean (0 or 1) (optional, default: 0) + + + + + +Year + +year([Date]) + +Arguments +Date: a date (optional, default: today) + + + + + +Years between two dates + +yearfrac(First date, Second date[, Day counting basis][, Financial function mode]) +Returns the number of years (fractional) between two dates.Basis is the type of day counting you want to use: 0: US 30/360, 1: real days (default), 2: real days/360, 3: real days/365 or 4: European 30/360. + +Arguments +First date: a date +Second date: a date +Day counting basis: an integer >= 0 and <= 4 (optional, default: 1) +Financial function mode: a boolean (0 or 1) (optional, default: 0) + + + + + + + +Economics + +Finance + + +Accrued interest of security paying at maturity + +accrintm(Issue date, Settlement date, Annual rate of security[, Par value][, Day counting basis]) +Returns the accrued interest for a security which pays interest at maturity date.Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360. + +Arguments +Issue date: a date +Settlement date: a date +Annual rate of security: a free value +Par value: a free value (optional, default: 1000) +Day counting basis: an integer >= 0 and <= 4 (optional, default: 0) + + + + + +Accrued interest of security with periodic interest payments + +accrint(Issue date, First interest, Settlement date, Annual rate of security, Par value, Frequency[, Day counting basis]) +Returns accrued interest for a security which pays periodic interest.Allowed frequencies are 1 - annual, 2 - semi-annual or 4 - quarterly. Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360. + +Arguments +Issue date: a date +First interest: a date +Settlement date: a date +Annual rate of security: a free value +Par value: a free value +Frequency: an integer >= 1 and <= 4 +Day counting basis: an integer >= 0 and <= 4 (optional, default: 0) + + + + + +Amount received at maturity for a security bond + +received(Settlement date, Maturity date, Investment, Discount rate[, Day counting basis]) +Returns the amount received at the maturity date for an invested security.Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360. The settlement date must be before maturity date. + +Arguments +Settlement date: a date +Maturity date: a date +Investment: a free value +Discount rate: a free value +Day counting basis: an integer >= 0 and <= 4 (optional, default: 0) + + + + + +Compound + +compound(Principal, Nominal interest rate, Periods per year, Years) +Returns the value of an investment, given the principal, nominal interest rate, compounding frequency and time. + +Arguments +Principal: a free value +Nominal interest rate: a free value +Periods per year: a free value +Years: a free value + + + + + +Discount rate for a security + +disc(Settlement date, Maturity date, Price per $100 face value, Redemption[, Day counting basis]) +Returns the discount rate for a security.Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360. + +Arguments +Settlement date: a date +Maturity date: a date +Price per $100 face value: a free value +Redemption: a free value +Day counting basis: an integer >= 0 and <= 4 (optional, default: 0) + + + + + +Dollar Decimal + +dollarde(Fractional dollar, Denominator of fraction) +Converts a dollar price expressed as a fraction into a dollar price expressed as a decimal number. + +Arguments +Fractional dollar: a free value +Denominator of fraction: an integer >= 1 + + + + + +Dollar Fraction + +dollarfr(Decimal dollar, Denominator of fraction) +Converts a decimal dollar price into a dollar price expressed as a fraction. + +Arguments +Decimal dollar: a free value +Denominator of fraction: an integer >= 1 + + + + + +Effective Interest Rate + +effect(Nominal interest rate, Periods) +Calculates the effective interest for a given nominal rate. + +Arguments +Nominal interest rate: a free value +Periods: a free value + + + + + +Future Value + +fv(Interest rate, Number of periods, Payment made each period[, Present value][, Type]) +Computes the future value of an investment. This is based on periodic, constant payments and a constant interest rate.If type = 1 then the payment is made at the beginning of the period, If type = 0 (or omitted) it is made at the end of each period. + +Arguments +Interest rate: a free value +Number of periods: a free value +Payment made each period: a free value +Present value: a free value (optional, default: 0) +Type: a boolean (0 or 1) (optional, default: 0) + + + + + +Interest paid on a given period of an investment (ISPMT) + +ispmt(Periodic interest rate, Amortizement period, Number of periods, Present value) +Calculates the interest paid on a given period of an investment. + +Arguments +Periodic interest rate: a free value +Amortizement period: an integer >= 1 +Number of periods: an integer >= 1 +Present value: a free value + + + + + +Interest rate for a fully invested security + +intrate(Settlement date, Maturity date, Investment, Redemption[, Day counting basis]) +Returns the interest rate for a fully invested security.Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360. + +Arguments +Settlement date: a date +Maturity date: a date +Investment: a free value +Redemption: a free value +Day counting basis: an integer >= 0 and <= 4 (optional, default: 0) + + + + + +Level-Coupon Bond + +level_coupon(Face value, Coupon rate, Coupons per year, Years, Market interest rate) +Calculates the value of a level-coupon bond. + +Arguments +Face value: a free value +Coupon rate: a free value +Coupons per year: a free value +Years: a free value +Market interest rate: a free value + + + + + +Nominal Interest Rate + +nominal(Effective interest rate, Periods) +Calculates the nominal interest rate from a given effective interest rate compounded at given intervals. + +Arguments +Effective interest rate: a free value +Periods: a free value + + + + + +Number of coupons to be paid + +coupnum(Settlement date, Maturity date, Frequency[, Day counting basis]) +Returns the number of coupons to be paid between the settlement and the maturity.Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360. + +Arguments +Settlement date: a date +Maturity date: a date +Frequency: an integer >= 1 and <= 12 +Day counting basis: an integer >= 0 and <= 4 (optional, default: 0) + + + + + +Payment for a loan + +pmt(Rate, Number of periods, Present value[, Future value][, Type]) +Returns the amount of payment for a loan based on a constant interest rate and constant payments (each payment is equal amount).If type = 1 then the payment is made at the beginning of the period, If type = 0 (or omitted) it is made at the end of each period. + +Arguments +Rate: a free value +Number of periods: a free value +Present value: a free value +Future value: a free value (optional, default: 0) +Type: a boolean (0 or 1) (optional, default: 0) + + + + + +Payment of an annuity going towards interest (IPMT) + +ipmt(Periodic interest rate, Period, Number of periods, Present value[, Future value][, Type]) +Calculates the amount of a payment of an annuity going towards interest.Type defines the due date. 1 for payment at the beginning of a period and 0 (default) for payment at the end of a period. + +Arguments +Periodic interest rate: a free value +Period: an integer >= 1 +Number of periods: an integer >= 1 +Present value: a free value +Future value: a free value (optional, default: 0) +Type: a boolean (0 or 1) (optional, default: 0) + + + + + +Payment of an annuity going towards principal (PPMT) + +ppmt(Periodic interest rate, Amortizement period, Number of periods, Present value[, Desired future value][, Type]) +Calculates the amount of a payment of an annuity going towards principal.Type defines the due date. 1 for payment at the beginning of a period and 0 (default) for payment at the end of a period. + +Arguments +Periodic interest rate: a free value +Amortizement period: an integer >= 1 +Number of periods: an integer >= 1 +Present value: a free value +Desired future value: a free value (optional, default: 0) +Type: a boolean (0 or 1) (optional, default: 0) + + + + + +Periods for investment to attain desired value + +g_duration(Rate, Present value, Future value) +Returns the number of periods needed for an investment to attain a desired value. + +Arguments +Rate: a free value +Present value: a free value +Future value: a free value + + + + + +Periods of an investment + +nper(Interest rate, Payment made each period, Present value[, Future value][, Type]) +Calculates number of periods of an investment based on periodic constant payments and a constant interest rate.Type defines the due date. 1 for payment at the beginning of a period and 0 (default) for payment at the end of a period. + +Arguments +Interest rate: a free value +Payment made each period: a free value +Present value: a free value +Future value: a free value (optional, default: 0) +Type: a free value (optional, default: 0) + + + + + +Present Value + +pv(Interest rate, Number of periods, Payment made each period[, Future value][, Type]) +Returns the present value of an investment.If type = 1 then the payment is made at the beginning of the period, If type = 0 (or omitted) it is made at the end of each period. + +Arguments +Interest rate: a free value +Number of periods: a free value +Payment made each period: a free value +Future value: a free value (optional, default: 0) +Type: a boolean (0 or 1) (optional, default: 0) + + + + + +Price per $100 face value of a security + +pricemat(Settlement date, Maturity date, Issue date, Discount rate, Annual yield[, Day counting basis]) +Calculates and returns the price per $100 face value of a security. The security pays interest at maturity.Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360. + +Arguments +Settlement date: a date +Maturity date: a date +Issue date: a date +Discount rate: a free value +Annual yield: a free value +Day counting basis: an integer >= 0 and <= 4 (optional, default: 0) + + + + + +Price per $100 face value of a security bond + +pricedisc(Settlement date, Maturity date, Discount, Redemption[, Day counting basis]) +Calculates and returns the price per $100 face value of a security bond. The security does not pay interest at maturity.Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360. + +Arguments +Settlement date: a date +Maturity date: a date +Discount: a free value +Redemption: a free value +Day counting basis: an integer >= 0 and <= 4 (optional, default: 0) + + + + + +Return on continuously compounded interest + +continuous(Principal, Interest rate, Years) +Calculates the return on continuously compounded interest, given the principal, nominal rate and time in years. + +Arguments +Principal: a free value +Interest rate: a free value +Years: a free value + + + + + +Straight Line Depreciation + +sln(Cost, Salvage value, Life) +Determines the straight line depreciation of an asset for a single period.Cost is the amount you paid for the asset. Salvage is the value of the asset at the end of the period. Life is the number of periods over which the asset is depreciated. SLN divides the cost evenly over the life of an asset. + +Arguments +Cost: a free value +Salvage value: a free value +Life: a free value + + + + + +Sum-of-Years Digits Depreciation + +syd(Cost, Salvage value, Life, Period) +Calculates the sum-of-years digits depreciation for an asset based on its cost, salvage value, anticipated life, and a particular period. This method accelerates the rate of the depreciation, so that more depreciation expense occurs in earlier periods than in later ones. The depreciable cost is the actual cost minus the salvage value. The useful life is the number of periods (typically years) over which the asset is depreciated. + +Arguments +Cost: a free value +Salvage value: a free value +Life: a free value +Period: a free value + + + + + +Treasury Bill Equivalent + +tbilleq(Settlement date, Maturity date, Discount rate) +Returns the bond equivalent for a treasury bill. + +Arguments +Settlement date: a date +Maturity date: a date +Discount rate: a free value + + + + + +Treasury Bill Price + +tbillprice(Settlement date, Maturity date, Discount rate) +Returns the price per $100 value for a treasury bill. + +Arguments +Settlement date: a date +Maturity date: a date +Discount rate: a free value + + + + + +Treasury Bill Yield + +tbillyield(Settlement date, Maturity date, Price per $100 face value) +Returns the yield for a treasury bill. + +Arguments +Settlement date: a date +Maturity date: a date +Price per $100 face value: a free value + + + + + +Zero Coupon + +zero_coupon(Face value, Interest rate, Years) +Calculates the value of a zero-coupon (pure discount) bond. + +Arguments +Face value: a free value +Interest rate: a free value +Years: a free value + + + + + + + +Microeconomics + + +Elasticity + +elasticity(Demand function, Price[, Price variable]) +Calculates the demand elesticity. Also works for supply elasticity, income elasticity, cross-price elasticity, etc. Just replace demand, with supply, or price with income...Ex. elasticity(100-x^2, 3) calculates the demand elasticity when the price is 3 for the function "Q = 100 - x^2" where x is the default price variable. + +Arguments +Demand function: a free value +Price: a free value +Price variable: an unknown variable/symbol (optional, default: x) + + + + + + + + +Exponents & Logarithms + + +10 raised the to power X + +exp10(Exponent) + +Arguments +Exponent: a free value + + + + + +2 raised the to power X + +exp2(Exponent) + +Arguments +Exponent: a free value + + + + + +Base-10 Logrithm + +log10(Value) +Returns the base n logarithm. + +Arguments +Value: a number >= 0 + + + + + +Base-2 Logrithm + +log2(Value) +Returns the base n logarithm. + +Arguments +Value: a number >= 0 + + + + + +Base-N Logarithm + +log(Value[, Base]) + +Arguments +Value: a number that is nonzero +Base: a number that is nonzero (optional, default: e) + + + + + +Complex Exponential (Cis) + +cis(Exponent) + +Arguments +Exponent: a free value + + + + + +Cube Root + +cbrt(Value) + +Arguments +Value: a free value + + + + + +Exponential (e^x) + +exp(Exponent) + +Arguments +Exponent: a free value + + + + + +Natural Logarithm + +ln(Value) + +Arguments +Value: a number that is nonzero + + + + + +Nth root + +root(Base, Exponent) + +Arguments +Base: a free value +Exponent: a free value + + + + + +Square + +sq(Value) + +Arguments +Value: a free value + + + + + +Square Root + +sqrt(Value) + +Arguments +Value: a free value + + + + + +Square root (x * pi) + +sqrtpi(Non-negative value) +Returns the non-negative square root of x * pi + +Arguments +Non-negative value: a number >= 0 + + + + + +X raised to the power Y + +pow(Base, Exponent) + +Arguments +Base: a free value +Exponent: a free value + + + + + + + +Geometry + +Circle + + +Circle Area + +circle(Radius) +Calculates the area of a circle using the radius + +Arguments +Radius: a free value + + + + + +Circle Circumference + +circumference(Radius) +Calculates the area of a circle using the radius + +Arguments +Radius: a free value + + + + + + + +Cone + + +Cone Volume + +cone(Radius, Height) + +Arguments +Radius: a free value +Height: a free value + + + + + +Surface Area of Cone + +cone_sa(Radius, Height) + +Arguments +Radius: a free value +Height: a free value + + + + + + + +Cube + + +Cube Volume + +cube(Length of side) + +Arguments +Length of side: a free value + + + + + +Surface Area of Cube + +cube_sa(Length of side) + +Arguments +Length of side: a free value + + + + + + + +Cylinder + + +Cylinder Volume + +cylinder(Radius, Height) + +Arguments +Radius: a free value +Height: a free value + + + + + +Surface Area of Cylinder + +cylinder_sa(Radius, Height) + +Arguments +Radius: a free value +Height: a free value + + + + + + + +Parallelogram + + +Parallelogram Area + +parallelogram(Base, Height) +Calculates the area of a four-sided figure whose opposite sides are both parallel and equal in length. + +Arguments +Base: a free value +Height: a free value + + + + + +Parallelogram Perimeter + +parallelogram_perimeter(Side A, Side B) +Calculates the perimeter of a four-sided figure whose opposite sides are both parallel and equal in length. + +Arguments +Side A: a free value +Side B: a free value + + + + + + + +Prism + + +Surface Area of Rectangular Prism + +rectprism_sa(Length, Width, Height) +Calculates the surface area of a prism with rectangular base. + +Arguments +Length: a free value +Width: a free value +Height: a free value + + + + + +Volume of Rectangular Prism + +rectprism(Length, Width, Height) +Calculates the volume of a prism with rectangular base. + +Arguments +Length: a free value +Width: a free value +Height: a free value + + + + + +Volume of Triangular Prism + +triangleprism(Length, Width, Height) +Calculates the volume of a prism with triangular base. + +Arguments +Length: a free value +Width: a free value +Height: a free value + + + + + + + +Pyramid + + +Height of Regular Tetrahedron + +tetrahedron_height(Length of side) + +Arguments +Length of side: a free value + + + + + +Height of Square Pyramid + +sqpyramid_height(Length of side) + +Arguments +Length of side: a free value + + + + + +Pyramid Volume + +pyramid(Length of base, Width of base, Height) +Calculates the volume of a 3-dimensional shape standing on a rectangular base and terminating in a point at the top. + +Arguments +Length of base: a free value +Width of base: a free value +Height: a free value + + + + + +Surface Area of Regular Tetrahedron + +tetrahedron_sa(Length of side) + +Arguments +Length of side: a free value + + + + + +Surface Area of Square Pyramid + +sqpyramid_sa(Length of side) + +Arguments +Length of side: a free value + + + + + +Volume of Regular Tetrahedron + +tetrahedron(Length of side) + +Arguments +Length of side: a free value + + + + + +Volume of Square Pyramid + +sqpyramid(Length of side) + +Arguments +Length of side: a free value + + + + + + + +Rectangle + + +Rectangle Area + +rect(Length, Width) + +Arguments +Length: a free value +Width: a free value + + + + + +Rectangle Perimeter + +rect_perimeter(Length, Width) + +Arguments +Length: a free value +Width: a free value + + + + + + + +Sphere + + +Sphere Volume + +sphere(Radius) + +Arguments +Radius: a free value + + + + + +Surface Area of Sphere + +sphere_sa(Radius) + +Arguments +Radius: a free value + + + + + + + +Square + + +Square Area + +square(Length of side) + +Arguments +Length of side: a free value + + + + + +Square Perimeter + +square_perimeter(Length of side) + +Arguments +Length of side: a free value + + + + + + + +Trapezoid + + +Trapezoid Area + +trapezoid(Side A, Side B, Height) +Calculates the area of a four-sided figure with two parallel sides. + +Arguments +Side A: a free value +Side B: a free value +Height: a free value + + + + + + + +Triangle + + +Hypotenuse + +hypot(Side A, Side B) + +Arguments +Side A: a free value +Side B: a free value + + + + + +Triangle Area + +triangle(Base, Height) + +Arguments +Base: a free value +Height: a free value + + + + + +Triangle Perimeter + +triangle_perimeter(Side A, Side B) + +Arguments +Side A: a free value +Side B: a free value + + + + + + + + +Logical + + +Bitwise Exclusive OR + +bitxor(Value 1, Value 2) + +Arguments +Value 1: an integer or a vector +Value 2: an integer or a vector + + + + + +Bitwise Shift + +shift(Number, Bits) + +Arguments +Number: an integer +Bits: an integer + + + + + +For...Do + +for(Initial value of counter, Counter variable, For condition, Counter update function, Initial value, Do function, Value variable) + +Arguments +Initial value of counter: a free value +Counter variable: an unknown variable/symbol +For condition: a free value +Counter update function: a free value +Initial value: a free value +Do function: a free value +Value variable: an unknown variable/symbol + + + + + +If...Then...Else + +if(Condition, Expression if condition is met, Expression if condition is NOT met) +Tests a condition and returns a value depending on the result. + +Arguments +Condition: a real number +Expression if condition is met: a free value +Expression if condition is NOT met: a free value + + + + + +Logical Exclusive OR + +xor(Value 1, Value 2) + +Arguments +Value 1: a free value +Value 2: a free value + + + + + + + +Matrices & Vectors + + +Adjugate (Adjoint) + +adj(Matrix) +Calculates the adjugate or adjoint of a matrix. + +Arguments +Matrix: a square matrix + + + + + +Cofactor + +cofactor(Matrix, Row, Column) +Calculates the cofactor of the element at specified position. + +Arguments +Matrix: a matrix +Row: an integer >= 1 +Column: an integer >= 1 + + + + + +Columns + +columns(Matrix) +Returns the number of columns in a matrix. + +Arguments +Matrix: a matrix + + + + + +Construct Matrix + +matrix(Rows, Columns, Elements) +Returns a matrix with specified dimensions and listed elements. Omitted elements are set to zero. + +Arguments +Rows: an integer >= 1 +Columns: an integer >= 1 +Elements: a vector + + + + + +Construct Vector + +vector([argument 1], ...) +Returns a vector with listed elements. + +Arguments +1: a free value (optional) + + + + + +Convert Matrix to Vector + +matrix2vector(Matrix) +Puts each element of a matrix in vertical order in a vector. + +Arguments +Matrix: a matrix + + + + + +Cross Product + +cross(Vector 1, Vector 2) +Calculates the cross product of a 3-dimensional vector. + +Arguments +Vector 1: a vector that fulfills the condition: "dimension(\x)==3" +Vector 2: a vector that fulfills the condition: "dimension(\x)==3" + + + + + +Determinant + +det(Matrix) +Calculates the determinant of a matrix. + +Arguments +Matrix: a square matrix + + + + + +Dimension + +dimension(Vector) +Returns the number of elements in a vector. + +Arguments +Vector: a vector + + + + + +Element + +element(Matrix/vector, Row/index[, Column]) +Returns the element at specified position in a matrix (row and column) or vector (index). + +Arguments +Matrix/vector: a vector +Row/index: an integer >= 1 +Column: an integer (optional, default: 0) + + + + + +Elements + +elements(Matrix or vector) +Returns the number of elements in a matrix or vector. + +Arguments +Matrix or vector: a vector + + + + + +Export To CSV File + +export(Matrix/vector, Filename[, Separator]) +Exports a matrix to a CSV data file. + +Arguments +Matrix/vector: a vector +Filename: a valid file name +Separator: a text string (optional, default: ,) + + + + + +Extract Column as Vector + +column(Matrix, Column) +Returns a column in a matrix as a vector. + +Arguments +Matrix: a matrix +Column: an integer >= 1 + + + + + +Extract row as vector + +row(Matrix, Row) +Returns a row in a matrix as a vector. + +Arguments +Matrix: a matrix +Row: an integer >= 1 + + + + + +Generate Vector + +genvector(Function, Min, Max, Dimension / Step size[, Variable][, Use step size]) +Returns a vector generated from a function with a variable (default x) running from min to max. The fourth argument is either the requested number of elements if the sixth argument is false (default) or the step between each value of the variable. + +Arguments +Function: a free value +Min: a free value +Max: a free value +Dimension / Step size: a free value +Variable: an unknown variable/symbol (optional, default: x) +Use step size: a boolean (0 or 1) (optional, default: 0) + + + + + +Identity + +identity(Matrix or rows/columns) +Returns the identity matrix of a matrix or with specified number of rows/columns. + +Arguments +Matrix or rows/columns: an integer >= 1 or a square matrix + + + + + +Load CSV File + +load(Filename[, First data row][, Separator]) +Returns a matrix imported from a CSV data file. + +Arguments +Filename: a valid file name +First data row: an integer >= 1 (optional, default: 1) +Separator: a text string (optional, default: ,) + + + + + +Matrix Area + +area(Matrix, Start row, Start column, End row, End column) +Returns a part of a matrix. + +Arguments +Matrix: a matrix +Start row: an integer >= 1 +Start column: an integer >= 1 +End row: an integer >= 1 +End column: an integer >= 1 + + + + + +Matrix Inverse + +inverse(Matrix) +Calculates the inverse of a matrix. The inverse is the matrix that multiplied by the original matrix equals the identity matrix (AB = BA = I). + +Arguments +Matrix: a square matrix + + + + + +Merge Vectors + +mergevectors(Vector 1[, Vector 2], ...) +Returns a vector with the elements from two vectors. + +Arguments +Vector 1: a vector +Vector 2: a vector (optional) + + + + + +Norm (length) + +norm(Vector) +Calculates the norm/length of a vector. + +Arguments +Vector: a vector + + + + + +Permanent + +permanent(Matrix) +Calculates the permanent of a matrix. The permanent differs from a determinant in that all signs in the expansion by minors are taken as positive. + +Arguments +Matrix: a square matrix + + + + + +Rank + +rank(Vector[, Ascending]) +Returns a vector with values of elements replaced with their mutual ranks.ex. rank([6, 1, 4]) = [3, 1, 2] + +Arguments +Vector: a vector +Ascending: a boolean (0 or 1) (optional, default: 1) + + + + + +Rows + +rows(Matrix) +Returns the number of rows in a matrix. + +Arguments +Matrix: a matrix + + + + + +Sort + +sort(Vector[, Ascending]) +Returns a sorted vector.ex. sort([6, 1, 4])=[1, 4, 6] + +Arguments +Vector: a vector +Ascending: a boolean (0 or 1) (optional, default: 1) + + + + + +Transpose + +transpose(Matrix) +Returns the transpose of a matrix. + +Arguments +Matrix: a matrix + + + + + +Vector Limits + +limits(Vector, Lower limit, Upper limit) +Returns a part of a vector between two positions. + +Arguments +Vector: a vector +Lower limit: an integer +Upper limit: an integer + + + + + + + +Miscellaneous + + +Body Mass Index (BMI) + +bmi(Weight, Length) +Calculates the Body Mass Index. The resulting BMI-value is sometimes interpreted as follows (although varies with age, sex, etc.):Underweight < 18.5Normal weight 18.5-25Overweight 25-30Obesity > 30Note that you must use units for weight (ex. 59kg) and length (ex. 174cm). + +Arguments +Weight: a free value +Length: a free value + + + + + +Kronecker Delta + +kronecker(Value 1 (i)[, Value 2 (j)]) +Returns 0 if i != j and 1 if i = j. + +Arguments +Value 1 (i): a real number +Value 2 (j): a real number (optional, default: 0) + + + + + +Riemann Zeta + +zeta(Integral point) + +Arguments +Integral point: an integer >= 1 and <= 2.1474836E9 + + + + + +Roman Number + +roman(Roman number) + +Arguments +Roman number: a text string + + + + + + + +Number Theory + + +Absolute Value + +abs(Value) + +Arguments +Value: a number + + + + + +Greatest Common Divisor + +gcd(1st value, 2nd value) + +Arguments +1st value: a free value that is rational (polynomial) +2nd value: a free value that is rational (polynomial) + + + + + +Least Common Multiplier + +lcm(1st value, 2nd value) + +Arguments +1st value: a free value that is rational (polynomial) +2nd value: a free value that is rational (polynomial) + + + + + + +Arithmetics + + +Add + +add(Terms) + +Arguments +Terms: a vector + + + + + +Denominator + +denominator(Number) + +Arguments +Number: a rational number + + + + + +Divide + +divide(Numerator, Denominator) + +Arguments +Numerator: a free value +Denominator: a free value + + + + + +Modulus + +mod(Numerator, Denominator) + +Arguments +Numerator: a real number +Denominator: a real number that is nonzero + + + + + +Multiply + +multiply(Factors) + +Arguments +Factors: a vector + + + + + +Negate + +neg(Value) + +Arguments +Value: a free value + + + + + +Numerator + +numerator(Number) + +Arguments +Number: a rational number + + + + + +Raise + +raise(Base, Exponent) + +Arguments +Base: a free value +Exponent: a free value + + + + + +Reciprocal + +inv(Value) + +Arguments +Value: a free value + + + + + +Remainder + +rem(Numerator, Denominator) + +Arguments +Numerator: a real number +Denominator: a real number that is nonzero + + + + + +Signum + +sgn(Number) + +Arguments +Number: a number + + + + + +Subtract + +subtract(Terms) + +Arguments +Terms: a vector + + + + + + + +Integers + + +Even + +even(Number) + +Arguments +Number: an integer + + + + + +Odd + +odd(Number) + +Arguments +Number: an integer + + + + + + + +Number Bases + + +Binary + +bin(Binary number) +Returns a decimal integer from a binary number + +Arguments +Binary number: a text string + + + + + +Hexadecimal + +hex(Hexadecimal number) +Returns a decimal value from a hexadecimal number + +Arguments +Hexadecimal number: a text string + + + + + +Number Base + +base(Number, Base) +Returns a decimal integer from a number of specified base between 2 and 36 + +Arguments +Number: a text string +Base: an integer >= 2 and <= 36 + + + + + +Octal + +oct(Octal number) +Returns a decimal integer from an octal number + +Arguments +Octal number: a text string + + + + + + + +Polynomials + + +Coefficient + +coeff(Polynomial, Number[, Variable]) + +Arguments +Polynomial: a free value that is rational (polynomial) +Number: an integer >= 0 +Variable: an unknown variable/symbol (optional, default: x) + + + + + +Content Part + +pcontent(Polynomial[, Variable]) + +Arguments +Polynomial: a free value that is rational (polynomial) +Variable: an unknown variable/symbol (optional, default: x) + + + + + +Leading Coefficient + +lcoeff(Polynomial[, Variable]) + +Arguments +Polynomial: a free value that is rational (polynomial) +Variable: an unknown variable/symbol (optional, default: x) + + + + + +Lowest Degree (Valuation) + +ldegree(Polynomial[, Variable]) + +Arguments +Polynomial: a free value that is rational (polynomial) +Variable: an unknown variable/symbol (optional, default: x) + + + + + +Polynomial Degree + +degree(Polynomial[, Variable]) + +Arguments +Polynomial: a free value that is rational (polynomial) +Variable: an unknown variable/symbol (optional, default: x) + + + + + +Primitive Part + +primpart(Polynomial[, Variable]) + +Arguments +Polynomial: a free value that is rational (polynomial) +Variable: an unknown variable/symbol (optional, default: x) + + + + + +Trailing Coefficient + +tcoeff(Polynomial[, Variable]) + +Arguments +Polynomial: a free value that is rational (polynomial) +Variable: an unknown variable/symbol (optional, default: x) + + + + + +Unit Part + +punit(Polynomial[, Variable]) + +Arguments +Polynomial: a free value that is rational (polynomial) +Variable: an unknown variable/symbol (optional, default: x) + + + + + + + +Rounding + + +Extract Fractional Part + +frac(Value) + +Arguments +Value: a real number + + + + + +Extract Integer Part + +int(Value) + +Arguments +Value: a real number + + + + + +Round + +round(Value) + +Arguments +Value: a real number + + + + + +Round Downwards + +floor(Value) + +Arguments +Value: a real number + + + + + +Round Towards Zero + +trunc(Value) + +Arguments +Value: a real number + + + + + +Round Upwards + +ceil(Value) + +Arguments +Value: a real number + + + + + + + + +Statistics + + +Random Number + +rand([Ceil]) +Generates a pseudo-random number. Returns a real number between 0 and 1, if ceil is zero (default), or an integer between 1 and (including) ceil. + +Arguments +Ceil: an integer (optional, default: -1) + + + + + +Random Number Between Limits + +randbetween(Bottom, Top) +Returns an integer between (including) bottom and top. + +Arguments +Bottom: an integer +Top: an integer + + + +Requirement +"Bottom"<="Top" + + + + + + +Descriptive Statistics + + +Decile + +decile(Data, Decile) + +Arguments +Data: a vector +Decile: a number >= 0 and <= 100 + + + + + +Interquartile Range + +iqr(Data) +Calculates the difference between the first and third quartile. + +Arguments +Data: a vector + + + + + +Max + +max(Vector) +Returns the highest value. + +Arguments +Vector: a vector + + + + + +Median + +median(Data) + +Arguments +Data: a vector + + + + + +Min + +min(Vector) +Returns the lowest value. + +Arguments +Vector: a vector + + + + + +Mode + +mode(Vector) +Returns the most frequently occuring value. + +Arguments +Vector: a vector + + + + + +Number of Samples + +number(Data) +Returns the number of samples. + +Arguments +Data: a vector + + + + + +Percentile + +percentile(Vector, Percentile (%)) + +Arguments +Vector: a vector +Percentile (%): a number > 0 and < 99 + + + + + +Quartile + +quartile(Data, Quartile) + +Arguments +Data: a vector +Quartile: an integer >= 1 and <= 3 + + + + + +Range + +range(Data) +Calculates the difference between the min and max value. + +Arguments +Data: a vector + + + + + +Sum (total) + +total(Data) + +Arguments +Data: a vector + + + + + + + +Distribution + + +Logistic Distribution + +logistic(X, Scale) +Returns the probability density p(x) at x for a logistic distribution with scale parameter. (from Gnumeric) + +Arguments +X: a free value +Scale: a number >= 0 + + + + + +Pareto Distribution + +pareto(X, Exponent, Scale) +Returns the probability density p(x) at x for a Pareto distribution with exponent and scale. (from Gnumeric) + +Arguments +X: a free value +Exponent: a number >= 0 +Scale: a number >= 0 + + + + + +Rayleigh Distribution + +rayleigh(X, Sigma) +Returns the probability density p(x) at x for a Rayleigh distribution with scale parameter sigma. (from Gnumeric) + +Arguments +X: a free value +Sigma: a number >= 0 + + + + + +Rayleigh Tail Distribution + +rayleightail(X, Lower limit, Sigma) +Returns the probability density p(x) at x for a Rayleigh tail distribution with scale parameter sigma and a lower limit. (from Gnumeric) + +Arguments +X: a free value +Lower limit: a free value +Sigma: a number >= 0 + + + + + + + +Means + + +Geometric Mean + +geomean(Data) + +Arguments +Data: a vector + + + + + +Harmonic Mean + +harmmean(Data) + +Arguments +Data: a vector + + + + + +Mean + +mean(Data) +average +Arguments +Data: a vector + + + + + +Quadratic Mean (RMS) + +rms(Data) + +Arguments +Data: a vector + + + + + +Trimmed Mean + +trimmean(Data, Trimmed percentage (at each end)) + +Arguments +Data: a vector +Trimmed percentage (at each end): a free value + + + + + +Weighted Mean + +weighmean(Data, Weights) + +Arguments +Data: a vector +Weights: a vector + + + + + +Winsorized Mean + +winsormean(Data, Winsorized percentage (at each end)) + +Arguments +Data: a vector +Winsorized percentage (at each end): a free value + + + + + + + +Moments + + +Covariance + +cov(Data 1, Data 2) +covar +Arguments +Data 1: a vector +Data 2: a vector + + + + + +Mean Deviation + +meandev(Data) + +Arguments +Data: a vector + + + + + +Pooled Variance + +poolvar(Data 1, Data 2) + +Arguments +Data 1: a vector +Data 2: a vector + + + + + +Standard Deviation (entire population) + +stdevp(Data) + +Arguments +Data: a vector + + + + + +Standard Deviation (random sampling) + +stdev(Data) + +Arguments +Data: a vector + + + + + +Standard Error + +stderr(Data) + +Arguments +Data: a vector + + + + + +Variance (entire population) + +varp(Data) + +Arguments +Data: a vector + + + + + +Variance (random sampling) + +var(Data) + +Arguments +Data: a vector + + + + + + + +Regression + + +Pearson's Correlation Coefficient + +pearson(Data 1, Data 2) +correl +Arguments +Data 1: a vector +Data 2: a vector + + + +Requirement +dimension("Data 1")=dimension("Data 2") + + + + + +Spearman's Rho + +spearman(Data 1, Data 2) + +Arguments +Data 1: a vector +Data 2: a vector + + + +Requirement +dimension("Data 1")=dimension("Data 2") + + + + + +Statistical Correlation + +cor(Data 1, Data 2) + +Arguments +Data 1: a vector +Data 2: a vector + + + + + + + +Statistical Tests + + +Paired T-Test + +pttest(Data 1, Data 2) + +Arguments +Data 1: a vector +Data 2: a vector + + + + + +Unpaired T-Test + +ttest(Data 1, Data 2) + +Arguments +Data 1: a vector +Data 2: a vector + + + + + + + + +Step Functions + + +Heaviside Step Function + +heaviside(Value) +Discontinuous function also known as "unit step function". Returns 0 if x < 0, 1 if x > 0, and 1/2 if x = 0. + +Arguments +Value: a real number + + + + + +Logit Transformation + +logit(Value) + +Arguments +Value: a number + + + + + +Ramp Function + +ramp(Value) + +Arguments +Value: a real number + + + + + +Rectangular Function + +rectangular(Value) + +Arguments +Value: a real number + + + + + +Sigmoid Function + +sigmoid(Value) + +Arguments +Value: a number + + + + + +Triangular Function + +triangular(Value) + +Arguments +Value: a real number + + + + + + + +Trigonometry + + +Cosecant + +csc(Angle) + +Arguments +Angle: an angle or a number (using the default angle unit) + + + + + +Cosine + +cos(Angle) + +Arguments +Angle: an angle or a number (using the default angle unit) + + + + + +Cotangent + +cot(Angle) + +Arguments +Angle: an angle or a number (using the default angle unit) + + + + + +Hyperbolic Cosecant + +csch(argument 1) + +Arguments +1: a free value + + + + + +Hyperbolic Cosine + +cosh(argument 1) + +Arguments +1: a number + + + + + +Hyperbolic Cotangent + +coth(argument 1) + +Arguments +1: a free value + + + + + +Hyperbolic Secant + +sech(argument 1) + +Arguments +1: a free value + + + + + +Hyperbolic Sine + +sinh(argument 1) + +Arguments +1: a number + + + + + +Hyperbolic Tangent + +tanh(argument 1) + +Arguments +1: a free value + + + + + +Inverse Cosecant + +acsc(argument 1) + +Arguments +1: a free value + + + + + +Inverse Cosine + +acos(argument 1) + +Arguments +1: a number + + + + + +Inverse Cotangent + +acot(argument 1) + +Arguments +1: a free value + + + + + +Inverse Hyperbolic Cosecant + +acsch(argument 1) + +Arguments +1: a free value + + + + + +Inverse Hyperbolic Cosine + +acosh(argument 1) + +Arguments +1: a number + + + + + +Inverse Hyperbolic Cotangent + +acoth(argument 1) + +Arguments +1: a free value + + + + + +Inverse Hyperbolic Secant + +asech(argument 1) + +Arguments +1: a free value + + + + + +Inverse Hyperbolic Sine + +asinh(argument 1) + +Arguments +1: a number + + + + + +Inverse Hyperbolic Tangent + +atanh(argument 1) + +Arguments +1: a number + + + + + +Inverse Secant + +asec(argument 1) + +Arguments +1: a free value + + + + + +Inverse Sine + +asin(argument 1) + +Arguments +1: a number + + + + + +Inverse Tangent + +atan(argument 1) + +Arguments +1: a number + + + + + +Radians to Default Angle Unit + +radtodef(Radians) + +Arguments +Radians: a free value + + + + + +Secant + +sec(Angle) + +Arguments +Angle: an angle or a number (using the default angle unit) + + + + + +Sine + +sin(Angle) + +Arguments +Angle: an angle or a number (using the default angle unit) + + + + + +Tangent + +tan(Angle) + +Arguments +Angle: an angle or a number (using the default angle unit) + + + + + + + +Utilities + + +ASCII Char + +char(Value) + +Arguments +Value: an integer >= 32 and <= 127 + + + + + +ASCII Value + +code(Character) + +Arguments +Character: a text string that fulfills the condition: "len(\x) = 1" + + + + + +Concatenate Strings + +concatenate(Text string 1[, Text string 2], ...) + +Arguments +Text string 1: a text string +Text string 2: a text string (optional) + + + + + +Custom Sum of Elements + +csum(First element, Last element, Initial value, Function, Value variable, Element variable, Vector[, Index variable][, Vector variable]) + +Arguments +First element: an integer +Last element: an integer +Initial value: a free value +Function: a free value +Value variable: an unknown variable/symbol +Element variable: an unknown variable/symbol +Vector: a vector +Index variable: an unknown variable/symbol (optional, default: "") +Vector variable: an unknown variable/symbol (optional, default: "") + + + + + +Display Error + +error(Message) + +Arguments +Message: a text string + + + + + +Display Message + +message(Message) + +Arguments +Message: a text string + + + + + +Display Warning + +warning(Message) + +Arguments +Message: a text string + + + + + +Function + +function(Expression, Arguments) + +Arguments +Expression: a text string +Arguments: a vector + + + + + +Length of string + +len(Text) + +Arguments +Text: a text string + + + + + +Process Matrix Elements + +processm(Function, Element variable, Matrix[, Row variable][, Column variable][, Matrix variable]) + +Arguments +Function: a free value +Element variable: an unknown variable/symbol +Matrix: a matrix +Row variable: an unknown variable/symbol (optional, default: "") +Column variable: an unknown variable/symbol (optional, default: "") +Matrix variable: an unknown variable/symbol (optional, default: "") + + + + + +Process Vector Elements + +process(Function, Element variable, Vector[, Index variable][, Vector variable]) + +Arguments +Function: a free value +Element variable: an unknown variable/symbol +Vector: a vector +Index variable: an unknown variable/symbol (optional, default: "") +Vector variable: an unknown variable/symbol (optional, default: "") + + + + + +RPN Stack Register + +register(Index) +Returns the value of a RPN stack register. + +Arguments +Index: an integer >= 1 + + + + + +RPN Stack Vector + +stack() +Returns the RPN stack as a vector. + + + +Replace + +replace(Expression, Original value, New value[, Precalculate expression]) +Replaces a certain value in an expression with a new value. The expression is calculated before the replacement if the fourth argument is true. + +Arguments +Expression: a free value +Original value: a free value +New value: a free value +Precalculate expression: a boolean (0 or 1) (optional, default: 0) + + + + + +Save as Variable + +save(Value, Name[, Category][, Title]) + +Arguments +Value: a free value +Name: a text string +Category: a text string (optional, default: Temporary) +Title: a text string (optional) + + + + + +Select Vector Elements + +select(Vector, Condition[, Element variable][, Select first match]) + +Arguments +Vector: a free value +Condition: a free value +Element variable: an unknown variable/symbol (optional, default: x) +Select first match: a boolean (0 or 1) (optional, default: 0) + + + + + +Strip Units + +nounit(Expression) +strip_unitsRemoves all units from an expression. The expression is calculated before the removal. + +Arguments +Expression: a free value + + + + + +Title + +title(Name) + +Arguments +Name: a valid function, unit or variable name + + + + + + + diff --git a/doc/en/qalculate_kde/gnuplot.png b/doc/en/qalculate_kde/gnuplot.png new file mode 100644 index 0000000..59df8e7 Binary files /dev/null and b/doc/en/qalculate_kde/gnuplot.png differ diff --git a/doc/en/qalculate_kde/import-csv.png b/doc/en/qalculate_kde/import-csv.png new file mode 100644 index 0000000..7f99259 Binary files /dev/null and b/doc/en/qalculate_kde/import-csv.png differ diff --git a/doc/en/qalculate_kde/index.docbook b/doc/en/qalculate_kde/index.docbook new file mode 100644 index 0000000..36d492c --- /dev/null +++ b/doc/en/qalculate_kde/index.docbook @@ -0,0 +1,1528 @@ + +Qalculate! 0.9.7"> + + + + + + + +]> + + + + +The &qalculate_kde; Handbook + + + + + +Niklas Knutsson + +
nq@altern.org
+
+
+
+ + + + +2005 +Niklas Knutsson + + + +&FDLNotice; + + + +2007-05-25 +0.9.7 + + + +&qalculate_kde; is a multi-purpose desktop calculator for GNU/Linux. +It is small and simple to use but with much power and versatility underneath. +Features include customizable functions, units, arbitrary precision, plotting, and a user-friendly +interface. + + + + +KDE +qalculate-kde +calculator +math + + +
+ + +Introduction + +Qalculate! is not your regular software replication of the cheapest available calculator. Qalculate! aims to make full use of the superior interface, power and flexibility of modern computers. + + +The center of attention in Qalculate! is the expression entry, Instead of entering each number in a mathematical expression separately, you can directly write the whole expression and later modify it. Just enter an expression as you would write it on paper, press Enter and voila! + + +The interpretation of expressions is flexible and fault tolerant, and if you nevertheless do something wrong, Qalculate! will tell you so. Not fully solvable expressions are however not errors. Qalculate! will simplify as far as it can and answer with an expression. + + +In addition to numbers and arithmetic operators, an expression may contain any combination of variables, units, and functions. These are immediately accessible from the user interface — the menu bar, the managers, the calculator keypad, and automatic completion. + + +Qalculate! also has some special tools to increase your efficiency, including a number base conversion dialog and a simple plotting interface. + + +Although use of Qalculate! for simple calculations should be natural and self-explanatory, reading the rest of the manual can help you maximize your productivity and discover some maybe unexpected features. More advanced users should read on and discover a large number of customization options and the ability to create and modify your own variables, functions and units directly from the user interface. + + + + +User Interface + +Main Window +
+ Main Window + + + + + + + +
+ +The main window provides a menu bar, the expression entry, the result display and a calculator keypad or history view which can be shown/hidden by clicking on Keypad and History, respectively. There are three buttons to the right of the expression entry and the result display. The upper button performs calculation of the entered expression (same as Enter), the one below saves the current result as a variable (see ), while the last button opens a dialog for conversion of units in the result (see ). When non-default options for the interpretion of expressions have been selected, the choice will be indicated in a small status area below the expression entry, to the right. + +
+ +Expression Entry + +The expression entry is the most important part of the Qalculate! user interface. The normal calculation procedure in Qalculate! is to type in a mathematical expression (ex. 5+5) and press Enter (or click Execute). The result (10) is then displayed below the expression entry in the result display. + +
+ Completion + + + + + + + +
+ +Qalculate! helps out with the expression by giving a list of possible endings to words representing functions, variables and units. The list will narrow with each letter typed. Select an item in the list and the name will be completed. If a function was selected, parenthesis will be added and the position moved for immediate entry of arguments. + + +As the expression is typed in, the area directly direclty below the expression entry, to the left, will show useful information. By default the calculator's interpretation of the expression is shown (ex. 5 * meter for 5m). The interpretation will be displayed in red (configurable) if there are errors in the expression or in blue for lesser errors (for example too many arguments in a function). If the last typed in text represents a function, and arguments are about to be entered, the functions name and its arguments will be displayed. The first argument in the information text is highlighted and includes information about its type and restrictions and when an argument has been entered, the next will be highlighted. + + +After execution of an expression, the whole expression will be marked. This normally means that if something new is entered, the old expression will be overwritten. If, however, an operator (+, −, *, /, ^) is entered first, the old expression will instead be the target of action. The operator will then apply to the whole expression, which is put in parenthesis. This works on all marked ranges, meaning that this way an expression can conveniently be put in parenthesis. Functions set the selection as their first argument. + + +The Up and Down keys will access previously entered expressions. With focus in the expression entry, Up traverses backwards in the expression history and Down forward. + + +The font used for the expression entry can be selected in the preferences dialog (EditConfigure Qalculate!). + +
+ +Result Display + +The result of calculations is displayed in the open area below the expression entry. The font used for the result display can be selected in the preferences dialog (EditConfigure Qalculate!). Use of Unicode signs can be turned off in the same dialog. Otherwise Qalculate! will try to make the result as fancy as possible and print π for pi, √ for sqrt, € for euro, and so on. Information about customization of the mathematical result output is available in . + + +In front of the result an equals or approximately equals sign is shown. This indicates whether Qalculate! was able to calculate/display the result exact or only approximate, in the current mode. + + +The result display has a context menu, which pops up when clicking with the right mouse button anywhere in the field. This menu provides a subset of the display alternatives from the mode menu () and some actions from the edit menu (). See more info in . Show Parsed Expression shows how the entered expression was interpreted before the calculation leading to the current result. + + +When you move the mouse over parts of the result, descriptions will pop up for variables, functions and units. This will only work if you have tooltips enabled in KDE. You can also show this information by double clicking or selecting Show Object Info in the context menu. For matrices and vectors, this will open a window with a spreadsheet-like table displaying the contents of the matrix/vector. + + +To copy the result, either select EditCopy Result, or mark and copy the text from the result display or history. Note that all results are not displayed in the result display as an expression which can be used directly in the expression entry. This is true for divisions, powers and vectors. For example, when the result "x^5" is marked and copied, the power sign will be lost. + + + +Keypad + +The keypad provides access to a fairly small set of traditional calculator buttons, which work as expected. The top buttons (from left to right) toggles exact calculation, toggles fractional number display, selects display mode and selects number base in result (see ). +
+ Keypad + + + + + + + +
+
+
+ +Calculation History + +The history view provides access to previous calculation results (50 rows are reloaded on restart). Previous expressions and results, as well as errors and warnings, are displayed in plain text and can be marked and copied (from the right-button context menu or with CtrlC) to the expression entry or elsewhere. +
+ Calculation History + + + + + + + +
+ +
+
+ +Menu Bar + +The menus in the menu bar provides access to most of the functionality of Qalculate!. Their contents are listed and described below. + + + File Menu + + + + + + Menu Item + Description + + + + + New + Submenu for creation of new objects. See . + + + Import CSV File... + Opens a dialog for import of a data file as a matrix or vectors. + + + Export CSV File... + Opens a dialog for export of a matrix or vector to a data file. + + + Store Result... (CtrlS) + Stores the current result as a variable. See . + + + Save Result Image... + Saves the result display to a PNG image. + + + Save Definitions + Saves all user definitions (variables, functions and units). + + + Update Exchange Rates + Downloads current exchange rates from the Internet. + + + Plot Functions/Data + Opens the plot dialog. See . + + + Convert Number Bases + Opens the number bases converter. See + + + Periodic Table + Shows a periodic table, with property values which can be inserted in the expression, in a new window. + + + Quit (CtrlQ) + Exits Qalculate! + + + +
+ + New Menu + + + + + + Menu Item + Description + + + + + Variable + Opens the variable edit dialog for creation of a new variable. + + + Matrix + Opens a dialog for entry of a new matrix variable. + + + Vector + Opens a dialog for entry of a new vector variable. + + + Unknown Variable + Opens the variable edit dialog for creation of a new unknown variable. + + + Function + Opens the function edit dialog for creation of a new function. + + + Data Set + Opens the data set edit dialog for creation of a new data set. + + + Unit + Opens the unit edit dialog for creation of a new unit. + + + +
+ + Edit Menu + + + + + + Menu Item + Description + + + + + Manage Variables (F2) + Opens the variable manager. See . + + + Manage Functions (F3) + Opens the function manager. See . + + + Manage Units (F4) + Opens the unit manager. See . + + + Manage Data Sets + Opens the data set manager. + + + Factorize + Factorizes the current result. For multivariate rational polynomials, only square free factorization is supported. + + + Simplify + Simplifies the current result. Note that easy simplifications are always automatically performed. + + + Set Unknowns... + Opens a dialog where the values of unknown variables in the result can be set and the result recalculated. + + + Convert To Unit + Submenu with units. Select a unit to convert the current result. + + + Set Prefix + Submenu for choice of unit prefix in current result. + + + Convert To Unit Expression (CtrlT) + Opens the convert to unit dialog for conversion of result to custom unit expression. See . + + + Convert To Base Units + Splits up unit(s) in the current result into base units. + + + Convert To Best Unit + Tries to convert the units in the current result so that as few units as possible is used. Base units are prioritized. + + + Insert Matrix + Opens a dialog where you can create a matrix in a spreadsheet-like table and insert into the expression entry. If selected expression text is a matrix, then the matrix is edited. + + + Insert Vector + Opens a dialog where you can create a vector in a spreadsheet-like table and insert into the expression entry. If selected expression text is a vector, then the vector is edited. + + + Copy Result (F5) + Copies the current result to the clipboard. + + + Configure Qalculate! + Opens the preferences dialog, which controls settings for visual appearance and start/exit actions. + + + Configure Shortcuts... + Opens a dialog for configuring keyboard shortcuts. + + + +
+ + Mode Menu + + + + + + Menu Item + Description + + + + + Number Base + Submenu with a list of number bases (binary, octal, decimal, hexadecimal, sexagesimal, time format, and other bases, and roman numerals) to select for result display, and a menu item (CtrlB) for opening a dialog to switch number bases in expression (input) and result (output). + + + Numerical Display + Submenu which selects numerical display mode. See . + + + Fractional Display + Submenu which selects decimal, fractional or combined fractional display. See . + + + Unit Display + Submenu which controls the display of units and prefixes. See . + + + Angle Unit + Submenu which sets the default angle unit for trigonometric functions. + + + Abbreviate Names + Toggles on/off use of abbreviation for unit, prefix, variable and function names in result display. + + + Enabled Objects + Submenu which enables/disables variables, functions, units and unknowns (will not affect defined unknown variables and quoted unknowns), and calculation of variables (If calculation of variables is not on, all variables will be treated as unknown). Here you can also disable complex and infinite results. + + + Approximation + Submenu which switches between different approximation modes. + + + Assumptions + Submenu which changes default assumptions for unknown variables. + + + Algebraic Mode + Submenu with options to automatically simplify or factorize the final result. Note that even if this is set to none, easy simplifications will be performed. In this menu, the option toggle on/off use of the assumption that unknown denominators not are zero is also found. This alternative makes it possible to avoid the situation where expressions such as (x-1)/(x-1) can not be further simplified because the denominator might be zero (if x equals 1). + + + Read Precision + Enables/disables interpretation of input numbers with decimals as approximate with a precision equal to the number of digits (after preceding zeroes). + + + Limit Implicit Multiplication + Activates/deactivates limits to implicit multiplication when parsing and displaying expressions. For details see + + + RPN Mode (CtrlR) + Toggles Reverse Polish Notation mode on/off. For details see + + + RPN Syntax + Toggles use of Reverse Polish Notation syntax in expressions on/off. + + + Precision + Opens a dialog to change precision in calculations. + + + Decimals + Opens a dialog to change displayed number of decimals. + + + Meta Modes + Provides a list of available meta modes for loading and menu items to save and delete modes. + + + Save Default Mode + Saves the current calculator mode as the startup default. + + + +
+ + Functions Menu + + + + + + Menu Item + Description + + + + + (Recent functions list) + Select a function to open the insert function dialog. + + + (Function list) + Select a function to open the insert function dialog. + + + +
+ + Variables Menu + + + + + + Menu Item + Description + + + + + (Recent variables list) + Select a variable to insert it into the expression entry. + + + (Variable list) + Select a variable to insert it into the expression entry. + + + +
+ + Units Menu + + + + + + Menu Item + Description + + + + + (Recent units list) + Select a unit to insert it into the expression entry. + + + (Unit list) + Select a unit to insert it into the expression entry. + + + +
+ + Help Menu + + + + + + Menu Item + Description + + + + + Qalculate! Handbook(F1) + Invokes the KDE Help system starting at the Qalculate! help pages. (this document). + + + What's This?(ShiftF1) + Changes the mouse cursor to a combination arrow and question mark. Clicking on items within Qalculate! will open a help window (if one exists for the particular item) explaining the item's function. + + + About Qalculate! + This will display version and author information. + + + About KDE + This displays the KDE version and other basic information. + + + +
+ +
+ +Variable/Function/Unit Managers + +The manager windows provide a structural way of working with variables, functions and units (collectively referred to as objects). The managers for the three different objects are essentially similar. They can be opened from the edit menu. F2, F3 and F4 can also be used for variables, functions and units respectively. The function manager can also be opened with the f(x) button in the keypad. + +
+ Variable Manager + + + + + + + +
+ +To the left is a category tree and beside that is a list of all objects in the selected category, including all subcategories. Objects without a category are put under Uncategorized. The top category, All, provides a list of all objects, except those that are deactivated and available in the second top-level category — Inactive. The object list does, in addition to descriptive names, for variables have an extra column for values of variables, and units have additional columns for abbreviation/singular/plural and base unit. + + +The buttons on the right work on the selected object in the list. New opens a dialog for creation of a new object, while Edit opens the same dialog to edit the selected unit. Insert inserts the object into the expression entry in the main window, Delete removes the object and (De)activate toggles recognition in expressions on/off. The unit manager has an additional button for conversion of the current result and the variable manager a button for export to a data file. + +
+ Function Manager + + + + + + + +
+ +The function manager has a description box at the bottom, which shows the syntax, description and arguments of the selected function. + +
+ Unit Manager + + + + + + + +
+ +The unit manager has an area for quick conversion between units. This converts between the selected unit in the list and the selected unit in the option menu. The menu contains the same units that are available in the list. Units are converted by specification of a quantity, in the entry next to the unit to convert from, followed by Enter. + + +For more information about variables, functions and units, see , and . + +
+ +Convert Number Bases Dialog + +The number bases dialog, accessible from the File Menu, is an efficient and convenient tool for conversion between binary, octal, decimal and hexadecimal numbers. This dialog contains entries for each number base. When a number is typed in any of the entries, the others are automatically updated to display the current number in their format. Numbers, or expressions, entered follow the same rules as expressions in the main expression entry. +
+ Convert Number Bases Dialog + + + + + + + +
+
+
+
+ + +Expressions + +Expressions are mathematical statements. Mathematical questions are asked through expressions, which contains objects tied together with operators. The result of an expression may also be an expression, if the result is not a single object. Apples and oranges can be mixed, but the result will hold them apart. Qalculate! knows algebra. + + +Objects + +In Qalculate! mathematical entities, such as numbers and variables, are referred to as objects. The recognized object types are listed below. + + + + + Numbers + + These are the regular numbers composed by digits 0-9 and a decimal sign — a dot, or a comma if it is the default decimal point in the locale/language used. If comma is used as decimal sign, the dot is still kept as an alternative decimal sign, if not explicitely turned off in the preferences dialog with Ignore dots in number (to allow it to be used as thousand separator instead). Numbers include integers, real numbers, and complex numbers. The imaginary part of complex numbers are written with as regular number followed by the special variable i, which represents the square root of -1 (ex. 2 + 3i). Spaces between digits are ignored (5 5 = 55). E (or e) can be considered as a shortcut for writing many zeroes and is equivalent to multiplication by 10 raised to the power of the right-hand value (ex. 5E3 = 5000). + Sexagesimal numbers (and time) can be entered directly using colons (ex. 5:30 = 5.5). A number immediately preceeded 0b, 0o or 0x are interpreted as a number with base 2, 8 or 16, respectively (if the default base is 10, ex. 0x3f = 63). The number base in can also be selected, either by using the base(), bin(), oct(), hex() and roman() functions, or by setting the base used for all numbers in the whole expression from ModeNumber BaseSelect Result and Expression Base.... + + + + Vectors and Matrices + + A matrix is a two-dimensional rectangular array of mathematical objects. Vectors are matrices with only one row or column, thus one-dimensional sequences of objects, Vectors and matrices are generated by vector(), matrix() and similar functions, or stored in a variable. Syntax in the form of [1, 2, 3, 4] and [[1, 2], [3, 4]] can also be used. + + + + Variables/Constants + + See . + + + + Functions + + See . + + + + Units and Prefixes + + Qalculate! understands abbreviated, plural and singular forms of unit names and prefixes. Prefixes must be put immediately before the unit to be interpreted as prefixes — 5 mm = 0.005 m, but 5 m m = 5 m^2. Also, for convenience units allow the power operator to be left out. A number following immediately after a unit is interpreted as an exponent (ex. 5 m2 = 5 m^2). This does not apply to currencies, as they might be put in front of the quantity. More information in . + + + + Unknowns + + Unknowns are text strings without any associated value. If Qalculate! finds a character that are not associated with any variable, function or unit in an expression, then it will be regarded as an unknown variable. These are temporary unknown variables with default assumptions. Unknowns can also be explicitly entered by putting a text string in quotes. This is also necessary for undefined unknown variables with more than one character (ex.xy is just one object, while xy means x * y). See . + + + + Text + + This category represent a number of different function argument types, such as regular text, dates and file names. They can, but do not need to be put in quotes except when containing the argument separator (, or ;). + + + + + +To avoid confusion, functions, units, variables and unknown variables can independently be disabled. + + +Variables, functions and units are all accessible in the menus and in the variable, function and unit managers, If their names are not remembered. Functions accessed this way has some extra conveniences. If the function has at least one argument, a dialog will pop up where arguments can be entered and a description of the +function and its arguments is available. + + +Qalculate! can handle most commonly used symbols for certain variables, functions and units, even though most are difficult to find on a keyboard. These include π for pi, √ for sqrt, € for euro, and so on. Most importantly it is possible to copy these symbols when used in the result. + + +For more information about variables, functions and units, see , and . + + + +Operators + +The following operators are defined in Qalculate! and may be used in expressions. + + + Operators + + + + + + + + + Operation + Symbol + Description + Example + Result + + + + + Addition + + + Adds the right value to the left value. + 1 + 1 + 2 + + + Subtraction + + Subtracts the right value from the left value. + 1 − 1 + 0 + + + Multiplication + ⋅ or * + Multiplies the left value by the right value. + 2 * 2 + 4 + + + Division + / + Divides the left value by the right value. + 2 / 2 + 1 + + + Exponent + ^ + Raises the left value by the right value. Can also be typed as **. Note that x^y^z equals x^(y^z), and not (x^y)^z. + 2^3 + 8 + + + 10^x + E + Multiplies the left value with 10 raised to the power of the right value. Equivalent to the exponential number format in result display. E is as much an operator as part of numbers. + 1E3 + 1000 + + + Parenthesis + ( and ) + Evaluates the expression in parenthesis first. + 5 * (1 + 1) + 10 + + + Less than + < + Returns 1 for true, if the left value is is less than the right, and 0 for false. + 1 < 2 + 1 + + + Greater than + > + Returns 1 for true, if the left value is greater than the right, and 0 for false. + 1 >2 + 0 + + + Less than or equal + ≤ or <= + Returns 1 for true, if the left value is less than or equal the right, and 0 for false. + 1 <= 2 + 1 + + + Greater than or equal + ≥ or >= + Returns 1 for true, if the left value is greater than or equal the right, and 0 for false. + 1 >= 2 + 0 + + + Equals + = + Returns 1 for true, if the left value equals the right, and 0 for false. + 1 = 2 + 0 + + + Not equals + ≠ or != + Returns 1 for true, if the left value not equals the right, and 0 for false. + 1 != 2 + 1 + + + Logical NOT + ! + Returns 1 for true, if the value to the right is false, and 0 for false. + !(1>2) + 1 + + + Logical OR + || or OR + Returns 1 for true, if the right or left value is true, and 0 for false. + 1>2 || 2>1 + 1 + + + Logical AND + && or AND + Returns 1 for true, if the right and left value is true, and 0 for false. + 1>2 && 2>1 + 0 + + + Bitwise NOT + ~ + Equivalent to -1-x. + ~(0010 | 1100) + -1111 + + + Bitwise Shift Left + << + Shifts the bits of the left value x steps to the left, where x is the value on the right. Implemented as a shortcut for shift() + 0011 << 1 + 0110 + + + Bitwise Shift Right + >> + Shifts the bits of the left value x steps to the right, where x is the value on the right. Implemented as a shortcut for shift() + 0011 << 1 + 0001 + + + Bitwise OR + | + If a bit is 1 in one of the numbers set it to 1, otherwise 0. Also functions as elementwise logical operator on vectors. + 0010 | 1100 + 1110 + + + Bitwise AND + & + If a bit is 1 in both numbers set it to 1, otherwise 0. Also functions as elementwise logical operator on vectors. + 1010 & 0011 + 0010 + + + +
+ +The operator names plus, minus, times, per, AND and OR may also be used, surrounded by space, for the corresponding operation (ex. 5 plus 2, but not 5plus2, equals 5 + 2). +These operator names are localized, but AND and OR are always available. +In addition to these operators there are a couple of shortcuts for certain functions, such as 5! which equals factorial(5). + + +The multiplication sign can generally be left out. This is not true for numbers (5(5) = 25 but 5 5 = 55). Expressions can also generally be written with or without spaces with the same result (2xsin(2) equals 2 x sin(2) which equals 2*x*sin(2)), but be careful. The vast number of functions and units means that without separating spaces, the result might not be obvious. To avoid confusion Qalculate! can limit the use of implicit multiplication (ModeLimit Implicit Multiplication), so that space, operator or parenthesis must be put between functions, units and variables (in this mode esqrt(5) does not equal e * sqrt(5)). Also note that unit prefixes must be put immediately before the unit, to be interpreted as prefixes (5 mm = 0.005 m, but 5 m m = 5m^2). You can see how to expression was interpreted in the history window. + + +Usually, mathematical expressions are written as normally expected. Standard operator precedence apply. Expressions are evaluated according to the following priorities: + + Parenthesis + E (10^x) + Short multiplication in front of variables, units, functions, parenthesis etc. (ex. 5(2+3)). Note that this implies that 2/5 cm equals 2/(5 cm) and not (2/5) cm + Functions (ex. sqrt(2)) + Exponents (x^y) + Multiplication and division (*, /) + Addition and subtraction (+, −) + Bitwise NOT (~) + << and >> + Bitwise AND (&) + Bitwise OR (|) + Comparison (>, <, =, >=, <=) + Logical NOT (!) + Logical AND (&&) + Logical OR (||) + + + + +
+
+ + +Calculator Modes + +Qalculate! provides flexible parsing, calculation output and result display. There are several ways in which parsing of expression and display of results can be customized. These modes can generally be changed through the mode menu. The state of each mode can be saved under a name in ModeMeta Modes for quick access. The Preset and Default meta modes are always available and represents the state when Qalculate! is load for the first time and the mode settings automatically loaded at each startup (and by default saved on exit), respectively. Different modes are summarized below. + + +Number Bases + +Non-decimal bases can be selected for display of numbers in the result. This include regular number bases (binary, octal, hexadecimal, sexagesimal) as well as sexagesimal time format and roman numerals. All number bases between 2 and 36, and base for expression input, can be selected from a dialog window accessed from ModeNumber BaseOther... or ModeNumber BaseSelect Result and Expression Base.... The convert number bases dialog (see ) is efficient for simple conversion between common bases. + + + +Numerical Display + +These modes mainly control when numbers are displayed exponentially (ex. 2.62E3 which equals 2620). In the default normal mode, numbers are displayed in exponential format if the exponent will be greater than the current precision. In scientific mode the lowest exponent is 3. In simple numerical mode the exponential format is never used and it is always used in purely scientific mode. In the engineering mode, the exponent is always a multiple of three. This is naturally equivalently true for numbers less than one and negative exponents. When the scientific modes are selected in the keypad (not from the menubar), negative exponents are automatically activated and sort minus last deactivated, while normal and simple modes do the opposite. + + + +Indicate Infinite Series + +If this option is on, Qalculate! will not round infinitely repeating digit sequences if discovered. Instead ... will be displayed after the maximal number of decimals and the result indicated as exact (compare 2/3 = 0.666667 with 2/3 = 0.666666...). + + + +Round Halfway Number To Even + +With this option, halfway numbers will be rounded to even instead of upwards (ex. 2.65 is then rounded to 2.6 instead of 2.7). Note that this behavior is always applied in the round() function. + + + +Show Ending Zeroes + +if this option is on, approximate numbers in the result will be appended with zeroes, so that the number of digits (after preceding zeroes) will equal the precision. + + + +Negative Exponents + +If negative exponents is activated, division is shown as a negative power (ex. x * y^-1 instead of x / y). + + + +Sort Minus Last + +This option decides if minus signs should be avoided in the first positions of the result expression. + + + +Fractional Display + +This controls if numbers are displayed in fractional or decimal mode. Decimal mode displays numbers as usually expected (6/4 = 1.5), combined displays a whole number and a fraction (6/4 = 1 1/2) and fractional only displays as fraction (6/4 = 3/2). + + + +Unit Display + +The use of prefixes for units can be toggled on and off. By default prefixes representing a power of ten not dividable by three (centi, deci, deca and hekto) are not used and need to be enabled. If denominator prefixes are not explicitly enabled, prefixes will only be set for the numerator in a fractional unit expression (ex. 1 Mg/m or 1 kg/mm). The place units separately alternative controls the display of unit expressions in result. If it is enabled (default) units will be displayed separate from other parts of the expression at the end (compare (5x*m)/(y*s) and 5x/y m/s). + + + +Abbreviate Names + +The display of unit, prefix, variable and function names can be controlled by selecting to display abbreviations or full length names (ex. 5 cm or 5 centimeters). Both abbreviations and long names can however always be entered in expressions. + + + +Approximation + +When always exact mode is on, the calculation will not go further than what can be calculated exactly (ex. sqrt(2+3) = sqrt(5)). The default Try Exact mode, will calculate the result exact as far as possible and then approximately. Approximate mode will directly calculate a approximate result, thus being a bit faster but giving a less correct approximate indication (sin(pi/2) return approximately one instead of exactly one). + + + +Assumptions + +This controls the default assumptions for unknown variables without explicitly defined assumptions. See . +The assume denominators non-zero alternative makes it possible to avoid the situation where expressions such as (x-1)/(x-1) can not be further simplified because the denominator might be zero (if x equals 1). With this alternative activated the example can be reduced to 1. + + + +Precision + +Precision controls the precision in approximate numbers and the number of significant digits. If the read precision option is turned on, input numbers with decimals will be interpreted as approximate with a precision equal to the number of digits (ex. 2.50 + 3.4567 = 5.96). + + + +Decimals + +In the decimals dialog, the number of decimals displayed can be controlled. This includes minimal (will fill out with zeroes) and maximal number of decimals (will round numbers). + + + +Limit Implicit Multiplication + +If the limit implicit multiplication mode is activated, the use of implicite multiplication when parsing expressions and displaying results will be limited to avoid confusion. For example, if this mode is not activated and integrte(5x) is accidently typed instead of integrate(5x), the expression is interpreted as int(e * e * (5 * x) * gr * t) (displayed in history window). The result will then without any error be int(2.3940139x * km^2) instead of 2.5x^2. If limit implicit multiplication is turned on to mistyped expression would instead show an error telling that integrte is not a valid variable, function or unit (unless unknowns is not enabled in which case the result will be 5 "integrate" * x). When implicit multiplication is limited variables, functions and units must be separated by a space, opertor or parenthesis (xy does not equal x * y). + + + + + +The RPN Mode + +The Reverse Polish Notation mode can be activated with ModeRPN Mode, CtrlR or from the context menu of the expression entry. For details about what Reverse Polish Notation is and how it generally works, see for example the RPN article at Wikipedia. + + +Central to the RPN mode is the stack, a list of registers/values that is operated on by functions and operators. The stack has a variable number of registers which can hold an unlimited number of values. The stack size is dynamically changed when a new value is added and the first value on the stack is shown in the result display. Mathematical operators such as plus and minus then operates on the first two, last added, values on the stack. The second value is changed with input from the first value. For example, the minus operator subtracts the first value from the second. Functions which require exactly one argument operates on the first value on the stack. Other functions, which require multiple arguments, must be entered in normal expression based way. + + +The RPN mode still allows full expression to be entered (you can add 5x+3+23+sin(2) directly to the stack). The buttons on the keypad do not insert operators and functions in the expression entry, but instead applies them to the stack. This is also true for the keypad keys on the keyboard. Enter calculates the current expressions and adds it to the stack. If the expression entry is not empty when applying an operator or function to the stack, the expression is first calculated and added to the stack. All keys on the main part of the keyboard add the corresponding characters in expression entry, unless the Use only keypad keys for RPN option is deactivated from the preferences dialog. To apply the raise operator '^' to the stack, without clicking the keypad button with the mouse, use the Ctrl* (keypad) shortcut. If the expression only contains an operator or a function, which requires exactly one argument, the operator/function is applied to the stack. + + +For example, 5 ENTER 3 + 2 / adds 5 to the stack, then adds 3 to the stack and moves 5 down a step and adds 3 to 5. The first value, 3, is removed from the stack and the value left is 8. Then 2 is added to the stack and 8 is divided by 2, resulting in 4. This would in a single expression be entered as (5+3)/2. + +
+ RPN Mode + + + + + + + +
+ +The RPN mode adds a third page to the main window, for display and manipulation of the values on the stack. This shows a list of values on the stack, with the last added value on the top. On the right are buttons for moving the selected value up or down, editing or removing the selected value, or remove all values from the stack. The equals buttons do in RPN mode in addition to calculating the expression, add it to the stack. + + +Changes in the display of result only affects the first value on the stack. + + +Note that Qalculate! in addition to the RPN mode, has a RPN syntax. The RPN syntax controls how expressions is interpreted. This means that instead of as with a traditional RPN calculator, where each value and operator is put on the stack separately, all values and operators are entered directly in an expression, with ENTER replaced by space (ex. 5 2 + which corresponds to 5 ENTER 2 ENTER +, and equals 5 + 2 in regular notation). + +
+
+ + +Variables + +Variables are used to conveniently store a fixed value/result under a name. Variables can store everything that a result may contain, including numbers, units, variables, unsolved expressions and functions etc. + + +There two different kinds of variables known and unknown. Known variables represents a fixed value, usually a number, while unknown variables represents a range or type of values (ex. a non-negative integer). + + +Some common constants that can only be approximately represented by a real number, such as pi and e, are special known variables. They are not fixed but are recalculated each time precision changes, thereby not compromising the arbitrary precision of Qalculate!. + + +The ans variable, which always contains the last calculated result, is another special and useful variable. + + +The unknown variables x, y and z are predefined. They cannot be deleted, but changed. By default they use the default assumptions. + + +For a complete list of available variables see or the variable manager. + + +Variable creation/editing +
+ Store Result + + + + + + + +
+ +The easiest way to create a known variable is to store the current result. This can be done by clicking the STO button or selecting FileStore Result.... Type a name for the variable in the dialog that pops up and optionally enter a category and descriptive name to keep variables well organized. + + +Known variables can also be created from scratch by selecting FileNewVariable or by clicking New in the variable manager. The value can then be filled in, in the text field below the name, and specified as exact or approximate. + +
+ New Variable + + + + + + + +
+ +The dialog for creation of unknown variables are accessed by selecting FileNewUnknown Variable. Instead of a value, an assumed type and sign can then be entered. + + +Edit a variable by clicking Edit in the variable manager. + + + +Variables stored in the Temporary category will not be saved after the program exit. + + +
+ +Vectors and Matrices + +Vectors and matrices are most effectively used stored in a variable. Qalculate! provides separate tools for these variables. They use a different dialog, where each element can be edited separately as in a spreadsheet. As with other variables, click Edit in the variable manager to edit a matrix/vector variable, but to create a new, select FileNewMatrix or FileNewVector. + +
+ Matrix/Vector Edit Dialog + + + + + + + +
+ +In this dialog, name, category and descriptive name are typed in as usual, but instead of a single value entry, the matrix/vector edit dialog has a table of entries. Select number of rows and columns above. In a vector this only determines how many value entries that are shown in the table and empty entries will be ignored. For matrices, each entry in the table is an element in the matrix. It is possible to switch between matrix and vector in the dialog (the menu item selected only determines the initial mode). + + + +Matrices and vectors can also be loaded from data files. These files most be plain text files with values organized in separated rows and columns. Select FileImport CSV File... and a dialog window pops up. First select the file to import and then specify whether if it shall be imported as a matrix or vectors. A name, descriptive name and category can optionally be typed in. If the name field is empty, the file name will be used instead. After that, the row in the file where the data starts should be specified. as well as whether this first row contains column headings. Finally the delimiter, used to separate columns in the file, must be selected. Click OK and variables will be generated from the file. If vectors are to be generated and the file contains more than one column, the name will be used as a subcategory and each variable will add the column heading (or Column 1, Column 2, ...) to the name and the descriptive name. + +
+ Import CSV Dialog + + + + + + + +
+ +The load() function can be used to access a CSV file directly in an expression. The reversed action is also available with export(), or the dialog accessed with FileExport CSV File... or from the variable manager. + +
+
+ + +Functions + +Functions are essentially mathematical formulas. They are used to store expressions with variable values, arguments. To execute a function, the values for a number of arguments need to specified. These arguments are then inserted into the expression, making it possible to calculate. + + +Functions is normally entered in an expression by writing the name followed by arguments, separated by commas (or semicolons in languages with comma as decimal point), in parenthesis, thus following the syntax name(arg1, arg2, ...). Qalculate! will give a helpful error message if the arguments are not correct. + +
+ Insert function dialog + + + + + + + +
+ +The insert function dialog presents an easy way to insert a function and its arguments. + + +Although it can lower the readability of an expression, it is perfectly legal to skip the parenthesis and put the arguments after a space, and end with a space or operator. This is most useful in short expressions with single argument functions (ex. sqrt 5). + + +Argument types include: + + Free — anything + Number — a numeric value + Integer — a whole number + Symbol — a defined or undefined unknown variable + Text — a free text string + Date — a date in local or standard format (Year-Month-Day, recommended) + Vector + Matrix + Boolean — 0 for false, 1 for true + Object — the name of a variable, function or unit + Variable — the name of a variable + Function — the name of a function + Unit — the name of a unit + File — the path to a file + Angle — an angle used in trigonometric functions, meaning a number and an angle unit. If no angle unit is included the default is used. + + + +The argument can be restricted by further conditions. For example that a number must be positive. + + +Available Functions + +Here the main function categories and some of their members are described, to give an overview of available functions. For information about separate functions and a complete list of all available functions see or the function manager. + + +Algebra + +Contains sum() and product(), which corresponds to the sum and product signs. solve() solves equations (ex. solve(x * 2 = 8) returns 4 meaning that x equals 4). Use solve2() and multisolve() to solve multiple equations with multiple variables. + + + +Calculus + +Includes diff(), which calculates the derivative of an expression with optional arguments with respect to (default x) and order (default 1), and a limited integration function. + + + +Combinatorics + +Contains functions such as perm() for permutations, comb() for combinations, and factorial(). + + + +Data Sets + +A data set consists of a set of properties and objects, which can be accessed by a function which takes two arguments — object and property. The function returns the object's value for the selected property. +For example, the data in the Elements data set is accessed with the atom() function, with the element (referenced using atomic symbol, number or name) and property (ex. weight) as arguments. +The special property info displays all properties of the object in a dialog window. + + + +Date & Time + +Includes days() and yearfrac() which returns the number of days and fractional years, respectively, between two dates. + + + +Exponents & Logarithms + +Standard logarithmic and exponential functions. ln() calculates the natural logarithm of a number, while log() allows a choice of base as the second argument. The exponential functions does not really add anything beyond the capabilities of the exponential operator, ^. + + + +Economics + +This essentially includes most of the financial functions that are usually found in spreadsheet applications. + + + +Elements + +This category includes functions to retrieve data such as atomic weight. The atom() function opens a window with available data of an element. These functions accept the number, symbol or name of the element as argument. The data are loaded on demand. + + + +Geometry + +Category with formulas mostly for calculation of circumference, area and volume of geometric shapes. + + + +Logical + +Some procedural functions mainly for use in other functions. These include if(), which tests a conditional expression and returns a value depending on if the expression evaluates true or false, and for(), which processes a value while a condition is true. + + + +Matrices & Vectors + +These are functions that generate, access and process matrices and vectors. The vector() function generates a vector from a variable number of arguments for elements, while matrix() first needs the number of rows and columns and then the elements from left to right. Matrices can also be imported directly from a CSV file with load(). + + +Separate elements at a specified row and column are accessed with element(). Other functions include det() for calculation of the determinant of a matrix and inverse() which returns the inverse of the given matrix, as well as functions such as sort() and rank(). + + + +Miscellaneous + +A category for functions that do not fit elsewhere. + + + +Number Theory + +Contains subcategories arithmetics, number bases, and rounding, in addition to functions such as abs(), which returns the absolute value of a number, and gcd(), the greatest common divisor. round() is the standard rounding function (note that halfway numbers are rounded to even). The functions for number bases translates a text string, representing an expression (bases that use letters does not allow variables, functions and units) with numbers in a different base, to a decimal number. Includes bin() for binary numbers, hex() for hexadecimal numbers, oct() for octal numbers and base() for numbers in a base between 2 and 36 specified in the second argument. + + + +Statistics + +Contains a lot of functions for descriptive statistics and some statistical tests. Data sets are stored as vectors. Generally, functions with a vector/data set as last argument can take elements/samples as a variable number of arguments directly instead of in a vector (ex. mean(1, 2, 3) equals mean(vector(1, 2, 3))). Also contains the rand() function, which returns a pseudo random number between 0 and 1, and does not take any arguments. + + + +Trigonometry + +Trigonometric functions, including sin(), cos(), tan(), sec(), csc(), cot(), and hyperbolic and inverse versions of those. These functions take as argument an angle. If the default angle unit (ModeAngle Unit) is set to none, the argument must have an angle unit appended (degrees, radians or gradians), otherwise the default unit will be appended automatically (and removed from result of inverse functions). + + + +Utilities + +Various utility functions. Most are only useful in definition of other functions. The save() function can however be a quick way of storing a value in a variable, and csum() can be a powerful tool for data processing. This category also contains some functions, such as char() and ascii(), that might be useful for programmers. , replace() provides an easy way of replacing unknown variables by known expressions in a value (ex. replace(5x^2+x, x, 3) equals 5*3^2+3). + + + + + + +Function creation/editing + +Functions are a bit more complex than variables, but can nevertheless be relatively easily created. FileNewFunction or click New in the function manager and the function edit dialog pops up. This dialog consists of two tabs/pages; the first with general descriptive information and the last for the function definition. First enter a name, used to reference the function in an expression. If an expression is entered a bit further down, then the function will already be fully working. A bit more does however need to be said about the function expression. + + +The expression of a function is basically a normal expression with placeholders for arguments. These placeholders consists of a backslash and a letter — x, y, z for the 1st, 2nd and 3rd arguments and a to u for argument 4 to 24. They are replaced by entered arguments when a function is calculated. The placeholders naturally also decide the number of arguments that a function requires. For example the function for triangle area (base * height / 2) has the name triangle and the expression (\x*\y)/2, which gives that triangle(2, 3) equals (2*3) / 2 and returns 3 as result. An argument can be used more than one time and all arguments must not necessarily be in order in the expression. +
+ Function Edit Dialog + + + + + + + +
+
+ +Additionally, optional arguments can be put in the expression with upper-case (X, Y, Z, ...) instead of lower-case letters (x, y, z, ...). The default value can be put in brackets after the letter (ex. \X{2}). The default value may be omitted and is then zero. All additional arguments after an optional argument must also be optional. + + +A condition that must be true (>0) for the function to be calculated, can optionally be entered in the text field below the expression. This follows the same conventions as function expressions. For example if the second argument must be higher than the first, \y > \x may be entered as condition. + + +Further, name, type and condition for each argument can be specified. + + +To keep functions well organized, supply a category, descriptive name and description. A function can also hidden from menus with the corresponding check box, which can be useful for sub functions. + + +Global, system-wide functions can not actually be changed by the user, but if one of these functions is edited, they are deactivated and seemingly replaced by a new function. This way global functions can be deleted by deactivation. Some functions are however hard-coded and cannot be changed by the user. + +
+
+ + +Units + +Units give numbers meaning in the real world. They specify what is measured by the numbers and the scale used. Qalculate! fully incorporates units in calculations and includes all standard SI units as well as many non-standard local units. +For a complete list of available units see or the unit manager. + + +Currency + +Among units, Qalculate! has support for currencies with up-to-date exchange rates. Currencies are normally referenced with the standard three letter code due to name clashes, but a number of currency unit can also be accessed through their regular name and symbol. U.S. dollars can, for example, be referenced both as USD and dollar/dollars, or with the $ symbol. + + +Current exchange rates are automatically fetched from the European Central Bank on the Internet, the first time Qalculate! is started. By default the exchange rates will thereafter have to be updated manually from FileUpdate Exchange Rates, unless automatic updates are enabled in the preferences dialog. + + + +Conversion + +Expressions can be converted to a specific unit directly in the expression entry with the to operator, which converts the left-hand expression to a specified unit (ex. 5 feet + 2 inches to cm converts the result of 5 feet + 2 inches to centimeters and displays it). Unit expressions may only contain units, prefixes, exponents, multiplication and division. Other elements are ignored. + + +The unit conversion dialog, accessible from the Convert button, EditConvert To Unit Expression... or CtrlT, can also be used. Enter a unit in the dialog that pops up, click Apply or OK and the displayed result is then converted. In this dialog, you can also select a unit from a list accessed by clicking Selector >>. When a unit is selected from the list the expression is updated and Apply automatically pressed. +
+ Unit Conversion Dialog + + + + + + + +
+
+ +The final way to convert to another unit is to use the predefined units in the EditConvert To Unit menu or press Convert Result in the unit manager. EditSet Prefix can be used to select a prefix. + + +It is also possible to let Qalculate! automagically convert the result to appropriate units with EditConvert To Best Unit or EditConvert To Base Units. If instead the corresponding choice is selected from ModeUnit Display, each result will automatically be converted until the choice is deactivated (ModeUnit DisplayNo Automatic Conversion). + +
+ +Unit creation/editing + +There are three different unit classes in Qalculate! — base, alias and composite units. Base units are units defined as basis for other units. Meters and seconds are typical base units. Alias units is defined in relation to another unit. For example, hour is defined as an alias unit that equals 60 minutes which in turn is defined in relation to seconds. Finally, composite units are defined by a unit expression with multiple units. Composite units often have an alias unit associated with them, as they do not have a reference name on their own. For example, a joule is defined as an alias defined in relation to a composite unit defined as Newton * meter. + + +Select FileNewUnit, or click New in the unit manager, and the unit edit dialog pops up. +
+ Unit Edit Dialog + + + + + + + +
+First the unit class needs to be selected. Depending on the unit class, different elements in the dialog will be enabled. For all units, category and descriptive name can be specified to keep them well organized. A unit can also be hidden from unit menus with the corresponding check box, which can be useful for some composite units. +
+ +Base and alias units normally have three different name forms defined for use in expressions — abbreviation (ex. m), singular (meter) and plural (meters). Composite units only have an internal name, used to reference the unit in definitions of other units. + + +For base units, the name is all that is needed. For alias units, on the other hand, a base unit, exponent and relation are necessary. For more complex relations an inverse relation can also be specified for conversion back from the base unit. The base unit must not necessarily be of the base unit class and it is recommended that an alias unit is defined in relation to the closest unit (ex. 1ft = 3 hands, 1 hand = 4 in, and 1 in = 0.0254 m). The relation is usually just a number that tells how large quantity of the base unit is needed to get the alias unit (alias unit = base unit * relation). More complex units can specify the relation as a full-blown expression where \x is replaced by the quantity of the base unit and \y is the exponent. For example, Degrees Celsius has the relation \x + 273.15 and the inverse relation \x − 273.15 to the base unit Kelvin. For simple relations, the reversion is automatic and ought not be defined separately. The check box below relation in the dialog specifies if the relation is exact or approximate. The exponent defines the exponential relation to the base unit, so that the alias unit equals the base unit raised to the exponent. For simple unit relations this gives: alias unit = relation * base unit^exponent. + + +Composite units need a unit expression with multiple units as base, in the base unit field. These expressions may only contain units, prefixes, exponents, multiplication and division (ex. km/h). + +
+
+ + +Plotting + +Plotting in Qalculate! is done through an external program, Gnuplot. Thus Gnuplot (>= v. 3.7) need to be installed on the computer for plotting to work. + + +To plot functions or data sets, select FilePlot Functions/Data, which brings up the plot dialog. The plot dialog consists of three tabs/pages — the first for the data, the second for the function range and sampling rate, and the last for control of function sampling and appearance. + +
+ Plot Data + + + + + + + +
+ +Plot functions are normal expressions that represents f(x) in y=f(x) (ex. sin(x)). The x can be specified as a different unknown variable (x, y, z) or a quoted text string (actually any mathematical expression which will then be matched in the plot expression and replaced by the values on the x axis) in the variable entry below the function/data list. + + +To plot a data set, enter an expression that results in a matrix or vector. Select Vector/Matrix below and vectors will appear as one series and matrices will appear with each column or row (if selected) as a series, If the paired matrix option instead is selected, the first column/row of the matrix will constitute the y-values and the second the x-values. + + +Type in an expression, press Enter and a new window will open with the plot. The title of the series, the diagram style and smoothing of the line can also be set. The series modified must be selected in the list and to apply changes click Apply. More series that will appear in the same plot window can be added. If the scale of the y values differ, series can be put on a secondary y-axis. + + + +Even though Qalculate! does all the calculations before handing over the data to Gnuplot, the resulting data must only consist of pure numbers, as Gnuplot knows nothing about the functions, variables, units, etc. of Qalculate!. + + + +For functions, the function range — min and max x value, and the number of values or the size of the step between each y value calculated — can be specified in the function range page. + +
+ Plot Settings + + + + + + + +
+ +A title can be set to appear at the top of the plot, as well as labels for the x and y axis. The appearance can also be controlled by selecting or disabling legend placement, displaying/hiding the grid and borders on the top and the right side of the diagram and choosing color or monochrome graphics. The x and y scales can be made logarithmic by clicking the box on the right and filling in a desired logarithmic base. + + +To update the plot window, click Apply at the bottom of the dialog. + +
+ Gnuplot + + + + + + + +
+ +The plot can be saved as an image file. Click Save and select a file name and folder. The extension of the file name will decide the file type (.png for PNG image, .svg for SVG, .ps for postscript, .eps for encapsulated postscript, .tex for LaTeX, and .fig for XFig). Default is to save as a PNG image. + +
+ + + + + +Credits and License + + +&qalculate_kde; + + +Program copyright 2005 Niklas Knutsson nq@altern.org + + + +Documentation copyright 2005 Niklas Knutsson nq@altern.org + + + + +&underFDL; + + + +&underGPL; + + + +&functionlist; +&variablelist; +&unitlist; + +&documentation.index; +
+ + + diff --git a/doc/en/qalculate_kde/insert-function.png b/doc/en/qalculate_kde/insert-function.png new file mode 100644 index 0000000..559e876 Binary files /dev/null and b/doc/en/qalculate_kde/insert-function.png differ diff --git a/doc/en/qalculate_kde/mainwindow.png b/doc/en/qalculate_kde/mainwindow.png new file mode 100644 index 0000000..e8a1914 Binary files /dev/null and b/doc/en/qalculate_kde/mainwindow.png differ diff --git a/doc/en/qalculate_kde/plot-data.png b/doc/en/qalculate_kde/plot-data.png new file mode 100644 index 0000000..cadd3ea Binary files /dev/null and b/doc/en/qalculate_kde/plot-data.png differ diff --git a/doc/en/qalculate_kde/plot-settings.png b/doc/en/qalculate_kde/plot-settings.png new file mode 100644 index 0000000..f6590be Binary files /dev/null and b/doc/en/qalculate_kde/plot-settings.png differ diff --git a/doc/en/qalculate_kde/rpn-mode.png b/doc/en/qalculate_kde/rpn-mode.png new file mode 100644 index 0000000..bf88634 Binary files /dev/null and b/doc/en/qalculate_kde/rpn-mode.png differ diff --git a/doc/en/qalculate_kde/store-variable.png b/doc/en/qalculate_kde/store-variable.png new file mode 100644 index 0000000..c5e7f1e Binary files /dev/null and b/doc/en/qalculate_kde/store-variable.png differ diff --git a/doc/en/qalculate_kde/unit-manager.png b/doc/en/qalculate_kde/unit-manager.png new file mode 100644 index 0000000..6157405 Binary files /dev/null and b/doc/en/qalculate_kde/unit-manager.png differ diff --git a/doc/en/qalculate_kde/units.docbook b/doc/en/qalculate_kde/units.docbook new file mode 100644 index 0000000..0020f2d --- /dev/null +++ b/doc/en/qalculate_kde/units.docbook @@ -0,0 +1,3455 @@ + +Unit List + +Angle + +Angular Acceleration + +Units: Angular Acceleration + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Radians per Second Squared +(rad_p_sqs) +rad/s^2 + + + + +
+
+ +Angular Velocity + +Units: Angular Velocity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Radians per Second +(rad_p_s) +rad/s + + + + +
+
+ +Plane Angle + +Units: Plane Angle + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Arcminute +arcminute / arcminutes +° +1/60 + + +Arcsecond +arcsecond / arcseconds +arcminute +1/60 + + +Degree +deg / ° / degree / degrees +rad +pi/180 + + +Gradian (Gon) +gra / gradian / gradians / gon / gons +rad +pi/200 + + +Meter per Meter +(m_p_m) +m/m + + + +Radian +rad / radian / radians +m_p_m +1 + + +Turn +turn / turns +° +360 + + + +
+
+ +Solid Angle + +Units: Solid Angle + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Square Meter per Square Meter +(sqm_p_sqm) +m^2/m^2 + + + +Steradian +sr / steradian / steradians +m_p_m +1 + + + +
+
+
+ +Area + +Units: Area + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Acre +acre / acres +ch^2 +10 + + +Are +a / are / ares +m^2 +100 + + +Barn +b / barn / barns +m^2 +1E-28 + + +Hectare +(ha) +ha + + + +Rood +rood / roods +yd^2 +1210 + + +Section +section / sections +mi^2 +1 + + +Square Foot +(sqft) +ft^2 + + + +Square Inch +(sqin) +in^2 + + + +Square Kilometer +(sqkm) +km^2 + + + +Square Meter +(sqm) +m^2 + + + +Square Mile +(sqmi) +mi^2 + + + +Township +township / townships +section +36 + + + +
+
+ +Currency + +Units: Currency + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Australian Dollars +AUD + +exchange rate + + +Austrian Schilling +ATS / schilling + +1/13.7603 + + +Belgian Franc +BEF + +1/40.3399 + + +British Pounds +GBP / £ + +exchange rate + + +Bulgarian Lev +lev / BGN + +exchange rate + + +Canadian Dollars +CAD + +exchange rate + + +Cent (USD) +¢ / cent / cents +$ +1/100 + + +Croatian Kuna +HRK + +exchange rate + + +Cypriot Pound +CYP + +exchange rate + + +Czech Koruna +CZK + +exchange rate + + +Danish Kroner +DKK + +exchange rate + + +Deutche Mark +DEM / mark + +1/1.95583 + + +Dutch Guilder +NLG / guilder + +1/2.20371 + + +Estonian Kroon +EEK + +exchange rate + + +Euro Cent +eurocent / eurocents + +1/100 + + +European Euros +EUR / € / euro / euros + + + + +Finnish Markka +FIM / markka + +1/5.94573 + + +French Franc +FRF / franc + +1/6.55957 + + +Greek Drachma +GRD + +1/340.750 + + +Hong Kong Dollars +HKD + +exchange rate + + +Hungarian Forint +forint / HUF + +exchange rate + + +Icelandic Krona +ISK + +exchange rate + + +Indonesian Rupiah +IDR + +exchange rate + + +Irish Pound +IEP + +1/0.787564 + + +Italian Lira +ITL / lira + +1/1936.27 + + +Japanese Yen +JPY / ¥ / yen + +exchange rate + + +Latvian Lat +lat / LVL + +exchange rate + + +Lithuanian Lit +lit / LTL + +exchange rate + + +Luxembourg Franc +LUF + +1/40.3399 + + +Malaysian Ringgit +MYR + +exchange rate + + +Maltese Lira +MTL + +exchange rate + + +New Zealand Dollars +NZD + +exchange rate + + +Norwegian Kroner +NOK + +exchange rate + + +Phillipine Peso +PHP + +exchange rate + + +Polish Zloty +zloty / PLN + +exchange rate + + +Portuguese Escudo +PTE / escudo + +1/200.482 + + +Romanian New Leu +leu / RON + +exchange rate + + +Russian Ruble +RUB / ruble + +exchange rate + + +Singapore Dollars +SGD + +exchange rate + + +Slovakian Koruna +SKK + +exchange rate + + +Slovenian Tolar +tolar / SIT + +exchange rate + + +South African Rand +ZAR + +exchange rate + + +South Korean Won +KRW + +exchange rate + + +Spanish Peseta +ESP / peseta / pesetas + +1/166.386 + + +Swedish Krona +SEK + +exchange rate + + +Swiss Francs +CHF + +exchange rate + + +Thai Bat +THB + +exchange rate + + +Turkish New Lira +TRY + +exchange rate + + +U.S. Dollars +$ / USD / dollar / dollars + +exchange rate + + +Yuan Renmimbi (PR China) +CNY + +exchange rate + + + +
+
+ +Electricity + +Capacitance + +Units: Capacitance + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Coulomb per Volt +(C_p_V) +C/V + + + +Farad +F / farad / farads +C_p_V +1 + + + +
+
+ +Current Density + +Units: Current Density + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Ampere per Meter Squared +(A_p_sqm) +A/m^2 + + + + +
+
+ +Electric Charge + +Units: Electric Charge + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Abcoulomb +abcoulomb / abcoulombs / abC / aC +C +10 + + +Coulomb +C / coulomb / coulombs +s_A +1 + + +Second Ampere +(s_A) +s A + + + +Statcoloumb (Franklin) +statcoulomb / statcoulombs / statC / franklin / Fr / franklins +C +3.3356410E-10 (approximate) + + + +
+
+ +Electric Charge Density + +Units: Electric Charge Density + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Coulomb per Cubic Meter +(C_p_cum) +C/m^3 + + + + +
+
+ +Electric Conductance + +Units: Electric Conductance + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Ampere per Volt +(A_p_V) +A/V + + + +Siemens +S / siemens +A_p_V +1 + + + +
+
+ +Electric Current + +Units: Electric Current + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Abampere +abampere / abA / aA / abamperes +A +10 + + +Ampere +A / ampere / amperes + + + + + +
+
+ +Electric Field Strength + +Units: Electric Field Strength + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Volt per Meter +(V_p_m) +V/m + + + + +
+
+ +Electric Flux Density + +Units: Electric Flux Density + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Coulomb per Meter Squared +(C_p_sqm) +C/m^2 + + + + +
+
+ +Electric Potential + +Units: Electric Potential + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Abvolt +abvolt / abvolts / abV +V +1E-8 + + +Statvolt +statvolt / statvolts / statV +V +299.792458 + + +Volt +V / volt / volts +W_p_A +1 + + +Watt per Ampere +(W_p_A) +W/A + + + + +
+
+ +Electric Resistance + +Units: Electric Resistance + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Abohm +abohm / abohms / abΩ +Ω +1E-9 + + +Ohm +Ω / ohm / ohms +V_p_A +1 + + +Statohm +statohm / statohms / statΩ +Ω +8.9875517874E11 (approximate) + + +Volt per Ampere +(V_p_A) +V/A + + + + +
+
+ +Inductance + +Units: Inductance + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Henry +H / henry / henrys +Wb_p_A +1 + + +Weber per Ampere +(Wb_p_A) +Wb/A + + + + +
+
+ +Permeability + +Units: Permeability + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Henry per Meter +(H_p_m) +H/m + + + + +
+
+ +Permittivity + +Units: Permittivity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Farad per Meter +(F_p_m) +F/m + + + + +
+
+
+ +Energy + +Units: Energy + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +British Thermal Unit (IT) +Btu +J +1055.056 + + +Calorie (15 degrees Celcius) +cal_fifteen +J +4.185880 (approximate) + + +Calorie (capital C) +Calorie / Calories +cal_IT +1000 + + +Calorie (international table) +cal_IT / cal / calorie / calories +J +4.1868 + + +Calorie (mean) +cal_mean +J +4.19002 (approximate) + + +Calorie (thermochemical) +cal_th +J +4.184 + + +Electron Volt +eV / electron_volt / electron_volts +J +1.602177E-19 (approximate) + + +Erg +erg / ergs +J +1E-7 + + +Foe +foe / foes +erg +1E51 + + +Foot-Pound Force +(ft_lbf) +ft lbf + + + +Joule +J / joule / joules +N_m +1 + + +Kilowatt Hour +(W_h) +kW h + + + +Watt Hour +(W_h) +W h + + + + +
+ +Energy Density + +Units: Energy Density + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Joule per Cubic Meter +(J_p_cum) +J/m^3 + + + + +
+
+ +Entropy + +Units: Entropy + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Joule per Kelvin +(J_p_K) +J/K + + + + +
+
+ +Molar Energy + +Units: Molar Energy + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Joule per Mole +(J_p_mol) +J/mol + + + + +
+
+ +Molar Entropy + +Units: Molar Entropy + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Joule per Mole Kelvin +(J_p_mol_K) +J/(mol K) + + + + +
+
+ +Power + +Units: Power + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Horse Power +hp / horsepower / horsepowers +W +745.699987158227022 + + +Joule per Second +(J_p_s) +J/s + + + +Pferdestärke +PS / pferdestärke +W +735.49875 + + +Watt +W / watt / watts +J_p_s +1 + + + +
+
+ +Specific Energy + +Units: Specific Energy + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Joule per Kilogram +(J_p_kg) +J/kg + + + + +
+
+ +Specific Entropy + +Units: Specific Entropy + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Joule per Kilogram Kelvin +(J_p_kg_K) +J/(kg K) + + + + +
+
+ +Thermal Conductivity + +Units: Thermal Conductivity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Watt per Meter Kelvin +(W_p_m_K) +W/(m K) + + + + +
+
+
+ +Force + +Units: Force + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Dyne +dyn / dyne / dynes +N +1E-5 + + +Kilopond (Kilogram-Force) +(kpond_c) +kpond + + + +Meter Kilogram per Second Squared +(m_kg_p_sqs) +m kg/s^2 + + + +Newton +N / newton / newtons +m_kg_p_sqs +1 + + +Pond (Gram-Force) +pond / ponds / gf +N +0.00980665 + + +Pound Foot per Second Squared +(lb_ft_p_sqs) +lb ft/s^2 + + + +Pound-force +lbf / pound_force +N +4.4482216152605 + + +Poundal +poundal / poundals / pdl +lb_ft_p_sqs +1 + + + +
+ +Dynamic Viscosity + +Units: Dynamic Viscosity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Pascal Second +(Pa_s) +Pa s + + + +Poise +P / poise / poises +Pa_s +0.1 + + + +
+
+ +Kinematic Viscosity + +Units: Kinematic Viscosity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Square Meter per Second +(sqm_p_s) +m^2/s + + + +Stokes +St / stokes +sqm_p_s +0.0001 + + + +
+
+ +Moment of Force + +Units: Moment of Force + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Newton Meter +(N_m) +N m + + + + +
+
+ +Pressure + +Units: Pressure + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Atmosphere +atm / atmosphere / atmospheres +Pa +101325 + + +Bar +bar / bars +Pa +100000 + + +Millimeter of Mercury +mmHg +atm +1/760 + + +Newton per Meter Squared +(N_p_sqm) +N/m^2 + + + +Pascal +Pa / pascal / pascals +N_p_sqm +1 + + +Pound-force per Square Inch +(lbf_p_sqin) +lbf/in^2 + + + +Pound-force per Square Inch (psi) +psi +lbf_p_sqin +1 + + +Torr +torr / torrs +atm +1/760 + + + +
+
+ +Surface Tension + +Units: Surface Tension + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Newton per Meter +(N_p_m) +N/m + + + + +
+
+
+ +Information + +Units: Information + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Bit +bit / bits + + + + +Byte (8-bit) +byte / bytes / octet / octets +bit +8 + + +Gibibit +(Gibit_c) +Gibit + + + +Gibibyte +(Gibyte_c) +Gibyte + + + +Gigabit +(Gbit_c) +Gbit + + + +Gigabyte +(Gbyte_c) +Gbyte + + + +Kibibit +(Kibit_c) +Kibit + + + +Kibibyte +(Kibyte_c) +Kibyte + + + +Kilobit +(kbit_c) +kbit + + + +Kilobyte +(kbyte_c) +kbyte + + + +Mebibit +(Mibit_c) +Mibit + + + +Mebibyte +(Mibyte_c) +Mibyte + + + +Megabit +(Mbit_c) +Mbit + + + +Megabyte +(Mbyte_c) +Mbyte + + + +Nibble +nibble / nibbles / nybble / nybbles / semioctet / semioctets +bit +4 + + +Terabit +(Tbit_c) +Tbit + + + +Terabyte +(Tbyte_c) +Tbyte + + + +Tribble +tribble / tribbles +nibble +3 + + +Word (16-bit) +word / words +bit +16 + + + +
+
+ +Length + +Units: Length + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Astronomical Unit +AU / astronomical_unit / astronomical_units +m +149578706600 + + +Centimeter +(cm_c) +cm + + + +Chain +ch / chain / chains +li +100 + + +Decimeter +(dm_c) +dm + + + +Fathom +fathom / fathoms +yd +2 + + +Foot +ft / foot / feet +hand +3 + + +Furlong +fur / furlong / furlongs +yd +220 + + +Hand +hand / hands +in +4 + + +Inch +in / inch / inches +m +0.0254 + + +Kilometer +(km_c) +km + + + +Light Year +ly / lightyear / lightyears +m +9460730472580800 + + +Link +li / link / links +ft +66/100 + + +Meter +m / meter / meters / metre / metres + + + + +Mil (1/1000 in) +mil / mils +in +0.001 + + +Mile +mi / mile / miles +ch +80 + + +Millimeter +(mm_c) +mm + + + +Nautical Mile +nautical_mile / nautical_miles +m +1852 + + +Parsec +pc / parsec / parsecs +AU +648000/pi + + +Rod (pole/perch) +rd / rod / rods +US_ft +16.5 + + +U.S. Survey Foot +US_ft / US_foot / US_feet +US_in +12 + + +U.S. Survey Inch +US_in / US_inch / US_inches +m +100/3937 + + +U.S. Survey Mile +US_mi / US_mile / US_miles +US_ft +5280 + + +Yard +yd / yard / yards +ft +3 + + +Ångström +Å / ångström / angstrom +m +1E-10 + + + +
+
+ +Light + +Illuminance + +Units: Illuminance + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Foot-Candle +fc / footcandle / footcandles +lm_p_sqft +1 + + +Lumen per Foot Squared +(lm_p_sqft) +lm/ft^2 + + + +Lumen per Meter Squared +(lm_p_sqm) +lm/m^2 + + + +Lux +lx / lux +lm_p_sqm +1 + + +Phot +ph / phot / phots +lx +10000 + + + +
+
+ +Irradiance + +Units: Irradiance + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Einstein per Meter Squared per Second +(einstein_p_sqm_p_s) +einstein/(s m^2) + + + +Microeinstein per Meter Squared per Second +(microeinstein_p_sqm_p_s) +µeinstein/(s m^2) + + + +Watt per Meter Squared +(W_p_sqm) +W/m^2 + + + + +
+
+ +Luminance + +Units: Luminance + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Candela per Meter Squared +(cd_p_sqm) +cd/m^2 + + + +Stilb +sb / stilb / stilbs +cd_p_sqm +10000 + + + +
+
+ +Luminous Flux + +Units: Luminous Flux + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Candela Steradian +(cd_sr) +cd sr + + + +Lumen +lm / lumen / lumens +cd_sr +1 + + + +
+
+ +Luminous Intensity + +Units: Luminous Intensity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Candela +cd / candela / candelas + + + + + +
+
+ +Radiance + +Units: Radiance + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Watt per Square Meter Steradian +(W_p_sqm_sr) +W/(sr m^2) + + + + +
+
+ +Radiant Intensity + +Units: Radiant Intensity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Watt per Steradian +(W_p_sr) +W/sr + + + + +
+
+
+ +Magnetism + +Magnetic Field Strength + +Units: Magnetic Field Strength + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Ampere per Meter +(A_p_m) +A/m + + + +Oersted +Oe / oersted / oersteds +A_p_m +1000/(4*pi) + + + +
+
+ +Magnetic Flux + +Units: Magnetic Flux + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Maxwell +Mx / maxwell / maxwells +Wb +1E-8 + + +Volt Seconds +(V_s) +V s + + + +Weber +Wb / weber / webers +V_s +1 + + + +
+
+ +Magnetic Flux Density + +Units: Magnetic Flux Density + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Gauss +gauss +T +0.0001 + + +Tesla +T / tesla / teslas +Wb_p_sqm +1 + + +Weber per Meter Squared +(Wb_p_sqm) +Wb/m^2 + + + + +
+
+ +Wave Number + +Units: Wave Number + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Reciprocal Meter +(recm) +m^-1 + + + + +
+
+
+ +Mass + +Units: Mass + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Carat +carat / carats +g +0.2 + + +Cental +cental / centals +lb +100 + + +Dram +dr / dram / drams +g +1.7718451953125 + + +Grain +gr / grain / grains +g +0.06479891 + + +Gram +g / gram / grams + + + + +Hektogram +(hg_c) +hg + + + +Kilogram +(kg_c) +kg + + + +Long Hundredweight +l_cwt / long_hundredweight / long_hundredweights +lb +112 + + +Long Ton +l_ton / long_ton / long_tons +lb +2240 + + +Metric Ton (Tonne) +t / tonne / tonnes / ton / tons +g +1000000 + + +Ounce +oz / ounce / ounces +dr +16 + + +Ounce (troy) +oz_t / troy_ounce / troy_ounces +pwt +20 + + +Pennyweight +pwt / pennyweight / pennyweights +gr +24 + + +Pfund +pfund +g +500 + + +Pound +lb / pound / pounds +oz +16 + + +Pound (troy) +lb_t / troy_pound / troy_pounds +oz_t +12 + + +Short Hundredweight +cwt / hundredweight / hundredweights +lb +100 + + +Short Ton +s_ton / short_ton / short_tons +lb +2000 + + +Stone +stone / stones +lb +14 + + +Zentner +zentner +pfund +100 + + + +
+ +Density + +Units: Density + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Atomic Mass Unit +u / atomic_mass_unit / atomic_mass_units +g_p_mol +1 + + +Gram per Cubic Centimeter +(g_p_cucm) +g/cm^3 + + + +Gram per Cubic Decimeter +(g_p_cudm) +g/dm^3 + + + +Gram per Mole +(g_p_mol) +g/mol + + + +Kilogram per Cubic Meter +(kg_p_cum) +kg/m^3 + + + + +
+
+ +Mass Fraction + +Units: Mass Fraction + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Kilogram per Kilogram +(kg_p_kg) +kg/kg + + + + +
+
+
+ +Radioactivity + +Units: Radioactivity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Becquerel +Bq / becquerel / becquerels +s^-1 +1 + + +Curie +Ci / curie / curies +Bq +3.7E10 + + + +
+ +Absorbed Dose + +Units: Absorbed Dose + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Gray +Gy / gray / grays +J_p_kg +1 + + +Rad +rad_radioactivity +Gy +1/100 + + + +
+
+ +Absorbed Dose Rate + +Units: Absorbed Dose Rate + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Gray per Second +(Gy_p_s) +Gy/s + + + + +
+
+ +Dose Equivalent + +Units: Dose Equivalent + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Rem +rem_radioactivity +Sv +1/100 + + +Sievert +Sv / sievert / sieverts +J_p_kg +1 + + + +
+
+ +Exposure + +Units: Exposure + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Coulomb per Kilogram +(C_p_kg) +C/kg + + + +Roentgen +R / roentgen / roentgens +C_p_kg +0.000258 + + + +
+
+
+ +Ratio + +Units: Ratio + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Bel +B / bel / bels +Np +0.5*ln(10) + + +Decibel +(dB_c) +dB + + + +Neper +Np / neper / nepers + + + + + +
+
+ +Speed + +Units: Speed + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Kilometer per Hour +(km_p_h) +km/h + + + +Knot +knot / knots +nautical_mile_p_h +1 + + +Meter per Second +(m_p_s) +m/s + + + +Miles per Hour +(mile_p_h) +mi/h + + + +Miles per Hour +mph +mile_p_h +1 + + +Nautical Mile per Hour +(nautical_mile_p_h) +nautical_mile/h + + + + +
+ +Acceleration + +Units: Acceleration + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Galileo +Gal / galileo / galileos +m_p_sqs +1/100 + + +Gee +gee / gees +m_p_sqs +9.80665 + + +Meter per Second Squared +(m_p_sqs) +m/s^2 + + + + +
+
+
+ +Substance + +Units: Substance + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Einstein +einstein / einsteins + + + + +Mole +mol / mole / moles + + + + + +
+ +Catalytic Activity + +Units: Catalytic Activity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Katal +kat / katal / katals +recs_mol +1 + + +Reciprocal Seconds Mole +(recs_mol) +mol/s + + + + +
+
+ +Catalytic Concentration + +Units: Catalytic Concentration + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Katal per Cubic Meter +(kat_p_cum) +kat/m^3 + + + + +
+
+ +Substance Concentration + +Units: Substance Concentration + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Mole per Cubic Meter +(mol_p_cum) +mol/m^3 + + + + +
+
+
+ +Temperature + +Units: Temperature + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Degree Celcius +oC / °C / celcius +K +\x + 273.15 + + +Degrees Fahrenheit +oF / °F / fahrenheit +K +(2298.35+5\x)/9 + + +Degrees Rankine +oR / °R / rankine +K +5\x/9 + + +Kelvin +K / kelvin / kelvins + + + + + +
+
+ +Time + +Units: Time + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Day +d / day / days +h +24 + + +Fortnight +fortnight / fortnights +week +2 + + +Hour +h / hour / hours +min +60 + + +Julian Year +year / years +d +365.25 + + +Minute +min / minute / minutes +s +60 + + +Second +s / second / seconds + + + + +Week +week / weeks +d +7 + + + +
+ +Frequency + +Units: Frequency + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Hertz +Hz / hertz +s^-1 +1 + + + +
+
+
+ +Volume + +Units: Volume + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Centiliter +(cl_c) +cL + + + +Cubic Inch +(cuin) +in^3 + + + +Cubic Meter +(cum) +m^3 + + + +Deciliter +(dl_c) +dL + + + +Liter +L / l / liter / liters / litre / litres +m^3 +0.001 + + +Milliliter +(ml_c) +mL + + + + +
+ +Cooking + +Units: Cooking + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Cup +cup / cups +L +0.250 + + +Dessertspoon +dessertspoon / dessertspoons +teaspoon +2 + + +Tablespoon +tablespoon / tablespoons +teaspoon +3 + + +Teaspoon +teaspoon / teaspoons +L +0.005 + + + +
+
+ +Fuel Economy + +Units: Fuel Economy + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Kilometer per Liter +(km_p_l) +km/L + + + +Liter per Kilometer +(l_p_km) +L/km + + + +Miles per Gallon +(mile_p_gal) +mi/gal + + + +Miles per Gallon +mpg +mile_p_gal +1 + + + +
+
+ +Imperial Capacity + +Units: Imperial Capacity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Imperial Bushel +UK_bu / imperial_bushel / imperial_bushels +UK_gal +8 + + +Imperial Fluid Drachm +UK_fl_dr / imperial_fluid_drachm / imperial_fluid_drachms +imperial_fluid_scuple +3 + + +Imperial Fluid Ounce +UK_fl_oz / imperial_fluid_ounce / imperial_fluid_ounces +L +0.0284130625 + + +Imperial Fluid Scuple +imperial_fluid_scuple / imperial_fluid_scuples +imperial_minim +20 + + +Imperial Gallon +UK_gal / imperial_gallon / imperial_gallons +UK_qt +4 + + +Imperial Gill +UK_gi / imperial_gill / imperial_gills +UK_fl_oz +5 + + +Imperial Minim +imperial_minim / imperial_minims +UK_fl_oz +1/480 + + +Imperial Pint +UK_pt / imperial_pint / imperial_pints +UK_gi +4 + + +Imperial Quart +UK_qt / imperial_quart / imperial_quarts +UK_pt +2 + + + +
+
+ +Specific Volume + +Units: Specific Volume + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +Cubic Meter per Kilogram +(cum_p_kg) +m^3/kg + + + + +
+
+ +U.S. Capacity + +Units: U.S. Capacity + + + + + + + +Title +Names +Base Unit(s) +Relation + + + + +U.S. Barrell (oil) +bbl / barrell / barrells +gal +42 + + +U.S. Bushel +bu / bushel / bushels +pk +4 + + +U.S. Dry Pint +dry_pt / dry_pint / dry_pints +in^3 +33.6003125 + + +U.S. Dry Quart +dry_qt / dry_quart / dry_quarts +dry_pt +2 + + +U.S. Fluid Drachm +fl_dr / fluid_drachm / fluid_drachms +minim +60 + + +U.S. Fluid Ounce +fl_oz / fluid_ounce / fluid_ounces +in^3 +231/128 + + +U.S. Gallon +gal / gallon / gallons +liq_qt +4 + + +U.S. Gill +gi / gill / gills +fl_oz +4 + + +U.S. Liquid Pints +liq_pt / liquid_pint / liquid_pints +gi +4 + + +U.S. Liquid Quarts +liq_qt / liquid_quart / liquid_quarts +liq_pt +2 + + +U.S. Minim +minim / minims +fl_oz +1/480 + + +U.S. Peck +pk / peck / pecks +dry_qt +8 + + + +
+
+
+
diff --git a/doc/en/qalculate_kde/variable-manager.png b/doc/en/qalculate_kde/variable-manager.png new file mode 100644 index 0000000..b33d9ea Binary files /dev/null and b/doc/en/qalculate_kde/variable-manager.png differ diff --git a/doc/en/qalculate_kde/variables.docbook b/doc/en/qalculate_kde/variables.docbook new file mode 100644 index 0000000..ab96abe --- /dev/null +++ b/doc/en/qalculate_kde/variables.docbook @@ -0,0 +1,631 @@ + +Variable List + +Basic Constants + +Variables: Basic Constants + + + + + + +Title +Names +Value + + + + +Apery's Constant +apery +zeta(3) + + +Archimede's Constant (pi) +π / pi +3.1415927 (approximate) + + +Catalan's Constant +catalan +0.91596559 (approximate) + + +Euler's Constant +γ / euler +0.57721566 (approximate) + + +Pythagora's Constant (sqrt 2) +pythagoras +sqrt(2) + + +The Base of Natural Logarithms (e) +e +2.7182818 (approximate) + + +The Golden Ratio +golden / φ +(1+sqrt(5))/2 + + + +
+
+ +Large Numbers + +Variables: Large Numbers + + + + + + +Title +Names +Value + + + + +Billion +billion +1E9 + + +Centillion +centillion +1E303 + + +Decillion +decillion +1E33 + + +Duodecillion +duodecillion +1E39 + + +Googol +googol +10^100 + + +Googolplex +googolplex +10^(10^100) + + +Hundred +hundred +1E2 + + +Million +million +1E6 + + +Nonillion +nonillion +1E30 + + +Novemdecillion +novemdecillion +1E60 + + +Octillion +octillion +1E27 + + +Octodecillion +octodecillion +1E57 + + +Quadrillion +quadrillion +1E15 + + +Quattuordecillion +quattuordecillion +1E45 + + +Quindecillion +quindecillion +1E48 + + +Quintillion +quintillion +1E18 + + +Septendecillion +septendecillion +1E54 + + +Septillion +septillion +1E24 + + +Sexdecillion +sexdecillion +1E51 + + +Sextillion +sextillion +1E21 + + +Thousand +thousand +1E3 + + +Tredecillion +tredecillion +1E42 + + +Trillion +trillion +1E12 + + +Undecillion +undecillion +1E36 + + +Vigintillion +vigintillion +1E63 + + + +
+
+ +Physical Constants + +Atomic and Nuclear Constants + +Variables: Atomic and Nuclear Constants + + + + + + +Title +Names +Value + + + + +Alpha Particle Mass +alpha_particle_mass / m_α +6.6446565E-24*g (approximate) + + +Bohr Radius +bohr_radius / a_o +0.5291772108E-10*m (approximate) + + +Classical Electron Radius +classical_electron_radius / r_e +2.817940325E-15*m (approximate) + + +Compton Wavelength +compton_wavelength / λ_C +2.426310238E-12*m (approximate) + + +Electron Mass +electron_mass / m_e +9.1093826E-28*g (approximate) + + +Helion Mass +helion_mass / m_h +5.00641214E-24*g (approximate) + + +Neutron Mass +neutron_mass / m_n +1.67492728E-24*g (approximate) + + +Proton Mass +proton_mass / m_p +1.67262171E-24*g (approximate) + + +Rydberg Constant +rydberg / R_∞ +10973731.568525*m^(-1) (approximate) + + +Tau Mass +tau_mass / m_τ +3.16777E-24*g (approximate) + + + +
+
+ +Electromagnetic Constants + +Variables: Electromagnetic Constants + + + + + + +Title +Names +Value + + + + +Borh Magneton +bohr_magneton / μ_B +927.400949E-26*J*T^(-1) (approximate) + + +Conductance Quantum +conductance_quantum / G_0 +7.748091733E-5*S (approximate) + + +Elementary Charge +elementary_charge / e_charge +1.60217653E-19*C (approximate) + + +Josephson Constant +josephson / K_J +483597.879E9*Hz*V^(-1) (approximate) + + +Magnetic Flux Quantum +magnetic_flux_quantum / Φ_0 +2.06783372E-15*Wb (approximate) + + +Nuclear Magneton +nuclear_magneton / μ_N +5.05078343E-27*J*T^(-1) (approximate) + + +von Klitzing Constant +klitzing / R_K +25812.807449*ohm (approximate) + + + +
+
+ +Physico-Chemical Constants + +Variables: Physico-Chemical Constants + + + + + + +Title +Names +Value + + + + +Atomic Mass Constant +atomic_mass / m_u +1.66053886E-24*g (approximate) + + +Avogadro Constant +avogadro / N_A +6.0221415E23*mol^(-1) (approximate) + + +Boltzmann Constant +boltzmann +1.3806505E-23*J*K^(-1) (approximate) + + +Faraday Constant +faraday +96485.3383*C*mol^(-1) (approximate) + + +First Radiation Constant +first_radiation / c_1 +3.74177138E-16*W*m^2 (approximate) + + +Ideal Gas Constant +ideal_gas +8.314472*J*K^(-1)*mol^(-1) (approximate) + + +Second Radiation Constant +second_radiation / c_2 +1.4387752E-2*m*K (approximate) + + + +
+
+ +Universal Constants + +Variables: Universal Constants + + + + + + +Title +Names +Value + + + + +Characteristic Impedance of Vacuum +characteristic_impedance / Z_0 +4E-7*pi*299792458*ohm + + +Electric Constant (Permittivity of Free Space) +electric_constant / ε_0 +1/(4E-7*pi*299792458^2)*F*m^(-1) + + +Magnetic Constant (Permeability of Free Space) +magnetic_constant / μ_0 +4E-7*pi*N*A^(-2) + + +Newtonian Constant of Gravitation +newtonian_constant / G +6.6742E-11*m^3*kg^(-1)*s^(-2) (approximate) + + +Planck Constant +planck +6.6260693E-34*J*s (approximate) + + +Planck Constant over 2 pi +planck2pi +planck/(2*pi) + + +Planck Length +planck_length / l_P +1.61624E-35*m (approximate) + + +Planck Mass +planck_mass / m_P +2.17645E-5*g (approximate) + + +Planck Temperature +planck_temperature / T_P +1.41679E32*K (approximate) + + +Planck Time +planck_time / t_P +5.39121E-44*s (approximate) + + +Speed of Light in Vacuum +c / speed_of_light +299792458*m*s^(-1) + + + +
+
+
+ +Small Numbers + +Variables: Small Numbers + + + + + + +Title +Names +Value + + + + +Per Mille +permille / ‰ +1/1000 + + +Per Myriad +permyriad / ‱ +1/10000 + + +Procent +% / procent +1/100 + + + +
+
+ +Special Numbers + +Variables: Special Numbers + + + + + + +Title +Names +Value + + + + +False +false / no +0 + + +Imaginary i (sqrt -1) +i +i + + +Infinity +infinity +infinity + + +Negative Infinity +minus_infinity +-(+infinity) + + +Positive Infinity +plus_infinity +(+infinity) + + +True +true / yes +1 + + +Undefined +undefined +undefined + + + +
+
+ +Temporary + +Variables: Temporary + + + + + + +Title +Names +Value + + + + +Answer 2 +ans2 +a previous result + + +Answer 3 +ans3 +a previous result + + +Answer 4 +ans4 +a previous result + + +Answer 5 +ans5 +a previous result + + +Last Answer +ans / answer / ans1 +a previous result + + + +
+
+ +Unknowns + +Variables: Unknowns + + + + + + +Title +Names +Value + + + + +x +x +default assumptions + + +y +y +default assumptions + + +z +z +default assumptions + + + +
+
+
diff --git a/po/Makefile.am b/po/Makefile.am new file mode 100644 index 0000000..02dd0c1 --- /dev/null +++ b/po/Makefile.am @@ -0,0 +1,2 @@ +POFILES = AUTO + diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..8df6eef --- /dev/null +++ b/po/fr.po @@ -0,0 +1,2639 @@ +# translation of fr.po to Français +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Nicolas Laug , 2006. +# Nicolas Laug , 2006. +msgid "" +msgstr "" +"Project-Id-Version: fr\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-05-08 14:44+0200\n" +"PO-Revision-Date: 2006-11-16 14:41-0500\n" +"Last-Translator: Nicolas Laug \n" +"Language-Team: Français \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#: _translatorinfo.cpp:1 +msgid "" +"_: NAME OF TRANSLATORS\n" +"Your names" +msgstr "Nicolas Laug" + +#: _translatorinfo.cpp:3 +msgid "" +"_: EMAIL OF TRANSLATORS\n" +"Your emails" +msgstr "nicologmail-traduction@yahoo.fr" + +#: kqalculate.cpp:264 +msgid "Remove from System Tray" +msgstr "Enlever de la boîte à miniatures" + +#: kqalculate.cpp:265 qalculateeditdatasetdialog.cpp:471 +#: qalculateplotdialog.cpp:226 +msgid "Hide" +msgstr "Cacher" + +#: kqalculate.cpp:286 kqalculate.cpp:4484 kqalculate.cpp:5915 +msgid "Enter" +msgstr "Entrée" + +#: kqalculate.cpp:287 kqalculate.cpp:513 kqalculate.cpp:4485 +#: kqalculate.cpp:4492 kqalculate.cpp:5916 +msgid "=" +msgstr "=" + +#: kqalculate.cpp:289 kqalculate.cpp:514 kqalculate.cpp:4489 +#: kqalculate.cpp:4490 +msgid "Calculate expression and add to stack" +msgstr "Calculer l'expression et l'ajouter à la pile" + +#: kqalculate.cpp:290 kqalculate.cpp:515 kqalculate.cpp:4493 +#: kqalculate.cpp:4494 +msgid "Calculate expression" +msgstr "Calculer l'expression" + +#: kqalculate.cpp:296 kqalculate.cpp:5918 +msgid "Store" +msgstr "Enregistrer" + +#: kqalculate.cpp:298 +msgid "Store result as variable" +msgstr "Enregistrer le résultat dans une variable" + +#: kqalculate.cpp:301 kqalculate.cpp:5920 qalculateconvertunitsdialog.cpp:42 +msgid "Convert" +msgstr "Convertir" + +#: kqalculate.cpp:303 +msgid "Convert units in result" +msgstr "Changer les unités du résultat." + +#: kqalculate.cpp:313 +msgid "Enter expression here" +msgstr "Entrez une expression ici" + +#: kqalculate.cpp:322 +msgid "status" +msgstr "état" + +#: kqalculate.cpp:354 qalculateeditdataobjectdialog.cpp:71 +msgid "Exact" +msgstr "Exact" + +#: kqalculate.cpp:355 +msgid "Toggle exact mode" +msgstr "Basculer le mode exact" + +#: kqalculate.cpp:358 kqalculate.cpp:1070 +msgid "Fraction" +msgstr "Fraction" + +#: kqalculate.cpp:359 +msgid "Toggle fractional display" +msgstr "Basculer l'affichage en fraction" + +#: kqalculate.cpp:363 +msgid "Numerical display" +msgstr "Affichage numérique" + +#: kqalculate.cpp:366 kqalculate.cpp:1046 qalculateresultdisplay.cpp:288 +msgid "Normal" +msgstr "Normal" + +#: kqalculate.cpp:367 kqalculate.cpp:1048 qalculateresultdisplay.cpp:291 +msgid "Engineering" +msgstr "" + +#: kqalculate.cpp:368 kqalculate.cpp:1050 qalculateresultdisplay.cpp:294 +msgid "Scientific" +msgstr "Scientifique" + +#: kqalculate.cpp:369 +msgid "Pure" +msgstr "Pur" + +#: kqalculate.cpp:370 kqalculate.cpp:1054 +msgid "Simple" +msgstr "Simple" + +#: kqalculate.cpp:372 +msgid "Base in result" +msgstr "Base du résultat" + +#: kqalculate.cpp:376 kqalculate.cpp:1029 qalculatesetbasedialog.cpp:35 +#: qalculatesetbasedialog.cpp:48 +msgid "Binary" +msgstr "Binaire" + +#: kqalculate.cpp:377 kqalculate.cpp:1031 qalculatesetbasedialog.cpp:36 +#: qalculatesetbasedialog.cpp:49 +msgid "Octal" +msgstr "Octale" + +#: kqalculate.cpp:378 kqalculate.cpp:1033 kqalculate.cpp:1066 +#: qalculatesetbasedialog.cpp:37 qalculatesetbasedialog.cpp:50 +msgid "Decimal" +msgstr "Décimale" + +#: kqalculate.cpp:379 kqalculate.cpp:1035 qalculatesetbasedialog.cpp:38 +#: qalculatesetbasedialog.cpp:51 +msgid "Hexadecimal" +msgstr "Hexadécimale" + +#: kqalculate.cpp:380 kqalculate.cpp:1039 qalculatesetbasedialog.cpp:42 +msgid "Sexagesimal" +msgstr "Sexagésimale" + +#: kqalculate.cpp:381 kqalculate.cpp:1041 +msgid "Time Format" +msgstr "Format de l'heure" + +#: kqalculate.cpp:383 kqalculate.cpp:1037 +msgid "Other..." +msgstr "Autre..." + +#: kqalculate.cpp:389 +msgid "f(x)" +msgstr "f(x)" + +#: kqalculate.cpp:393 +msgid "Open functions manager" +msgstr "Ouvrir le gestionnaire de fonctions" + +#: kqalculate.cpp:395 +msgid "sqrt" +msgstr "sqrt" + +#: kqalculate.cpp:396 +msgid "Square root" +msgstr "Racine carrée" + +#: kqalculate.cpp:399 kqalculate.cpp:947 +msgid "xy" +msgstr "xy" + +#: kqalculate.cpp:400 +msgid "Raise (Ctrl+*)" +msgstr "Élever (Ctrl+*)" + +#: kqalculate.cpp:403 kqalculate.cpp:946 +msgid "x2" +msgstr "x2" + +#: kqalculate.cpp:404 +msgid "Square" +msgstr "Carré" + +#: kqalculate.cpp:406 +msgid "log" +msgstr "log" + +#: kqalculate.cpp:407 +msgid "Base-10 logarithm" +msgstr "Logarithme en base 10" + +#: kqalculate.cpp:409 +msgid "ln" +msgstr "ln" + +#: kqalculate.cpp:410 +msgid "Natural logarithm" +msgstr "Logarithme népérien (naturel)" + +#: kqalculate.cpp:412 +msgid "x!" +msgstr "x!" + +#: kqalculate.cpp:413 +msgid "Factorial" +msgstr "Factorielle" + +#: kqalculate.cpp:415 +msgid "cos" +msgstr "cos" + +#: kqalculate.cpp:416 +msgid "Cosine" +msgstr "Cosinus" + +#: kqalculate.cpp:418 +msgid "tan" +msgstr "tan" + +#: kqalculate.cpp:419 +msgid "Tangent" +msgstr "Tangente" + +#: kqalculate.cpp:421 +msgid "hyp" +msgstr "hyp" + +#: kqalculate.cpp:422 +msgid "Toggle hyperbolic functions" +msgstr "Basculer les fonctions hyperboliques" + +#: kqalculate.cpp:425 +msgid "inv" +msgstr "inv" + +#: kqalculate.cpp:426 +msgid "Toggle inverse functions" +msgstr "Basculer les fonctions réciproques" + +#: kqalculate.cpp:429 +msgid "sin" +msgstr "sin" + +#: kqalculate.cpp:430 +msgid "Sine" +msgstr "Sinus" + +#: kqalculate.cpp:435 +msgid "Deg" +msgstr "Deg" + +#: kqalculate.cpp:436 +msgid "Angle Unit: Degrees" +msgstr "Unité d'angle : Degré" + +#: kqalculate.cpp:439 +msgid "Rad" +msgstr "Rad" + +#: kqalculate.cpp:440 +msgid "Angle Unit: Radians" +msgstr "Unité d'angle : Radian" + +#: kqalculate.cpp:443 +msgid "Gra" +msgstr "Gr" + +#: kqalculate.cpp:444 +msgid "Angle Unit: Gradians" +msgstr "Unité d'angle : Grade" + +#: kqalculate.cpp:447 kqalculate.cpp:1094 kqalculate.cpp:1152 +#: qalculateplotdialog.cpp:126 +msgid "None" +msgstr "Aucun" + +#: kqalculate.cpp:464 +msgid "7" +msgstr "7" + +#: kqalculate.cpp:466 +msgid "8" +msgstr "8" + +#: kqalculate.cpp:468 +msgid "9" +msgstr "9" + +#: kqalculate.cpp:470 +msgid "4" +msgstr "4" + +#: kqalculate.cpp:472 +msgid "5" +msgstr "5" + +#: kqalculate.cpp:474 +msgid "6" +msgstr "6" + +#: kqalculate.cpp:476 +msgid "1" +msgstr "1" + +#: kqalculate.cpp:478 +msgid "2" +msgstr "2" + +#: kqalculate.cpp:480 +msgid "3" +msgstr "3" + +#: kqalculate.cpp:482 +msgid "0" +msgstr "0" + +#: kqalculate.cpp:485 +msgid "Decimal point" +msgstr "Point décimal" + +#: kqalculate.cpp:487 +msgid "EXP" +msgstr "EXP" + +#: kqalculate.cpp:488 +msgid "10^x (Ctrl+Shift+E)" +msgstr "" + +#: kqalculate.cpp:491 +msgid "Del" +msgstr "Eff" + +#: kqalculate.cpp:494 +msgid "AC" +msgstr "AC" + +#: kqalculate.cpp:498 +msgid "Multiply" +msgstr "Multiplier" + +#: kqalculate.cpp:501 +msgid "Divide" +msgstr "Diviser" + +#: kqalculate.cpp:507 +msgid "Subtract" +msgstr "Soustraire" + +#: kqalculate.cpp:509 +msgid "Ans" +msgstr "Préc." + +#: kqalculate.cpp:510 +msgid "Previous result" +msgstr "Résultat précédent" + +#: kqalculate.cpp:512 kqalculate.cpp:4488 +msgid "Ent" +msgstr "Ent" + +#: kqalculate.cpp:535 +msgid "Index" +msgstr "Index" + +#: kqalculate.cpp:536 qalculateeditdataobjectdialog.cpp:49 +#: qalculatevariablesdialog.cpp:61 +msgid "Value" +msgstr "Valeur" + +#: kqalculate.cpp:555 kqalculate.cpp:5924 +msgid "Up" +msgstr "Haut" + +#: kqalculate.cpp:556 +msgid "Move selected register up" +msgstr "Déplacer le registre sélectionné vers le haut" + +#: kqalculate.cpp:560 kqalculate.cpp:5926 +msgid "Down" +msgstr "Bas" + +#: kqalculate.cpp:561 +msgid "Move selected register down" +msgstr "Déplacer le registre sélectionné vers le bas" + +#: kqalculate.cpp:566 +msgid "Edit value of selected register" +msgstr "Éditer la valeur du registre sélectionné" + +#: kqalculate.cpp:571 +msgid "Delete selected register" +msgstr "Effacer le registre sélectionné" + +#: kqalculate.cpp:576 +msgid "Clear the RPN stack" +msgstr "Vider la pile NPI" + +#: kqalculate.cpp:592 +msgid "Keypad" +msgstr "Clavier" + +#: kqalculate.cpp:593 +msgid "Show/hide keypad" +msgstr "Afficher/cacher le clavier" + +#: kqalculate.cpp:596 +msgid "History" +msgstr "Historique" + +#: kqalculate.cpp:597 +msgid "Show/hide history" +msgstr "Afficher/Cacher l'historique" + +#: kqalculate.cpp:600 +msgid "RPN Stack" +msgstr "Pile NPI" + +#: kqalculate.cpp:601 +msgid "Show/hide RPN stack" +msgstr "Afficher/Cacher la pile NPI" + +#: kqalculate.cpp:716 kqalculate.cpp:2527 +msgid "RPN Register Moved" +msgstr "Registre NPI déplacé" + +#: kqalculate.cpp:752 kqalculate.cpp:784 kqalculate.cpp:2138 +#: kqalculate.cpp:2702 kqalculate.cpp:2739 +msgid "approx." +msgstr "approx." + +#: kqalculate.cpp:894 kqalculate.cpp:4813 +msgid "Load meta mode: %1" +msgstr "" + +#: kqalculate.cpp:966 +msgid "Qalculate! - Scientific Calculator" +msgstr "Qalculate! - Caculatrice Scientifique" + +#: kqalculate.cpp:985 qalculateeditfunctiondialog.cpp:601 +#: qalculateresultdisplay.cpp:62 +msgid "Variable" +msgstr "Variable" + +#: kqalculate.cpp:986 qalculateeditfunctiondialog.cpp:596 +#: qalculateeditmatrixvectordialog.cpp:106 qalculateimportcsvdialog.cpp:52 +#: qalculateinsertmatrixvectordialog.cpp:85 +#: qalculateinsertmatrixvectordialog.cpp:310 +msgid "Matrix" +msgstr "Matrice" + +#: kqalculate.cpp:987 qalculateeditfunctiondialog.cpp:595 +#: qalculateeditmatrixvectordialog.cpp:109 +#: qalculateinsertmatrixvectordialog.cpp:88 +#: qalculateinsertmatrixvectordialog.cpp:308 +msgid "Vector" +msgstr "Vecteur" + +#: kqalculate.cpp:988 +msgid "Unknown Variable" +msgstr "Variable Inconnue" + +#: kqalculate.cpp:989 qalculateeditdatasetdialog.cpp:70 +#: qalculateeditfunctiondialog.cpp:71 qalculateeditfunctiondialog.cpp:599 +#: qalculateplotdialog.cpp:98 qalculateresultdisplay.cpp:92 +msgid "Function" +msgstr "Fonction" + +#: kqalculate.cpp:990 qalculatedatasetsdialog.cpp:64 +msgid "Data Set" +msgstr "Ensemble de données" + +#: kqalculate.cpp:991 qalculateconvertunitsdialog.cpp:68 +#: qalculateeditfunctiondialog.cpp:600 qalculateresultdisplay.cpp:67 +#: qalculateunitsdialog.cpp:67 +msgid "Unit" +msgstr "Unité" + +#: kqalculate.cpp:992 +msgid "Import CSV File..." +msgstr "Importer un fichier CSV..." + +#: kqalculate.cpp:993 +msgid "Export CSV File..." +msgstr "Exporter un fichier CSV..." + +#: kqalculate.cpp:994 +msgid "Store Result..." +msgstr "Enregistrer le résultat..." + +#: kqalculate.cpp:995 +msgid "Save Result Image..." +msgstr "Enregistrer l'image du résultat..." + +#: kqalculate.cpp:996 +msgid "Save Definitions" +msgstr "Enregistrer les définitions" + +#: kqalculate.cpp:997 +msgid "Update Exchange Rates" +msgstr "Mettre à jour les taux d'échange" + +#: kqalculate.cpp:998 +msgid "Plot Functions/Data" +msgstr "Tracer des fonctions/données" + +#: kqalculate.cpp:1000 +msgid "Convert Number Bases" +msgstr "Convertir des bases de nombres" + +#: kqalculate.cpp:1001 qalculateperiodictabledialog.cpp:40 +msgid "Periodic Table" +msgstr "Table périodique" + +#: kqalculate.cpp:1008 +msgid "Show/hide main Qalculate! window" +msgstr "" + +#: kqalculate.cpp:1011 +#, fuzzy +msgid "Configure &Global Shortcuts..." +msgstr "Configurer Qalculate!" + +#: kqalculate.cpp:1013 +msgid "Manage Variables" +msgstr "Gérer les variables" + +#: kqalculate.cpp:1014 +msgid "Manage Functions" +msgstr "Gérer les fonctions" + +#: kqalculate.cpp:1015 +msgid "Manage Units" +msgstr "Gérer les unités" + +#: kqalculate.cpp:1016 +msgid "Manage Data Sets" +msgstr "Gérer les ensembles de données" + +#: kqalculate.cpp:1017 kqalculate.cpp:1150 +msgid "Factorize" +msgstr "Factoriser" + +#: kqalculate.cpp:1018 kqalculate.cpp:1148 +msgid "Simplify" +msgstr "Simplifier" + +#: kqalculate.cpp:1019 +msgid "Set Unknowns..." +msgstr "Définir les inconnues..." + +#: kqalculate.cpp:1020 +msgid "Convert to Unit Expression..." +msgstr "Convertir en expression d'unités..." + +#: kqalculate.cpp:1021 kqalculate.cpp:1084 +msgid "Convert to Base Units" +msgstr "Convertir en unités de base" + +#: kqalculate.cpp:1022 kqalculate.cpp:1086 +msgid "Convert to Best Unit" +msgstr "Convertir vers la meilleure unité" + +#: kqalculate.cpp:1023 +msgid "Insert Matrix..." +msgstr "Insérer une matrice..." + +#: kqalculate.cpp:1024 +msgid "Insert Vector..." +msgstr "Insérer un vecteur" + +#: kqalculate.cpp:1025 +msgid "Copy Result" +msgstr "Copier le résultat" + +#: kqalculate.cpp:1026 +msgid "Clear History" +msgstr "Vider l'historique" + +#: kqalculate.cpp:1027 +msgid "Configure Qalculate!" +msgstr "Configurer Qalculate!" + +#: kqalculate.cpp:1043 +msgid "Roman Numerals" +msgstr "Chiffres romains" + +#: kqalculate.cpp:1045 +msgid "Select Result and Expression Base..." +msgstr "Sélectionner la base du résultat et de l'expression..." + +#: kqalculate.cpp:1052 +msgid "Purely Scientific" +msgstr "Purement scientifique" + +#: kqalculate.cpp:1056 +msgid "Indicate Infinite Series" +msgstr "Indiquer les suites infinies" + +#: kqalculate.cpp:1058 +msgid "Sort Minus Last" +msgstr "" + +#: kqalculate.cpp:1060 +#, fuzzy +msgid "Negative Exponents" +msgstr "Strictement négatif" + +#: kqalculate.cpp:1062 +msgid "Show Ending Zeroes" +msgstr "Afficher les zéros de fin" + +#: kqalculate.cpp:1064 +msgid "Round Halfway Numbers to Even" +msgstr "Arrondir les nombres à mi-chemin au nombre inférieur" + +#: kqalculate.cpp:1068 +msgid "Decimal (Try Exact)" +msgstr "Décimal (essayer exact)" + +#: kqalculate.cpp:1072 +msgid "Combined" +msgstr "Combiné" + +#: kqalculate.cpp:1074 +msgid "Enable Prefixes" +msgstr "Activer les préfixes" + +#: kqalculate.cpp:1076 +msgid "Enable Use of All SI Prefixes" +msgstr "Activer l'utilisation de tous les préfixes SI" + +#: kqalculate.cpp:1078 +msgid "Enable Denominator Prefixes" +msgstr "Activer les préfixes de dénominateur" + +#: kqalculate.cpp:1080 +msgid "Place Units Separately" +msgstr "Placer les unités séparément" + +#: kqalculate.cpp:1082 +msgid "No Automatic Conversion" +msgstr "Pas de conversion automatique" + +#: kqalculate.cpp:1088 +msgid "Degrees" +msgstr "Dégrés" + +#: kqalculate.cpp:1090 +msgid "Radians" +msgstr "Radians" + +#: kqalculate.cpp:1092 +msgid "Gradians" +msgstr "Grades" + +#: kqalculate.cpp:1096 +msgid "Abbreviate Names" +msgstr "Noms abrégés" + +#: kqalculate.cpp:1098 +msgid "Enable Variables" +msgstr "Activer les variables" + +#: kqalculate.cpp:1100 +msgid "Enable Functions" +msgstr "Activer les fonctions" + +#: kqalculate.cpp:1102 +msgid "Enable Units" +msgstr "Activer les unités" + +#: kqalculate.cpp:1104 +msgid "Enable Unknowns" +msgstr "Activer les inconnues" + +#: kqalculate.cpp:1106 +msgid "Calculate Variables" +msgstr "Calculer les variables" + +#: kqalculate.cpp:1108 +msgid "Allow Complex Result" +msgstr "Autoriser les résultats complexes" + +#: kqalculate.cpp:1110 +msgid "Allow Infinite Result" +msgstr "Autoriser les résultats infinis" + +#: kqalculate.cpp:1112 +msgid "Try Exact" +msgstr "Essayer les résultats exacts" + +#: kqalculate.cpp:1114 +msgid "Always Exact" +msgstr "Toujours exact" + +#: kqalculate.cpp:1116 qalculateeditdataobjectdialog.cpp:70 +msgid "Approximate" +msgstr "Approximer" + +#: kqalculate.cpp:1118 kqalculate.cpp:1132 +#: qalculateeditunknownvariabledialog.cpp:65 +#: qalculateeditunknownvariabledialog.cpp:78 +#: qalculateperiodictabledialog.cpp:235 +msgid "Unknown" +msgstr "Inconnue" + +#: kqalculate.cpp:1120 qalculateeditunknownvariabledialog.cpp:66 +msgid "Not Matrix" +msgstr "Non matriciel" + +#: kqalculate.cpp:1122 qalculateeditdatasetdialog.cpp:468 +#: qalculateeditfunctiondialog.cpp:590 +#: qalculateeditunknownvariabledialog.cpp:67 +msgid "Number" +msgstr "Nombre" + +#: kqalculate.cpp:1124 +msgid "Complex" +msgstr "Complexe" + +#: kqalculate.cpp:1126 +msgid "Real" +msgstr "Réel" + +#: kqalculate.cpp:1128 +msgid "Rational" +msgstr "Rationnel" + +#: kqalculate.cpp:1130 qalculateeditfunctiondialog.cpp:591 +#: qalculateeditunknownvariabledialog.cpp:71 +msgid "Integer" +msgstr "Entier" + +#: kqalculate.cpp:1134 qalculateeditunknownvariabledialog.cpp:83 +msgid "Non-Zero" +msgstr "Non nul" + +#: kqalculate.cpp:1136 qalculateeditunknownvariabledialog.cpp:79 +msgid "Positive" +msgstr "Strictement positif" + +#: kqalculate.cpp:1138 qalculateeditunknownvariabledialog.cpp:80 +msgid "Non-Negative" +msgstr "Positif" + +#: kqalculate.cpp:1140 qalculateeditunknownvariabledialog.cpp:81 +msgid "Negative" +msgstr "Strictement négatif" + +#: kqalculate.cpp:1142 qalculateeditunknownvariabledialog.cpp:82 +msgid "Non-Positive" +msgstr "Négatif" + +#: kqalculate.cpp:1144 +msgid "Non-Zero Denominators" +msgstr "Dénominateurs non nuls" + +#: kqalculate.cpp:1146 +msgid "Warn About Denominators Assumed Non-Zero" +msgstr "Alerter si les dénominateurs sont supposés non nuls" + +#: kqalculate.cpp:1154 +msgid "Read Precision" +msgstr "Précision de la saisie" + +#: kqalculate.cpp:1156 +msgid "Limit Implicit Multiplication" +msgstr "Limiter les multiplications implicites" + +#: kqalculate.cpp:1158 +msgid "RPN Mode" +msgstr "Mode NPI" + +#: kqalculate.cpp:1160 +msgid "RPN Syntax" +msgstr "Syntaxe NPI" + +#: kqalculate.cpp:1162 qalculateprecisiondialog.cpp:31 +msgid "Precision" +msgstr "Précision" + +#: kqalculate.cpp:1163 qalculatedecimalsdialog.cpp:27 +msgid "Decimals" +msgstr "Décimales" + +#: kqalculate.cpp:1164 +msgid "Save Mode..." +msgstr "Enregistrer le mode..." + +#: kqalculate.cpp:1165 +msgid "Delete Mode..." +msgstr "Effacer le mode" + +#: kqalculate.cpp:1167 +msgid "Save Default Mode" +msgstr "Enregistrer le mode par défaut" + +#: kqalculate.cpp:1168 +msgid "Clear Stack" +msgstr "Vider la pile" + +#: kqalculate.cpp:1172 +#, fuzzy +msgid "Exp RPN Operation" +msgstr "Opération NPI" + +#: kqalculate.cpp:1860 +msgid "and" +msgstr "et" + +#: kqalculate.cpp:1865 +msgid "or" +msgstr "ou" + +#: kqalculate.cpp:2122 +msgid "undefined" +msgstr "indéfini" + +#: kqalculate.cpp:2164 +msgid "EXACT" +msgstr "EXACT" + +#: kqalculate.cpp:2167 +msgid "APPROX" +msgstr "APPROX" + +#: kqalculate.cpp:2171 +msgid "RPN" +msgstr "NPI" + +#: kqalculate.cpp:2179 +msgid "BIN" +msgstr "BIN" + +#: kqalculate.cpp:2184 +msgid "OCT" +msgstr "OCT" + +#: kqalculate.cpp:2189 +msgid "HEX" +msgstr "HEX" + +#: kqalculate.cpp:2194 +msgid "ROMAN" +msgstr "ROMAIN" + +#: kqalculate.cpp:2206 +msgid "DEG" +msgstr "DEG" + +#: kqalculate.cpp:2211 +msgid "RAD" +msgstr "RAD" + +#: kqalculate.cpp:2216 +msgid "GRA" +msgstr "GR" + +#: kqalculate.cpp:2223 +msgid "PREC" +msgstr "PREC" + +#: kqalculate.cpp:2228 +msgid "FUNC" +msgstr "FUNC" + +#: kqalculate.cpp:2234 +msgid "UNIT" +msgstr "UNIT" + +#: kqalculate.cpp:2240 +msgid "VAR" +msgstr "VAR" + +#: kqalculate.cpp:2246 +msgid "INF" +msgstr "INF" + +#: kqalculate.cpp:2252 +msgid "CPLX" +msgstr "CPLX" + +#: kqalculate.cpp:2333 kqalculate.cpp:2351 kqalculate.cpp:2581 +msgid "aborted" +msgstr "abandonné" + +#: kqalculate.cpp:2352 +msgid "calculation was aborted" +msgstr "le calcul a été abandonné" + +#: kqalculate.cpp:2588 +msgid "result processing was aborted" +msgstr "le calcul du résultat a été abandonné" + +#: kqalculate.cpp:2636 +msgid "Processing..." +msgstr "Calcul en cours..." + +#: kqalculate.cpp:2640 kqalculate.cpp:2885 kqalculate.cpp:3145 +msgid "Abort" +msgstr "Abandonner" + +#: kqalculate.cpp:2873 +msgid "Factorizing..." +msgstr "Factorisation en cours..." + +#: kqalculate.cpp:2877 +msgid "Simplifying..." +msgstr "Simplification en cours..." + +#: kqalculate.cpp:3141 +msgid "Calculating..." +msgstr "Calcul en cours..." + +#: kqalculate.cpp:3191 +msgid "RPN Operation" +msgstr "Opération NPI" + +#: kqalculate.cpp:3259 +msgid "Errors" +msgstr "Erreurs" + +#: kqalculate.cpp:3260 +msgid "Warnings" +msgstr "Avertissements" + +#: kqalculate.cpp:3270 +msgid "Couldn't write definitions" +msgstr "Impossible d'écrire les définitions" + +#: kqalculate.cpp:3538 +msgid "Prefixes" +msgstr "Préfixes" + +#: kqalculate.cpp:3665 +msgid "No Prefix" +msgstr "Pas de préfixe" + +#: kqalculate.cpp:3816 qalculatevariablesdialog.cpp:191 +#: qalculatevariablesdialog.cpp:337 +msgid "Variable does not exist anymore." +msgstr "La variable n'existe plus" + +#: kqalculate.cpp:3832 qalculateconvertunitsdialog.cpp:153 +#: qalculateunitsdialog.cpp:223 qalculateunitsdialog.cpp:337 +msgid "Unit does not exist anymore." +msgstr "L'unité n'existe plus" + +#: kqalculate.cpp:3905 +msgid "Failed to download exchange rates from ECB." +msgstr "Échec du téléchargement des taux d'échanges de ECB." + +#: kqalculate.cpp:4752 +msgid "Save Mode" +msgstr "Enregister le mode" + +#: kqalculate.cpp:4755 +#, fuzzy +msgid "Mode name:" +msgstr "Nom du Mode:" + +#: kqalculate.cpp:4765 +msgid "Shortcut:" +msgstr "" + +#: kqalculate.cpp:4792 +msgid "Empty mode name." +msgstr "Nom de mode vide." + +#: kqalculate.cpp:4795 +msgid "Preset mode cannot be overwritten." +msgstr "La prédéfinition ne peut être écrasée." + +#: kqalculate.cpp:4827 +msgid "Delete Mode" +msgstr "Effacer le mode" + +#: kqalculate.cpp:4827 +msgid "Mode:" +msgstr "Mode:" + +#: kqalculate.cpp:5001 +msgid "log10 function not found." +msgstr "Fonction log10 non trouvée." + +#: kqalculate.cpp:5545 main.cpp:156 main.cpp:159 main.cpp:160 main.cpp:161 +#: main.cpp:162 +msgid "Temporary" +msgstr "Temporaire" + +#: kqalculate.cpp:5567 kqalculate.cpp:5594 qalculatefunctionsdialog.cpp:191 +#: qalculatefunctionsdialog.cpp:300 +msgid "Function does not exist anymore." +msgstr "La fonction n'existe plus." + +#: kqalculate.cpp:5697 kqalculate.cpp:5733 +msgid "My Variables" +msgstr "Mes variables" + +#: kqalculate.cpp:5709 qalculateimportcsvdialog.cpp:56 +msgid "Vectors" +msgstr "Vecteurs" + +#: kqalculate.cpp:5721 +msgid "Matrices" +msgstr "Matrices" + +#: kqalculate.cpp:5762 qalculateplotdialog.cpp:726 +msgid "Save Image" +msgstr "Enregistrer l'image" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "" +"A file named \"%1\" already exists. Are you sure you want to overwrite it?" +msgstr "" +"Un fichier nommé \"%1\" existe déjà. Êtes-vous sûr de vouloir l'écraser?" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "Overwrite File?" +msgstr "Écraser le fichier?" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "&Overwrite" +msgstr "&Écraser" + +#: kqalculate.cpp:5801 +msgid "Failed to save image." +msgstr "Échec de l'enregistrement de l'image." + +#: kqalculate.cpp:6027 +msgid "No unknowns in result." +msgstr "Pas d'inconnue dans le résultat." + +#: kqalculate.cpp:6030 +msgid "Set Unknowns" +msgstr "Définir les inconnues" + +#: kqalculate.cpp:6194 +msgid "Too many arguments for %1()." +msgstr "Trop d'arguments pour %1()." + +#: kqalculate.cpp:6220 qalculatedatasetsdialog.cpp:342 +#: qalculatefunctionsdialog.cpp:343 qalculateresultdisplay.cpp:120 +msgid "argument" +msgstr "argument" + +#: kqalculate.cpp:6442 kqalculate.cpp:6446 +#, fuzzy +msgid "Edit Expression" +msgstr "Expression" + +#: kqalculate.cpp:6451 +#, fuzzy +msgid "Edit Result" +msgstr "Éditer les noms" + +#: kqalculate.cpp:6454 +#, fuzzy +msgid "Insert Result Variable" +msgstr "Enregistrer le résultat dans une variable" + +#: main.cpp:45 +msgid "A powerful and easy to use desktop calculator" +msgstr "Une calculatrice de bureau puissante et facile à utiliser" + +#: main.cpp:51 +msgid "Calculate X11-clipboard content (selected text)" +msgstr "Caculer le contenu du presse papier de X11 (texte sélectionné)" + +#: main.cpp:52 +msgid "Initial expression to calculate" +msgstr "Expression initiale à calculer" + +#: main.cpp:134 +msgid "Enter a mathematical expression above.
Ex. 5 + 2 / 3" +msgstr "Entrez une expression mathématique ci-dessous.
Ex. 5 + 2 / 3" + +#: main.cpp:143 +msgid "" +"You need to download exchange rates to be able to convert between different " +"currencies. You can later get current exchange rates by selecting \"Update " +"Exchange Rates\" under the File menu.\n" +"\n" +"Do you want to fetch exchange rates now from the Internet?" +msgstr "" +"Vous devez télécharger les taux d'échange pour effectuer des conversions " +"entre différentes devises. Vous pourrez ensuite récupérer les taux d'échange " +"en sélectionnant\"Mettre à jour les taux d'échange\" dans le menu Fichier.\n" +"\n" +"Voulez-vous télécharger les taux d'échange sur Internet maintenant?" + +#: main.cpp:143 +msgid "Update exchange rates?" +msgstr "Mettre à jour les taux d'échange?" + +#: main.cpp:155 +msgid "ans" +msgstr "ans" + +#: main.cpp:156 +msgid "Last Answer" +msgstr "Réponse précédente" + +#: main.cpp:157 +msgid "answer" +msgstr "réponse" + +#: main.cpp:159 +msgid "Answer 2" +msgstr "Réponse 2" + +#: main.cpp:160 +msgid "Answer 3" +msgstr "Réponse 3" + +#: main.cpp:161 +msgid "Answer 4" +msgstr "Réponse 4" + +#: main.cpp:162 +msgid "Answer 5" +msgstr "Réponse 5" + +#: main.cpp:166 +msgid "Failed to load global definitions!" +msgstr "Échec du chargement des définitions globales!" + +#: main.cpp:290 +msgid "Qalculate!" +msgstr "Qalculate!" + +#: preferences.cpp:208 +msgid "Preset" +msgstr "Présélection" + +#: preferences.cpp:669 +#, c-format +msgid "" +"Couldn't write preferences to\n" +"%s" +msgstr "Impossible d'écrire les préférences sur
%s" + +#: qalculateconvertnumberbasesdialog.cpp:31 qalculatesetbasedialog.cpp:29 +msgid "Number Bases" +msgstr "Bases numériques" + +#: qalculateconvertnumberbasesdialog.cpp:37 +msgid "Decimal:" +msgstr "Décimale:" + +#: qalculateconvertnumberbasesdialog.cpp:41 +msgid "Binary:" +msgstr "Binaire:" + +#: qalculateconvertnumberbasesdialog.cpp:45 +msgid "Octal:" +msgstr "Octale:" + +#: qalculateconvertnumberbasesdialog.cpp:49 +msgid "Hexadecimal:" +msgstr "Hexadécimale:" + +#: qalculateconvertunitsdialog.cpp:44 +msgid "Selector" +msgstr "Sélecteur" + +#: qalculateconvertunitsdialog.cpp:50 qalculateeditdatasetdialog.cpp:482 +msgid "Unit expression:" +msgstr "Expression d'unités:" + +#: qalculateconvertunitsdialog.cpp:63 qalculatefunctionsdialog.cpp:55 +#: qalculateunitsdialog.cpp:63 qalculatevariablesdialog.cpp:57 +msgid "Category" +msgstr "Catégorie" + +#: qalculateconvertunitsdialog.cpp:85 qalculateconvertunitsdialog.cpp:86 +#: qalculateconvertunitsdialog.cpp:141 qalculateconvertunitsdialog.cpp:180 +#: qalculatefunctionsdialog.cpp:118 qalculatefunctionsdialog.cpp:119 +#: qalculatefunctionsdialog.cpp:183 qalculatefunctionsdialog.cpp:505 +#: qalculateunitsdialog.cpp:150 qalculateunitsdialog.cpp:151 +#: qalculateunitsdialog.cpp:215 qalculateunitsdialog.cpp:416 +#: qalculatevariablesdialog.cpp:116 qalculatevariablesdialog.cpp:117 +#: qalculatevariablesdialog.cpp:183 qalculatevariablesdialog.cpp:462 +msgid "All" +msgstr "Tous" + +#: qalculateconvertunitsdialog.cpp:132 qalculateconvertunitsdialog.cpp:133 +#: qalculateconvertunitsdialog.cpp:134 qalculateconvertunitsdialog.cpp:182 +#: qalculatefunctionsdialog.cpp:165 qalculatefunctionsdialog.cpp:166 +#: qalculatefunctionsdialog.cpp:167 qalculatefunctionsdialog.cpp:236 +#: qalculatefunctionsdialog.cpp:262 qalculatefunctionsdialog.cpp:285 +#: qalculatefunctionsdialog.cpp:507 qalculateunitsdialog.cpp:197 +#: qalculateunitsdialog.cpp:198 qalculateunitsdialog.cpp:199 +#: qalculateunitsdialog.cpp:273 qalculateunitsdialog.cpp:299 +#: qalculateunitsdialog.cpp:322 qalculateunitsdialog.cpp:418 +#: qalculatevariablesdialog.cpp:165 qalculatevariablesdialog.cpp:166 +#: qalculatevariablesdialog.cpp:167 qalculatevariablesdialog.cpp:258 +#: qalculatevariablesdialog.cpp:284 qalculatevariablesdialog.cpp:322 +#: qalculatevariablesdialog.cpp:464 +msgid "Uncategorized" +msgstr "Sans catégorie" + +#: qalculatedatasetsdialog.cpp:46 qalculateeditdatasetdialog.cpp:232 +msgid "Data Sets" +msgstr "Ensembles de données" + +#: qalculatedatasetsdialog.cpp:61 +msgid "Data Sets:" +msgstr "Ensembles de données:" + +#: qalculatedatasetsdialog.cpp:68 qalculatedatasetsdialog.cpp:91 +#: qalculateeditdatasetdialog.cpp:107 qalculateeditdatasetdialog.cpp:629 +#: qalculateeditfunctiondialog.cpp:133 qalculateeditfunctiondialog.cpp:492 +#: qalculateeditnamesdialog.cpp:64 qalculatefunctionsdialog.cpp:67 +#: qalculateunitsdialog.cpp:91 qalculatevariablesdialog.cpp:66 +msgid "New" +msgstr "Nouveau" + +#: qalculatedatasetsdialog.cpp:77 qalculateeditdatasetdialog.cpp:79 +#: qalculateeditdatasetdialog.cpp:456 qalculateeditfunctiondialog.cpp:98 +msgid "Description:" +msgstr "Description:" + +#: qalculatedatasetsdialog.cpp:84 +msgid "Objects:" +msgstr "Objets:" + +#: qalculatedatasetsdialog.cpp:87 qalculateeditdatasetdialog.cpp:236 +#: qalculateeditfunctiondialog.cpp:598 +msgid "Object" +msgstr "Objet" + +#: qalculatedatasetsdialog.cpp:100 +msgid "Attributes:" +msgstr "Attributs:" + +#: qalculatedatasetsdialog.cpp:157 qalculatedatasetsdialog.cpp:218 +msgid "Data set does not exist anymore." +msgstr "L'ensemble de données n'existe plus." + +#: qalculatedatasetsdialog.cpp:300 qalculateeditdatasetdialog.cpp:195 +#: qalculatefunctionsdialog.cpp:456 +msgid "key" +msgstr "clé" + +#: qalculatedatasetsdialog.cpp:316 +msgid "Data Retrieval Function" +msgstr "Fonction de récupération de données" + +#: qalculatedecimalsdialog.cpp:31 +msgid "Max decimals:" +msgstr "Décimales max:" + +#: qalculatedecimalsdialog.cpp:39 +msgid "Min decimals:" +msgstr "Décimales min:" + +#: qalculateeditdataobjectdialog.cpp:30 qalculateeditdataobjectdialog.cpp:40 +msgid "Edit Object" +msgstr "Éditer l'objet" + +#: qalculateeditdataobjectdialog.cpp:42 +msgid "New Object" +msgstr "Nouvel objet" + +#: qalculateeditdataobjectdialog.cpp:48 qalculateeditdatasetdialog.cpp:242 +msgid "Property" +msgstr "Propriété" + +#. i18n: file ./qalculate_kdeui.rc line 116 +#: qalculateeditdataobjectdialog.cpp:51 rc.cpp:39 +#, no-c-format +msgid "Approximation" +msgstr "Approximation" + +#: qalculateeditdatasetdialog.cpp:53 qalculateeditdatasetdialog.cpp:307 +msgid "Edit Data Set" +msgstr "Éditer l'ensemble de données" + +#: qalculateeditdatasetdialog.cpp:68 qalculateeditfunctiondialog.cpp:70 +#: qalculatepreferencesdialog.cpp:157 +msgid "General" +msgstr "Général" + +#: qalculateeditdatasetdialog.cpp:73 qalculateplotdialog.cpp:86 +#: qalculateplotdialog.cpp:189 +msgid "Title:" +msgstr "Titre:" + +#: qalculateeditdatasetdialog.cpp:76 +msgid "Data file:" +msgstr "Fichier de données:" + +#: qalculateeditdatasetdialog.cpp:87 +msgid "Copyright:" +msgstr "Copyright:" + +#: qalculateeditdatasetdialog.cpp:97 +msgid "Properties:" +msgstr "Propriétés:" + +#: qalculateeditdatasetdialog.cpp:99 qalculateplotdialog.cpp:153 +msgid "Title" +msgstr "Titre" + +#: qalculateeditdatasetdialog.cpp:100 qalculateeditdatasetdialog.cpp:620 +#: qalculateeditfunctiondialog.cpp:124 qalculateeditnamesdialog.cpp:41 +#: qalculateeditunitdialog.cpp:50 +msgid "Name" +msgstr "Nom" + +#: qalculateeditdatasetdialog.cpp:101 qalculateeditfunctiondialog.cpp:125 +#: qalculateeditunitdialog.cpp:75 qalculateeditunknownvariabledialog.cpp:60 +msgid "Type" +msgstr "Type" + +#: qalculateeditdatasetdialog.cpp:115 qalculateeditdatasetdialog.cpp:442 +#: qalculateeditfunctiondialog.cpp:74 qalculateeditfunctiondialog.cpp:583 +#: qalculateeditmatrixvectordialog.cpp:78 qalculateeditunitdialog.cpp:55 +#: qalculateeditunknownvariabledialog.cpp:47 +#: qalculateeditvariabledialog.cpp:49 qalculateimportcsvdialog.cpp:60 +msgid "Name:" +msgstr "Nom:" + +#: qalculateeditdatasetdialog.cpp:124 qalculateeditdatasetdialog.cpp:451 +#: qalculateeditfunctiondialog.cpp:83 qalculateeditmatrixvectordialog.cpp:87 +#: qalculateeditunitdialog.cpp:64 qalculateeditunknownvariabledialog.cpp:56 +#: qalculateeditvariabledialog.cpp:60 +msgid "Names Details" +msgstr "Détails des noms" + +#: qalculateeditdatasetdialog.cpp:126 +msgid "Object argument name:" +msgstr "Nom de l'argument de l'objet:" + +#: qalculateeditdatasetdialog.cpp:129 +msgid "Property argument name:" +msgstr "Nom de l'argument de la propriété" + +#: qalculateeditdatasetdialog.cpp:132 +msgid "Default property:" +msgstr "Propriété par défaut:" + +#: qalculateeditdatasetdialog.cpp:173 +msgid "text" +msgstr "texte" + +#: qalculateeditdatasetdialog.cpp:178 qalculateeditdatasetdialog.cpp:186 +msgid "approximate" +msgstr "approché" + +#: qalculateeditdatasetdialog.cpp:181 qalculateexpressionedit.cpp:712 +#: qalculatevariablesdialog.cpp:428 +msgid "number" +msgstr "nombre" + +#: qalculateeditdatasetdialog.cpp:189 +msgid "expression" +msgstr "expression" + +#: qalculateeditdatasetdialog.cpp:213 qalculateeditdatasetdialog.cpp:499 +#: qalculateeditfunctiondialog.cpp:190 qalculateeditmatrixvectordialog.cpp:185 +#: qalculateeditunitdialog.cpp:146 qalculateeditunknownvariabledialog.cpp:132 +#: qalculateeditvariabledialog.cpp:102 +msgid "Empty name field" +msgstr "Champ de nom vide" + +#: qalculateeditdatasetdialog.cpp:217 qalculateeditfunctiondialog.cpp:201 +msgid "" +"A function with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "Une fonction avec le même nom existe déjà. Voulez-vous l'écraser?" + +#: qalculateeditdatasetdialog.cpp:309 +msgid "Edit Data Set (global)" +msgstr "Éditer l'ensemble de données (global)" + +#: qalculateeditdatasetdialog.cpp:311 +msgid "New Data Set" +msgstr "Nouvel ensemble de données" + +#: qalculateeditdatasetdialog.cpp:322 +msgid "info" +msgstr "info" + +#: qalculateeditdatasetdialog.cpp:435 qalculateeditdatasetdialog.cpp:548 +msgid "Edit Property" +msgstr "Éditer la propriété" + +#: qalculateeditdatasetdialog.cpp:453 qalculateeditfunctiondialog.cpp:90 +#: qalculateeditmatrixvectordialog.cpp:93 qalculateeditunitdialog.cpp:66 +#: qalculateeditunknownvariabledialog.cpp:90 +#: qalculateeditvariabledialog.cpp:80 qalculateimportcsvdialog.cpp:63 +msgid "Descriptive name:" +msgstr "Nom descriptif:" + +#: qalculateeditdatasetdialog.cpp:464 +msgid "Value type:" +msgstr "Type de valeur:" + +#: qalculateeditdatasetdialog.cpp:467 qalculateeditfunctiondialog.cpp:593 +msgid "Text" +msgstr "Texte" + +#: qalculateeditdatasetdialog.cpp:469 qalculateeditfunctiondialog.cpp:482 +#: qalculateplotdialog.cpp:154 +msgid "Expression" +msgstr "Expression" + +#: qalculateeditdatasetdialog.cpp:474 +msgid "Use as key" +msgstr "Utiliser comme clé" + +#: qalculateeditdatasetdialog.cpp:476 +msgid "Approximate value" +msgstr "Valeur approchée" + +#: qalculateeditdatasetdialog.cpp:478 +msgid "Case sensitive value" +msgstr "Valeur sensible à la casse" + +#: qalculateeditdatasetdialog.cpp:480 +msgid "Value uses brackets" +msgstr "La valeur utilise des crochets" + +#: qalculateeditdatasetdialog.cpp:550 +msgid "New Property" +msgstr "Nouvelle propriété" + +#: qalculateeditdatasetdialog.cpp:615 qalculateeditnamesdialog.cpp:34 +msgid "Edit Names" +msgstr "Éditer les noms" + +#: qalculateeditdatasetdialog.cpp:621 qalculateeditfunctiondialog.cpp:481 +#: qalculateeditnamesdialog.cpp:46 +msgid "Reference" +msgstr "Référence" + +#: qalculateeditfunctiondialog.cpp:55 qalculateeditfunctiondialog.cpp:286 +msgid "Edit Function" +msgstr "Éditer la fonction" + +#: qalculateeditfunctiondialog.cpp:85 qalculateeditmatrixvectordialog.cpp:89 +#: qalculateeditunitdialog.cpp:87 qalculateeditunknownvariabledialog.cpp:85 +#: qalculateeditvariabledialog.cpp:74 qalculateimportcsvdialog.cpp:66 +msgid "Category:" +msgstr "Catégorie :" + +#: qalculateeditfunctiondialog.cpp:96 +msgid "Hide function" +msgstr "Cacher la fonction" + +#: qalculateeditfunctiondialog.cpp:106 qalculateplotdialog.cpp:89 +msgid "Expression:" +msgstr "Expression :" + +#: qalculateeditfunctiondialog.cpp:115 +msgid "Condition:" +msgstr "Condition :" + +#: qalculateeditfunctiondialog.cpp:120 qalculateeditfunctiondialog.cpp:476 +msgid "Sub-Functions" +msgstr "Sous-fonctions" + +#: qalculateeditfunctiondialog.cpp:122 +msgid "Arguments:" +msgstr "Arguments :" + +#: qalculateeditfunctiondialog.cpp:197 +msgid "Empty expression field" +msgstr "Champ d'expression vide" + +#: qalculateeditfunctiondialog.cpp:288 +msgid "Edit Function (global)" +msgstr "Éditer la fonction (global)" + +#: qalculateeditfunctiondialog.cpp:290 +msgid "New Function" +msgstr "Nouvelle fonction" + +#: qalculateeditfunctiondialog.cpp:483 +msgid "Precalculate" +msgstr "Précalculer" + +#: qalculateeditfunctiondialog.cpp:579 qalculateeditfunctiondialog.cpp:675 +msgid "Edit Argument" +msgstr "Éditer l'argument" + +#: qalculateeditfunctiondialog.cpp:586 +msgid "Type:" +msgstr "Type :" + +#: qalculateeditfunctiondialog.cpp:589 +msgid "Free" +msgstr "Libre" + +#: qalculateeditfunctiondialog.cpp:592 +msgid "Symbol" +msgstr "Symbole" + +#: qalculateeditfunctiondialog.cpp:594 qalculateinsertfunctiondialog.cpp:353 +msgid "Date" +msgstr "Date" + +#: qalculateeditfunctiondialog.cpp:597 +msgid "Boolean" +msgstr "Booléen" + +#: qalculateeditfunctiondialog.cpp:603 +msgid "Angle" +msgstr "Angle" + +#: qalculateeditfunctiondialog.cpp:605 +msgid "Enable rules and type test" +msgstr "Activer les règles et le test du type" + +#: qalculateeditfunctiondialog.cpp:607 +msgid "Custom condition:" +msgstr "Condition personnalisée" + +#: qalculateeditfunctiondialog.cpp:611 +msgid "Allow matrix" +msgstr "Autoriser les matrices" + +#: qalculateeditfunctiondialog.cpp:613 +msgid "Forbid zero" +msgstr "Interdire zéro" + +#: qalculateeditfunctiondialog.cpp:615 +msgid "Allow complex" +msgstr "Autoriser les nombres complexes" + +#: qalculateeditfunctiondialog.cpp:617 qalculateplotdialog.cpp:164 +msgid "Min:" +msgstr "Min :" + +#: qalculateeditfunctiondialog.cpp:624 qalculateeditfunctiondialog.cpp:633 +msgid "Include equals" +msgstr "Inclure les égalités" + +#: qalculateeditfunctiondialog.cpp:626 qalculateplotdialog.cpp:167 +msgid "Max:" +msgstr "Max :" + +#: qalculateeditfunctiondialog.cpp:677 +msgid "New Argument" +msgstr "Nouvel argument" + +#: qalculateeditmatrixvectordialog.cpp:71 +#: qalculateeditunknownvariabledialog.cpp:40 +#: qalculateeditvariabledialog.cpp:41 qalculateeditvariabledialog.cpp:180 +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Edit Variable" +msgstr "Éditer la variable" + +#: qalculateeditmatrixvectordialog.cpp:96 +#: qalculateinsertmatrixvectordialog.cpp:75 +msgid "Rows:" +msgstr "Lignes :" + +#: qalculateeditmatrixvectordialog.cpp:99 +#: qalculateinsertmatrixvectordialog.cpp:78 +msgid "Columns:" +msgstr "Colonnes :" + +#: qalculateeditmatrixvectordialog.cpp:112 +#: qalculateeditmatrixvectordialog.cpp:133 +#: qalculateeditmatrixvectordialog.cpp:295 +#: qalculateinsertmatrixvectordialog.cpp:91 +#: qalculateinsertmatrixvectordialog.cpp:115 +#: qalculateinsertmatrixvectordialog.cpp:275 +msgid "Elements:" +msgstr "Éléments :" + +#: qalculateeditmatrixvectordialog.cpp:146 +#: qalculateeditmatrixvectordialog.cpp:292 +#: qalculateinsertmatrixvectordialog.cpp:128 +#: qalculateinsertmatrixvectordialog.cpp:272 +msgid "Elements (in horizontal order):" +msgstr "Éléments (par ordre horizontal) :" + +#: qalculateeditmatrixvectordialog.cpp:189 +#: qalculateeditunknownvariabledialog.cpp:136 +#: qalculateeditvariabledialog.cpp:114 +msgid "" +"An unit or variable with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"Une unité avec le même nom existe déjà.\n" +"Voulez-vous l'écraser?" + +#: qalculateeditmatrixvectordialog.cpp:301 +msgid "Edit Vector" +msgstr "Éditer le vecteur" + +#: qalculateeditmatrixvectordialog.cpp:303 +msgid "Edit Vector (global)" +msgstr "Éditer le vecteur (global)" + +#: qalculateeditmatrixvectordialog.cpp:305 +msgid "New Vector" +msgstr "Nouveau vecteur" + +#: qalculateeditmatrixvectordialog.cpp:310 +msgid "Edit Matrix" +msgstr "Éditer la matrice" + +#: qalculateeditmatrixvectordialog.cpp:312 +msgid "Edit Matrix (global)" +msgstr "Éditer la matrice (global)" + +#: qalculateeditmatrixvectordialog.cpp:314 +msgid "New Matrix" +msgstr "Nouvelle matrice" + +#: qalculateeditnamesdialog.cpp:42 +msgid "Abbreviation" +msgstr "Abréviation" + +#: qalculateeditnamesdialog.cpp:44 +msgid "Plural" +msgstr "Pluriel" + +#: qalculateeditnamesdialog.cpp:48 +msgid "Avoid Input" +msgstr "Éviter la saisie" + +#: qalculateeditnamesdialog.cpp:50 +msgid "Unicode" +msgstr "Unicode" + +#: qalculateeditnamesdialog.cpp:52 +msgid "Suffix" +msgstr "Suffixe" + +#: qalculateeditnamesdialog.cpp:54 +msgid "Case Sensitive" +msgstr "Sensible à la casse" + +#: qalculateeditunitdialog.cpp:43 qalculateeditunitdialog.cpp:287 +msgid "Edit Unit" +msgstr "Éditer l'unité" + +#: qalculateeditunitdialog.cpp:72 +msgid "Hide unit" +msgstr "Cacher l'unité" + +#: qalculateeditunitdialog.cpp:80 +msgid "Class:" +msgstr "Classe :" + +#: qalculateeditunitdialog.cpp:83 +msgid "Base Unit" +msgstr "Unité de base" + +#: qalculateeditunitdialog.cpp:84 +msgid "Alias" +msgstr "Alias" + +#: qalculateeditunitdialog.cpp:85 +msgid "Composite Unit" +msgstr "Unité composée" + +#: qalculateeditunitdialog.cpp:92 +msgid "System:" +msgstr "Système :" + +#: qalculateeditunitdialog.cpp:95 +msgid "SI" +msgstr "SI" + +#: qalculateeditunitdialog.cpp:96 +msgid "CGS" +msgstr "CGS" + +#: qalculateeditunitdialog.cpp:97 +msgid "Imperial" +msgstr "Impérial" + +#: qalculateeditunitdialog.cpp:98 +msgid "US Survey" +msgstr "Étude américaine" + +#: qalculateeditunitdialog.cpp:102 +msgid "Relation" +msgstr "Relation" + +#: qalculateeditunitdialog.cpp:107 +msgid "Base unit:" +msgstr "Unité de base :" + +#: qalculateeditunitdialog.cpp:110 +msgid "Exponent:" +msgstr "Exposant :" + +#: qalculateeditunitdialog.cpp:114 +msgid "Relation:" +msgstr "Relation :" + +#: qalculateeditunitdialog.cpp:121 +msgid "Relation is exact" +msgstr "La relation est exacte" + +#: qalculateeditunitdialog.cpp:123 +msgid "Inverse relation:" +msgstr "Relation inverse :" + +#: qalculateeditunitdialog.cpp:150 +msgid "" +"A variable or unit with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"Une variable avec le même nom existe déjà.\n" +"Voulez-vous l'écraser?" + +#: qalculateeditunitdialog.cpp:175 qalculateeditunitdialog.cpp:219 +msgid "Base unit does not exist" +msgstr "L'unité de base n'existe pas" + +#: qalculateeditunitdialog.cpp:289 +msgid "Edit Unit (global)" +msgstr "Éditer l'unité (global)" + +#: qalculateeditunitdialog.cpp:291 +msgid "New Unit" +msgstr "Nouvelle unité" + +#: qalculateeditunknownvariabledialog.cpp:58 +msgid "Custom assumptions:" +msgstr "Hypothèses personnalisées" + +#: qalculateeditunknownvariabledialog.cpp:68 +msgid "Complex Number" +msgstr "Nombre complexe" + +#: qalculateeditunknownvariabledialog.cpp:69 +msgid "Real Number" +msgstr "Nombre réel" + +#: qalculateeditunknownvariabledialog.cpp:70 +msgid "Rational Number" +msgstr "Nombre rationnel" + +#: qalculateeditunknownvariabledialog.cpp:73 +msgid "Sign" +msgstr "Signe" + +#: qalculateeditunknownvariabledialog.cpp:199 +msgid "Edit Unknown Variable" +msgstr "Éditer la variable inconnue" + +#: qalculateeditunknownvariabledialog.cpp:201 +msgid "Edit Unknown Variable (global)" +msgstr "Éditer la variable inconnue (global)" + +#: qalculateeditunknownvariabledialog.cpp:203 +msgid "New Unknown Variable" +msgstr "Nouvelle variable inconnue" + +#: qalculateeditvariabledialog.cpp:63 qalculateinsertfunctiondialog.cpp:91 +msgid "Value:" +msgstr "Valeur :" + +#: qalculateeditvariabledialog.cpp:71 +msgid "Value is exact" +msgstr "La valeur est exacte" + +#: qalculateeditvariabledialog.cpp:110 +msgid "Empty value field" +msgstr "Champ de valeur vide" + +#: qalculateeditvariabledialog.cpp:182 +msgid "Edit Variable (global)" +msgstr "Éditer la variable (global)" + +#: qalculateeditvariabledialog.cpp:185 +msgid "New Variable" +msgstr "Nouvelle variable" + +#: qalculateexportcsvdialog.cpp:37 qalculateexportcsvdialog.cpp:54 +msgid "Export CSV File" +msgstr "Exporter le fichier CSV" + +#: qalculateexportcsvdialog.cpp:42 +msgid "Current result" +msgstr "Résultat actuel" + +#: qalculateexportcsvdialog.cpp:46 +msgid "Matrix/vector variable" +msgstr "Variable matricielle/vectorielle" + +#: qalculateexportcsvdialog.cpp:51 qalculateimportcsvdialog.cpp:43 +msgid "File:" +msgstr "Fichier :" + +#: qalculateexportcsvdialog.cpp:56 qalculateimportcsvdialog.cpp:80 +msgid "Delimiter:" +msgstr "Délimiteur :" + +#: qalculateexportcsvdialog.cpp:59 qalculateimportcsvdialog.cpp:83 +msgid "Comma" +msgstr "Virgule" + +#: qalculateexportcsvdialog.cpp:60 qalculateimportcsvdialog.cpp:84 +msgid "Tabulator" +msgstr "Tabulation" + +#: qalculateexportcsvdialog.cpp:61 qalculateimportcsvdialog.cpp:85 +msgid "Semicolon" +msgstr "Point-virgule" + +#: qalculateexportcsvdialog.cpp:62 qalculateimportcsvdialog.cpp:86 +msgid "Space" +msgstr "Espace" + +#: qalculateexportcsvdialog.cpp:63 qalculateimportcsvdialog.cpp:87 +msgid "Other" +msgstr "Autre" + +#: qalculateexportcsvdialog.cpp:93 qalculateimportcsvdialog.cpp:116 +msgid "No file name entered." +msgstr "Vous n'avez pas entré de nom de fichier." + +#: qalculateexportcsvdialog.cpp:122 qalculateimportcsvdialog.cpp:145 +msgid "No delimiter selected." +msgstr "Vous n'avez pas entré de délimiteur." + +#: qalculateexportcsvdialog.cpp:135 +msgid "No variable name entered." +msgstr "Vous n'avez pas entré de nom de variable." + +#: qalculateexportcsvdialog.cpp:147 +msgid "No known variable with entered name found." +msgstr "Aucune variable correspondant au nom entré n'a été trouvée." + +#: qalculateexportcsvdialog.cpp:154 +#, c-format +msgid "" +"Could not export to file \n" +"%s" +msgstr "" +"Impossible d'exporter dans le fichier \n" +"%s" + +#: qalculateexpressionedit.cpp:146 +msgid "Disable Completion" +msgstr "Désactiver le complètement" + +#: qalculateexpressionedit.cpp:147 +msgid "Enable Completion" +msgstr "Activer le complètement" + +#. i18n: file ./qalculate_kdeui.rc line 154 +#: qalculateexpressionedit.cpp:161 qalculateresultdisplay.cpp:333 rc.cpp:48 +#, no-c-format +msgid "Meta Modes" +msgstr "Méta-modes" + +#: qalculateexpressionedit.cpp:655 qalculatevariablesdialog.cpp:366 +msgid "a previous result" +msgstr "un résultat précédent" + +#: qalculateexpressionedit.cpp:661 qalculatevariablesdialog.cpp:376 +msgid "matrix" +msgstr "matrice" + +#: qalculateexpressionedit.cpp:663 qalculatevariablesdialog.cpp:378 +msgid "vector" +msgstr "vecteur" + +#: qalculateexpressionedit.cpp:672 qalculatevariablesdialog.cpp:387 +msgid "positive" +msgstr "strictement positif" + +#: qalculateexpressionedit.cpp:676 qalculatevariablesdialog.cpp:391 +msgid "non-positive" +msgstr "négatif" + +#: qalculateexpressionedit.cpp:680 qalculatevariablesdialog.cpp:395 +msgid "negative" +msgstr "strictement négatif" + +#: qalculateexpressionedit.cpp:684 qalculatevariablesdialog.cpp:399 +msgid "non-negative" +msgstr "positif" + +#: qalculateexpressionedit.cpp:688 qalculatevariablesdialog.cpp:403 +msgid "non-zero" +msgstr "non nul" + +#: qalculateexpressionedit.cpp:696 qalculatevariablesdialog.cpp:412 +msgid "integer" +msgstr "entier" + +#: qalculateexpressionedit.cpp:700 qalculatevariablesdialog.cpp:416 +msgid "rational" +msgstr "rationnel" + +#: qalculateexpressionedit.cpp:704 qalculatevariablesdialog.cpp:420 +msgid "real" +msgstr "réel" + +#: qalculateexpressionedit.cpp:708 qalculatevariablesdialog.cpp:424 +msgid "complex" +msgstr "complexe" + +#: qalculateexpressionedit.cpp:716 qalculatevariablesdialog.cpp:432 +msgid "(not matrix)" +msgstr "(non matriciel)" + +#: qalculateexpressionedit.cpp:721 qalculatevariablesdialog.cpp:438 +msgid "unknown" +msgstr "inconnue" + +#: qalculateexpressionedit.cpp:723 qalculatevariablesdialog.cpp:440 +msgid "default assumptions" +msgstr "hypothèses par défaut" + +#: qalculatefunctionsdialog.cpp:47 +msgid "Functions" +msgstr "Fonctions" + +#: qalculatefunctionsdialog.cpp:59 +msgid "Function Name" +msgstr "Nom de fonction" + +#: qalculatefunctionsdialog.cpp:75 qalculatefunctionsdialog.cpp:313 +#: qalculateunitsdialog.cpp:99 qalculateunitsdialog.cpp:352 +#: qalculatevariablesdialog.cpp:74 qalculatevariablesdialog.cpp:349 +msgid "Deactivate" +msgstr "Désactiver" + +#: qalculatefunctionsdialog.cpp:174 qalculatefunctionsdialog.cpp:175 +#: qalculatefunctionsdialog.cpp:176 qalculatefunctionsdialog.cpp:234 +#: qalculatefunctionsdialog.cpp:260 qalculatefunctionsdialog.cpp:283 +#: qalculatefunctionsdialog.cpp:509 qalculateunitsdialog.cpp:206 +#: qalculateunitsdialog.cpp:207 qalculateunitsdialog.cpp:208 +#: qalculateunitsdialog.cpp:271 qalculateunitsdialog.cpp:297 +#: qalculateunitsdialog.cpp:320 qalculateunitsdialog.cpp:420 +#: qalculatevariablesdialog.cpp:174 qalculatevariablesdialog.cpp:175 +#: qalculatevariablesdialog.cpp:176 qalculatevariablesdialog.cpp:256 +#: qalculatevariablesdialog.cpp:282 qalculatevariablesdialog.cpp:320 +#: qalculatevariablesdialog.cpp:466 +msgid "Inactive" +msgstr "Désactivé" + +#: qalculatefunctionsdialog.cpp:315 qalculateunitsdialog.cpp:354 +#: qalculatevariablesdialog.cpp:351 +msgid "Activate" +msgstr "Activer" + +#: qalculatefunctionsdialog.cpp:367 qalculateresultdisplay.cpp:148 +#, c-format +msgid "" +"Retrieves data from the %s data set for a given object and property. If " +"\"info\" is typed as property, a dialog window will pop up with all " +"properties of the object." +msgstr "" +"Récupère des données de l'ensemble de données %s pour un objet et une " +"propriété données. Si \"info\" est entré comme propriété, une boîte de " +"dialogue s'ouvrira avec toutes les propriétés de l'objet." + +#: qalculatefunctionsdialog.cpp:391 +msgid "Arguments" +msgstr "Arguments" + +#: qalculatefunctionsdialog.cpp:412 qalculateinsertfunctiondialog.cpp:194 +#: qalculateinsertfunctiondialog.cpp:227 +msgid "optional" +msgstr "optionnel" + +#: qalculatefunctionsdialog.cpp:416 +msgid "default: " +msgstr "défaut :" + +#: qalculatefunctionsdialog.cpp:426 +msgid "Requirement" +msgstr "Exigence" + +#: qalculateimportcsvdialog.cpp:39 qalculateimportcsvdialog.cpp:46 +msgid "Import CSV File" +msgstr "Importer un fichier CSV" + +#: qalculateimportcsvdialog.cpp:48 +msgid "Import as:" +msgstr "Importer en tant que :" + +#: qalculateimportcsvdialog.cpp:71 +msgid "First row:" +msgstr "Première ligne :" + +#: qalculateimportcsvdialog.cpp:77 +#, fuzzy +msgid "Includes headings" +msgstr "Inclure les en-têtes" + +#: qalculateimportcsvdialog.cpp:149 +msgid "An error occured when importing the CSV file." +msgstr "Un erreur est survenue lors de l'importation du fichier CSV." + +#: qalculateinsertfunctiondialog.cpp:50 qalculateinsertfunctiondialog.cpp:57 +msgid "Execute" +msgstr "Exécuter" + +#: qalculateinsertfunctiondialog.cpp:93 +msgid "Argument" +msgstr "Argument" + +#: qalculateinsertfunctiondialog.cpp:152 +msgid "True" +msgstr "Vrai" + +#: qalculateinsertfunctiondialog.cpp:153 +msgid "False" +msgstr "Faux" + +#: qalculateinsertfunctiondialog.cpp:184 +msgid "Info" +msgstr "Info" + +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Insert Selection" +msgstr "Insérer la sélection" + +#: qalculateinsertmatrixvectordialog.cpp:293 +msgid "Vector Result" +msgstr "Résultat vectoriel" + +#: qalculateinsertmatrixvectordialog.cpp:295 +msgid "Matrix Result" +msgstr "Résultat matriciel" + +#: qalculateperiodictabledialog.cpp:195 +msgid "Element Data" +msgstr "Donnée de l'élément" + +#: qalculateperiodictabledialog.cpp:221 +msgid "Classification" +msgstr "Classification" + +#: qalculateperiodictabledialog.cpp:224 +msgid "Alkali Metal" +msgstr "Métal alcalin" + +#: qalculateperiodictabledialog.cpp:225 +msgid "Alkaline-Earth Metal" +msgstr "Métal alcalino-terreux" + +#: qalculateperiodictabledialog.cpp:226 +msgid "Lanthanide" +msgstr "Lanthanide" + +#: qalculateperiodictabledialog.cpp:227 +msgid "Actinide" +msgstr "Actinide" + +#: qalculateperiodictabledialog.cpp:228 +msgid "Transition Metal" +msgstr "Métal de transition" + +#: qalculateperiodictabledialog.cpp:229 +msgid "Metal" +msgstr "Métal" + +#: qalculateperiodictabledialog.cpp:230 +msgid "Metalloid" +msgstr "Métalloïde" + +#: qalculateperiodictabledialog.cpp:231 +msgid "Non-Metal" +msgstr "Non métal" + +#: qalculateperiodictabledialog.cpp:232 +msgid "Halogen" +msgstr "Halogène" + +#: qalculateperiodictabledialog.cpp:233 +msgid "Noble Gas" +msgstr "Gaz noble" + +#: qalculateperiodictabledialog.cpp:234 +msgid "Transactinide" +msgstr "Transactinide" + +#: qalculateplotdialog.cpp:64 +msgid "Plot" +msgstr "Graphique" + +#: qalculateplotdialog.cpp:82 +msgid "Data" +msgstr "Donnée" + +#: qalculateplotdialog.cpp:83 +msgid "Function Range" +msgstr "Ensemble de départ" + +#: qalculateplotdialog.cpp:101 +msgid "Vector/matrix" +msgstr "Vecteur/Matrice" + +#: qalculateplotdialog.cpp:104 +msgid "Paired matrix" +msgstr "Matrice à deux colonnes" + +#: qalculateplotdialog.cpp:107 +msgid "Rows" +msgstr "Lignes" + +#: qalculateplotdialog.cpp:109 +msgid "X variable:" +msgstr "Varable X :" + +#: qalculateplotdialog.cpp:113 +msgid "Style:" +msgstr "Style :" + +#: qalculateplotdialog.cpp:115 +msgid "Line" +msgstr "Ligne" + +#: qalculateplotdialog.cpp:116 +msgid "Points" +msgstr "Points" + +#: qalculateplotdialog.cpp:117 +msgid "Line with points" +msgstr "Ligne avec des points" + +#: qalculateplotdialog.cpp:118 +msgid "Boxes/bars" +msgstr "Boîtes/barres" + +#: qalculateplotdialog.cpp:119 +msgid "Histogram" +msgstr "Histogramme" + +#: qalculateplotdialog.cpp:120 +msgid "Steps" +msgstr "Histogramme" + +#: qalculateplotdialog.cpp:121 +msgid "Candlesticks" +msgstr "" + +#: qalculateplotdialog.cpp:122 +msgid "Dots" +msgstr "Points" + +#: qalculateplotdialog.cpp:124 +msgid "Smoothing:" +msgstr "Lissage :" + +#: qalculateplotdialog.cpp:127 +msgid "Monotonic" +msgstr "Monotone" + +#: qalculateplotdialog.cpp:128 +msgid "Natural cubic splines" +msgstr "Splines cubiques naturelles" + +#: qalculateplotdialog.cpp:129 +msgid "Bezier" +msgstr "Bézier" + +#: qalculateplotdialog.cpp:130 +msgid "Bezier (monotonic)" +msgstr "Bézier (monotone)" + +#: qalculateplotdialog.cpp:132 +msgid "Y-axis:" +msgstr "Axe des Y :" + +#: qalculateplotdialog.cpp:136 +msgid "Primary" +msgstr "Primaire" + +#: qalculateplotdialog.cpp:139 +msgid "Secondary" +msgstr "Secondaire" + +#: qalculateplotdialog.cpp:171 +msgid "Sampling rate:" +msgstr "Taux d'échantillonage :" + +#: qalculateplotdialog.cpp:176 +msgid "Step size:" +msgstr "Taille des pas" + +#: qalculateplotdialog.cpp:194 +msgid "Display grid" +msgstr "Afficher la grille" + +#: qalculateplotdialog.cpp:196 +msgid "Display full border" +msgstr "Afficher toute la bordure" + +#: qalculateplotdialog.cpp:199 +msgid "Logarithmic x scale:" +msgstr "Échelle des X logarithmique :" + +#: qalculateplotdialog.cpp:203 +msgid "Logarithmic y scale:" +msgstr "Échelle des Y logarithmique :" + +#: qalculateplotdialog.cpp:207 +msgid "X-axis label:" +msgstr "Étiquette de l'axe des X :" + +#: qalculateplotdialog.cpp:210 +msgid "Y-axis label:" +msgstr "Étiquette de l'axe des Y :" + +#: qalculateplotdialog.cpp:213 +msgid "Color display:" +msgstr "Affichage de la couleur :" + +#: qalculateplotdialog.cpp:217 +msgid "Color" +msgstr "Couleur" + +#: qalculateplotdialog.cpp:220 +msgid "Monochrome" +msgstr "Monochrome" + +#: qalculateplotdialog.cpp:224 +msgid "Legend placement:" +msgstr "Placement de la légende :" + +#: qalculateplotdialog.cpp:227 +msgid "Top-left" +msgstr "En haut à gauche" + +#: qalculateplotdialog.cpp:228 +msgid "Top-right" +msgstr "En haut à droite" + +#: qalculateplotdialog.cpp:229 +msgid "Bottom-left" +msgstr "En bas à gauche" + +#: qalculateplotdialog.cpp:230 +msgid "Bottom-right" +msgstr "En bas à droite" + +#: qalculateplotdialog.cpp:231 +msgid "Below" +msgstr "En dessous" + +#: qalculateplotdialog.cpp:232 +msgid "Outside" +msgstr "En dehors" + +#: qalculateplotdialog.cpp:403 qalculateplotdialog.cpp:458 +#: qalculateplotdialog.cpp:506 +msgid "Empty expression." +msgstr "Expression vide." + +#: qalculateplotdialog.cpp:472 qalculateplotdialog.cpp:519 +msgid "Empty x variable." +msgstr "Variable x vide." + +#: qalculateprecisiondialog.cpp:34 qalculateprecisiondialog.cpp:36 +msgid "Recalculate" +msgstr "Recalculer" + +#: qalculateprecisiondialog.cpp:41 +msgid "Precision:" +msgstr "Précision :" + +#: qalculatepreferencesdialog.cpp:100 +msgid "Choose..." +msgstr "Choisir..." + +#: qalculatepreferencesdialog.cpp:147 +msgid "Preferences" +msgstr "Préférences" + +#: qalculatepreferencesdialog.cpp:161 +msgid "Close to system tray" +msgstr "Fermer vers la boîte à miniatures" + +#: qalculatepreferencesdialog.cpp:162 +msgid "" +"If the application will reside in the system tray when the window is closed" +msgstr "" +"Si l'application résidera dans la boîte à miniatures lorsque à la fermeture " +"de la fenêtre" + +#: qalculatepreferencesdialog.cpp:164 +msgid "Display expression status" +msgstr "Affiche le résultat de l'expression" + +#: qalculatepreferencesdialog.cpp:165 +msgid "" +"If as-you-type expression status shall be displayed below the expression " +"entry" +msgstr "" +"Si une expression s'affichant au fil de la frappe doit s'afficher sous " +"l'entrée de l'expression." + +#: qalculatepreferencesdialog.cpp:167 +msgid "Use icon buttons" +msgstr "Utiliser des boutons sous forme d'icône" + +#: qalculatepreferencesdialog.cpp:168 +msgid "" +"Use icons instead of text on the top-right buttons. The third state uses the " +"style setting for icons on buttons." +msgstr "" +"Utiliser des icônes plutôt que du texte dans les boutons en haut à droite. " +"Le troisième état utilise les préférences de style pour les icônes sur les " +"boutons." + +#: qalculatepreferencesdialog.cpp:171 +msgid "Update exchange rates on start" +msgstr "Mettre à jour les taux d'échange au démarrage" + +#: qalculatepreferencesdialog.cpp:172 +msgid "" +"If current exchange rates shall be downloaded from the internet at program " +"start" +msgstr "" +"Si les taux d'échange doivent être téléchargés sur internet au démarrage du " +"programme" + +#: qalculatepreferencesdialog.cpp:174 +msgid "Save mode on exit" +msgstr "Enregistrer le mode en quittant" + +#: qalculatepreferencesdialog.cpp:175 +msgid "If the mode of the calculator shall be restored" +msgstr "Si le mode de la calculatrice doit être restauré" + +#: qalculatepreferencesdialog.cpp:177 +msgid "Save definitions on exit" +msgstr "Enregistrer les définitions en quittant" + +#: qalculatepreferencesdialog.cpp:178 +msgid "" +"If changes to functions, units and variables shall be saved automatically" +msgstr "" +"Si les modifications apportées aux fonctions, unités et variables doivent " +"être automatiquement enregistrées" + +#: qalculatepreferencesdialog.cpp:180 +msgid "Use only keypad keys for RPN" +msgstr "N'utiliser que les touches du pavé numériquer pour la NPI" + +#: qalculatepreferencesdialog.cpp:181 +msgid "" +"Use only keypad keys for RPN operations (+-*/^) and use the rest of the " +"keyboard for expression entry" +msgstr "" +"N'utiliser que les touches du pavé numérique pour les opération NPI (+-*/^) " +"et utiliser le reste du clavier pour la saisie d'expressions" + +#: qalculatepreferencesdialog.cpp:183 +msgid "Ignores dots in numbers" +msgstr "Ignore les points dans les nombres" + +#: qalculatepreferencesdialog.cpp:184 +msgid "" +"Allow dots, '.', to be used as thousands separator instead of as an " +"alternative to decimal sign" +msgstr "" +"Permettre les points, '.', comme séparateur des milliers au lieu d'une " +"alternative au signe décimal." + +#: qalculatepreferencesdialog.cpp:187 +msgid "Enable unicode signs" +msgstr "Activer les signes unicode" + +#: qalculatepreferencesdialog.cpp:188 +msgid "Disable this if you have problems with some fancy characters" +msgstr "" +"Désactivez cette option si vous avez des problèmes avec certains caractères " +"spéciaux" + +#: qalculatepreferencesdialog.cpp:190 +msgid "Use lower case in numbers" +msgstr "Utiliser les minuscules dans les nombres" + +#: qalculatepreferencesdialog.cpp:191 +msgid "If lower case letters should be used in numbers with non-decimal base" +msgstr "" +"Si des lettres en minuscules doivent être utilisées dans les nombres avec " +"une base non décimale" + +#: qalculatepreferencesdialog.cpp:193 +msgid "Use lower case \"e\"" +msgstr "Utiliser la minuscule \"e\"" + +#: qalculatepreferencesdialog.cpp:194 +msgid "If \"e\"; shall be used instead of \"E\" in numbers" +msgstr "Si \"e\" doit être utilisé au lieu de \"E\" dans les nombres" + +#: qalculatepreferencesdialog.cpp:196 +msgid "Alternative base prefixes" +msgstr "Préfixes des bases alternatives" + +#: qalculatepreferencesdialog.cpp:197 +msgid "" +"If hexadecimal numbers shall be displayed with \"0x0\" and binary numbers " +"with \"0b00\" as prefixes" +msgstr "" +"Si les nombres hexadécimaux doivent être affichés avecle préfixe \"0x0\" et " +"les nombres binaires avec \"0b00\"" + +#: qalculatepreferencesdialog.cpp:199 +msgid "Spell out logical operators" +msgstr "Écrire les opérateurs logiques en toutes lettres" + +#: qalculatepreferencesdialog.cpp:200 +msgid "If logical and/or shall be displayed as \"&&\"/\"||\" or \"and\"/\"or\"" +msgstr "" +"Si les opérateurs logiques et/ou doivent être affichés \"&&\"/\"||\" ou \"et" +"\"/\"ou\"" + +#: qalculatepreferencesdialog.cpp:203 +msgid "Multiplication sign:" +msgstr "Signe de la multiplication :" + +#: qalculatepreferencesdialog.cpp:215 +msgid "Division sign:" +msgstr "Signe de la division :" + +#: qalculatepreferencesdialog.cpp:230 +msgid "Custom result font" +msgstr "Police du résultat personnalisée" + +#: qalculatepreferencesdialog.cpp:234 +msgid "Custom expression font" +msgstr "Police de l'expression personnalisée" + +#: qalculatepreferencesdialog.cpp:238 +msgid "Custom status font" +msgstr "Police de l'état personnalisée" + +#: qalculatepreferencesdialog.cpp:243 +msgid "Status error color:" +msgstr "Couleur des erreurs :" + +#: qalculatepreferencesdialog.cpp:250 +msgid "Status warning color:" +msgstr "Couleur des avertissements :" + +#: qalculateresultdisplay.cpp:52 +msgid "a matrix" +msgstr "une matrice" + +#: qalculateresultdisplay.cpp:54 +msgid "a vector" +msgstr "un vecteur" + +#: qalculateresultdisplay.cpp:57 +msgid "double-click to view/edit" +msgstr "double-cliquez pour voir/éditer" + +#: qalculateresultdisplay.cpp:60 +msgid "Unknown variable" +msgstr "Variable inconnue" + +#: qalculateresultdisplay.cpp:72 +msgid "Prefix" +msgstr "Préfixe" + +#: qalculateresultdisplay.cpp:336 +msgid "Show Parsed Expression" +msgstr "Afficher l'expression parcourue" + +#: qalculateresultdisplay.cpp:342 qalculateresultdisplay.cpp:353 +msgid "Show Object Info" +msgstr "Afficher l'information de l'objet" + +#: qalculateresultdisplay.cpp:348 +msgid "View/Edit Matrix" +msgstr "Voir/éditer la matrice" + +#: qalculateresultdisplay.cpp:350 +msgid "View/Edit Vector" +msgstr "Voir/éditer le vecteur" + +#: qalculateresultdisplay.cpp:382 +msgid "Parsed expression:" +msgstr "Expression parcourue :" + +#: qalculatesetbasedialog.cpp:33 +msgid "Result Base" +msgstr "Base du résultat" + +#: qalculatesetbasedialog.cpp:39 qalculatesetbasedialog.cpp:52 +msgid "Other:" +msgstr "Autre :" + +#: qalculatesetbasedialog.cpp:43 +msgid "Time format" +msgstr "Format de l'heure" + +#: qalculatesetbasedialog.cpp:44 qalculatesetbasedialog.cpp:55 +msgid "Roman numerals" +msgstr "Chiffres romains" + +#: qalculatesetbasedialog.cpp:46 +msgid "Expression Base" +msgstr "Base de l'expression" + +#: qalculateunitsdialog.cpp:54 +msgid "Units" +msgstr "Unités" + +#: qalculateunitsdialog.cpp:68 +msgid "Names" +msgstr "Noms" + +#: qalculateunitsdialog.cpp:69 +msgid "Base" +msgstr "Base" + +#: qalculateunitsdialog.cpp:72 +msgid "Conversion" +msgstr "Conversion" + +#: qalculateunitsdialog.cpp:105 +msgid "Convert Result" +msgstr "Convertir le résultat" + +#: qalculateunitsdialog.cpp:250 +msgid "Cannot delete unit as it is needed by other units." +msgstr "" +"Impossible de détruire l'unité car elle est utilisée par d'autres unités" + +#: qalculatevariablesdialog.cpp:51 +msgid "Variables" +msgstr "Variables" + +#: qalculatevariablesdialog.cpp:60 +msgid "Variable Name" +msgstr "Nom de variable" + +#. i18n: file ./qalculate_kdeui.rc line 5 +#: rc.cpp:6 +#, no-c-format +msgid "&New" +msgstr "&Nouveau" + +#. i18n: file ./qalculate_kdeui.rc line 37 +#: rc.cpp:12 +#, no-c-format +msgid "&Set Prefix" +msgstr "&Définir le préfixe" + +#. i18n: file ./qalculate_kdeui.rc line 39 +#: rc.cpp:15 +#, no-c-format +msgid "&Convert To Unit" +msgstr "&Convertir vers l'unité" + +#. i18n: file ./qalculate_kdeui.rc line 54 +#: rc.cpp:18 +#, no-c-format +msgid "&Mode" +msgstr "&Mode" + +#. i18n: file ./qalculate_kdeui.rc line 55 +#: rc.cpp:21 +#, no-c-format +msgid "Number Base" +msgstr "Base des nombres" + +#. i18n: file ./qalculate_kdeui.rc line 67 +#: rc.cpp:24 +#, no-c-format +msgid "Numerical Display" +msgstr "Affichage numérique" + +#. i18n: file ./qalculate_kdeui.rc line 80 +#: rc.cpp:27 +#, no-c-format +msgid "Fractional Display" +msgstr "Affichage sous forme de fraction" + +#. i18n: file ./qalculate_kdeui.rc line 86 +#: rc.cpp:30 +#, no-c-format +msgid "Unit Display" +msgstr "Affichage des unités" + +#. i18n: file ./qalculate_kdeui.rc line 96 +#: rc.cpp:33 +#, no-c-format +msgid "Angle Unit" +msgstr "Unité d'angle" + +#. i18n: file ./qalculate_kdeui.rc line 104 +#: rc.cpp:36 +#, no-c-format +msgid "Enabled Objects" +msgstr "Objets activés" + +#. i18n: file ./qalculate_kdeui.rc line 121 +#: rc.cpp:42 +#, no-c-format +msgid "Assumptions" +msgstr "Hypothèses" + +#. i18n: file ./qalculate_kdeui.rc line 137 +#: rc.cpp:45 +#, no-c-format +msgid "Algebraic Mode" +msgstr "Mode algébrique" + +#. i18n: file ./qalculate_kdeui.rc line 161 +#: rc.cpp:51 +#, no-c-format +msgid "Fu&nctions" +msgstr "Fo&nctions" + +#. i18n: file ./qalculate_kdeui.rc line 163 +#: rc.cpp:54 +#, no-c-format +msgid "&Variables" +msgstr "&Variables" + +#. i18n: file ./qalculate_kdeui.rc line 165 +#: rc.cpp:57 +#, no-c-format +msgid "&Units" +msgstr "&Unités" + +#~ msgid "10^x" +#~ msgstr "10^x" diff --git a/po/nl.po b/po/nl.po new file mode 100644 index 0000000..69d08c3 --- /dev/null +++ b/po/nl.po @@ -0,0 +1,2634 @@ +# translation of qalculate-kde.po to +# translation of qalculate_kde.po to +# This file is distributed under the same license as the PACKAGE package. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER. +# +# Rinse de Vries , 2006. +# Jaap Woldringh , 2006. +msgid "" +msgstr "" +"Project-Id-Version: qalculate_kde\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-05-08 14:44+0200\n" +"PO-Revision-Date: 07.11.YYYY 11:21\n" +"Last-Translator: Jaap Woldringh \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.2\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: _translatorinfo.cpp:1 +msgid "" +"_: NAME OF TRANSLATORS\n" +"Your names" +msgstr "Jaap Woldringh" + +#: _translatorinfo.cpp:3 +msgid "" +"_: EMAIL OF TRANSLATORS\n" +"Your emails" +msgstr "jjh punt woldringh op planet punt nl" + +#: kqalculate.cpp:264 +msgid "Remove from System Tray" +msgstr "Uit systeemvak verwijderen" + +#: kqalculate.cpp:265 qalculateeditdatasetdialog.cpp:471 +#: qalculateplotdialog.cpp:226 +msgid "Hide" +msgstr "Verbergen" + +#: kqalculate.cpp:286 kqalculate.cpp:4484 kqalculate.cpp:5915 +msgid "Enter" +msgstr "Invoeren" + +#: kqalculate.cpp:287 kqalculate.cpp:513 kqalculate.cpp:4485 +#: kqalculate.cpp:4492 kqalculate.cpp:5916 +msgid "=" +msgstr "=" + +#: kqalculate.cpp:289 kqalculate.cpp:514 kqalculate.cpp:4489 +#: kqalculate.cpp:4490 +msgid "Calculate expression and add to stack" +msgstr "" +"Expressie berekenen en plaats het antwoord in het stapelgeheugen (stack)" + +#: kqalculate.cpp:290 kqalculate.cpp:515 kqalculate.cpp:4493 +#: kqalculate.cpp:4494 +msgid "Calculate expression" +msgstr "Expressie berekenen" + +#: kqalculate.cpp:296 kqalculate.cpp:5918 +msgid "Store" +msgstr "Opslaan" + +#: kqalculate.cpp:298 +msgid "Store result as variable" +msgstr "Antwoord opslaan als een variabele" + +#: kqalculate.cpp:301 kqalculate.cpp:5920 qalculateconvertunitsdialog.cpp:42 +msgid "Convert" +msgstr "Converteren" + +#: kqalculate.cpp:303 +msgid "Convert units in result" +msgstr "Eenheden in het antwoord converteren" + +#: kqalculate.cpp:313 +msgid "Enter expression here" +msgstr "Expressie hier invoeren" + +#: kqalculate.cpp:322 +msgid "status" +msgstr "status" + +#: kqalculate.cpp:354 qalculateeditdataobjectdialog.cpp:71 +msgid "Exact" +msgstr "Exact" + +#: kqalculate.cpp:355 +msgid "Toggle exact mode" +msgstr "Exactmodus aan/uit" + +#: kqalculate.cpp:358 kqalculate.cpp:1070 +msgid "Fraction" +msgstr "Breuk" + +#: kqalculate.cpp:359 +msgid "Toggle fractional display" +msgstr "Tonen van breuken instellen" + +#: kqalculate.cpp:363 +msgid "Numerical display" +msgstr "Tonen van getallen" + +#: kqalculate.cpp:366 kqalculate.cpp:1046 qalculateresultdisplay.cpp:288 +msgid "Normal" +msgstr "Normaal" + +#: kqalculate.cpp:367 kqalculate.cpp:1048 qalculateresultdisplay.cpp:291 +msgid "Engineering" +msgstr "Technisch" + +#: kqalculate.cpp:368 kqalculate.cpp:1050 qalculateresultdisplay.cpp:294 +msgid "Scientific" +msgstr "Wetenschappelijk" + +#: kqalculate.cpp:369 +msgid "Pure" +msgstr "Zuiver" + +#: kqalculate.cpp:370 kqalculate.cpp:1054 +msgid "Simple" +msgstr "Eenvoudig" + +#: kqalculate.cpp:372 +msgid "Base in result" +msgstr "Grondtal in antwoord" + +#: kqalculate.cpp:376 kqalculate.cpp:1029 qalculatesetbasedialog.cpp:35 +#: qalculatesetbasedialog.cpp:48 +msgid "Binary" +msgstr "Binair" + +#: kqalculate.cpp:377 kqalculate.cpp:1031 qalculatesetbasedialog.cpp:36 +#: qalculatesetbasedialog.cpp:49 +msgid "Octal" +msgstr "Octaal" + +#: kqalculate.cpp:378 kqalculate.cpp:1033 kqalculate.cpp:1066 +#: qalculatesetbasedialog.cpp:37 qalculatesetbasedialog.cpp:50 +msgid "Decimal" +msgstr "Decimaal" + +#: kqalculate.cpp:379 kqalculate.cpp:1035 qalculatesetbasedialog.cpp:38 +#: qalculatesetbasedialog.cpp:51 +msgid "Hexadecimal" +msgstr "Hexadecimaal" + +#: kqalculate.cpp:380 kqalculate.cpp:1039 qalculatesetbasedialog.cpp:42 +msgid "Sexagesimal" +msgstr "Sexagesimaal" + +#: kqalculate.cpp:381 kqalculate.cpp:1041 +msgid "Time Format" +msgstr "Tijdnotatie" + +#: kqalculate.cpp:383 kqalculate.cpp:1037 +msgid "Other..." +msgstr "Overig..." + +#: kqalculate.cpp:389 +msgid "f(x)" +msgstr "f(x)" + +#: kqalculate.cpp:393 +msgid "Open functions manager" +msgstr "Functiebeheer openen" + +#: kqalculate.cpp:395 +msgid "sqrt" +msgstr "sqrt" + +#: kqalculate.cpp:396 +msgid "Square root" +msgstr "Vierkantswortel" + +#: kqalculate.cpp:399 kqalculate.cpp:947 +msgid "xy" +msgstr "xy" + +#: kqalculate.cpp:400 +msgid "Raise (Ctrl+*)" +msgstr "Machtsverheffen (Ctrl+*)" + +#: kqalculate.cpp:403 kqalculate.cpp:946 +msgid "x2" +msgstr "x2" + +#: kqalculate.cpp:404 +msgid "Square" +msgstr "Kwadraat" + +#: kqalculate.cpp:406 +msgid "log" +msgstr "log" + +#: kqalculate.cpp:407 +msgid "Base-10 logarithm" +msgstr "Logaritme met grondtal 10" + +#: kqalculate.cpp:409 +msgid "ln" +msgstr "ln" + +#: kqalculate.cpp:410 +msgid "Natural logarithm" +msgstr "Natuurlijke logaritme" + +#: kqalculate.cpp:412 +msgid "x!" +msgstr "x!" + +#: kqalculate.cpp:413 +msgid "Factorial" +msgstr "Faculteit" + +#: kqalculate.cpp:415 +msgid "cos" +msgstr "cos" + +#: kqalculate.cpp:416 +msgid "Cosine" +msgstr "Cosinus" + +#: kqalculate.cpp:418 +msgid "tan" +msgstr "tan" + +#: kqalculate.cpp:419 +msgid "Tangent" +msgstr "Tangens" + +#: kqalculate.cpp:421 +msgid "hyp" +msgstr "hyp" + +#: kqalculate.cpp:422 +msgid "Toggle hyperbolic functions" +msgstr "Hyperbolische functies aan/uit" + +#: kqalculate.cpp:425 +msgid "inv" +msgstr "inv" + +#: kqalculate.cpp:426 +msgid "Toggle inverse functions" +msgstr "Inverse functies aan/uit" + +#: kqalculate.cpp:429 +msgid "sin" +msgstr "sin" + +#: kqalculate.cpp:430 +msgid "Sine" +msgstr "Sinus" + +#: kqalculate.cpp:435 +msgid "Deg" +msgstr "Deg" + +#: kqalculate.cpp:436 +msgid "Angle Unit: Degrees" +msgstr "Hoekeenheid: Graden" + +#: kqalculate.cpp:439 +msgid "Rad" +msgstr "Rad" + +#: kqalculate.cpp:440 +msgid "Angle Unit: Radians" +msgstr "Hoekeenheid: Radialen" + +#: kqalculate.cpp:443 +msgid "Gra" +msgstr "Gra" + +#: kqalculate.cpp:444 +msgid "Angle Unit: Gradians" +msgstr "Hoekeenheid: Grads" + +#: kqalculate.cpp:447 kqalculate.cpp:1094 kqalculate.cpp:1152 +#: qalculateplotdialog.cpp:126 +msgid "None" +msgstr "Geen" + +#: kqalculate.cpp:464 +msgid "7" +msgstr "7" + +#: kqalculate.cpp:466 +msgid "8" +msgstr "8" + +#: kqalculate.cpp:468 +msgid "9" +msgstr "9" + +#: kqalculate.cpp:470 +msgid "4" +msgstr "4" + +#: kqalculate.cpp:472 +msgid "5" +msgstr "5" + +#: kqalculate.cpp:474 +msgid "6" +msgstr "6" + +#: kqalculate.cpp:476 +msgid "1" +msgstr "1" + +#: kqalculate.cpp:478 +msgid "2" +msgstr "2" + +#: kqalculate.cpp:480 +msgid "3" +msgstr "3" + +#: kqalculate.cpp:482 +msgid "0" +msgstr "0" + +#: kqalculate.cpp:485 +msgid "Decimal point" +msgstr "Decimale komma" + +#: kqalculate.cpp:487 +msgid "EXP" +msgstr "EXP" + +#: kqalculate.cpp:488 +msgid "10^x (Ctrl+Shift+E)" +msgstr "10^x (Ctrl+Shift+E)" + +#: kqalculate.cpp:491 +msgid "Del" +msgstr "Del" + +#: kqalculate.cpp:494 +msgid "AC" +msgstr "AC" + +#: kqalculate.cpp:498 +msgid "Multiply" +msgstr "Vermenigvuldigen" + +#: kqalculate.cpp:501 +msgid "Divide" +msgstr "Delen" + +#: kqalculate.cpp:507 +msgid "Subtract" +msgstr "Aftrekken" + +#: kqalculate.cpp:509 +msgid "Ans" +msgstr "Antw" + +#: kqalculate.cpp:510 +msgid "Previous result" +msgstr "Vorig antwoord" + +#: kqalculate.cpp:512 kqalculate.cpp:4488 +msgid "Ent" +msgstr "Ent" + +#: kqalculate.cpp:535 +msgid "Index" +msgstr "Index" + +#: kqalculate.cpp:536 qalculateeditdataobjectdialog.cpp:49 +#: qalculatevariablesdialog.cpp:61 +msgid "Value" +msgstr "Waarde" + +#: kqalculate.cpp:555 kqalculate.cpp:5924 +msgid "Up" +msgstr "Op" + +#: kqalculate.cpp:556 +msgid "Move selected register up" +msgstr "Geselecteerd register naar boven verplaatsen" + +#: kqalculate.cpp:560 kqalculate.cpp:5926 +msgid "Down" +msgstr "Neer" + +#: kqalculate.cpp:561 +msgid "Move selected register down" +msgstr "Geselecteerd register naar beneden verplaatsen" + +#: kqalculate.cpp:566 +msgid "Edit value of selected register" +msgstr "Waarde in geselecteerd register bewerken" + +#: kqalculate.cpp:571 +msgid "Delete selected register" +msgstr "Geselecteerd register wissen" + +#: kqalculate.cpp:576 +msgid "Clear the RPN stack" +msgstr "RPN-stapelgeheugen wissen" + +#: kqalculate.cpp:592 +msgid "Keypad" +msgstr "Toetsenbord" + +#: kqalculate.cpp:593 +msgid "Show/hide keypad" +msgstr "Toetsenbord tonen aan/uit" + +#: kqalculate.cpp:596 +msgid "History" +msgstr "Geschiedenis" + +#: kqalculate.cpp:597 +msgid "Show/hide history" +msgstr "Geschiedenis tonen aan/uit" + +#: kqalculate.cpp:600 +msgid "RPN Stack" +msgstr "RPN-stapelgeheugen (stack)" + +#: kqalculate.cpp:601 +msgid "Show/hide RPN stack" +msgstr "RPN-stapelgeheugen tonen aan/uit" + +#: kqalculate.cpp:716 kqalculate.cpp:2527 +msgid "RPN Register Moved" +msgstr "RPN-register is verplaatst" + +#: kqalculate.cpp:752 kqalculate.cpp:784 kqalculate.cpp:2138 +#: kqalculate.cpp:2702 kqalculate.cpp:2739 +msgid "approx." +msgstr "benadering" + +#: kqalculate.cpp:894 kqalculate.cpp:4813 +msgid "Load meta mode: %1" +msgstr "Inlezen metamodus: %1" + +#: kqalculate.cpp:966 +msgid "Qalculate! - Scientific Calculator" +msgstr "Qalculate! - Wetenschappelijke Rekenmachine" + +#: kqalculate.cpp:985 qalculateeditfunctiondialog.cpp:601 +#: qalculateresultdisplay.cpp:62 +msgid "Variable" +msgstr "Variabele" + +#: kqalculate.cpp:986 qalculateeditfunctiondialog.cpp:596 +#: qalculateeditmatrixvectordialog.cpp:106 qalculateimportcsvdialog.cpp:52 +#: qalculateinsertmatrixvectordialog.cpp:85 +#: qalculateinsertmatrixvectordialog.cpp:310 +msgid "Matrix" +msgstr "Matrix" + +#: kqalculate.cpp:987 qalculateeditfunctiondialog.cpp:595 +#: qalculateeditmatrixvectordialog.cpp:109 +#: qalculateinsertmatrixvectordialog.cpp:88 +#: qalculateinsertmatrixvectordialog.cpp:308 +msgid "Vector" +msgstr "Vector" + +#: kqalculate.cpp:988 +msgid "Unknown Variable" +msgstr "Onbekende variabele" + +#: kqalculate.cpp:989 qalculateeditdatasetdialog.cpp:70 +#: qalculateeditfunctiondialog.cpp:71 qalculateeditfunctiondialog.cpp:599 +#: qalculateplotdialog.cpp:98 qalculateresultdisplay.cpp:92 +msgid "Function" +msgstr "Functie" + +#: kqalculate.cpp:990 qalculatedatasetsdialog.cpp:64 +msgid "Data Set" +msgstr "Gegevensverzameling" + +#: kqalculate.cpp:991 qalculateconvertunitsdialog.cpp:68 +#: qalculateeditfunctiondialog.cpp:600 qalculateresultdisplay.cpp:67 +#: qalculateunitsdialog.cpp:67 +msgid "Unit" +msgstr "Eenheid" + +#: kqalculate.cpp:992 +msgid "Import CSV File..." +msgstr "CSV-bestand importeren..." + +#: kqalculate.cpp:993 +msgid "Export CSV File..." +msgstr "CSV-bestand exporteren..." + +#: kqalculate.cpp:994 +msgid "Store Result..." +msgstr "Antwoord opslaan..." + +#: kqalculate.cpp:995 +msgid "Save Result Image..." +msgstr "Afbeelding van het antwoord opslaan..." + +#: kqalculate.cpp:996 +msgid "Save Definitions" +msgstr "Definities bewaren" + +#: kqalculate.cpp:997 +msgid "Update Exchange Rates" +msgstr "Wisselkoersen bijwerken" + +#: kqalculate.cpp:998 +msgid "Plot Functions/Data" +msgstr "Functies/Gegevens plotten" + +#: kqalculate.cpp:1000 +msgid "Convert Number Bases" +msgstr "Getallen converteren naar ander grondtal" + +#: kqalculate.cpp:1001 qalculateperiodictabledialog.cpp:40 +msgid "Periodic Table" +msgstr "Periodiek systeem" + +#: kqalculate.cpp:1008 +msgid "Show/hide main Qalculate! window" +msgstr "Tonen/verbergen hoofdvenster van Qalculate!" + +#: kqalculate.cpp:1011 +msgid "Configure &Global Shortcuts..." +msgstr "&Globale sneltoetsen instellen..." + +#: kqalculate.cpp:1013 +msgid "Manage Variables" +msgstr "Variabelen beheren" + +#: kqalculate.cpp:1014 +msgid "Manage Functions" +msgstr "Functies beheren" + +#: kqalculate.cpp:1015 +msgid "Manage Units" +msgstr "Eenheden beheren" + +#: kqalculate.cpp:1016 +msgid "Manage Data Sets" +msgstr "Gegevensverzamelingen beheren" + +#: kqalculate.cpp:1017 kqalculate.cpp:1150 +msgid "Factorize" +msgstr "Ontbinden in factoren" + +#: kqalculate.cpp:1018 kqalculate.cpp:1148 +msgid "Simplify" +msgstr "Vereenvoudigen" + +#: kqalculate.cpp:1019 +msgid "Set Unknowns..." +msgstr "Onbekenden een waarde geven..." + +#: kqalculate.cpp:1020 +msgid "Convert to Unit Expression..." +msgstr "Converteren naar eenheidexpressie..." + +#: kqalculate.cpp:1021 kqalculate.cpp:1084 +msgid "Convert to Base Units" +msgstr "Converteren naar basiseenheden" + +#: kqalculate.cpp:1022 kqalculate.cpp:1086 +msgid "Convert to Best Unit" +msgstr "Converteren naar meest geschikte eenheid" + +#: kqalculate.cpp:1023 +msgid "Insert Matrix..." +msgstr "Matrix invoegen..." + +#: kqalculate.cpp:1024 +msgid "Insert Vector..." +msgstr "Vector invoegen..." + +#: kqalculate.cpp:1025 +msgid "Copy Result" +msgstr "Antwoord kopiëren" + +#: kqalculate.cpp:1026 +msgid "Clear History" +msgstr "Geschiedenis wissen" + +#: kqalculate.cpp:1027 +msgid "Configure Qalculate!" +msgstr "Qalculate! instellen" + +#: kqalculate.cpp:1043 +msgid "Roman Numerals" +msgstr "Romeinse cijfers" + +#: kqalculate.cpp:1045 +msgid "Select Result and Expression Base..." +msgstr "Grondtal voor antwoord en expressie selecteren..." + +#: kqalculate.cpp:1052 +msgid "Purely Scientific" +msgstr "Zuiver wetenschappelijk" + +#: kqalculate.cpp:1056 +msgid "Indicate Infinite Series" +msgstr "Oneindige reeks aangeven" + +#: kqalculate.cpp:1058 +msgid "Sort Minus Last" +msgstr "Sorteer minus het laatst" + +#: kqalculate.cpp:1060 +msgid "Negative Exponents" +msgstr "Negatieve exponenten" + +#: kqalculate.cpp:1062 +msgid "Show Ending Zeroes" +msgstr "Afsluitende nullen weergeven" + +#: kqalculate.cpp:1064 +msgid "Round Halfway Numbers to Even" +msgstr "Tussenliggende getallen naar even afronden" + +#: kqalculate.cpp:1068 +msgid "Decimal (Try Exact)" +msgstr "Decimaal (Exact proberen)" + +#: kqalculate.cpp:1072 +msgid "Combined" +msgstr "Gecombineerd" + +#: kqalculate.cpp:1074 +msgid "Enable Prefixes" +msgstr "Voorvoegsels toestaan" + +#: kqalculate.cpp:1076 +msgid "Enable Use of All SI Prefixes" +msgstr "Gebruik van alle SI-voorvoegsels toestaan" + +#: kqalculate.cpp:1078 +msgid "Enable Denominator Prefixes" +msgstr "Voorvoegsel voor noemer toestaan" + +#: kqalculate.cpp:1080 +msgid "Place Units Separately" +msgstr "Eenheden afzonderlijk plaatsen" + +#: kqalculate.cpp:1082 +msgid "No Automatic Conversion" +msgstr "Geen automatische conversie" + +#: kqalculate.cpp:1088 +msgid "Degrees" +msgstr "Graden (90 graden in rechte hoek)" + +#: kqalculate.cpp:1090 +msgid "Radians" +msgstr "Radialen" + +#: kqalculate.cpp:1092 +msgid "Gradians" +msgstr "Grads (100 grads in rechte hoek)" + +#: kqalculate.cpp:1096 +msgid "Abbreviate Names" +msgstr "Namen afkorten" + +#: kqalculate.cpp:1098 +msgid "Enable Variables" +msgstr "Variabelen toestaan" + +#: kqalculate.cpp:1100 +msgid "Enable Functions" +msgstr "Functies toestaan" + +#: kqalculate.cpp:1102 +msgid "Enable Units" +msgstr "Eenheden toestaan" + +#: kqalculate.cpp:1104 +msgid "Enable Unknowns" +msgstr "Onbekende variabelen toestaan" + +#: kqalculate.cpp:1106 +msgid "Calculate Variables" +msgstr "Variabelen berekenen" + +#: kqalculate.cpp:1108 +msgid "Allow Complex Result" +msgstr "Complexe antwoorden toestaan" + +#: kqalculate.cpp:1110 +msgid "Allow Infinite Result" +msgstr "Oneindige antwoorden toestaan" + +#: kqalculate.cpp:1112 +msgid "Try Exact" +msgstr "Exact proberen" + +#: kqalculate.cpp:1114 +msgid "Always Exact" +msgstr "Altijd exact" + +#: kqalculate.cpp:1116 qalculateeditdataobjectdialog.cpp:70 +msgid "Approximate" +msgstr "Benaderd" + +#: kqalculate.cpp:1118 kqalculate.cpp:1132 +#: qalculateeditunknownvariabledialog.cpp:65 +#: qalculateeditunknownvariabledialog.cpp:78 +#: qalculateperiodictabledialog.cpp:235 +msgid "Unknown" +msgstr "Onbekende" + +#: kqalculate.cpp:1120 qalculateeditunknownvariabledialog.cpp:66 +msgid "Not Matrix" +msgstr "Geen matrix" + +#: kqalculate.cpp:1122 qalculateeditdatasetdialog.cpp:468 +#: qalculateeditfunctiondialog.cpp:590 +#: qalculateeditunknownvariabledialog.cpp:67 +msgid "Number" +msgstr "Getal" + +#: kqalculate.cpp:1124 +msgid "Complex" +msgstr "Complex" + +#: kqalculate.cpp:1126 +msgid "Real" +msgstr "Reëel" + +#: kqalculate.cpp:1128 +msgid "Rational" +msgstr "Rationaal" + +#: kqalculate.cpp:1130 qalculateeditfunctiondialog.cpp:591 +#: qalculateeditunknownvariabledialog.cpp:71 +msgid "Integer" +msgstr "Geheel" + +#: kqalculate.cpp:1134 qalculateeditunknownvariabledialog.cpp:83 +msgid "Non-Zero" +msgstr "Ongelijk aan nul" + +#: kqalculate.cpp:1136 qalculateeditunknownvariabledialog.cpp:79 +msgid "Positive" +msgstr "Positief" + +#: kqalculate.cpp:1138 qalculateeditunknownvariabledialog.cpp:80 +msgid "Non-Negative" +msgstr "Niet-negatief" + +#: kqalculate.cpp:1140 qalculateeditunknownvariabledialog.cpp:81 +msgid "Negative" +msgstr "Negatief" + +#: kqalculate.cpp:1142 qalculateeditunknownvariabledialog.cpp:82 +msgid "Non-Positive" +msgstr "Niet-positief" + +#: kqalculate.cpp:1144 +msgid "Non-Zero Denominators" +msgstr "Noemers ongelijk aan nul" + +#: kqalculate.cpp:1146 +msgid "Warn About Denominators Assumed Non-Zero" +msgstr "Waarschuwen als noemers ongelijk nul worden aangenomen" + +#: kqalculate.cpp:1154 +msgid "Read Precision" +msgstr "Nauwkeurigheid lezen" + +#: kqalculate.cpp:1156 +msgid "Limit Implicit Multiplication" +msgstr "Impliciet vermenigvuldigen beperken" + +#: kqalculate.cpp:1158 +msgid "RPN Mode" +msgstr "RPN-modus" + +#: kqalculate.cpp:1160 +msgid "RPN Syntax" +msgstr "RPN-notatie" + +#: kqalculate.cpp:1162 qalculateprecisiondialog.cpp:31 +msgid "Precision" +msgstr "Nauwkeurigheid" + +#: kqalculate.cpp:1163 qalculatedecimalsdialog.cpp:27 +msgid "Decimals" +msgstr "Decimalen" + +#: kqalculate.cpp:1164 +msgid "Save Mode..." +msgstr "Modus opslaan..." + +#: kqalculate.cpp:1165 +msgid "Delete Mode..." +msgstr "Modus wissen..." + +#: kqalculate.cpp:1167 +msgid "Save Default Mode" +msgstr "Standaardmodus opslaan" + +#: kqalculate.cpp:1168 +msgid "Clear Stack" +msgstr "Stapelgeheugen wissen" + +#: kqalculate.cpp:1172 +msgid "Exp RPN Operation" +msgstr "Exp RPN-bewerking" + +#: kqalculate.cpp:1860 +msgid "and" +msgstr "and" + +#: kqalculate.cpp:1865 +msgid "or" +msgstr "or" + +#: kqalculate.cpp:2122 +msgid "undefined" +msgstr "ongedefinieerd" + +#: kqalculate.cpp:2164 +msgid "EXACT" +msgstr "EXACT" + +#: kqalculate.cpp:2167 +msgid "APPROX" +msgstr "BENADERING" + +#: kqalculate.cpp:2171 +msgid "RPN" +msgstr "RPN" + +#: kqalculate.cpp:2179 +msgid "BIN" +msgstr "BIN" + +#: kqalculate.cpp:2184 +msgid "OCT" +msgstr "OCT" + +#: kqalculate.cpp:2189 +msgid "HEX" +msgstr "HEX" + +#: kqalculate.cpp:2194 +msgid "ROMAN" +msgstr "ROMEINS" + +#: kqalculate.cpp:2206 +msgid "DEG" +msgstr "DEG" + +#: kqalculate.cpp:2211 +msgid "RAD" +msgstr "RAD" + +#: kqalculate.cpp:2216 +msgid "GRA" +msgstr "GRA" + +#: kqalculate.cpp:2223 +msgid "PREC" +msgstr "PREC" + +#: kqalculate.cpp:2228 +msgid "FUNC" +msgstr "FUNC" + +#: kqalculate.cpp:2234 +msgid "UNIT" +msgstr "EENH" + +#: kqalculate.cpp:2240 +msgid "VAR" +msgstr "VAR" + +#: kqalculate.cpp:2246 +msgid "INF" +msgstr "INF" + +#: kqalculate.cpp:2252 +msgid "CPLX" +msgstr "CPLX" + +#: kqalculate.cpp:2333 kqalculate.cpp:2351 kqalculate.cpp:2581 +msgid "aborted" +msgstr "afgebroken" + +#: kqalculate.cpp:2352 +msgid "calculation was aborted" +msgstr "berekening werd afgebroken" + +#: kqalculate.cpp:2588 +msgid "result processing was aborted" +msgstr "berekening werd afgebroken" + +#: kqalculate.cpp:2636 +msgid "Processing..." +msgstr "Verwerken..." + +#: kqalculate.cpp:2640 kqalculate.cpp:2885 kqalculate.cpp:3145 +msgid "Abort" +msgstr "Afbreken" + +#: kqalculate.cpp:2873 +msgid "Factorizing..." +msgstr "Ontbinden in factoren..." + +#: kqalculate.cpp:2877 +msgid "Simplifying..." +msgstr "Vereenvoudigen..." + +#: kqalculate.cpp:3141 +msgid "Calculating..." +msgstr "Berekenen..." + +#: kqalculate.cpp:3191 +msgid "RPN Operation" +msgstr "RPN-bewerking" + +#: kqalculate.cpp:3259 +msgid "Errors" +msgstr "Fouten" + +#: kqalculate.cpp:3260 +msgid "Warnings" +msgstr "Waarschuwingen" + +#: kqalculate.cpp:3270 +msgid "Couldn't write definitions" +msgstr "Kon definities niet schrijven" + +#: kqalculate.cpp:3538 +msgid "Prefixes" +msgstr "Voorvoegsels" + +#: kqalculate.cpp:3665 +msgid "No Prefix" +msgstr "Geen voorvoegsel" + +#: kqalculate.cpp:3816 qalculatevariablesdialog.cpp:191 +#: qalculatevariablesdialog.cpp:337 +msgid "Variable does not exist anymore." +msgstr "Variabele bestaat niet meer." + +#: kqalculate.cpp:3832 qalculateconvertunitsdialog.cpp:153 +#: qalculateunitsdialog.cpp:223 qalculateunitsdialog.cpp:337 +msgid "Unit does not exist anymore." +msgstr "Eenheid bestaat niet meer." + +#: kqalculate.cpp:3905 +msgid "Failed to download exchange rates from ECB." +msgstr "Het ophalen van de wisselkoersen van de ECB is mislukt." + +#: kqalculate.cpp:4752 +msgid "Save Mode" +msgstr "Modus opslaan" + +#: kqalculate.cpp:4755 +msgid "Mode name:" +msgstr "Modusnaam:" + +#: kqalculate.cpp:4765 +msgid "Shortcut:" +msgstr "Sneltoets:" + +#: kqalculate.cpp:4792 +msgid "Empty mode name." +msgstr "Geen modusnaam." + +#: kqalculate.cpp:4795 +msgid "Preset mode cannot be overwritten." +msgstr "Vooringestelde modus kan niet worden overschreven." + +#: kqalculate.cpp:4827 +msgid "Delete Mode" +msgstr "Modus wissen" + +#: kqalculate.cpp:4827 +msgid "Mode:" +msgstr "Modus:" + +#: kqalculate.cpp:5001 +msgid "log10 function not found." +msgstr "Kon log10-functie niet vinden." + +#: kqalculate.cpp:5545 main.cpp:156 main.cpp:159 main.cpp:160 main.cpp:161 +#: main.cpp:162 +msgid "Temporary" +msgstr "Tijdelijk" + +#: kqalculate.cpp:5567 kqalculate.cpp:5594 qalculatefunctionsdialog.cpp:191 +#: qalculatefunctionsdialog.cpp:300 +msgid "Function does not exist anymore." +msgstr "Functie bestaat niet meer." + +#: kqalculate.cpp:5697 kqalculate.cpp:5733 +msgid "My Variables" +msgstr "Mijn variabelen" + +#: kqalculate.cpp:5709 qalculateimportcsvdialog.cpp:56 +msgid "Vectors" +msgstr "Vectoren" + +#: kqalculate.cpp:5721 +msgid "Matrices" +msgstr "Matrices" + +#: kqalculate.cpp:5762 qalculateplotdialog.cpp:726 +msgid "Save Image" +msgstr "Afbeelding opslaan" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "" +"A file named \"%1\" already exists. Are you sure you want to overwrite it?" +msgstr "Een bestand met de naam \"%1\" bestaat al. Wilt u het overschrijven?" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "Overwrite File?" +msgstr "Bestand overschrijven?" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "&Overwrite" +msgstr "&Overschrijven" + +#: kqalculate.cpp:5801 +msgid "Failed to save image." +msgstr "Afbeelding opslaan is mislukt." + +#: kqalculate.cpp:6027 +msgid "No unknowns in result." +msgstr "Geen onbekenden in antwoord." + +#: kqalculate.cpp:6030 +msgid "Set Unknowns" +msgstr "Onbekenden een waarde geven" + +#: kqalculate.cpp:6194 +msgid "Too many arguments for %1()." +msgstr "Teveel argumenten voor %1()." + +#: kqalculate.cpp:6220 qalculatedatasetsdialog.cpp:342 +#: qalculatefunctionsdialog.cpp:343 qalculateresultdisplay.cpp:120 +msgid "argument" +msgstr "argument" + +#: kqalculate.cpp:6442 kqalculate.cpp:6446 +msgid "Edit Expression" +msgstr "Expressie bewerken" + +#: kqalculate.cpp:6451 +msgid "Edit Result" +msgstr "Antwoord bewerken" + +#: kqalculate.cpp:6454 +msgid "Insert Result Variable" +msgstr "Antwoordvariabele invoegen" + +#: main.cpp:45 +msgid "A powerful and easy to use desktop calculator" +msgstr "" +"Een gemakkelijk te gebruiken rekenmachine op het bureaublad met veel " +"mogelijkheden" + +#: main.cpp:51 +msgid "Calculate X11-clipboard content (selected text)" +msgstr "X11-klembordinhoud berekenen (geselecteerde tekst)" + +#: main.cpp:52 +msgid "Initial expression to calculate" +msgstr "Te berekenen initiële expressie" + +#: main.cpp:134 +msgid "Enter a mathematical expression above.
Ex. 5 + 2 / 3" +msgstr "Een rekenkundige expressie hierboven invoeren.
Bv.. 5 + 2 / 3" + +#: main.cpp:143 +msgid "" +"You need to download exchange rates to be able to convert between different " +"currencies. You can later get current exchange rates by selecting \"Update " +"Exchange Rates\" under the File menu.\n" +"\n" +"Do you want to fetch exchange rates now from the Internet?" +msgstr "" +"U moet de wisselkoersen ophalen om van de ene naar de andere munteenheid te " +"kunnen converteren. U kunt de huidige wisselkoersen ophalen door " +"\"Wisselkoersen ophalen\" te selecteren in het menu Bestand.\n" +"\n" +"Wilt u de wisselkoersen nu ophalen van het internet?" + +#: main.cpp:143 +msgid "Update exchange rates?" +msgstr "Wisselkoersen bijwerken?" + +#: main.cpp:155 +msgid "ans" +msgstr "antw" + +#: main.cpp:156 +msgid "Last Answer" +msgstr "Laatste antwoord" + +#: main.cpp:157 +msgid "answer" +msgstr "antwoord" + +#: main.cpp:159 +msgid "Answer 2" +msgstr "Antwoord 2" + +#: main.cpp:160 +msgid "Answer 3" +msgstr "Antwoord 3" + +#: main.cpp:161 +msgid "Answer 4" +msgstr "Antwoord 4" + +#: main.cpp:162 +msgid "Answer 5" +msgstr "Antwoord 5" + +#: main.cpp:166 +msgid "Failed to load global definitions!" +msgstr "Het inlezen van de globale definities is mislukt!" + +#: main.cpp:290 +msgid "Qalculate!" +msgstr "Qalculate!" + +#: preferences.cpp:208 +msgid "Preset" +msgstr "Voorinstelling" + +#: preferences.cpp:669 +#, c-format +msgid "" +"Couldn't write preferences to\n" +"%s" +msgstr "" +"Kon de voorkeurinstellingen niet schrijven naar\n" +"%s" + +#: qalculateconvertnumberbasesdialog.cpp:31 qalculatesetbasedialog.cpp:29 +msgid "Number Bases" +msgstr "Grondtallen voor talstelsels" + +#: qalculateconvertnumberbasesdialog.cpp:37 +msgid "Decimal:" +msgstr "Decimaal:" + +#: qalculateconvertnumberbasesdialog.cpp:41 +msgid "Binary:" +msgstr "Binair:" + +#: qalculateconvertnumberbasesdialog.cpp:45 +msgid "Octal:" +msgstr "Octaal:" + +#: qalculateconvertnumberbasesdialog.cpp:49 +msgid "Hexadecimal:" +msgstr "Hexadecimaal:" + +#: qalculateconvertunitsdialog.cpp:44 +msgid "Selector" +msgstr "Keuze" + +#: qalculateconvertunitsdialog.cpp:50 qalculateeditdatasetdialog.cpp:482 +msgid "Unit expression:" +msgstr "Eenheidexpressie:" + +#: qalculateconvertunitsdialog.cpp:63 qalculatefunctionsdialog.cpp:55 +#: qalculateunitsdialog.cpp:63 qalculatevariablesdialog.cpp:57 +msgid "Category" +msgstr "Categorie" + +#: qalculateconvertunitsdialog.cpp:85 qalculateconvertunitsdialog.cpp:86 +#: qalculateconvertunitsdialog.cpp:141 qalculateconvertunitsdialog.cpp:180 +#: qalculatefunctionsdialog.cpp:118 qalculatefunctionsdialog.cpp:119 +#: qalculatefunctionsdialog.cpp:183 qalculatefunctionsdialog.cpp:505 +#: qalculateunitsdialog.cpp:150 qalculateunitsdialog.cpp:151 +#: qalculateunitsdialog.cpp:215 qalculateunitsdialog.cpp:416 +#: qalculatevariablesdialog.cpp:116 qalculatevariablesdialog.cpp:117 +#: qalculatevariablesdialog.cpp:183 qalculatevariablesdialog.cpp:462 +msgid "All" +msgstr "Alles" + +#: qalculateconvertunitsdialog.cpp:132 qalculateconvertunitsdialog.cpp:133 +#: qalculateconvertunitsdialog.cpp:134 qalculateconvertunitsdialog.cpp:182 +#: qalculatefunctionsdialog.cpp:165 qalculatefunctionsdialog.cpp:166 +#: qalculatefunctionsdialog.cpp:167 qalculatefunctionsdialog.cpp:236 +#: qalculatefunctionsdialog.cpp:262 qalculatefunctionsdialog.cpp:285 +#: qalculatefunctionsdialog.cpp:507 qalculateunitsdialog.cpp:197 +#: qalculateunitsdialog.cpp:198 qalculateunitsdialog.cpp:199 +#: qalculateunitsdialog.cpp:273 qalculateunitsdialog.cpp:299 +#: qalculateunitsdialog.cpp:322 qalculateunitsdialog.cpp:418 +#: qalculatevariablesdialog.cpp:165 qalculatevariablesdialog.cpp:166 +#: qalculatevariablesdialog.cpp:167 qalculatevariablesdialog.cpp:258 +#: qalculatevariablesdialog.cpp:284 qalculatevariablesdialog.cpp:322 +#: qalculatevariablesdialog.cpp:464 +msgid "Uncategorized" +msgstr "Niet-gecategoriseerd" + +#: qalculatedatasetsdialog.cpp:46 qalculateeditdatasetdialog.cpp:232 +msgid "Data Sets" +msgstr "Gegevensverzamelingen" + +#: qalculatedatasetsdialog.cpp:61 +msgid "Data Sets:" +msgstr "Gegevensverzamelingen:" + +#: qalculatedatasetsdialog.cpp:68 qalculatedatasetsdialog.cpp:91 +#: qalculateeditdatasetdialog.cpp:107 qalculateeditdatasetdialog.cpp:629 +#: qalculateeditfunctiondialog.cpp:133 qalculateeditfunctiondialog.cpp:492 +#: qalculateeditnamesdialog.cpp:64 qalculatefunctionsdialog.cpp:67 +#: qalculateunitsdialog.cpp:91 qalculatevariablesdialog.cpp:66 +msgid "New" +msgstr "Nieuw" + +#: qalculatedatasetsdialog.cpp:77 qalculateeditdatasetdialog.cpp:79 +#: qalculateeditdatasetdialog.cpp:456 qalculateeditfunctiondialog.cpp:98 +msgid "Description:" +msgstr "Beschrijving:" + +#: qalculatedatasetsdialog.cpp:84 +msgid "Objects:" +msgstr "Objecten:" + +#: qalculatedatasetsdialog.cpp:87 qalculateeditdatasetdialog.cpp:236 +#: qalculateeditfunctiondialog.cpp:598 +msgid "Object" +msgstr "Object" + +#: qalculatedatasetsdialog.cpp:100 +msgid "Attributes:" +msgstr "Attributen:" + +#: qalculatedatasetsdialog.cpp:157 qalculatedatasetsdialog.cpp:218 +msgid "Data set does not exist anymore." +msgstr "Gegevensverzameling bestaat niet meer." + +#: qalculatedatasetsdialog.cpp:300 qalculateeditdatasetdialog.cpp:195 +#: qalculatefunctionsdialog.cpp:456 +msgid "key" +msgstr "sleutelwaarde" + +#: qalculatedatasetsdialog.cpp:316 +msgid "Data Retrieval Function" +msgstr "Functie voor ophalen gegevens" + +#: qalculatedecimalsdialog.cpp:31 +msgid "Max decimals:" +msgstr "Max decimalen:" + +#: qalculatedecimalsdialog.cpp:39 +msgid "Min decimals:" +msgstr "Min decimalen:" + +#: qalculateeditdataobjectdialog.cpp:30 qalculateeditdataobjectdialog.cpp:40 +msgid "Edit Object" +msgstr "Object bewerken" + +#: qalculateeditdataobjectdialog.cpp:42 +msgid "New Object" +msgstr "Nieuw object" + +#: qalculateeditdataobjectdialog.cpp:48 qalculateeditdatasetdialog.cpp:242 +msgid "Property" +msgstr "Eigenschap" + +#. i18n: file ./qalculate_kdeui.rc line 116 +#: qalculateeditdataobjectdialog.cpp:51 rc.cpp:39 +#, no-c-format +msgid "Approximation" +msgstr "Benadering" + +#: qalculateeditdatasetdialog.cpp:53 qalculateeditdatasetdialog.cpp:307 +msgid "Edit Data Set" +msgstr "Gegevensverzameling bewerken" + +#: qalculateeditdatasetdialog.cpp:68 qalculateeditfunctiondialog.cpp:70 +#: qalculatepreferencesdialog.cpp:157 +msgid "General" +msgstr "Algemeen" + +#: qalculateeditdatasetdialog.cpp:73 qalculateplotdialog.cpp:86 +#: qalculateplotdialog.cpp:189 +msgid "Title:" +msgstr "Titel:" + +#: qalculateeditdatasetdialog.cpp:76 +msgid "Data file:" +msgstr "Gegevensbestand:" + +#: qalculateeditdatasetdialog.cpp:87 +msgid "Copyright:" +msgstr "Copyright:" + +#: qalculateeditdatasetdialog.cpp:97 +msgid "Properties:" +msgstr "Eigenschappen:" + +#: qalculateeditdatasetdialog.cpp:99 qalculateplotdialog.cpp:153 +msgid "Title" +msgstr "Titel" + +#: qalculateeditdatasetdialog.cpp:100 qalculateeditdatasetdialog.cpp:620 +#: qalculateeditfunctiondialog.cpp:124 qalculateeditnamesdialog.cpp:41 +#: qalculateeditunitdialog.cpp:50 +msgid "Name" +msgstr "Naam" + +#: qalculateeditdatasetdialog.cpp:101 qalculateeditfunctiondialog.cpp:125 +#: qalculateeditunitdialog.cpp:75 qalculateeditunknownvariabledialog.cpp:60 +msgid "Type" +msgstr "Type" + +#: qalculateeditdatasetdialog.cpp:115 qalculateeditdatasetdialog.cpp:442 +#: qalculateeditfunctiondialog.cpp:74 qalculateeditfunctiondialog.cpp:583 +#: qalculateeditmatrixvectordialog.cpp:78 qalculateeditunitdialog.cpp:55 +#: qalculateeditunknownvariabledialog.cpp:47 +#: qalculateeditvariabledialog.cpp:49 qalculateimportcsvdialog.cpp:60 +msgid "Name:" +msgstr "Naam:" + +#: qalculateeditdatasetdialog.cpp:124 qalculateeditdatasetdialog.cpp:451 +#: qalculateeditfunctiondialog.cpp:83 qalculateeditmatrixvectordialog.cpp:87 +#: qalculateeditunitdialog.cpp:64 qalculateeditunknownvariabledialog.cpp:56 +#: qalculateeditvariabledialog.cpp:60 +msgid "Names Details" +msgstr "Namen van onderdelen" + +#: qalculateeditdatasetdialog.cpp:126 +msgid "Object argument name:" +msgstr "Naam objectargument:" + +#: qalculateeditdatasetdialog.cpp:129 +msgid "Property argument name:" +msgstr "Naam eigenschapargument:" + +#: qalculateeditdatasetdialog.cpp:132 +msgid "Default property:" +msgstr "Standaard eigenschap:" + +#: qalculateeditdatasetdialog.cpp:173 +msgid "text" +msgstr "tekst" + +#: qalculateeditdatasetdialog.cpp:178 qalculateeditdatasetdialog.cpp:186 +msgid "approximate" +msgstr "benaderd" + +#: qalculateeditdatasetdialog.cpp:181 qalculateexpressionedit.cpp:712 +#: qalculatevariablesdialog.cpp:428 +msgid "number" +msgstr "getal" + +#: qalculateeditdatasetdialog.cpp:189 +msgid "expression" +msgstr "expressie" + +#: qalculateeditdatasetdialog.cpp:213 qalculateeditdatasetdialog.cpp:499 +#: qalculateeditfunctiondialog.cpp:190 qalculateeditmatrixvectordialog.cpp:185 +#: qalculateeditunitdialog.cpp:146 qalculateeditunknownvariabledialog.cpp:132 +#: qalculateeditvariabledialog.cpp:102 +msgid "Empty name field" +msgstr "Naamveld is leeg" + +#: qalculateeditdatasetdialog.cpp:217 qalculateeditfunctiondialog.cpp:201 +msgid "" +"A function with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"Een functie met deze naam bestaat reeds.\n" +"Wilt u die overschrijven?" + +#: qalculateeditdatasetdialog.cpp:309 +msgid "Edit Data Set (global)" +msgstr "Gegevensverzameling bewerken (globaal)" + +#: qalculateeditdatasetdialog.cpp:311 +msgid "New Data Set" +msgstr "Nieuwe gegevensverzameling" + +#: qalculateeditdatasetdialog.cpp:322 +msgid "info" +msgstr "info" + +#: qalculateeditdatasetdialog.cpp:435 qalculateeditdatasetdialog.cpp:548 +msgid "Edit Property" +msgstr "Eigenschap bewerken" + +#: qalculateeditdatasetdialog.cpp:453 qalculateeditfunctiondialog.cpp:90 +#: qalculateeditmatrixvectordialog.cpp:93 qalculateeditunitdialog.cpp:66 +#: qalculateeditunknownvariabledialog.cpp:90 +#: qalculateeditvariabledialog.cpp:80 qalculateimportcsvdialog.cpp:63 +msgid "Descriptive name:" +msgstr "Beschrijvende naam:" + +#: qalculateeditdatasetdialog.cpp:464 +msgid "Value type:" +msgstr "Waardetype:" + +#: qalculateeditdatasetdialog.cpp:467 qalculateeditfunctiondialog.cpp:593 +msgid "Text" +msgstr "Tekst" + +#: qalculateeditdatasetdialog.cpp:469 qalculateeditfunctiondialog.cpp:482 +#: qalculateplotdialog.cpp:154 +msgid "Expression" +msgstr "Expressie" + +#: qalculateeditdatasetdialog.cpp:474 +msgid "Use as key" +msgstr "Gebruiken als toets" + +#: qalculateeditdatasetdialog.cpp:476 +msgid "Approximate value" +msgstr "Benaderde waarde" + +#: qalculateeditdatasetdialog.cpp:478 +msgid "Case sensitive value" +msgstr "Hoofdlettergevoelige waarde" + +#: qalculateeditdatasetdialog.cpp:480 +msgid "Value uses brackets" +msgstr "Waarde met vierkante haakjes" + +#: qalculateeditdatasetdialog.cpp:550 +msgid "New Property" +msgstr "Nieuwe eigenschap" + +#: qalculateeditdatasetdialog.cpp:615 qalculateeditnamesdialog.cpp:34 +msgid "Edit Names" +msgstr "Namen bewerken" + +#: qalculateeditdatasetdialog.cpp:621 qalculateeditfunctiondialog.cpp:481 +#: qalculateeditnamesdialog.cpp:46 +msgid "Reference" +msgstr "Referentie" + +#: qalculateeditfunctiondialog.cpp:55 qalculateeditfunctiondialog.cpp:286 +msgid "Edit Function" +msgstr "Functie bewerken" + +#: qalculateeditfunctiondialog.cpp:85 qalculateeditmatrixvectordialog.cpp:89 +#: qalculateeditunitdialog.cpp:87 qalculateeditunknownvariabledialog.cpp:85 +#: qalculateeditvariabledialog.cpp:74 qalculateimportcsvdialog.cpp:66 +msgid "Category:" +msgstr "Categorie:" + +#: qalculateeditfunctiondialog.cpp:96 +msgid "Hide function" +msgstr "Functie verbergen" + +#: qalculateeditfunctiondialog.cpp:106 qalculateplotdialog.cpp:89 +msgid "Expression:" +msgstr "Expressie:" + +#: qalculateeditfunctiondialog.cpp:115 +msgid "Condition:" +msgstr "Conditie:" + +#: qalculateeditfunctiondialog.cpp:120 qalculateeditfunctiondialog.cpp:476 +msgid "Sub-Functions" +msgstr "Subfuncties" + +#: qalculateeditfunctiondialog.cpp:122 +msgid "Arguments:" +msgstr "Argumenten:" + +#: qalculateeditfunctiondialog.cpp:197 +msgid "Empty expression field" +msgstr "Expressieveld is leeg" + +#: qalculateeditfunctiondialog.cpp:288 +msgid "Edit Function (global)" +msgstr "Functie bewerken (globaal)" + +#: qalculateeditfunctiondialog.cpp:290 +msgid "New Function" +msgstr "Nieuwe functie" + +#: qalculateeditfunctiondialog.cpp:483 +msgid "Precalculate" +msgstr "Voorberekenen" + +#: qalculateeditfunctiondialog.cpp:579 qalculateeditfunctiondialog.cpp:675 +msgid "Edit Argument" +msgstr "Argument bewerken" + +#: qalculateeditfunctiondialog.cpp:586 +msgid "Type:" +msgstr "Type:" + +#: qalculateeditfunctiondialog.cpp:589 +msgid "Free" +msgstr "Vrij" + +#: qalculateeditfunctiondialog.cpp:592 +msgid "Symbol" +msgstr "Symbool" + +#: qalculateeditfunctiondialog.cpp:594 qalculateinsertfunctiondialog.cpp:353 +msgid "Date" +msgstr "Datum" + +#: qalculateeditfunctiondialog.cpp:597 +msgid "Boolean" +msgstr "Booleaans" + +#: qalculateeditfunctiondialog.cpp:603 +msgid "Angle" +msgstr "Hoek" + +#: qalculateeditfunctiondialog.cpp:605 +msgid "Enable rules and type test" +msgstr "Test voor regels en type toestaan" + +#: qalculateeditfunctiondialog.cpp:607 +msgid "Custom condition:" +msgstr "Aangepaste conditie:" + +#: qalculateeditfunctiondialog.cpp:611 +msgid "Allow matrix" +msgstr "Matrix toestaan" + +#: qalculateeditfunctiondialog.cpp:613 +msgid "Forbid zero" +msgstr "Nul niet toestaan" + +#: qalculateeditfunctiondialog.cpp:615 +msgid "Allow complex" +msgstr "Complex toestaan" + +#: qalculateeditfunctiondialog.cpp:617 qalculateplotdialog.cpp:164 +msgid "Min:" +msgstr "Min:" + +#: qalculateeditfunctiondialog.cpp:624 qalculateeditfunctiondialog.cpp:633 +msgid "Include equals" +msgstr "Ook is gelijk aan" + +#: qalculateeditfunctiondialog.cpp:626 qalculateplotdialog.cpp:167 +msgid "Max:" +msgstr "Max:" + +#: qalculateeditfunctiondialog.cpp:677 +msgid "New Argument" +msgstr "Nieuw argument" + +#: qalculateeditmatrixvectordialog.cpp:71 +#: qalculateeditunknownvariabledialog.cpp:40 +#: qalculateeditvariabledialog.cpp:41 qalculateeditvariabledialog.cpp:180 +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Edit Variable" +msgstr "Variabele bewerken" + +#: qalculateeditmatrixvectordialog.cpp:96 +#: qalculateinsertmatrixvectordialog.cpp:75 +msgid "Rows:" +msgstr "Rijen:" + +#: qalculateeditmatrixvectordialog.cpp:99 +#: qalculateinsertmatrixvectordialog.cpp:78 +msgid "Columns:" +msgstr "Kolommen:" + +#: qalculateeditmatrixvectordialog.cpp:112 +#: qalculateeditmatrixvectordialog.cpp:133 +#: qalculateeditmatrixvectordialog.cpp:295 +#: qalculateinsertmatrixvectordialog.cpp:91 +#: qalculateinsertmatrixvectordialog.cpp:115 +#: qalculateinsertmatrixvectordialog.cpp:275 +msgid "Elements:" +msgstr "Elementen:" + +#: qalculateeditmatrixvectordialog.cpp:146 +#: qalculateeditmatrixvectordialog.cpp:292 +#: qalculateinsertmatrixvectordialog.cpp:128 +#: qalculateinsertmatrixvectordialog.cpp:272 +msgid "Elements (in horizontal order):" +msgstr "Elementen (horizontale volgorde):" + +#: qalculateeditmatrixvectordialog.cpp:189 +#: qalculateeditunknownvariabledialog.cpp:136 +#: qalculateeditvariabledialog.cpp:114 +msgid "" +"An unit or variable with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"Er bestaat al een eenheid of variabele met deze naam.\n" +"Wilt u die overschrijven?" + +#: qalculateeditmatrixvectordialog.cpp:301 +msgid "Edit Vector" +msgstr "Vector bewerken" + +#: qalculateeditmatrixvectordialog.cpp:303 +msgid "Edit Vector (global)" +msgstr "Vector bewerken (globaal)" + +#: qalculateeditmatrixvectordialog.cpp:305 +msgid "New Vector" +msgstr "Nieuwe vector" + +#: qalculateeditmatrixvectordialog.cpp:310 +msgid "Edit Matrix" +msgstr "Matrix bewerken" + +#: qalculateeditmatrixvectordialog.cpp:312 +msgid "Edit Matrix (global)" +msgstr "Matrix bewerken (globaal)" + +#: qalculateeditmatrixvectordialog.cpp:314 +msgid "New Matrix" +msgstr "Nieuwe matrix" + +#: qalculateeditnamesdialog.cpp:42 +msgid "Abbreviation" +msgstr "Afkorting" + +#: qalculateeditnamesdialog.cpp:44 +msgid "Plural" +msgstr "Meervoud" + +#: qalculateeditnamesdialog.cpp:48 +msgid "Avoid Input" +msgstr "Invoer vermijden" + +#: qalculateeditnamesdialog.cpp:50 +msgid "Unicode" +msgstr "Unicode" + +#: qalculateeditnamesdialog.cpp:52 +msgid "Suffix" +msgstr "Achtervoegsel" + +#: qalculateeditnamesdialog.cpp:54 +msgid "Case Sensitive" +msgstr "Hoofdlettergevoelig" + +#: qalculateeditunitdialog.cpp:43 qalculateeditunitdialog.cpp:287 +msgid "Edit Unit" +msgstr "Eenheid bewerken" + +#: qalculateeditunitdialog.cpp:72 +msgid "Hide unit" +msgstr "Eenheid verbergen" + +#: qalculateeditunitdialog.cpp:80 +msgid "Class:" +msgstr "Klasse:" + +#: qalculateeditunitdialog.cpp:83 +msgid "Base Unit" +msgstr "Basiseenheid" + +#: qalculateeditunitdialog.cpp:84 +msgid "Alias" +msgstr "Alias" + +#: qalculateeditunitdialog.cpp:85 +msgid "Composite Unit" +msgstr "Samengestelde eenheid" + +#: qalculateeditunitdialog.cpp:92 +msgid "System:" +msgstr "Systeem:" + +#: qalculateeditunitdialog.cpp:95 +msgid "SI" +msgstr "SI" + +#: qalculateeditunitdialog.cpp:96 +msgid "CGS" +msgstr "CGS" + +#: qalculateeditunitdialog.cpp:97 +msgid "Imperial" +msgstr "Imperial" + +#: qalculateeditunitdialog.cpp:98 +msgid "US Survey" +msgstr "US Survey" + +#: qalculateeditunitdialog.cpp:102 +msgid "Relation" +msgstr "Relatie" + +#: qalculateeditunitdialog.cpp:107 +msgid "Base unit:" +msgstr "Basiseenheid:" + +#: qalculateeditunitdialog.cpp:110 +msgid "Exponent:" +msgstr "Exponent:" + +#: qalculateeditunitdialog.cpp:114 +msgid "Relation:" +msgstr "Relatie:" + +#: qalculateeditunitdialog.cpp:121 +msgid "Relation is exact" +msgstr "Relatie is exact" + +#: qalculateeditunitdialog.cpp:123 +msgid "Inverse relation:" +msgstr "Inverse relatie:" + +#: qalculateeditunitdialog.cpp:150 +msgid "" +"A variable or unit with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"Er bestaat al een variabele of eenheid met deze naam.\n" +"Wilt u die overschrijven?" + +#: qalculateeditunitdialog.cpp:175 qalculateeditunitdialog.cpp:219 +msgid "Base unit does not exist" +msgstr "Basiseenheid bestaat niet" + +#: qalculateeditunitdialog.cpp:289 +msgid "Edit Unit (global)" +msgstr "Eenheid bewerken (globaal)" + +#: qalculateeditunitdialog.cpp:291 +msgid "New Unit" +msgstr "Nieuwe eenheid" + +#: qalculateeditunknownvariabledialog.cpp:58 +msgid "Custom assumptions:" +msgstr "Aangepaste aannames:" + +#: qalculateeditunknownvariabledialog.cpp:68 +msgid "Complex Number" +msgstr "Complex getal" + +#: qalculateeditunknownvariabledialog.cpp:69 +msgid "Real Number" +msgstr "Reëel getal" + +#: qalculateeditunknownvariabledialog.cpp:70 +msgid "Rational Number" +msgstr "Rationaal getal" + +#: qalculateeditunknownvariabledialog.cpp:73 +msgid "Sign" +msgstr "Teken" + +#: qalculateeditunknownvariabledialog.cpp:199 +msgid "Edit Unknown Variable" +msgstr "Onbekende variabele bewerken" + +#: qalculateeditunknownvariabledialog.cpp:201 +msgid "Edit Unknown Variable (global)" +msgstr "Onbekende variabele bewerken (globaal)" + +#: qalculateeditunknownvariabledialog.cpp:203 +msgid "New Unknown Variable" +msgstr "Nieuwe onbekende variabele" + +#: qalculateeditvariabledialog.cpp:63 qalculateinsertfunctiondialog.cpp:91 +msgid "Value:" +msgstr "Waarde:" + +#: qalculateeditvariabledialog.cpp:71 +msgid "Value is exact" +msgstr "Waarde is exact" + +#: qalculateeditvariabledialog.cpp:110 +msgid "Empty value field" +msgstr "Waardeveld is leeg" + +#: qalculateeditvariabledialog.cpp:182 +msgid "Edit Variable (global)" +msgstr "Variabele bewerken (globaal)" + +#: qalculateeditvariabledialog.cpp:185 +msgid "New Variable" +msgstr "Nieuwe variabele" + +#: qalculateexportcsvdialog.cpp:37 qalculateexportcsvdialog.cpp:54 +msgid "Export CSV File" +msgstr "CSV-bestand exporteren" + +#: qalculateexportcsvdialog.cpp:42 +msgid "Current result" +msgstr "Huidig antwoord" + +#: qalculateexportcsvdialog.cpp:46 +msgid "Matrix/vector variable" +msgstr "Matrix/vector-variabele" + +#: qalculateexportcsvdialog.cpp:51 qalculateimportcsvdialog.cpp:43 +msgid "File:" +msgstr "Bestand:" + +#: qalculateexportcsvdialog.cpp:56 qalculateimportcsvdialog.cpp:80 +msgid "Delimiter:" +msgstr "Scheidingsteken:" + +#: qalculateexportcsvdialog.cpp:59 qalculateimportcsvdialog.cpp:83 +msgid "Comma" +msgstr "Komma" + +#: qalculateexportcsvdialog.cpp:60 qalculateimportcsvdialog.cpp:84 +msgid "Tabulator" +msgstr "Tabtoets" + +#: qalculateexportcsvdialog.cpp:61 qalculateimportcsvdialog.cpp:85 +msgid "Semicolon" +msgstr "Puntkomma" + +#: qalculateexportcsvdialog.cpp:62 qalculateimportcsvdialog.cpp:86 +msgid "Space" +msgstr "Spatie" + +#: qalculateexportcsvdialog.cpp:63 qalculateimportcsvdialog.cpp:87 +msgid "Other" +msgstr "Overig" + +#: qalculateexportcsvdialog.cpp:93 qalculateimportcsvdialog.cpp:116 +msgid "No file name entered." +msgstr "Geen bestandsnaam opgegeven." + +#: qalculateexportcsvdialog.cpp:122 qalculateimportcsvdialog.cpp:145 +msgid "No delimiter selected." +msgstr "Geen scheidingsteken geselecteerd." + +#: qalculateexportcsvdialog.cpp:135 +msgid "No variable name entered." +msgstr "Geen naam opgegeven voor variabele." + +#: qalculateexportcsvdialog.cpp:147 +msgid "No known variable with entered name found." +msgstr "Geen bekende variabele met opgegeven naam gevonden." + +#: qalculateexportcsvdialog.cpp:154 +#, c-format +msgid "" +"Could not export to file \n" +"%s" +msgstr "" +"Kon niet exporteren naar bestand \n" +"%s" + +#: qalculateexpressionedit.cpp:146 +msgid "Disable Completion" +msgstr "Voltooien uitschakelen" + +#: qalculateexpressionedit.cpp:147 +msgid "Enable Completion" +msgstr "Voltooien toestaan" + +#. i18n: file ./qalculate_kdeui.rc line 154 +#: qalculateexpressionedit.cpp:161 qalculateresultdisplay.cpp:333 rc.cpp:48 +#, no-c-format +msgid "Meta Modes" +msgstr "Metamodes" + +#: qalculateexpressionedit.cpp:655 qalculatevariablesdialog.cpp:366 +msgid "a previous result" +msgstr "een vorig antwoord" + +#: qalculateexpressionedit.cpp:661 qalculatevariablesdialog.cpp:376 +msgid "matrix" +msgstr "matrix" + +#: qalculateexpressionedit.cpp:663 qalculatevariablesdialog.cpp:378 +msgid "vector" +msgstr "vector" + +#: qalculateexpressionedit.cpp:672 qalculatevariablesdialog.cpp:387 +msgid "positive" +msgstr "positief" + +#: qalculateexpressionedit.cpp:676 qalculatevariablesdialog.cpp:391 +msgid "non-positive" +msgstr "Niet-positief" + +#: qalculateexpressionedit.cpp:680 qalculatevariablesdialog.cpp:395 +msgid "negative" +msgstr "negatief" + +#: qalculateexpressionedit.cpp:684 qalculatevariablesdialog.cpp:399 +msgid "non-negative" +msgstr "niet-negatief" + +#: qalculateexpressionedit.cpp:688 qalculatevariablesdialog.cpp:403 +msgid "non-zero" +msgstr "ongelijk nul" + +#: qalculateexpressionedit.cpp:696 qalculatevariablesdialog.cpp:412 +msgid "integer" +msgstr "geheel" + +#: qalculateexpressionedit.cpp:700 qalculatevariablesdialog.cpp:416 +msgid "rational" +msgstr "rationaal" + +#: qalculateexpressionedit.cpp:704 qalculatevariablesdialog.cpp:420 +msgid "real" +msgstr "reëel" + +#: qalculateexpressionedit.cpp:708 qalculatevariablesdialog.cpp:424 +msgid "complex" +msgstr "complex" + +#: qalculateexpressionedit.cpp:716 qalculatevariablesdialog.cpp:432 +msgid "(not matrix)" +msgstr "(geen matrix)" + +#: qalculateexpressionedit.cpp:721 qalculatevariablesdialog.cpp:438 +msgid "unknown" +msgstr "onbekende" + +#: qalculateexpressionedit.cpp:723 qalculatevariablesdialog.cpp:440 +msgid "default assumptions" +msgstr "standaard aannames" + +#: qalculatefunctionsdialog.cpp:47 +msgid "Functions" +msgstr "Functies" + +#: qalculatefunctionsdialog.cpp:59 +msgid "Function Name" +msgstr "Functienaam" + +#: qalculatefunctionsdialog.cpp:75 qalculatefunctionsdialog.cpp:313 +#: qalculateunitsdialog.cpp:99 qalculateunitsdialog.cpp:352 +#: qalculatevariablesdialog.cpp:74 qalculatevariablesdialog.cpp:349 +msgid "Deactivate" +msgstr "Uitschakelen" + +#: qalculatefunctionsdialog.cpp:174 qalculatefunctionsdialog.cpp:175 +#: qalculatefunctionsdialog.cpp:176 qalculatefunctionsdialog.cpp:234 +#: qalculatefunctionsdialog.cpp:260 qalculatefunctionsdialog.cpp:283 +#: qalculatefunctionsdialog.cpp:509 qalculateunitsdialog.cpp:206 +#: qalculateunitsdialog.cpp:207 qalculateunitsdialog.cpp:208 +#: qalculateunitsdialog.cpp:271 qalculateunitsdialog.cpp:297 +#: qalculateunitsdialog.cpp:320 qalculateunitsdialog.cpp:420 +#: qalculatevariablesdialog.cpp:174 qalculatevariablesdialog.cpp:175 +#: qalculatevariablesdialog.cpp:176 qalculatevariablesdialog.cpp:256 +#: qalculatevariablesdialog.cpp:282 qalculatevariablesdialog.cpp:320 +#: qalculatevariablesdialog.cpp:466 +msgid "Inactive" +msgstr "Inactief" + +#: qalculatefunctionsdialog.cpp:315 qalculateunitsdialog.cpp:354 +#: qalculatevariablesdialog.cpp:351 +msgid "Activate" +msgstr "Activeren" + +#: qalculatefunctionsdialog.cpp:367 qalculateresultdisplay.cpp:148 +#, c-format +msgid "" +"Retrieves data from the %s data set for a given object and property. If " +"\"info\" is typed as property, a dialog window will pop up with all " +"properties of the object." +msgstr "" +"Haalt gegevens op van een gegeven object of eigenschap uit de " +"gegevensverzameling %s. Indien als eigenschap \"info\" wordt ingetypt krijgt " +"u een dialoogvenster te zien waarin alle eigenschappen van het object worden " +"genoemd." + +#: qalculatefunctionsdialog.cpp:391 +msgid "Arguments" +msgstr "Argumenten" + +#: qalculatefunctionsdialog.cpp:412 qalculateinsertfunctiondialog.cpp:194 +#: qalculateinsertfunctiondialog.cpp:227 +msgid "optional" +msgstr "optioneel" + +#: qalculatefunctionsdialog.cpp:416 +msgid "default: " +msgstr "standaard: " + +#: qalculatefunctionsdialog.cpp:426 +msgid "Requirement" +msgstr "Vereiste" + +#: qalculateimportcsvdialog.cpp:39 qalculateimportcsvdialog.cpp:46 +msgid "Import CSV File" +msgstr "CSV-bestand importeren" + +#: qalculateimportcsvdialog.cpp:48 +msgid "Import as:" +msgstr "Importeren als:" + +#: qalculateimportcsvdialog.cpp:71 +msgid "First row:" +msgstr "Eerste rij:" + +#: qalculateimportcsvdialog.cpp:77 +msgid "Includes headings" +msgstr "Ook de koppen weergegeven" + +#: qalculateimportcsvdialog.cpp:149 +msgid "An error occured when importing the CSV file." +msgstr "Fout bij het importeren van het CSV-bestand." + +#: qalculateinsertfunctiondialog.cpp:50 qalculateinsertfunctiondialog.cpp:57 +msgid "Execute" +msgstr "Uitvoeren" + +#: qalculateinsertfunctiondialog.cpp:93 +msgid "Argument" +msgstr "Argument" + +#: qalculateinsertfunctiondialog.cpp:152 +msgid "True" +msgstr "Waar" + +#: qalculateinsertfunctiondialog.cpp:153 +msgid "False" +msgstr "Onwaar" + +#: qalculateinsertfunctiondialog.cpp:184 +msgid "Info" +msgstr "Info" + +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Insert Selection" +msgstr "Selectie invoegen" + +#: qalculateinsertmatrixvectordialog.cpp:293 +msgid "Vector Result" +msgstr "Antwoordvector" + +#: qalculateinsertmatrixvectordialog.cpp:295 +msgid "Matrix Result" +msgstr "Antwoordmatrix" + +#: qalculateperiodictabledialog.cpp:195 +msgid "Element Data" +msgstr "Elementgegevens" + +#: qalculateperiodictabledialog.cpp:221 +msgid "Classification" +msgstr "Indeling" + +#: qalculateperiodictabledialog.cpp:224 +msgid "Alkali Metal" +msgstr "Alkalisch metaal" + +#: qalculateperiodictabledialog.cpp:225 +msgid "Alkaline-Earth Metal" +msgstr "Alkalisch aardmetaal" + +#: qalculateperiodictabledialog.cpp:226 +msgid "Lanthanide" +msgstr "Lanthanide" + +#: qalculateperiodictabledialog.cpp:227 +msgid "Actinide" +msgstr "Actinide" + +#: qalculateperiodictabledialog.cpp:228 +msgid "Transition Metal" +msgstr "Overgangsmetaal" + +#: qalculateperiodictabledialog.cpp:229 +msgid "Metal" +msgstr "Metaal" + +#: qalculateperiodictabledialog.cpp:230 +msgid "Metalloid" +msgstr "Metalloïde (halfmetaal)" + +#: qalculateperiodictabledialog.cpp:231 +msgid "Non-Metal" +msgstr "Niet-metaal" + +#: qalculateperiodictabledialog.cpp:232 +msgid "Halogen" +msgstr "Halogeen" + +#: qalculateperiodictabledialog.cpp:233 +msgid "Noble Gas" +msgstr "Edelgas" + +#: qalculateperiodictabledialog.cpp:234 +msgid "Transactinide" +msgstr "Transactinide" + +#: qalculateplotdialog.cpp:64 +msgid "Plot" +msgstr "Plot" + +#: qalculateplotdialog.cpp:82 +msgid "Data" +msgstr "Gegevens" + +#: qalculateplotdialog.cpp:83 +msgid "Function Range" +msgstr "Functiebereik" + +#: qalculateplotdialog.cpp:101 +msgid "Vector/matrix" +msgstr "Vector/matrix" + +#: qalculateplotdialog.cpp:104 +msgid "Paired matrix" +msgstr "Gepaarde matrix" + +#: qalculateplotdialog.cpp:107 +msgid "Rows" +msgstr "Rijen" + +#: qalculateplotdialog.cpp:109 +msgid "X variable:" +msgstr "Variabele X:" + +#: qalculateplotdialog.cpp:113 +msgid "Style:" +msgstr "Stijl:" + +#: qalculateplotdialog.cpp:115 +msgid "Line" +msgstr "Lijn" + +#: qalculateplotdialog.cpp:116 +msgid "Points" +msgstr "Punten" + +#: qalculateplotdialog.cpp:117 +msgid "Line with points" +msgstr "Lijn met punten" + +#: qalculateplotdialog.cpp:118 +msgid "Boxes/bars" +msgstr "Vakken/balken" + +#: qalculateplotdialog.cpp:119 +msgid "Histogram" +msgstr "Histogram" + +#: qalculateplotdialog.cpp:120 +msgid "Steps" +msgstr "Stappen" + +#: qalculateplotdialog.cpp:121 +msgid "Candlesticks" +msgstr "Kaarsdiagrammen" + +#: qalculateplotdialog.cpp:122 +msgid "Dots" +msgstr "Puntjes" + +#: qalculateplotdialog.cpp:124 +msgid "Smoothing:" +msgstr "Gladstrijken:" + +#: qalculateplotdialog.cpp:127 +msgid "Monotonic" +msgstr "Monotoon" + +#: qalculateplotdialog.cpp:128 +msgid "Natural cubic splines" +msgstr "Natuurlijke kubische splines" + +#: qalculateplotdialog.cpp:129 +msgid "Bezier" +msgstr "Bézier" + +#: qalculateplotdialog.cpp:130 +msgid "Bezier (monotonic)" +msgstr "Bézier (monotoon)" + +#: qalculateplotdialog.cpp:132 +msgid "Y-axis:" +msgstr "Y-as:" + +#: qalculateplotdialog.cpp:136 +msgid "Primary" +msgstr "Primair" + +#: qalculateplotdialog.cpp:139 +msgid "Secondary" +msgstr "Secondair" + +#: qalculateplotdialog.cpp:171 +msgid "Sampling rate:" +msgstr "Monsterfrequentie:" + +#: qalculateplotdialog.cpp:176 +msgid "Step size:" +msgstr "Stapgrootte:" + +#: qalculateplotdialog.cpp:194 +msgid "Display grid" +msgstr "Rooster tonen" + +#: qalculateplotdialog.cpp:196 +msgid "Display full border" +msgstr "Volledige rand tonen" + +#: qalculateplotdialog.cpp:199 +msgid "Logarithmic x scale:" +msgstr "Logaritmische schaal x-as:" + +#: qalculateplotdialog.cpp:203 +msgid "Logarithmic y scale:" +msgstr "Logaritmische schaal y-as:" + +#: qalculateplotdialog.cpp:207 +msgid "X-axis label:" +msgstr "Tekst bij x-as:" + +#: qalculateplotdialog.cpp:210 +msgid "Y-axis label:" +msgstr "Tekst bij y-as:" + +#: qalculateplotdialog.cpp:213 +msgid "Color display:" +msgstr "Kleuren:" + +#: qalculateplotdialog.cpp:217 +msgid "Color" +msgstr "Kleur" + +#: qalculateplotdialog.cpp:220 +msgid "Monochrome" +msgstr "Zwartwit" + +#: qalculateplotdialog.cpp:224 +msgid "Legend placement:" +msgstr "Plaats van legenda:" + +#: qalculateplotdialog.cpp:227 +msgid "Top-left" +msgstr "Linksboven" + +#: qalculateplotdialog.cpp:228 +msgid "Top-right" +msgstr "Rechtsboven" + +#: qalculateplotdialog.cpp:229 +msgid "Bottom-left" +msgstr "Linksonder" + +#: qalculateplotdialog.cpp:230 +msgid "Bottom-right" +msgstr "Rechtsonder" + +#: qalculateplotdialog.cpp:231 +msgid "Below" +msgstr "Onder" + +#: qalculateplotdialog.cpp:232 +msgid "Outside" +msgstr "Er buiten" + +#: qalculateplotdialog.cpp:403 qalculateplotdialog.cpp:458 +#: qalculateplotdialog.cpp:506 +msgid "Empty expression." +msgstr "Expressie niet gegeven." + +#: qalculateplotdialog.cpp:472 qalculateplotdialog.cpp:519 +msgid "Empty x variable." +msgstr "Variabele niet gegeven." + +#: qalculateprecisiondialog.cpp:34 qalculateprecisiondialog.cpp:36 +msgid "Recalculate" +msgstr "Opnieuw berekenen" + +#: qalculateprecisiondialog.cpp:41 +msgid "Precision:" +msgstr "Nauwkeurigheid:" + +#: qalculatepreferencesdialog.cpp:100 +msgid "Choose..." +msgstr "Kiezen..." + +#: qalculatepreferencesdialog.cpp:147 +msgid "Preferences" +msgstr "Voorkeuren" + +#: qalculatepreferencesdialog.cpp:161 +msgid "Close to system tray" +msgstr "Dichtbij systeemvak" + +#: qalculatepreferencesdialog.cpp:162 +msgid "" +"If the application will reside in the system tray when the window is closed" +msgstr "" +"Of de toepassing in het systeemvak moet blijven na het afsluiten van het " +"venster" + +#: qalculatepreferencesdialog.cpp:164 +msgid "Display expression status" +msgstr "Toon expressiestatus" + +#: qalculatepreferencesdialog.cpp:165 +msgid "" +"If as-you-type expression status shall be displayed below the expression " +"entry" +msgstr "" +"Indien status expressie zoals u-die-intypt moet worden getoond onder de " +"invoer van de expressie" + +#: qalculatepreferencesdialog.cpp:167 +msgid "Use icon buttons" +msgstr "Knoppen met pictogrammen gebruiken" + +#: qalculatepreferencesdialog.cpp:168 +msgid "" +"Use icons instead of text on the top-right buttons. The third state uses the " +"style setting for icons on buttons." +msgstr "" +"Gebruik pictogrammen in plaats van tekst voor de knoppen rechtsboven. In de " +"derde toestand worden de stijlinstellingen voor pictogrammen en knoppen " +"gebruikt." + +#: qalculatepreferencesdialog.cpp:171 +msgid "Update exchange rates on start" +msgstr "Wisselkoersen ophalen bij opstarten" + +#: qalculatepreferencesdialog.cpp:172 +msgid "" +"If current exchange rates shall be downloaded from the internet at program " +"start" +msgstr "" +"Of de huidige wisselkoersen moeten worden opgehaald van het internet bij het " +"starten van het programma" + +#: qalculatepreferencesdialog.cpp:174 +msgid "Save mode on exit" +msgstr "Modus opslaan bij verlaten" + +#: qalculatepreferencesdialog.cpp:175 +msgid "If the mode of the calculator shall be restored" +msgstr "Indien de modus van de rekenmachine moet worden teruggezet" + +#: qalculatepreferencesdialog.cpp:177 +msgid "Save definitions on exit" +msgstr "Definities opslaan bij verlaten" + +#: qalculatepreferencesdialog.cpp:178 +msgid "" +"If changes to functions, units and variables shall be saved automatically" +msgstr "" +"Of veranderingen in functies, eenheden en variabelen automatisch moeten " +"worden opgeslagen" + +#: qalculatepreferencesdialog.cpp:180 +msgid "Use only keypad keys for RPN" +msgstr "" +"Gebruik voor RPN alleen de toesten van het numerieke deel van het toetsenbord" + +#: qalculatepreferencesdialog.cpp:181 +msgid "" +"Use only keypad keys for RPN operations (+-*/^) and use the rest of the " +"keyboard for expression entry" +msgstr "" +"Gebruik alleen de toesten op het numerieke deel van het toetsenbord voor RPN-" +"bewerkingen (+-*/^) en gebruik de rest van het toestenbord voor de invoer " +"van expressies" + +#: qalculatepreferencesdialog.cpp:183 +msgid "Ignores dots in numbers" +msgstr "Punten in getallen worden genegeerd" + +#: qalculatepreferencesdialog.cpp:184 +msgid "" +"Allow dots, '.', to be used as thousands separator instead of as an " +"alternative to decimal sign" +msgstr "" +"Toestaan dat punten, '.', worden gebruikt als scheidingsteken voor " +"duizendtallen in plaats van een alternatief decimaal teken" + +#: qalculatepreferencesdialog.cpp:187 +msgid "Enable unicode signs" +msgstr "Unicode toestaan" + +#: qalculatepreferencesdialog.cpp:188 +msgid "Disable this if you have problems with some fancy characters" +msgstr "Dit uitschakelen als er problemen zijn met bijzondere karakters" + +#: qalculatepreferencesdialog.cpp:190 +msgid "Use lower case in numbers" +msgstr "Kleine letters voor getallen gebruiken" + +#: qalculatepreferencesdialog.cpp:191 +msgid "If lower case letters should be used in numbers with non-decimal base" +msgstr "Indien kleine letters moeten worden gebruikt in niet-decimale getallen" + +#: qalculatepreferencesdialog.cpp:193 +msgid "Use lower case \"e\"" +msgstr "Kleine letter \"e\" gebruiken" + +#: qalculatepreferencesdialog.cpp:194 +msgid "If \"e\"; shall be used instead of \"E\" in numbers" +msgstr "Indien in getallen \"e\" moet worden gebruikt in plaats van \"E\"" + +#: qalculatepreferencesdialog.cpp:196 +msgid "Alternative base prefixes" +msgstr "Alternatieve voorvoegsels voor het grondtal" + +#: qalculatepreferencesdialog.cpp:197 +msgid "" +"If hexadecimal numbers shall be displayed with \"0x0\" and binary numbers " +"with \"0b00\" as prefixes" +msgstr "" +"Of hexadecimale getallen worden getoond met het voorvoegsel \"0x0\" en " +"binaire getallen met het voorvoegsel \"0b00\"" + +#: qalculatepreferencesdialog.cpp:199 +msgid "Spell out logical operators" +msgstr "Logische operatoren voluit spellen" + +#: qalculatepreferencesdialog.cpp:200 +msgid "If logical and/or shall be displayed as \"&&\"/\"||\" or \"and\"/\"or\"" +msgstr "" +"Indien logische and/or moeten worden getoond als \"&&\"/\"||\" of als \"and" +"\"/\"or\"" + +#: qalculatepreferencesdialog.cpp:203 +msgid "Multiplication sign:" +msgstr "Vermenigvuldigingsteken:" + +#: qalculatepreferencesdialog.cpp:215 +msgid "Division sign:" +msgstr "Teken voor deling:" + +#: qalculatepreferencesdialog.cpp:230 +msgid "Custom result font" +msgstr "Aangepast lettertype voor antwoord" + +#: qalculatepreferencesdialog.cpp:234 +msgid "Custom expression font" +msgstr "Aangepast lettertype voor expressie" + +#: qalculatepreferencesdialog.cpp:238 +msgid "Custom status font" +msgstr "Aangepast lettertype voor status" + +#: qalculatepreferencesdialog.cpp:243 +msgid "Status error color:" +msgstr "Kleur foutstatus:" + +#: qalculatepreferencesdialog.cpp:250 +msgid "Status warning color:" +msgstr "Kleur waarschuwingstatus:" + +#: qalculateresultdisplay.cpp:52 +msgid "a matrix" +msgstr "een matrix" + +#: qalculateresultdisplay.cpp:54 +msgid "a vector" +msgstr "een vector" + +#: qalculateresultdisplay.cpp:57 +msgid "double-click to view/edit" +msgstr "dubbelklik voor bekijken/bewerken" + +#: qalculateresultdisplay.cpp:60 +msgid "Unknown variable" +msgstr "Onbekende variabele" + +#: qalculateresultdisplay.cpp:72 +msgid "Prefix" +msgstr "Voorvoegsel" + +#: qalculateresultdisplay.cpp:336 +msgid "Show Parsed Expression" +msgstr "Ingelezen functie tonen" + +#: qalculateresultdisplay.cpp:342 qalculateresultdisplay.cpp:353 +msgid "Show Object Info" +msgstr "Informatie over object tonen" + +#: qalculateresultdisplay.cpp:348 +msgid "View/Edit Matrix" +msgstr "Matrix bekijken/bewerken" + +#: qalculateresultdisplay.cpp:350 +msgid "View/Edit Vector" +msgstr "Vector bekijken/bewerken" + +#: qalculateresultdisplay.cpp:382 +msgid "Parsed expression:" +msgstr "Ingelezen expressie:" + +#: qalculatesetbasedialog.cpp:33 +msgid "Result Base" +msgstr "Grondtal van het antwoord" + +#: qalculatesetbasedialog.cpp:39 qalculatesetbasedialog.cpp:52 +msgid "Other:" +msgstr "Overig:" + +#: qalculatesetbasedialog.cpp:43 +msgid "Time format" +msgstr "Tijdnotatie" + +#: qalculatesetbasedialog.cpp:44 qalculatesetbasedialog.cpp:55 +msgid "Roman numerals" +msgstr "Romeinse cijfers" + +#: qalculatesetbasedialog.cpp:46 +msgid "Expression Base" +msgstr "Grondtal van de expressie" + +#: qalculateunitsdialog.cpp:54 +msgid "Units" +msgstr "Eenheden" + +#: qalculateunitsdialog.cpp:68 +msgid "Names" +msgstr "Namen" + +#: qalculateunitsdialog.cpp:69 +msgid "Base" +msgstr "Grondtal" + +#: qalculateunitsdialog.cpp:72 +msgid "Conversion" +msgstr "Conversie" + +#: qalculateunitsdialog.cpp:105 +msgid "Convert Result" +msgstr "Antwoord converteren" + +#: qalculateunitsdialog.cpp:250 +msgid "Cannot delete unit as it is needed by other units." +msgstr "Kan eenheid niet wissen omdat die nodig is voor andere eenheden." + +#: qalculatevariablesdialog.cpp:51 +msgid "Variables" +msgstr "Variabelen" + +#: qalculatevariablesdialog.cpp:60 +msgid "Variable Name" +msgstr "Naam variabele" + +#. i18n: file ./qalculate_kdeui.rc line 5 +#: rc.cpp:6 +#, no-c-format +msgid "&New" +msgstr "&Nieuw" + +#. i18n: file ./qalculate_kdeui.rc line 37 +#: rc.cpp:12 +#, no-c-format +msgid "&Set Prefix" +msgstr "&Voorvoegsel" + +#. i18n: file ./qalculate_kdeui.rc line 39 +#: rc.cpp:15 +#, no-c-format +msgid "&Convert To Unit" +msgstr "&Converteren naar eenheid" + +#. i18n: file ./qalculate_kdeui.rc line 54 +#: rc.cpp:18 +#, no-c-format +msgid "&Mode" +msgstr "&Modus" + +#. i18n: file ./qalculate_kdeui.rc line 55 +#: rc.cpp:21 +#, no-c-format +msgid "Number Base" +msgstr "Grondtal talstelsel" + +#. i18n: file ./qalculate_kdeui.rc line 67 +#: rc.cpp:24 +#, no-c-format +msgid "Numerical Display" +msgstr "Tonen getal" + +#. i18n: file ./qalculate_kdeui.rc line 80 +#: rc.cpp:27 +#, no-c-format +msgid "Fractional Display" +msgstr "Tonen breuk" + +#. i18n: file ./qalculate_kdeui.rc line 86 +#: rc.cpp:30 +#, no-c-format +msgid "Unit Display" +msgstr "Tonen eenheid" + +#. i18n: file ./qalculate_kdeui.rc line 96 +#: rc.cpp:33 +#, no-c-format +msgid "Angle Unit" +msgstr "Hoekeenheid" + +#. i18n: file ./qalculate_kdeui.rc line 104 +#: rc.cpp:36 +#, no-c-format +msgid "Enabled Objects" +msgstr "Ingeschakelde objecten" + +#. i18n: file ./qalculate_kdeui.rc line 121 +#: rc.cpp:42 +#, no-c-format +msgid "Assumptions" +msgstr "Aannames" + +#. i18n: file ./qalculate_kdeui.rc line 137 +#: rc.cpp:45 +#, no-c-format +msgid "Algebraic Mode" +msgstr "Algebraïsche modus" + +#. i18n: file ./qalculate_kdeui.rc line 161 +#: rc.cpp:51 +#, no-c-format +msgid "Fu&nctions" +msgstr "Fu&ncties" + +#. i18n: file ./qalculate_kdeui.rc line 163 +#: rc.cpp:54 +#, no-c-format +msgid "&Variables" +msgstr "&Variabelen" + +#. i18n: file ./qalculate_kdeui.rc line 165 +#: rc.cpp:57 +#, no-c-format +msgid "&Units" +msgstr "&Eenheden" diff --git a/po/qalculate_kde.pot b/po/qalculate_kde.pot new file mode 100644 index 0000000..4f9b462 --- /dev/null +++ b/po/qalculate_kde.pot @@ -0,0 +1,2587 @@ +# SOME DESCRIPTIVE TITLE. +# This file is put in the public domain. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-05-08 14:44+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: _translatorinfo.cpp:1 +msgid "" +"_: NAME OF TRANSLATORS\n" +"Your names" +msgstr "" + +#: _translatorinfo.cpp:3 +msgid "" +"_: EMAIL OF TRANSLATORS\n" +"Your emails" +msgstr "" + +#: kqalculate.cpp:264 +msgid "Remove from System Tray" +msgstr "" + +#: kqalculate.cpp:265 qalculateeditdatasetdialog.cpp:471 +#: qalculateplotdialog.cpp:226 +msgid "Hide" +msgstr "" + +#: kqalculate.cpp:286 kqalculate.cpp:4484 kqalculate.cpp:5915 +msgid "Enter" +msgstr "" + +#: kqalculate.cpp:287 kqalculate.cpp:513 kqalculate.cpp:4485 +#: kqalculate.cpp:4492 kqalculate.cpp:5916 +msgid "=" +msgstr "" + +#: kqalculate.cpp:289 kqalculate.cpp:514 kqalculate.cpp:4489 +#: kqalculate.cpp:4490 +msgid "Calculate expression and add to stack" +msgstr "" + +#: kqalculate.cpp:290 kqalculate.cpp:515 kqalculate.cpp:4493 +#: kqalculate.cpp:4494 +msgid "Calculate expression" +msgstr "" + +#: kqalculate.cpp:296 kqalculate.cpp:5918 +msgid "Store" +msgstr "" + +#: kqalculate.cpp:298 +msgid "Store result as variable" +msgstr "" + +#: kqalculate.cpp:301 kqalculate.cpp:5920 qalculateconvertunitsdialog.cpp:42 +msgid "Convert" +msgstr "" + +#: kqalculate.cpp:303 +msgid "Convert units in result" +msgstr "" + +#: kqalculate.cpp:313 +msgid "Enter expression here" +msgstr "" + +#: kqalculate.cpp:322 +msgid "status" +msgstr "" + +#: kqalculate.cpp:354 qalculateeditdataobjectdialog.cpp:71 +msgid "Exact" +msgstr "" + +#: kqalculate.cpp:355 +msgid "Toggle exact mode" +msgstr "" + +#: kqalculate.cpp:358 kqalculate.cpp:1070 +msgid "Fraction" +msgstr "" + +#: kqalculate.cpp:359 +msgid "Toggle fractional display" +msgstr "" + +#: kqalculate.cpp:363 +msgid "Numerical display" +msgstr "" + +#: kqalculate.cpp:366 kqalculate.cpp:1046 qalculateresultdisplay.cpp:288 +msgid "Normal" +msgstr "" + +#: kqalculate.cpp:367 kqalculate.cpp:1048 qalculateresultdisplay.cpp:291 +msgid "Engineering" +msgstr "" + +#: kqalculate.cpp:368 kqalculate.cpp:1050 qalculateresultdisplay.cpp:294 +msgid "Scientific" +msgstr "" + +#: kqalculate.cpp:369 +msgid "Pure" +msgstr "" + +#: kqalculate.cpp:370 kqalculate.cpp:1054 +msgid "Simple" +msgstr "" + +#: kqalculate.cpp:372 +msgid "Base in result" +msgstr "" + +#: kqalculate.cpp:376 kqalculate.cpp:1029 qalculatesetbasedialog.cpp:35 +#: qalculatesetbasedialog.cpp:48 +msgid "Binary" +msgstr "" + +#: kqalculate.cpp:377 kqalculate.cpp:1031 qalculatesetbasedialog.cpp:36 +#: qalculatesetbasedialog.cpp:49 +msgid "Octal" +msgstr "" + +#: kqalculate.cpp:378 kqalculate.cpp:1033 kqalculate.cpp:1066 +#: qalculatesetbasedialog.cpp:37 qalculatesetbasedialog.cpp:50 +msgid "Decimal" +msgstr "" + +#: kqalculate.cpp:379 kqalculate.cpp:1035 qalculatesetbasedialog.cpp:38 +#: qalculatesetbasedialog.cpp:51 +msgid "Hexadecimal" +msgstr "" + +#: kqalculate.cpp:380 kqalculate.cpp:1039 qalculatesetbasedialog.cpp:42 +msgid "Sexagesimal" +msgstr "" + +#: kqalculate.cpp:381 kqalculate.cpp:1041 +msgid "Time Format" +msgstr "" + +#: kqalculate.cpp:383 kqalculate.cpp:1037 +msgid "Other..." +msgstr "" + +#: kqalculate.cpp:389 +msgid "f(x)" +msgstr "" + +#: kqalculate.cpp:393 +msgid "Open functions manager" +msgstr "" + +#: kqalculate.cpp:395 +msgid "sqrt" +msgstr "" + +#: kqalculate.cpp:396 +msgid "Square root" +msgstr "" + +#: kqalculate.cpp:399 kqalculate.cpp:947 +msgid "xy" +msgstr "" + +#: kqalculate.cpp:400 +msgid "Raise (Ctrl+*)" +msgstr "" + +#: kqalculate.cpp:403 kqalculate.cpp:946 +msgid "x2" +msgstr "" + +#: kqalculate.cpp:404 +msgid "Square" +msgstr "" + +#: kqalculate.cpp:406 +msgid "log" +msgstr "" + +#: kqalculate.cpp:407 +msgid "Base-10 logarithm" +msgstr "" + +#: kqalculate.cpp:409 +msgid "ln" +msgstr "" + +#: kqalculate.cpp:410 +msgid "Natural logarithm" +msgstr "" + +#: kqalculate.cpp:412 +msgid "x!" +msgstr "" + +#: kqalculate.cpp:413 +msgid "Factorial" +msgstr "" + +#: kqalculate.cpp:415 +msgid "cos" +msgstr "" + +#: kqalculate.cpp:416 +msgid "Cosine" +msgstr "" + +#: kqalculate.cpp:418 +msgid "tan" +msgstr "" + +#: kqalculate.cpp:419 +msgid "Tangent" +msgstr "" + +#: kqalculate.cpp:421 +msgid "hyp" +msgstr "" + +#: kqalculate.cpp:422 +msgid "Toggle hyperbolic functions" +msgstr "" + +#: kqalculate.cpp:425 +msgid "inv" +msgstr "" + +#: kqalculate.cpp:426 +msgid "Toggle inverse functions" +msgstr "" + +#: kqalculate.cpp:429 +msgid "sin" +msgstr "" + +#: kqalculate.cpp:430 +msgid "Sine" +msgstr "" + +#: kqalculate.cpp:435 +msgid "Deg" +msgstr "" + +#: kqalculate.cpp:436 +msgid "Angle Unit: Degrees" +msgstr "" + +#: kqalculate.cpp:439 +msgid "Rad" +msgstr "" + +#: kqalculate.cpp:440 +msgid "Angle Unit: Radians" +msgstr "" + +#: kqalculate.cpp:443 +msgid "Gra" +msgstr "" + +#: kqalculate.cpp:444 +msgid "Angle Unit: Gradians" +msgstr "" + +#: kqalculate.cpp:447 kqalculate.cpp:1094 kqalculate.cpp:1152 +#: qalculateplotdialog.cpp:126 +msgid "None" +msgstr "" + +#: kqalculate.cpp:464 +msgid "7" +msgstr "" + +#: kqalculate.cpp:466 +msgid "8" +msgstr "" + +#: kqalculate.cpp:468 +msgid "9" +msgstr "" + +#: kqalculate.cpp:470 +msgid "4" +msgstr "" + +#: kqalculate.cpp:472 +msgid "5" +msgstr "" + +#: kqalculate.cpp:474 +msgid "6" +msgstr "" + +#: kqalculate.cpp:476 +msgid "1" +msgstr "" + +#: kqalculate.cpp:478 +msgid "2" +msgstr "" + +#: kqalculate.cpp:480 +msgid "3" +msgstr "" + +#: kqalculate.cpp:482 +msgid "0" +msgstr "" + +#: kqalculate.cpp:485 +msgid "Decimal point" +msgstr "" + +#: kqalculate.cpp:487 +msgid "EXP" +msgstr "" + +#: kqalculate.cpp:488 +msgid "10^x (Ctrl+Shift+E)" +msgstr "" + +#: kqalculate.cpp:491 +msgid "Del" +msgstr "" + +#: kqalculate.cpp:494 +msgid "AC" +msgstr "" + +#: kqalculate.cpp:498 +msgid "Multiply" +msgstr "" + +#: kqalculate.cpp:501 +msgid "Divide" +msgstr "" + +#: kqalculate.cpp:507 +msgid "Subtract" +msgstr "" + +#: kqalculate.cpp:509 +msgid "Ans" +msgstr "" + +#: kqalculate.cpp:510 +msgid "Previous result" +msgstr "" + +#: kqalculate.cpp:512 kqalculate.cpp:4488 +msgid "Ent" +msgstr "" + +#: kqalculate.cpp:535 +msgid "Index" +msgstr "" + +#: kqalculate.cpp:536 qalculateeditdataobjectdialog.cpp:49 +#: qalculatevariablesdialog.cpp:61 +msgid "Value" +msgstr "" + +#: kqalculate.cpp:555 kqalculate.cpp:5924 +msgid "Up" +msgstr "" + +#: kqalculate.cpp:556 +msgid "Move selected register up" +msgstr "" + +#: kqalculate.cpp:560 kqalculate.cpp:5926 +msgid "Down" +msgstr "" + +#: kqalculate.cpp:561 +msgid "Move selected register down" +msgstr "" + +#: kqalculate.cpp:566 +msgid "Edit value of selected register" +msgstr "" + +#: kqalculate.cpp:571 +msgid "Delete selected register" +msgstr "" + +#: kqalculate.cpp:576 +msgid "Clear the RPN stack" +msgstr "" + +#: kqalculate.cpp:592 +msgid "Keypad" +msgstr "" + +#: kqalculate.cpp:593 +msgid "Show/hide keypad" +msgstr "" + +#: kqalculate.cpp:596 +msgid "History" +msgstr "" + +#: kqalculate.cpp:597 +msgid "Show/hide history" +msgstr "" + +#: kqalculate.cpp:600 +msgid "RPN Stack" +msgstr "" + +#: kqalculate.cpp:601 +msgid "Show/hide RPN stack" +msgstr "" + +#: kqalculate.cpp:716 kqalculate.cpp:2527 +msgid "RPN Register Moved" +msgstr "" + +#: kqalculate.cpp:752 kqalculate.cpp:784 kqalculate.cpp:2138 +#: kqalculate.cpp:2702 kqalculate.cpp:2739 +msgid "approx." +msgstr "" + +#: kqalculate.cpp:894 kqalculate.cpp:4813 +msgid "Load meta mode: %1" +msgstr "" + +#: kqalculate.cpp:966 +msgid "Qalculate! - Scientific Calculator" +msgstr "" + +#: kqalculate.cpp:985 qalculateeditfunctiondialog.cpp:601 +#: qalculateresultdisplay.cpp:62 +msgid "Variable" +msgstr "" + +#: kqalculate.cpp:986 qalculateeditfunctiondialog.cpp:596 +#: qalculateeditmatrixvectordialog.cpp:106 qalculateimportcsvdialog.cpp:52 +#: qalculateinsertmatrixvectordialog.cpp:85 +#: qalculateinsertmatrixvectordialog.cpp:310 +msgid "Matrix" +msgstr "" + +#: kqalculate.cpp:987 qalculateeditfunctiondialog.cpp:595 +#: qalculateeditmatrixvectordialog.cpp:109 +#: qalculateinsertmatrixvectordialog.cpp:88 +#: qalculateinsertmatrixvectordialog.cpp:308 +msgid "Vector" +msgstr "" + +#: kqalculate.cpp:988 +msgid "Unknown Variable" +msgstr "" + +#: kqalculate.cpp:989 qalculateeditdatasetdialog.cpp:70 +#: qalculateeditfunctiondialog.cpp:71 qalculateeditfunctiondialog.cpp:599 +#: qalculateplotdialog.cpp:98 qalculateresultdisplay.cpp:92 +msgid "Function" +msgstr "" + +#: kqalculate.cpp:990 qalculatedatasetsdialog.cpp:64 +msgid "Data Set" +msgstr "" + +#: kqalculate.cpp:991 qalculateconvertunitsdialog.cpp:68 +#: qalculateeditfunctiondialog.cpp:600 qalculateresultdisplay.cpp:67 +#: qalculateunitsdialog.cpp:67 +msgid "Unit" +msgstr "" + +#: kqalculate.cpp:992 +msgid "Import CSV File..." +msgstr "" + +#: kqalculate.cpp:993 +msgid "Export CSV File..." +msgstr "" + +#: kqalculate.cpp:994 +msgid "Store Result..." +msgstr "" + +#: kqalculate.cpp:995 +msgid "Save Result Image..." +msgstr "" + +#: kqalculate.cpp:996 +msgid "Save Definitions" +msgstr "" + +#: kqalculate.cpp:997 +msgid "Update Exchange Rates" +msgstr "" + +#: kqalculate.cpp:998 +msgid "Plot Functions/Data" +msgstr "" + +#: kqalculate.cpp:1000 +msgid "Convert Number Bases" +msgstr "" + +#: kqalculate.cpp:1001 qalculateperiodictabledialog.cpp:40 +msgid "Periodic Table" +msgstr "" + +#: kqalculate.cpp:1008 +msgid "Show/hide main Qalculate! window" +msgstr "" + +#: kqalculate.cpp:1011 +msgid "Configure &Global Shortcuts..." +msgstr "" + +#: kqalculate.cpp:1013 +msgid "Manage Variables" +msgstr "" + +#: kqalculate.cpp:1014 +msgid "Manage Functions" +msgstr "" + +#: kqalculate.cpp:1015 +msgid "Manage Units" +msgstr "" + +#: kqalculate.cpp:1016 +msgid "Manage Data Sets" +msgstr "" + +#: kqalculate.cpp:1017 kqalculate.cpp:1150 +msgid "Factorize" +msgstr "" + +#: kqalculate.cpp:1018 kqalculate.cpp:1148 +msgid "Simplify" +msgstr "" + +#: kqalculate.cpp:1019 +msgid "Set Unknowns..." +msgstr "" + +#: kqalculate.cpp:1020 +msgid "Convert to Unit Expression..." +msgstr "" + +#: kqalculate.cpp:1021 kqalculate.cpp:1084 +msgid "Convert to Base Units" +msgstr "" + +#: kqalculate.cpp:1022 kqalculate.cpp:1086 +msgid "Convert to Best Unit" +msgstr "" + +#: kqalculate.cpp:1023 +msgid "Insert Matrix..." +msgstr "" + +#: kqalculate.cpp:1024 +msgid "Insert Vector..." +msgstr "" + +#: kqalculate.cpp:1025 +msgid "Copy Result" +msgstr "" + +#: kqalculate.cpp:1026 +msgid "Clear History" +msgstr "" + +#: kqalculate.cpp:1027 +msgid "Configure Qalculate!" +msgstr "" + +#: kqalculate.cpp:1043 +msgid "Roman Numerals" +msgstr "" + +#: kqalculate.cpp:1045 +msgid "Select Result and Expression Base..." +msgstr "" + +#: kqalculate.cpp:1052 +msgid "Purely Scientific" +msgstr "" + +#: kqalculate.cpp:1056 +msgid "Indicate Infinite Series" +msgstr "" + +#: kqalculate.cpp:1058 +msgid "Sort Minus Last" +msgstr "" + +#: kqalculate.cpp:1060 +msgid "Negative Exponents" +msgstr "" + +#: kqalculate.cpp:1062 +msgid "Show Ending Zeroes" +msgstr "" + +#: kqalculate.cpp:1064 +msgid "Round Halfway Numbers to Even" +msgstr "" + +#: kqalculate.cpp:1068 +msgid "Decimal (Try Exact)" +msgstr "" + +#: kqalculate.cpp:1072 +msgid "Combined" +msgstr "" + +#: kqalculate.cpp:1074 +msgid "Enable Prefixes" +msgstr "" + +#: kqalculate.cpp:1076 +msgid "Enable Use of All SI Prefixes" +msgstr "" + +#: kqalculate.cpp:1078 +msgid "Enable Denominator Prefixes" +msgstr "" + +#: kqalculate.cpp:1080 +msgid "Place Units Separately" +msgstr "" + +#: kqalculate.cpp:1082 +msgid "No Automatic Conversion" +msgstr "" + +#: kqalculate.cpp:1088 +msgid "Degrees" +msgstr "" + +#: kqalculate.cpp:1090 +msgid "Radians" +msgstr "" + +#: kqalculate.cpp:1092 +msgid "Gradians" +msgstr "" + +#: kqalculate.cpp:1096 +msgid "Abbreviate Names" +msgstr "" + +#: kqalculate.cpp:1098 +msgid "Enable Variables" +msgstr "" + +#: kqalculate.cpp:1100 +msgid "Enable Functions" +msgstr "" + +#: kqalculate.cpp:1102 +msgid "Enable Units" +msgstr "" + +#: kqalculate.cpp:1104 +msgid "Enable Unknowns" +msgstr "" + +#: kqalculate.cpp:1106 +msgid "Calculate Variables" +msgstr "" + +#: kqalculate.cpp:1108 +msgid "Allow Complex Result" +msgstr "" + +#: kqalculate.cpp:1110 +msgid "Allow Infinite Result" +msgstr "" + +#: kqalculate.cpp:1112 +msgid "Try Exact" +msgstr "" + +#: kqalculate.cpp:1114 +msgid "Always Exact" +msgstr "" + +#: kqalculate.cpp:1116 qalculateeditdataobjectdialog.cpp:70 +msgid "Approximate" +msgstr "" + +#: kqalculate.cpp:1118 kqalculate.cpp:1132 +#: qalculateeditunknownvariabledialog.cpp:65 +#: qalculateeditunknownvariabledialog.cpp:78 +#: qalculateperiodictabledialog.cpp:235 +msgid "Unknown" +msgstr "" + +#: kqalculate.cpp:1120 qalculateeditunknownvariabledialog.cpp:66 +msgid "Not Matrix" +msgstr "" + +#: kqalculate.cpp:1122 qalculateeditdatasetdialog.cpp:468 +#: qalculateeditfunctiondialog.cpp:590 +#: qalculateeditunknownvariabledialog.cpp:67 +msgid "Number" +msgstr "" + +#: kqalculate.cpp:1124 +msgid "Complex" +msgstr "" + +#: kqalculate.cpp:1126 +msgid "Real" +msgstr "" + +#: kqalculate.cpp:1128 +msgid "Rational" +msgstr "" + +#: kqalculate.cpp:1130 qalculateeditfunctiondialog.cpp:591 +#: qalculateeditunknownvariabledialog.cpp:71 +msgid "Integer" +msgstr "" + +#: kqalculate.cpp:1134 qalculateeditunknownvariabledialog.cpp:83 +msgid "Non-Zero" +msgstr "" + +#: kqalculate.cpp:1136 qalculateeditunknownvariabledialog.cpp:79 +msgid "Positive" +msgstr "" + +#: kqalculate.cpp:1138 qalculateeditunknownvariabledialog.cpp:80 +msgid "Non-Negative" +msgstr "" + +#: kqalculate.cpp:1140 qalculateeditunknownvariabledialog.cpp:81 +msgid "Negative" +msgstr "" + +#: kqalculate.cpp:1142 qalculateeditunknownvariabledialog.cpp:82 +msgid "Non-Positive" +msgstr "" + +#: kqalculate.cpp:1144 +msgid "Non-Zero Denominators" +msgstr "" + +#: kqalculate.cpp:1146 +msgid "Warn About Denominators Assumed Non-Zero" +msgstr "" + +#: kqalculate.cpp:1154 +msgid "Read Precision" +msgstr "" + +#: kqalculate.cpp:1156 +msgid "Limit Implicit Multiplication" +msgstr "" + +#: kqalculate.cpp:1158 +msgid "RPN Mode" +msgstr "" + +#: kqalculate.cpp:1160 +msgid "RPN Syntax" +msgstr "" + +#: kqalculate.cpp:1162 qalculateprecisiondialog.cpp:31 +msgid "Precision" +msgstr "" + +#: kqalculate.cpp:1163 qalculatedecimalsdialog.cpp:27 +msgid "Decimals" +msgstr "" + +#: kqalculate.cpp:1164 +msgid "Save Mode..." +msgstr "" + +#: kqalculate.cpp:1165 +msgid "Delete Mode..." +msgstr "" + +#: kqalculate.cpp:1167 +msgid "Save Default Mode" +msgstr "" + +#: kqalculate.cpp:1168 +msgid "Clear Stack" +msgstr "" + +#: kqalculate.cpp:1172 +msgid "Exp RPN Operation" +msgstr "" + +#: kqalculate.cpp:1860 +msgid "and" +msgstr "" + +#: kqalculate.cpp:1865 +msgid "or" +msgstr "" + +#: kqalculate.cpp:2122 +msgid "undefined" +msgstr "" + +#: kqalculate.cpp:2164 +msgid "EXACT" +msgstr "" + +#: kqalculate.cpp:2167 +msgid "APPROX" +msgstr "" + +#: kqalculate.cpp:2171 +msgid "RPN" +msgstr "" + +#: kqalculate.cpp:2179 +msgid "BIN" +msgstr "" + +#: kqalculate.cpp:2184 +msgid "OCT" +msgstr "" + +#: kqalculate.cpp:2189 +msgid "HEX" +msgstr "" + +#: kqalculate.cpp:2194 +msgid "ROMAN" +msgstr "" + +#: kqalculate.cpp:2206 +msgid "DEG" +msgstr "" + +#: kqalculate.cpp:2211 +msgid "RAD" +msgstr "" + +#: kqalculate.cpp:2216 +msgid "GRA" +msgstr "" + +#: kqalculate.cpp:2223 +msgid "PREC" +msgstr "" + +#: kqalculate.cpp:2228 +msgid "FUNC" +msgstr "" + +#: kqalculate.cpp:2234 +msgid "UNIT" +msgstr "" + +#: kqalculate.cpp:2240 +msgid "VAR" +msgstr "" + +#: kqalculate.cpp:2246 +msgid "INF" +msgstr "" + +#: kqalculate.cpp:2252 +msgid "CPLX" +msgstr "" + +#: kqalculate.cpp:2333 kqalculate.cpp:2351 kqalculate.cpp:2581 +msgid "aborted" +msgstr "" + +#: kqalculate.cpp:2352 +msgid "calculation was aborted" +msgstr "" + +#: kqalculate.cpp:2588 +msgid "result processing was aborted" +msgstr "" + +#: kqalculate.cpp:2636 +msgid "Processing..." +msgstr "" + +#: kqalculate.cpp:2640 kqalculate.cpp:2885 kqalculate.cpp:3145 +msgid "Abort" +msgstr "" + +#: kqalculate.cpp:2873 +msgid "Factorizing..." +msgstr "" + +#: kqalculate.cpp:2877 +msgid "Simplifying..." +msgstr "" + +#: kqalculate.cpp:3141 +msgid "Calculating..." +msgstr "" + +#: kqalculate.cpp:3191 +msgid "RPN Operation" +msgstr "" + +#: kqalculate.cpp:3259 +msgid "Errors" +msgstr "" + +#: kqalculate.cpp:3260 +msgid "Warnings" +msgstr "" + +#: kqalculate.cpp:3270 +msgid "Couldn't write definitions" +msgstr "" + +#: kqalculate.cpp:3538 +msgid "Prefixes" +msgstr "" + +#: kqalculate.cpp:3665 +msgid "No Prefix" +msgstr "" + +#: kqalculate.cpp:3816 qalculatevariablesdialog.cpp:191 +#: qalculatevariablesdialog.cpp:337 +msgid "Variable does not exist anymore." +msgstr "" + +#: kqalculate.cpp:3832 qalculateconvertunitsdialog.cpp:153 +#: qalculateunitsdialog.cpp:223 qalculateunitsdialog.cpp:337 +msgid "Unit does not exist anymore." +msgstr "" + +#: kqalculate.cpp:3905 +msgid "Failed to download exchange rates from ECB." +msgstr "" + +#: kqalculate.cpp:4752 +msgid "Save Mode" +msgstr "" + +#: kqalculate.cpp:4755 +msgid "Mode name:" +msgstr "" + +#: kqalculate.cpp:4765 +msgid "Shortcut:" +msgstr "" + +#: kqalculate.cpp:4792 +msgid "Empty mode name." +msgstr "" + +#: kqalculate.cpp:4795 +msgid "Preset mode cannot be overwritten." +msgstr "" + +#: kqalculate.cpp:4827 +msgid "Delete Mode" +msgstr "" + +#: kqalculate.cpp:4827 +msgid "Mode:" +msgstr "" + +#: kqalculate.cpp:5001 +msgid "log10 function not found." +msgstr "" + +#: kqalculate.cpp:5545 main.cpp:156 main.cpp:159 main.cpp:160 main.cpp:161 +#: main.cpp:162 +msgid "Temporary" +msgstr "" + +#: kqalculate.cpp:5567 kqalculate.cpp:5594 qalculatefunctionsdialog.cpp:191 +#: qalculatefunctionsdialog.cpp:300 +msgid "Function does not exist anymore." +msgstr "" + +#: kqalculate.cpp:5697 kqalculate.cpp:5733 +msgid "My Variables" +msgstr "" + +#: kqalculate.cpp:5709 qalculateimportcsvdialog.cpp:56 +msgid "Vectors" +msgstr "" + +#: kqalculate.cpp:5721 +msgid "Matrices" +msgstr "" + +#: kqalculate.cpp:5762 qalculateplotdialog.cpp:726 +msgid "Save Image" +msgstr "" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "" +"A file named \"%1\" already exists. Are you sure you want to overwrite it?" +msgstr "" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "Overwrite File?" +msgstr "" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "&Overwrite" +msgstr "" + +#: kqalculate.cpp:5801 +msgid "Failed to save image." +msgstr "" + +#: kqalculate.cpp:6027 +msgid "No unknowns in result." +msgstr "" + +#: kqalculate.cpp:6030 +msgid "Set Unknowns" +msgstr "" + +#: kqalculate.cpp:6194 +msgid "Too many arguments for %1()." +msgstr "" + +#: kqalculate.cpp:6220 qalculatedatasetsdialog.cpp:342 +#: qalculatefunctionsdialog.cpp:343 qalculateresultdisplay.cpp:120 +msgid "argument" +msgstr "" + +#: kqalculate.cpp:6442 kqalculate.cpp:6446 +msgid "Edit Expression" +msgstr "" + +#: kqalculate.cpp:6451 +msgid "Edit Result" +msgstr "" + +#: kqalculate.cpp:6454 +msgid "Insert Result Variable" +msgstr "" + +#: main.cpp:45 +msgid "A powerful and easy to use desktop calculator" +msgstr "" + +#: main.cpp:51 +msgid "Calculate X11-clipboard content (selected text)" +msgstr "" + +#: main.cpp:52 +msgid "Initial expression to calculate" +msgstr "" + +#: main.cpp:134 +msgid "Enter a mathematical expression above.
Ex. 5 + 2 / 3" +msgstr "" + +#: main.cpp:143 +msgid "" +"You need to download exchange rates to be able to convert between different " +"currencies. You can later get current exchange rates by selecting \"Update " +"Exchange Rates\" under the File menu.\n" +"\n" +"Do you want to fetch exchange rates now from the Internet?" +msgstr "" + +#: main.cpp:143 +msgid "Update exchange rates?" +msgstr "" + +#: main.cpp:155 +msgid "ans" +msgstr "" + +#: main.cpp:156 +msgid "Last Answer" +msgstr "" + +#: main.cpp:157 +msgid "answer" +msgstr "" + +#: main.cpp:159 +msgid "Answer 2" +msgstr "" + +#: main.cpp:160 +msgid "Answer 3" +msgstr "" + +#: main.cpp:161 +msgid "Answer 4" +msgstr "" + +#: main.cpp:162 +msgid "Answer 5" +msgstr "" + +#: main.cpp:166 +msgid "Failed to load global definitions!" +msgstr "" + +#: main.cpp:290 +msgid "Qalculate!" +msgstr "" + +#: preferences.cpp:208 +msgid "Preset" +msgstr "" + +#: preferences.cpp:669 +#, c-format +msgid "" +"Couldn't write preferences to\n" +"%s" +msgstr "" + +#: qalculateconvertnumberbasesdialog.cpp:31 qalculatesetbasedialog.cpp:29 +msgid "Number Bases" +msgstr "" + +#: qalculateconvertnumberbasesdialog.cpp:37 +msgid "Decimal:" +msgstr "" + +#: qalculateconvertnumberbasesdialog.cpp:41 +msgid "Binary:" +msgstr "" + +#: qalculateconvertnumberbasesdialog.cpp:45 +msgid "Octal:" +msgstr "" + +#: qalculateconvertnumberbasesdialog.cpp:49 +msgid "Hexadecimal:" +msgstr "" + +#: qalculateconvertunitsdialog.cpp:44 +msgid "Selector" +msgstr "" + +#: qalculateconvertunitsdialog.cpp:50 qalculateeditdatasetdialog.cpp:482 +msgid "Unit expression:" +msgstr "" + +#: qalculateconvertunitsdialog.cpp:63 qalculatefunctionsdialog.cpp:55 +#: qalculateunitsdialog.cpp:63 qalculatevariablesdialog.cpp:57 +msgid "Category" +msgstr "" + +#: qalculateconvertunitsdialog.cpp:85 qalculateconvertunitsdialog.cpp:86 +#: qalculateconvertunitsdialog.cpp:141 qalculateconvertunitsdialog.cpp:180 +#: qalculatefunctionsdialog.cpp:118 qalculatefunctionsdialog.cpp:119 +#: qalculatefunctionsdialog.cpp:183 qalculatefunctionsdialog.cpp:505 +#: qalculateunitsdialog.cpp:150 qalculateunitsdialog.cpp:151 +#: qalculateunitsdialog.cpp:215 qalculateunitsdialog.cpp:416 +#: qalculatevariablesdialog.cpp:116 qalculatevariablesdialog.cpp:117 +#: qalculatevariablesdialog.cpp:183 qalculatevariablesdialog.cpp:462 +msgid "All" +msgstr "" + +#: qalculateconvertunitsdialog.cpp:132 qalculateconvertunitsdialog.cpp:133 +#: qalculateconvertunitsdialog.cpp:134 qalculateconvertunitsdialog.cpp:182 +#: qalculatefunctionsdialog.cpp:165 qalculatefunctionsdialog.cpp:166 +#: qalculatefunctionsdialog.cpp:167 qalculatefunctionsdialog.cpp:236 +#: qalculatefunctionsdialog.cpp:262 qalculatefunctionsdialog.cpp:285 +#: qalculatefunctionsdialog.cpp:507 qalculateunitsdialog.cpp:197 +#: qalculateunitsdialog.cpp:198 qalculateunitsdialog.cpp:199 +#: qalculateunitsdialog.cpp:273 qalculateunitsdialog.cpp:299 +#: qalculateunitsdialog.cpp:322 qalculateunitsdialog.cpp:418 +#: qalculatevariablesdialog.cpp:165 qalculatevariablesdialog.cpp:166 +#: qalculatevariablesdialog.cpp:167 qalculatevariablesdialog.cpp:258 +#: qalculatevariablesdialog.cpp:284 qalculatevariablesdialog.cpp:322 +#: qalculatevariablesdialog.cpp:464 +msgid "Uncategorized" +msgstr "" + +#: qalculatedatasetsdialog.cpp:46 qalculateeditdatasetdialog.cpp:232 +msgid "Data Sets" +msgstr "" + +#: qalculatedatasetsdialog.cpp:61 +msgid "Data Sets:" +msgstr "" + +#: qalculatedatasetsdialog.cpp:68 qalculatedatasetsdialog.cpp:91 +#: qalculateeditdatasetdialog.cpp:107 qalculateeditdatasetdialog.cpp:629 +#: qalculateeditfunctiondialog.cpp:133 qalculateeditfunctiondialog.cpp:492 +#: qalculateeditnamesdialog.cpp:64 qalculatefunctionsdialog.cpp:67 +#: qalculateunitsdialog.cpp:91 qalculatevariablesdialog.cpp:66 +msgid "New" +msgstr "" + +#: qalculatedatasetsdialog.cpp:77 qalculateeditdatasetdialog.cpp:79 +#: qalculateeditdatasetdialog.cpp:456 qalculateeditfunctiondialog.cpp:98 +msgid "Description:" +msgstr "" + +#: qalculatedatasetsdialog.cpp:84 +msgid "Objects:" +msgstr "" + +#: qalculatedatasetsdialog.cpp:87 qalculateeditdatasetdialog.cpp:236 +#: qalculateeditfunctiondialog.cpp:598 +msgid "Object" +msgstr "" + +#: qalculatedatasetsdialog.cpp:100 +msgid "Attributes:" +msgstr "" + +#: qalculatedatasetsdialog.cpp:157 qalculatedatasetsdialog.cpp:218 +msgid "Data set does not exist anymore." +msgstr "" + +#: qalculatedatasetsdialog.cpp:300 qalculateeditdatasetdialog.cpp:195 +#: qalculatefunctionsdialog.cpp:456 +msgid "key" +msgstr "" + +#: qalculatedatasetsdialog.cpp:316 +msgid "Data Retrieval Function" +msgstr "" + +#: qalculatedecimalsdialog.cpp:31 +msgid "Max decimals:" +msgstr "" + +#: qalculatedecimalsdialog.cpp:39 +msgid "Min decimals:" +msgstr "" + +#: qalculateeditdataobjectdialog.cpp:30 qalculateeditdataobjectdialog.cpp:40 +msgid "Edit Object" +msgstr "" + +#: qalculateeditdataobjectdialog.cpp:42 +msgid "New Object" +msgstr "" + +#: qalculateeditdataobjectdialog.cpp:48 qalculateeditdatasetdialog.cpp:242 +msgid "Property" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 116 +#: qalculateeditdataobjectdialog.cpp:51 rc.cpp:39 +#, no-c-format +msgid "Approximation" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:53 qalculateeditdatasetdialog.cpp:307 +msgid "Edit Data Set" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:68 qalculateeditfunctiondialog.cpp:70 +#: qalculatepreferencesdialog.cpp:157 +msgid "General" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:73 qalculateplotdialog.cpp:86 +#: qalculateplotdialog.cpp:189 +msgid "Title:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:76 +msgid "Data file:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:87 +msgid "Copyright:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:97 +msgid "Properties:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:99 qalculateplotdialog.cpp:153 +msgid "Title" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:100 qalculateeditdatasetdialog.cpp:620 +#: qalculateeditfunctiondialog.cpp:124 qalculateeditnamesdialog.cpp:41 +#: qalculateeditunitdialog.cpp:50 +msgid "Name" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:101 qalculateeditfunctiondialog.cpp:125 +#: qalculateeditunitdialog.cpp:75 qalculateeditunknownvariabledialog.cpp:60 +msgid "Type" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:115 qalculateeditdatasetdialog.cpp:442 +#: qalculateeditfunctiondialog.cpp:74 qalculateeditfunctiondialog.cpp:583 +#: qalculateeditmatrixvectordialog.cpp:78 qalculateeditunitdialog.cpp:55 +#: qalculateeditunknownvariabledialog.cpp:47 +#: qalculateeditvariabledialog.cpp:49 qalculateimportcsvdialog.cpp:60 +msgid "Name:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:124 qalculateeditdatasetdialog.cpp:451 +#: qalculateeditfunctiondialog.cpp:83 qalculateeditmatrixvectordialog.cpp:87 +#: qalculateeditunitdialog.cpp:64 qalculateeditunknownvariabledialog.cpp:56 +#: qalculateeditvariabledialog.cpp:60 +msgid "Names Details" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:126 +msgid "Object argument name:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:129 +msgid "Property argument name:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:132 +msgid "Default property:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:173 +msgid "text" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:178 qalculateeditdatasetdialog.cpp:186 +msgid "approximate" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:181 qalculateexpressionedit.cpp:712 +#: qalculatevariablesdialog.cpp:428 +msgid "number" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:189 +msgid "expression" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:213 qalculateeditdatasetdialog.cpp:499 +#: qalculateeditfunctiondialog.cpp:190 qalculateeditmatrixvectordialog.cpp:185 +#: qalculateeditunitdialog.cpp:146 qalculateeditunknownvariabledialog.cpp:132 +#: qalculateeditvariabledialog.cpp:102 +msgid "Empty name field" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:217 qalculateeditfunctiondialog.cpp:201 +msgid "" +"A function with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:309 +msgid "Edit Data Set (global)" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:311 +msgid "New Data Set" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:322 +msgid "info" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:435 qalculateeditdatasetdialog.cpp:548 +msgid "Edit Property" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:453 qalculateeditfunctiondialog.cpp:90 +#: qalculateeditmatrixvectordialog.cpp:93 qalculateeditunitdialog.cpp:66 +#: qalculateeditunknownvariabledialog.cpp:90 +#: qalculateeditvariabledialog.cpp:80 qalculateimportcsvdialog.cpp:63 +msgid "Descriptive name:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:464 +msgid "Value type:" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:467 qalculateeditfunctiondialog.cpp:593 +msgid "Text" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:469 qalculateeditfunctiondialog.cpp:482 +#: qalculateplotdialog.cpp:154 +msgid "Expression" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:474 +msgid "Use as key" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:476 +msgid "Approximate value" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:478 +msgid "Case sensitive value" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:480 +msgid "Value uses brackets" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:550 +msgid "New Property" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:615 qalculateeditnamesdialog.cpp:34 +msgid "Edit Names" +msgstr "" + +#: qalculateeditdatasetdialog.cpp:621 qalculateeditfunctiondialog.cpp:481 +#: qalculateeditnamesdialog.cpp:46 +msgid "Reference" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:55 qalculateeditfunctiondialog.cpp:286 +msgid "Edit Function" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:85 qalculateeditmatrixvectordialog.cpp:89 +#: qalculateeditunitdialog.cpp:87 qalculateeditunknownvariabledialog.cpp:85 +#: qalculateeditvariabledialog.cpp:74 qalculateimportcsvdialog.cpp:66 +msgid "Category:" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:96 +msgid "Hide function" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:106 qalculateplotdialog.cpp:89 +msgid "Expression:" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:115 +msgid "Condition:" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:120 qalculateeditfunctiondialog.cpp:476 +msgid "Sub-Functions" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:122 +msgid "Arguments:" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:197 +msgid "Empty expression field" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:288 +msgid "Edit Function (global)" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:290 +msgid "New Function" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:483 +msgid "Precalculate" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:579 qalculateeditfunctiondialog.cpp:675 +msgid "Edit Argument" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:586 +msgid "Type:" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:589 +msgid "Free" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:592 +msgid "Symbol" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:594 qalculateinsertfunctiondialog.cpp:353 +msgid "Date" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:597 +msgid "Boolean" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:603 +msgid "Angle" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:605 +msgid "Enable rules and type test" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:607 +msgid "Custom condition:" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:611 +msgid "Allow matrix" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:613 +msgid "Forbid zero" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:615 +msgid "Allow complex" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:617 qalculateplotdialog.cpp:164 +msgid "Min:" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:624 qalculateeditfunctiondialog.cpp:633 +msgid "Include equals" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:626 qalculateplotdialog.cpp:167 +msgid "Max:" +msgstr "" + +#: qalculateeditfunctiondialog.cpp:677 +msgid "New Argument" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:71 +#: qalculateeditunknownvariabledialog.cpp:40 +#: qalculateeditvariabledialog.cpp:41 qalculateeditvariabledialog.cpp:180 +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Edit Variable" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:96 +#: qalculateinsertmatrixvectordialog.cpp:75 +msgid "Rows:" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:99 +#: qalculateinsertmatrixvectordialog.cpp:78 +msgid "Columns:" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:112 +#: qalculateeditmatrixvectordialog.cpp:133 +#: qalculateeditmatrixvectordialog.cpp:295 +#: qalculateinsertmatrixvectordialog.cpp:91 +#: qalculateinsertmatrixvectordialog.cpp:115 +#: qalculateinsertmatrixvectordialog.cpp:275 +msgid "Elements:" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:146 +#: qalculateeditmatrixvectordialog.cpp:292 +#: qalculateinsertmatrixvectordialog.cpp:128 +#: qalculateinsertmatrixvectordialog.cpp:272 +msgid "Elements (in horizontal order):" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:189 +#: qalculateeditunknownvariabledialog.cpp:136 +#: qalculateeditvariabledialog.cpp:114 +msgid "" +"An unit or variable with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:301 +msgid "Edit Vector" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:303 +msgid "Edit Vector (global)" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:305 +msgid "New Vector" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:310 +msgid "Edit Matrix" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:312 +msgid "Edit Matrix (global)" +msgstr "" + +#: qalculateeditmatrixvectordialog.cpp:314 +msgid "New Matrix" +msgstr "" + +#: qalculateeditnamesdialog.cpp:42 +msgid "Abbreviation" +msgstr "" + +#: qalculateeditnamesdialog.cpp:44 +msgid "Plural" +msgstr "" + +#: qalculateeditnamesdialog.cpp:48 +msgid "Avoid Input" +msgstr "" + +#: qalculateeditnamesdialog.cpp:50 +msgid "Unicode" +msgstr "" + +#: qalculateeditnamesdialog.cpp:52 +msgid "Suffix" +msgstr "" + +#: qalculateeditnamesdialog.cpp:54 +msgid "Case Sensitive" +msgstr "" + +#: qalculateeditunitdialog.cpp:43 qalculateeditunitdialog.cpp:287 +msgid "Edit Unit" +msgstr "" + +#: qalculateeditunitdialog.cpp:72 +msgid "Hide unit" +msgstr "" + +#: qalculateeditunitdialog.cpp:80 +msgid "Class:" +msgstr "" + +#: qalculateeditunitdialog.cpp:83 +msgid "Base Unit" +msgstr "" + +#: qalculateeditunitdialog.cpp:84 +msgid "Alias" +msgstr "" + +#: qalculateeditunitdialog.cpp:85 +msgid "Composite Unit" +msgstr "" + +#: qalculateeditunitdialog.cpp:92 +msgid "System:" +msgstr "" + +#: qalculateeditunitdialog.cpp:95 +msgid "SI" +msgstr "" + +#: qalculateeditunitdialog.cpp:96 +msgid "CGS" +msgstr "" + +#: qalculateeditunitdialog.cpp:97 +msgid "Imperial" +msgstr "" + +#: qalculateeditunitdialog.cpp:98 +msgid "US Survey" +msgstr "" + +#: qalculateeditunitdialog.cpp:102 +msgid "Relation" +msgstr "" + +#: qalculateeditunitdialog.cpp:107 +msgid "Base unit:" +msgstr "" + +#: qalculateeditunitdialog.cpp:110 +msgid "Exponent:" +msgstr "" + +#: qalculateeditunitdialog.cpp:114 +msgid "Relation:" +msgstr "" + +#: qalculateeditunitdialog.cpp:121 +msgid "Relation is exact" +msgstr "" + +#: qalculateeditunitdialog.cpp:123 +msgid "Inverse relation:" +msgstr "" + +#: qalculateeditunitdialog.cpp:150 +msgid "" +"A variable or unit with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" + +#: qalculateeditunitdialog.cpp:175 qalculateeditunitdialog.cpp:219 +msgid "Base unit does not exist" +msgstr "" + +#: qalculateeditunitdialog.cpp:289 +msgid "Edit Unit (global)" +msgstr "" + +#: qalculateeditunitdialog.cpp:291 +msgid "New Unit" +msgstr "" + +#: qalculateeditunknownvariabledialog.cpp:58 +msgid "Custom assumptions:" +msgstr "" + +#: qalculateeditunknownvariabledialog.cpp:68 +msgid "Complex Number" +msgstr "" + +#: qalculateeditunknownvariabledialog.cpp:69 +msgid "Real Number" +msgstr "" + +#: qalculateeditunknownvariabledialog.cpp:70 +msgid "Rational Number" +msgstr "" + +#: qalculateeditunknownvariabledialog.cpp:73 +msgid "Sign" +msgstr "" + +#: qalculateeditunknownvariabledialog.cpp:199 +msgid "Edit Unknown Variable" +msgstr "" + +#: qalculateeditunknownvariabledialog.cpp:201 +msgid "Edit Unknown Variable (global)" +msgstr "" + +#: qalculateeditunknownvariabledialog.cpp:203 +msgid "New Unknown Variable" +msgstr "" + +#: qalculateeditvariabledialog.cpp:63 qalculateinsertfunctiondialog.cpp:91 +msgid "Value:" +msgstr "" + +#: qalculateeditvariabledialog.cpp:71 +msgid "Value is exact" +msgstr "" + +#: qalculateeditvariabledialog.cpp:110 +msgid "Empty value field" +msgstr "" + +#: qalculateeditvariabledialog.cpp:182 +msgid "Edit Variable (global)" +msgstr "" + +#: qalculateeditvariabledialog.cpp:185 +msgid "New Variable" +msgstr "" + +#: qalculateexportcsvdialog.cpp:37 qalculateexportcsvdialog.cpp:54 +msgid "Export CSV File" +msgstr "" + +#: qalculateexportcsvdialog.cpp:42 +msgid "Current result" +msgstr "" + +#: qalculateexportcsvdialog.cpp:46 +msgid "Matrix/vector variable" +msgstr "" + +#: qalculateexportcsvdialog.cpp:51 qalculateimportcsvdialog.cpp:43 +msgid "File:" +msgstr "" + +#: qalculateexportcsvdialog.cpp:56 qalculateimportcsvdialog.cpp:80 +msgid "Delimiter:" +msgstr "" + +#: qalculateexportcsvdialog.cpp:59 qalculateimportcsvdialog.cpp:83 +msgid "Comma" +msgstr "" + +#: qalculateexportcsvdialog.cpp:60 qalculateimportcsvdialog.cpp:84 +msgid "Tabulator" +msgstr "" + +#: qalculateexportcsvdialog.cpp:61 qalculateimportcsvdialog.cpp:85 +msgid "Semicolon" +msgstr "" + +#: qalculateexportcsvdialog.cpp:62 qalculateimportcsvdialog.cpp:86 +msgid "Space" +msgstr "" + +#: qalculateexportcsvdialog.cpp:63 qalculateimportcsvdialog.cpp:87 +msgid "Other" +msgstr "" + +#: qalculateexportcsvdialog.cpp:93 qalculateimportcsvdialog.cpp:116 +msgid "No file name entered." +msgstr "" + +#: qalculateexportcsvdialog.cpp:122 qalculateimportcsvdialog.cpp:145 +msgid "No delimiter selected." +msgstr "" + +#: qalculateexportcsvdialog.cpp:135 +msgid "No variable name entered." +msgstr "" + +#: qalculateexportcsvdialog.cpp:147 +msgid "No known variable with entered name found." +msgstr "" + +#: qalculateexportcsvdialog.cpp:154 +#, c-format +msgid "" +"Could not export to file \n" +"%s" +msgstr "" + +#: qalculateexpressionedit.cpp:146 +msgid "Disable Completion" +msgstr "" + +#: qalculateexpressionedit.cpp:147 +msgid "Enable Completion" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 154 +#: qalculateexpressionedit.cpp:161 qalculateresultdisplay.cpp:333 rc.cpp:48 +#, no-c-format +msgid "Meta Modes" +msgstr "" + +#: qalculateexpressionedit.cpp:655 qalculatevariablesdialog.cpp:366 +msgid "a previous result" +msgstr "" + +#: qalculateexpressionedit.cpp:661 qalculatevariablesdialog.cpp:376 +msgid "matrix" +msgstr "" + +#: qalculateexpressionedit.cpp:663 qalculatevariablesdialog.cpp:378 +msgid "vector" +msgstr "" + +#: qalculateexpressionedit.cpp:672 qalculatevariablesdialog.cpp:387 +msgid "positive" +msgstr "" + +#: qalculateexpressionedit.cpp:676 qalculatevariablesdialog.cpp:391 +msgid "non-positive" +msgstr "" + +#: qalculateexpressionedit.cpp:680 qalculatevariablesdialog.cpp:395 +msgid "negative" +msgstr "" + +#: qalculateexpressionedit.cpp:684 qalculatevariablesdialog.cpp:399 +msgid "non-negative" +msgstr "" + +#: qalculateexpressionedit.cpp:688 qalculatevariablesdialog.cpp:403 +msgid "non-zero" +msgstr "" + +#: qalculateexpressionedit.cpp:696 qalculatevariablesdialog.cpp:412 +msgid "integer" +msgstr "" + +#: qalculateexpressionedit.cpp:700 qalculatevariablesdialog.cpp:416 +msgid "rational" +msgstr "" + +#: qalculateexpressionedit.cpp:704 qalculatevariablesdialog.cpp:420 +msgid "real" +msgstr "" + +#: qalculateexpressionedit.cpp:708 qalculatevariablesdialog.cpp:424 +msgid "complex" +msgstr "" + +#: qalculateexpressionedit.cpp:716 qalculatevariablesdialog.cpp:432 +msgid "(not matrix)" +msgstr "" + +#: qalculateexpressionedit.cpp:721 qalculatevariablesdialog.cpp:438 +msgid "unknown" +msgstr "" + +#: qalculateexpressionedit.cpp:723 qalculatevariablesdialog.cpp:440 +msgid "default assumptions" +msgstr "" + +#: qalculatefunctionsdialog.cpp:47 +msgid "Functions" +msgstr "" + +#: qalculatefunctionsdialog.cpp:59 +msgid "Function Name" +msgstr "" + +#: qalculatefunctionsdialog.cpp:75 qalculatefunctionsdialog.cpp:313 +#: qalculateunitsdialog.cpp:99 qalculateunitsdialog.cpp:352 +#: qalculatevariablesdialog.cpp:74 qalculatevariablesdialog.cpp:349 +msgid "Deactivate" +msgstr "" + +#: qalculatefunctionsdialog.cpp:174 qalculatefunctionsdialog.cpp:175 +#: qalculatefunctionsdialog.cpp:176 qalculatefunctionsdialog.cpp:234 +#: qalculatefunctionsdialog.cpp:260 qalculatefunctionsdialog.cpp:283 +#: qalculatefunctionsdialog.cpp:509 qalculateunitsdialog.cpp:206 +#: qalculateunitsdialog.cpp:207 qalculateunitsdialog.cpp:208 +#: qalculateunitsdialog.cpp:271 qalculateunitsdialog.cpp:297 +#: qalculateunitsdialog.cpp:320 qalculateunitsdialog.cpp:420 +#: qalculatevariablesdialog.cpp:174 qalculatevariablesdialog.cpp:175 +#: qalculatevariablesdialog.cpp:176 qalculatevariablesdialog.cpp:256 +#: qalculatevariablesdialog.cpp:282 qalculatevariablesdialog.cpp:320 +#: qalculatevariablesdialog.cpp:466 +msgid "Inactive" +msgstr "" + +#: qalculatefunctionsdialog.cpp:315 qalculateunitsdialog.cpp:354 +#: qalculatevariablesdialog.cpp:351 +msgid "Activate" +msgstr "" + +#: qalculatefunctionsdialog.cpp:367 qalculateresultdisplay.cpp:148 +#, c-format +msgid "" +"Retrieves data from the %s data set for a given object and property. If " +"\"info\" is typed as property, a dialog window will pop up with all " +"properties of the object." +msgstr "" + +#: qalculatefunctionsdialog.cpp:391 +msgid "Arguments" +msgstr "" + +#: qalculatefunctionsdialog.cpp:412 qalculateinsertfunctiondialog.cpp:194 +#: qalculateinsertfunctiondialog.cpp:227 +msgid "optional" +msgstr "" + +#: qalculatefunctionsdialog.cpp:416 +msgid "default: " +msgstr "" + +#: qalculatefunctionsdialog.cpp:426 +msgid "Requirement" +msgstr "" + +#: qalculateimportcsvdialog.cpp:39 qalculateimportcsvdialog.cpp:46 +msgid "Import CSV File" +msgstr "" + +#: qalculateimportcsvdialog.cpp:48 +msgid "Import as:" +msgstr "" + +#: qalculateimportcsvdialog.cpp:71 +msgid "First row:" +msgstr "" + +#: qalculateimportcsvdialog.cpp:77 +msgid "Includes headings" +msgstr "" + +#: qalculateimportcsvdialog.cpp:149 +msgid "An error occured when importing the CSV file." +msgstr "" + +#: qalculateinsertfunctiondialog.cpp:50 qalculateinsertfunctiondialog.cpp:57 +msgid "Execute" +msgstr "" + +#: qalculateinsertfunctiondialog.cpp:93 +msgid "Argument" +msgstr "" + +#: qalculateinsertfunctiondialog.cpp:152 +msgid "True" +msgstr "" + +#: qalculateinsertfunctiondialog.cpp:153 +msgid "False" +msgstr "" + +#: qalculateinsertfunctiondialog.cpp:184 +msgid "Info" +msgstr "" + +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Insert Selection" +msgstr "" + +#: qalculateinsertmatrixvectordialog.cpp:293 +msgid "Vector Result" +msgstr "" + +#: qalculateinsertmatrixvectordialog.cpp:295 +msgid "Matrix Result" +msgstr "" + +#: qalculateperiodictabledialog.cpp:195 +msgid "Element Data" +msgstr "" + +#: qalculateperiodictabledialog.cpp:221 +msgid "Classification" +msgstr "" + +#: qalculateperiodictabledialog.cpp:224 +msgid "Alkali Metal" +msgstr "" + +#: qalculateperiodictabledialog.cpp:225 +msgid "Alkaline-Earth Metal" +msgstr "" + +#: qalculateperiodictabledialog.cpp:226 +msgid "Lanthanide" +msgstr "" + +#: qalculateperiodictabledialog.cpp:227 +msgid "Actinide" +msgstr "" + +#: qalculateperiodictabledialog.cpp:228 +msgid "Transition Metal" +msgstr "" + +#: qalculateperiodictabledialog.cpp:229 +msgid "Metal" +msgstr "" + +#: qalculateperiodictabledialog.cpp:230 +msgid "Metalloid" +msgstr "" + +#: qalculateperiodictabledialog.cpp:231 +msgid "Non-Metal" +msgstr "" + +#: qalculateperiodictabledialog.cpp:232 +msgid "Halogen" +msgstr "" + +#: qalculateperiodictabledialog.cpp:233 +msgid "Noble Gas" +msgstr "" + +#: qalculateperiodictabledialog.cpp:234 +msgid "Transactinide" +msgstr "" + +#: qalculateplotdialog.cpp:64 +msgid "Plot" +msgstr "" + +#: qalculateplotdialog.cpp:82 +msgid "Data" +msgstr "" + +#: qalculateplotdialog.cpp:83 +msgid "Function Range" +msgstr "" + +#: qalculateplotdialog.cpp:101 +msgid "Vector/matrix" +msgstr "" + +#: qalculateplotdialog.cpp:104 +msgid "Paired matrix" +msgstr "" + +#: qalculateplotdialog.cpp:107 +msgid "Rows" +msgstr "" + +#: qalculateplotdialog.cpp:109 +msgid "X variable:" +msgstr "" + +#: qalculateplotdialog.cpp:113 +msgid "Style:" +msgstr "" + +#: qalculateplotdialog.cpp:115 +msgid "Line" +msgstr "" + +#: qalculateplotdialog.cpp:116 +msgid "Points" +msgstr "" + +#: qalculateplotdialog.cpp:117 +msgid "Line with points" +msgstr "" + +#: qalculateplotdialog.cpp:118 +msgid "Boxes/bars" +msgstr "" + +#: qalculateplotdialog.cpp:119 +msgid "Histogram" +msgstr "" + +#: qalculateplotdialog.cpp:120 +msgid "Steps" +msgstr "" + +#: qalculateplotdialog.cpp:121 +msgid "Candlesticks" +msgstr "" + +#: qalculateplotdialog.cpp:122 +msgid "Dots" +msgstr "" + +#: qalculateplotdialog.cpp:124 +msgid "Smoothing:" +msgstr "" + +#: qalculateplotdialog.cpp:127 +msgid "Monotonic" +msgstr "" + +#: qalculateplotdialog.cpp:128 +msgid "Natural cubic splines" +msgstr "" + +#: qalculateplotdialog.cpp:129 +msgid "Bezier" +msgstr "" + +#: qalculateplotdialog.cpp:130 +msgid "Bezier (monotonic)" +msgstr "" + +#: qalculateplotdialog.cpp:132 +msgid "Y-axis:" +msgstr "" + +#: qalculateplotdialog.cpp:136 +msgid "Primary" +msgstr "" + +#: qalculateplotdialog.cpp:139 +msgid "Secondary" +msgstr "" + +#: qalculateplotdialog.cpp:171 +msgid "Sampling rate:" +msgstr "" + +#: qalculateplotdialog.cpp:176 +msgid "Step size:" +msgstr "" + +#: qalculateplotdialog.cpp:194 +msgid "Display grid" +msgstr "" + +#: qalculateplotdialog.cpp:196 +msgid "Display full border" +msgstr "" + +#: qalculateplotdialog.cpp:199 +msgid "Logarithmic x scale:" +msgstr "" + +#: qalculateplotdialog.cpp:203 +msgid "Logarithmic y scale:" +msgstr "" + +#: qalculateplotdialog.cpp:207 +msgid "X-axis label:" +msgstr "" + +#: qalculateplotdialog.cpp:210 +msgid "Y-axis label:" +msgstr "" + +#: qalculateplotdialog.cpp:213 +msgid "Color display:" +msgstr "" + +#: qalculateplotdialog.cpp:217 +msgid "Color" +msgstr "" + +#: qalculateplotdialog.cpp:220 +msgid "Monochrome" +msgstr "" + +#: qalculateplotdialog.cpp:224 +msgid "Legend placement:" +msgstr "" + +#: qalculateplotdialog.cpp:227 +msgid "Top-left" +msgstr "" + +#: qalculateplotdialog.cpp:228 +msgid "Top-right" +msgstr "" + +#: qalculateplotdialog.cpp:229 +msgid "Bottom-left" +msgstr "" + +#: qalculateplotdialog.cpp:230 +msgid "Bottom-right" +msgstr "" + +#: qalculateplotdialog.cpp:231 +msgid "Below" +msgstr "" + +#: qalculateplotdialog.cpp:232 +msgid "Outside" +msgstr "" + +#: qalculateplotdialog.cpp:403 qalculateplotdialog.cpp:458 +#: qalculateplotdialog.cpp:506 +msgid "Empty expression." +msgstr "" + +#: qalculateplotdialog.cpp:472 qalculateplotdialog.cpp:519 +msgid "Empty x variable." +msgstr "" + +#: qalculateprecisiondialog.cpp:34 qalculateprecisiondialog.cpp:36 +msgid "Recalculate" +msgstr "" + +#: qalculateprecisiondialog.cpp:41 +msgid "Precision:" +msgstr "" + +#: qalculatepreferencesdialog.cpp:100 +msgid "Choose..." +msgstr "" + +#: qalculatepreferencesdialog.cpp:147 +msgid "Preferences" +msgstr "" + +#: qalculatepreferencesdialog.cpp:161 +msgid "Close to system tray" +msgstr "" + +#: qalculatepreferencesdialog.cpp:162 +msgid "" +"If the application will reside in the system tray when the window is closed" +msgstr "" + +#: qalculatepreferencesdialog.cpp:164 +msgid "Display expression status" +msgstr "" + +#: qalculatepreferencesdialog.cpp:165 +msgid "" +"If as-you-type expression status shall be displayed below the expression " +"entry" +msgstr "" + +#: qalculatepreferencesdialog.cpp:167 +msgid "Use icon buttons" +msgstr "" + +#: qalculatepreferencesdialog.cpp:168 +msgid "" +"Use icons instead of text on the top-right buttons. The third state uses the " +"style setting for icons on buttons." +msgstr "" + +#: qalculatepreferencesdialog.cpp:171 +msgid "Update exchange rates on start" +msgstr "" + +#: qalculatepreferencesdialog.cpp:172 +msgid "" +"If current exchange rates shall be downloaded from the internet at program " +"start" +msgstr "" + +#: qalculatepreferencesdialog.cpp:174 +msgid "Save mode on exit" +msgstr "" + +#: qalculatepreferencesdialog.cpp:175 +msgid "If the mode of the calculator shall be restored" +msgstr "" + +#: qalculatepreferencesdialog.cpp:177 +msgid "Save definitions on exit" +msgstr "" + +#: qalculatepreferencesdialog.cpp:178 +msgid "" +"If changes to functions, units and variables shall be saved automatically" +msgstr "" + +#: qalculatepreferencesdialog.cpp:180 +msgid "Use only keypad keys for RPN" +msgstr "" + +#: qalculatepreferencesdialog.cpp:181 +msgid "" +"Use only keypad keys for RPN operations (+-*/^) and use the rest of the " +"keyboard for expression entry" +msgstr "" + +#: qalculatepreferencesdialog.cpp:183 +msgid "Ignores dots in numbers" +msgstr "" + +#: qalculatepreferencesdialog.cpp:184 +msgid "" +"Allow dots, '.', to be used as thousands separator instead of as an " +"alternative to decimal sign" +msgstr "" + +#: qalculatepreferencesdialog.cpp:187 +msgid "Enable unicode signs" +msgstr "" + +#: qalculatepreferencesdialog.cpp:188 +msgid "Disable this if you have problems with some fancy characters" +msgstr "" + +#: qalculatepreferencesdialog.cpp:190 +msgid "Use lower case in numbers" +msgstr "" + +#: qalculatepreferencesdialog.cpp:191 +msgid "If lower case letters should be used in numbers with non-decimal base" +msgstr "" + +#: qalculatepreferencesdialog.cpp:193 +msgid "Use lower case \"e\"" +msgstr "" + +#: qalculatepreferencesdialog.cpp:194 +msgid "If \"e\"; shall be used instead of \"E\" in numbers" +msgstr "" + +#: qalculatepreferencesdialog.cpp:196 +msgid "Alternative base prefixes" +msgstr "" + +#: qalculatepreferencesdialog.cpp:197 +msgid "" +"If hexadecimal numbers shall be displayed with \"0x0\" and binary numbers " +"with \"0b00\" as prefixes" +msgstr "" + +#: qalculatepreferencesdialog.cpp:199 +msgid "Spell out logical operators" +msgstr "" + +#: qalculatepreferencesdialog.cpp:200 +msgid "If logical and/or shall be displayed as \"&&\"/\"||\" or \"and\"/\"or\"" +msgstr "" + +#: qalculatepreferencesdialog.cpp:203 +msgid "Multiplication sign:" +msgstr "" + +#: qalculatepreferencesdialog.cpp:215 +msgid "Division sign:" +msgstr "" + +#: qalculatepreferencesdialog.cpp:230 +msgid "Custom result font" +msgstr "" + +#: qalculatepreferencesdialog.cpp:234 +msgid "Custom expression font" +msgstr "" + +#: qalculatepreferencesdialog.cpp:238 +msgid "Custom status font" +msgstr "" + +#: qalculatepreferencesdialog.cpp:243 +msgid "Status error color:" +msgstr "" + +#: qalculatepreferencesdialog.cpp:250 +msgid "Status warning color:" +msgstr "" + +#: qalculateresultdisplay.cpp:52 +msgid "a matrix" +msgstr "" + +#: qalculateresultdisplay.cpp:54 +msgid "a vector" +msgstr "" + +#: qalculateresultdisplay.cpp:57 +msgid "double-click to view/edit" +msgstr "" + +#: qalculateresultdisplay.cpp:60 +msgid "Unknown variable" +msgstr "" + +#: qalculateresultdisplay.cpp:72 +msgid "Prefix" +msgstr "" + +#: qalculateresultdisplay.cpp:336 +msgid "Show Parsed Expression" +msgstr "" + +#: qalculateresultdisplay.cpp:342 qalculateresultdisplay.cpp:353 +msgid "Show Object Info" +msgstr "" + +#: qalculateresultdisplay.cpp:348 +msgid "View/Edit Matrix" +msgstr "" + +#: qalculateresultdisplay.cpp:350 +msgid "View/Edit Vector" +msgstr "" + +#: qalculateresultdisplay.cpp:382 +msgid "Parsed expression:" +msgstr "" + +#: qalculatesetbasedialog.cpp:33 +msgid "Result Base" +msgstr "" + +#: qalculatesetbasedialog.cpp:39 qalculatesetbasedialog.cpp:52 +msgid "Other:" +msgstr "" + +#: qalculatesetbasedialog.cpp:43 +msgid "Time format" +msgstr "" + +#: qalculatesetbasedialog.cpp:44 qalculatesetbasedialog.cpp:55 +msgid "Roman numerals" +msgstr "" + +#: qalculatesetbasedialog.cpp:46 +msgid "Expression Base" +msgstr "" + +#: qalculateunitsdialog.cpp:54 +msgid "Units" +msgstr "" + +#: qalculateunitsdialog.cpp:68 +msgid "Names" +msgstr "" + +#: qalculateunitsdialog.cpp:69 +msgid "Base" +msgstr "" + +#: qalculateunitsdialog.cpp:72 +msgid "Conversion" +msgstr "" + +#: qalculateunitsdialog.cpp:105 +msgid "Convert Result" +msgstr "" + +#: qalculateunitsdialog.cpp:250 +msgid "Cannot delete unit as it is needed by other units." +msgstr "" + +#: qalculatevariablesdialog.cpp:51 +msgid "Variables" +msgstr "" + +#: qalculatevariablesdialog.cpp:60 +msgid "Variable Name" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 5 +#: rc.cpp:6 +#, no-c-format +msgid "&New" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 37 +#: rc.cpp:12 +#, no-c-format +msgid "&Set Prefix" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 39 +#: rc.cpp:15 +#, no-c-format +msgid "&Convert To Unit" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 54 +#: rc.cpp:18 +#, no-c-format +msgid "&Mode" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 55 +#: rc.cpp:21 +#, no-c-format +msgid "Number Base" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 67 +#: rc.cpp:24 +#, no-c-format +msgid "Numerical Display" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 80 +#: rc.cpp:27 +#, no-c-format +msgid "Fractional Display" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 86 +#: rc.cpp:30 +#, no-c-format +msgid "Unit Display" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 96 +#: rc.cpp:33 +#, no-c-format +msgid "Angle Unit" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 104 +#: rc.cpp:36 +#, no-c-format +msgid "Enabled Objects" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 121 +#: rc.cpp:42 +#, no-c-format +msgid "Assumptions" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 137 +#: rc.cpp:45 +#, no-c-format +msgid "Algebraic Mode" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 161 +#: rc.cpp:51 +#, no-c-format +msgid "Fu&nctions" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 163 +#: rc.cpp:54 +#, no-c-format +msgid "&Variables" +msgstr "" + +#. i18n: file ./qalculate_kdeui.rc line 165 +#: rc.cpp:57 +#, no-c-format +msgid "&Units" +msgstr "" diff --git a/po/sv.po b/po/sv.po new file mode 100644 index 0000000..031d43f --- /dev/null +++ b/po/sv.po @@ -0,0 +1,2615 @@ +# translation of sv.po to Swedish +# Niklas Knutsson , 2005. +msgid "" +msgstr "" +"Project-Id-Version: sv\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-05-08 14:44+0200\n" +"PO-Revision-Date: 2006-04-29 23:40+0200\n" +"Last-Translator: Niklas Knutsson \n" +"Language-Team: Swedish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: _translatorinfo.cpp:1 +msgid "" +"_: NAME OF TRANSLATORS\n" +"Your names" +msgstr "Niklas Knutsson" + +#: _translatorinfo.cpp:3 +msgid "" +"_: EMAIL OF TRANSLATORS\n" +"Your emails" +msgstr "nq@altern.org" + +#: kqalculate.cpp:264 +msgid "Remove from System Tray" +msgstr "Ta bort från aktivitetsfältet" + +#: kqalculate.cpp:265 qalculateeditdatasetdialog.cpp:471 +#: qalculateplotdialog.cpp:226 +msgid "Hide" +msgstr "Göm" + +#: kqalculate.cpp:286 kqalculate.cpp:4484 kqalculate.cpp:5915 +msgid "Enter" +msgstr "" + +#: kqalculate.cpp:287 kqalculate.cpp:513 kqalculate.cpp:4485 +#: kqalculate.cpp:4492 kqalculate.cpp:5916 +msgid "=" +msgstr "" + +#: kqalculate.cpp:289 kqalculate.cpp:514 kqalculate.cpp:4489 +#: kqalculate.cpp:4490 +msgid "Calculate expression and add to stack" +msgstr "Beräkna uttrycket och lägg till i stacken" + +#: kqalculate.cpp:290 kqalculate.cpp:515 kqalculate.cpp:4493 +#: kqalculate.cpp:4494 +msgid "Calculate expression" +msgstr "Beräkna uttrycket" + +#: kqalculate.cpp:296 kqalculate.cpp:5918 +msgid "Store" +msgstr "Spara" + +#: kqalculate.cpp:298 +msgid "Store result as variable" +msgstr "Spara resultatet som en variabel" + +#: kqalculate.cpp:301 kqalculate.cpp:5920 qalculateconvertunitsdialog.cpp:42 +msgid "Convert" +msgstr "Omvandla" + +#: kqalculate.cpp:303 +msgid "Convert units in result" +msgstr "Omvandla enheter i resultatet" + +#: kqalculate.cpp:313 +msgid "Enter expression here" +msgstr "Skriv in uttryck här" + +#: kqalculate.cpp:322 +msgid "status" +msgstr "status" + +#: kqalculate.cpp:354 qalculateeditdataobjectdialog.cpp:71 +msgid "Exact" +msgstr "Exakt" + +#: kqalculate.cpp:355 +msgid "Toggle exact mode" +msgstr "(Av)aktivera exakt läge" + +#: kqalculate.cpp:358 kqalculate.cpp:1070 +msgid "Fraction" +msgstr "Bråktal" + +#: kqalculate.cpp:359 +msgid "Toggle fractional display" +msgstr "(Av)aktivera bråktalsvisning" + +#: kqalculate.cpp:363 +msgid "Numerical display" +msgstr "Numerisk visning" + +#: kqalculate.cpp:366 kqalculate.cpp:1046 qalculateresultdisplay.cpp:288 +msgid "Normal" +msgstr "Normal" + +#: kqalculate.cpp:367 kqalculate.cpp:1048 qalculateresultdisplay.cpp:291 +msgid "Engineering" +msgstr "Teknisk" + +#: kqalculate.cpp:368 kqalculate.cpp:1050 qalculateresultdisplay.cpp:294 +msgid "Scientific" +msgstr "Vetenskaplig" + +#: kqalculate.cpp:369 +msgid "Pure" +msgstr "Strik" + +#: kqalculate.cpp:370 kqalculate.cpp:1054 +msgid "Simple" +msgstr "Enkel" + +#: kqalculate.cpp:372 +msgid "Base in result" +msgstr "Nummerbas i resultatet" + +#: kqalculate.cpp:376 kqalculate.cpp:1029 qalculatesetbasedialog.cpp:35 +#: qalculatesetbasedialog.cpp:48 +msgid "Binary" +msgstr "Binär" + +#: kqalculate.cpp:377 kqalculate.cpp:1031 qalculatesetbasedialog.cpp:36 +#: qalculatesetbasedialog.cpp:49 +msgid "Octal" +msgstr "Oktal" + +#: kqalculate.cpp:378 kqalculate.cpp:1033 kqalculate.cpp:1066 +#: qalculatesetbasedialog.cpp:37 qalculatesetbasedialog.cpp:50 +msgid "Decimal" +msgstr "Decimal" + +#: kqalculate.cpp:379 kqalculate.cpp:1035 qalculatesetbasedialog.cpp:38 +#: qalculatesetbasedialog.cpp:51 +msgid "Hexadecimal" +msgstr "Hexadecimal" + +#: kqalculate.cpp:380 kqalculate.cpp:1039 qalculatesetbasedialog.cpp:42 +msgid "Sexagesimal" +msgstr "Sexagesimal" + +#: kqalculate.cpp:381 kqalculate.cpp:1041 +msgid "Time Format" +msgstr "Tidsformat" + +#: kqalculate.cpp:383 kqalculate.cpp:1037 +msgid "Other..." +msgstr "Annan..." + +#: kqalculate.cpp:389 +msgid "f(x)" +msgstr "" + +#: kqalculate.cpp:393 +msgid "Open functions manager" +msgstr "Öppna funktionshanteraren" + +#: kqalculate.cpp:395 +msgid "sqrt" +msgstr "" + +#: kqalculate.cpp:396 +msgid "Square root" +msgstr "Kvadratrot" + +#: kqalculate.cpp:399 kqalculate.cpp:947 +msgid "xy" +msgstr "" + +#: kqalculate.cpp:400 +msgid "Raise (Ctrl+*)" +msgstr "Upphöj (Ctrl+*)" + +#: kqalculate.cpp:403 kqalculate.cpp:946 +msgid "x2" +msgstr "" + +#: kqalculate.cpp:404 +msgid "Square" +msgstr "Kvadrat" + +#: kqalculate.cpp:406 +msgid "log" +msgstr "" + +#: kqalculate.cpp:407 +msgid "Base-10 logarithm" +msgstr "Bas-10-logaritm" + +#: kqalculate.cpp:409 +msgid "ln" +msgstr "" + +#: kqalculate.cpp:410 +msgid "Natural logarithm" +msgstr "Naturlig logaritm" + +#: kqalculate.cpp:412 +msgid "x!" +msgstr "" + +#: kqalculate.cpp:413 +msgid "Factorial" +msgstr "Fakultet" + +#: kqalculate.cpp:415 +msgid "cos" +msgstr "" + +#: kqalculate.cpp:416 +msgid "Cosine" +msgstr "Cosinus" + +#: kqalculate.cpp:418 +msgid "tan" +msgstr "" + +#: kqalculate.cpp:419 +msgid "Tangent" +msgstr "Tangens" + +#: kqalculate.cpp:421 +msgid "hyp" +msgstr "" + +#: kqalculate.cpp:422 +msgid "Toggle hyperbolic functions" +msgstr "(Av)aktivera hyperbola funktioner" + +#: kqalculate.cpp:425 +msgid "inv" +msgstr "" + +#: kqalculate.cpp:426 +msgid "Toggle inverse functions" +msgstr "(Av)aktivera inversa funktioner" + +#: kqalculate.cpp:429 +msgid "sin" +msgstr "" + +#: kqalculate.cpp:430 +msgid "Sine" +msgstr "Sinus" + +#: kqalculate.cpp:435 +msgid "Deg" +msgstr "" + +#: kqalculate.cpp:436 +msgid "Angle Unit: Degrees" +msgstr "Vinkelenhet: Grader" + +#: kqalculate.cpp:439 +msgid "Rad" +msgstr "" + +#: kqalculate.cpp:440 +msgid "Angle Unit: Radians" +msgstr "Vinkelenhet: Radianer" + +#: kqalculate.cpp:443 +msgid "Gra" +msgstr "" + +#: kqalculate.cpp:444 +msgid "Angle Unit: Gradians" +msgstr "Vinkelenhet: Gradienter" + +#: kqalculate.cpp:447 kqalculate.cpp:1094 kqalculate.cpp:1152 +#: qalculateplotdialog.cpp:126 +msgid "None" +msgstr "Ingen" + +#: kqalculate.cpp:464 +msgid "7" +msgstr "" + +#: kqalculate.cpp:466 +msgid "8" +msgstr "" + +#: kqalculate.cpp:468 +msgid "9" +msgstr "" + +#: kqalculate.cpp:470 +msgid "4" +msgstr "" + +#: kqalculate.cpp:472 +msgid "5" +msgstr "" + +#: kqalculate.cpp:474 +msgid "6" +msgstr "" + +#: kqalculate.cpp:476 +msgid "1" +msgstr "" + +#: kqalculate.cpp:478 +msgid "2" +msgstr "" + +#: kqalculate.cpp:480 +msgid "3" +msgstr "" + +#: kqalculate.cpp:482 +msgid "0" +msgstr "" + +#: kqalculate.cpp:485 +msgid "Decimal point" +msgstr "Decimalkomma" + +#: kqalculate.cpp:487 +msgid "EXP" +msgstr "" + +#: kqalculate.cpp:488 +msgid "10^x (Ctrl+Shift+E)" +msgstr "" + +#: kqalculate.cpp:491 +msgid "Del" +msgstr "" + +#: kqalculate.cpp:494 +msgid "AC" +msgstr "" + +#: kqalculate.cpp:498 +msgid "Multiply" +msgstr "Multiplicera" + +#: kqalculate.cpp:501 +msgid "Divide" +msgstr "Dela" + +#: kqalculate.cpp:507 +msgid "Subtract" +msgstr "Subtrahera" + +#: kqalculate.cpp:509 +msgid "Ans" +msgstr "" + +#: kqalculate.cpp:510 +msgid "Previous result" +msgstr "Föregående resultat" + +#: kqalculate.cpp:512 kqalculate.cpp:4488 +msgid "Ent" +msgstr "" + +#: kqalculate.cpp:535 +msgid "Index" +msgstr "" + +#: kqalculate.cpp:536 qalculateeditdataobjectdialog.cpp:49 +#: qalculatevariablesdialog.cpp:61 +msgid "Value" +msgstr "Värde" + +#: kqalculate.cpp:555 kqalculate.cpp:5924 +msgid "Up" +msgstr "Upp" + +#: kqalculate.cpp:556 +msgid "Move selected register up" +msgstr "Flytta valt register uppåt" + +#: kqalculate.cpp:560 kqalculate.cpp:5926 +msgid "Down" +msgstr "Ned" + +#: kqalculate.cpp:561 +msgid "Move selected register down" +msgstr "Flytta valt register nedåt" + +#: kqalculate.cpp:566 +msgid "Edit value of selected register" +msgstr "Redigera värdet för valt register" + +#: kqalculate.cpp:571 +msgid "Delete selected register" +msgstr "Ta bort valt register" + +#: kqalculate.cpp:576 +msgid "Clear the RPN stack" +msgstr "Töm RPN-stacken" + +#: kqalculate.cpp:592 +msgid "Keypad" +msgstr "Knappsats" + +#: kqalculate.cpp:593 +msgid "Show/hide keypad" +msgstr "Visa/göm knappsats" + +#: kqalculate.cpp:596 +msgid "History" +msgstr "Historik" + +#: kqalculate.cpp:597 +msgid "Show/hide history" +msgstr "Visa/göm historik" + +#: kqalculate.cpp:600 +msgid "RPN Stack" +msgstr "RPN-stack" + +#: kqalculate.cpp:601 +msgid "Show/hide RPN stack" +msgstr "Visa/göm RPN-stacken" + +#: kqalculate.cpp:716 kqalculate.cpp:2527 +msgid "RPN Register Moved" +msgstr "RPN-register flyttades" + +#: kqalculate.cpp:752 kqalculate.cpp:784 kqalculate.cpp:2138 +#: kqalculate.cpp:2702 kqalculate.cpp:2739 +msgid "approx." +msgstr "ca" + +#: kqalculate.cpp:894 kqalculate.cpp:4813 +msgid "Load meta mode: %1" +msgstr "Ladda metaläge: %1" + +#: kqalculate.cpp:966 +msgid "Qalculate! - Scientific Calculator" +msgstr "Qalculate! - Vetenskaplig kalkulator" + +#: kqalculate.cpp:985 qalculateeditfunctiondialog.cpp:601 +#: qalculateresultdisplay.cpp:62 +msgid "Variable" +msgstr "Variabel" + +#: kqalculate.cpp:986 qalculateeditfunctiondialog.cpp:596 +#: qalculateeditmatrixvectordialog.cpp:106 qalculateimportcsvdialog.cpp:52 +#: qalculateinsertmatrixvectordialog.cpp:85 +#: qalculateinsertmatrixvectordialog.cpp:310 +msgid "Matrix" +msgstr "Matris" + +#: kqalculate.cpp:987 qalculateeditfunctiondialog.cpp:595 +#: qalculateeditmatrixvectordialog.cpp:109 +#: qalculateinsertmatrixvectordialog.cpp:88 +#: qalculateinsertmatrixvectordialog.cpp:308 +msgid "Vector" +msgstr "Vektor" + +#: kqalculate.cpp:988 +msgid "Unknown Variable" +msgstr "Okänd variabel" + +#: kqalculate.cpp:989 qalculateeditdatasetdialog.cpp:70 +#: qalculateeditfunctiondialog.cpp:71 qalculateeditfunctiondialog.cpp:599 +#: qalculateplotdialog.cpp:98 qalculateresultdisplay.cpp:92 +msgid "Function" +msgstr "Funktion" + +#: kqalculate.cpp:990 qalculatedatasetsdialog.cpp:64 +msgid "Data Set" +msgstr "Dataset" + +#: kqalculate.cpp:991 qalculateconvertunitsdialog.cpp:68 +#: qalculateeditfunctiondialog.cpp:600 qalculateresultdisplay.cpp:67 +#: qalculateunitsdialog.cpp:67 +msgid "Unit" +msgstr "Enhet" + +#: kqalculate.cpp:992 +msgid "Import CSV File..." +msgstr "Importera CSV-fil..." + +#: kqalculate.cpp:993 +msgid "Export CSV File..." +msgstr "Exportera CSV-fil..." + +#: kqalculate.cpp:994 +msgid "Store Result..." +msgstr "Spara resultatet..." + +#: kqalculate.cpp:995 +msgid "Save Result Image..." +msgstr "Spara resultatbild..." + +#: kqalculate.cpp:996 +msgid "Save Definitions" +msgstr "Spara definitioner" + +#: kqalculate.cpp:997 +msgid "Update Exchange Rates" +msgstr "Uppdatera växelkurser" + +#: kqalculate.cpp:998 +msgid "Plot Functions/Data" +msgstr "Rita functions-/datadiagram" + +#: kqalculate.cpp:1000 +msgid "Convert Number Bases" +msgstr "Omvandla mellan nummerbaser" + +#: kqalculate.cpp:1001 qalculateperiodictabledialog.cpp:40 +msgid "Periodic Table" +msgstr "Periodiska systemet" + +#: kqalculate.cpp:1008 +msgid "Show/hide main Qalculate! window" +msgstr "Visa/dölj Qalculate!:s huvudfönster" + +#: kqalculate.cpp:1011 +msgid "Configure &Global Shortcuts..." +msgstr "Anpassa &globala snabbtangenter..." + +#: kqalculate.cpp:1013 +msgid "Manage Variables" +msgstr "Hantera variabler" + +#: kqalculate.cpp:1014 +msgid "Manage Functions" +msgstr "Hantera funktioner" + +#: kqalculate.cpp:1015 +msgid "Manage Units" +msgstr "Hantera enheter" + +#: kqalculate.cpp:1016 +msgid "Manage Data Sets" +msgstr "Hantera dataset" + +#: kqalculate.cpp:1017 kqalculate.cpp:1150 +msgid "Factorize" +msgstr "Faktorisera" + +#: kqalculate.cpp:1018 kqalculate.cpp:1148 +msgid "Simplify" +msgstr "Förenkla" + +#: kqalculate.cpp:1019 +msgid "Set Unknowns..." +msgstr "Ange okända värden..." + +#: kqalculate.cpp:1020 +msgid "Convert to Unit Expression..." +msgstr "Omvandla till enhetsuttryck" + +#: kqalculate.cpp:1021 kqalculate.cpp:1084 +msgid "Convert to Base Units" +msgstr "Omvandla till basenheter" + +#: kqalculate.cpp:1022 kqalculate.cpp:1086 +msgid "Convert to Best Unit" +msgstr "Omvandla till lämpligast enhet" + +#: kqalculate.cpp:1023 +msgid "Insert Matrix..." +msgstr "Infoga matris..." + +#: kqalculate.cpp:1024 +msgid "Insert Vector..." +msgstr "Infoga vektor..." + +#: kqalculate.cpp:1025 +msgid "Copy Result" +msgstr "Kopiera resultatet" + +#: kqalculate.cpp:1026 +msgid "Clear History" +msgstr "Töm historiken" + +#: kqalculate.cpp:1027 +msgid "Configure Qalculate!" +msgstr "Anpassa Qalculate!" + +#: kqalculate.cpp:1043 +msgid "Roman Numerals" +msgstr "Romerska siffror" + +#: kqalculate.cpp:1045 +msgid "Select Result and Expression Base..." +msgstr "Välj bas i resultat och uttryck..." + +#: kqalculate.cpp:1052 +msgid "Purely Scientific" +msgstr "Strikt vetenskapligt" + +#: kqalculate.cpp:1056 +msgid "Indicate Infinite Series" +msgstr "Indikera oändliga talserier" + +#: kqalculate.cpp:1058 +msgid "Sort Minus Last" +msgstr "Sortera minus sist" + +#: kqalculate.cpp:1060 +msgid "Negative Exponents" +msgstr "Negativa exponenter" + +#: kqalculate.cpp:1062 +msgid "Show Ending Zeroes" +msgstr "Visa avslutande nollor" + +#: kqalculate.cpp:1064 +msgid "Round Halfway Numbers to Even" +msgstr "Avrunda mittimellan-tal till jämn siffra" + +#: kqalculate.cpp:1068 +msgid "Decimal (Try Exact)" +msgstr "Decimal (försök exakt)" + +#: kqalculate.cpp:1072 +msgid "Combined" +msgstr "Kombinerad" + +#: kqalculate.cpp:1074 +msgid "Enable Prefixes" +msgstr "Använd prefix" + +#: kqalculate.cpp:1076 +msgid "Enable Use of All SI Prefixes" +msgstr "Automatisk användning av alla SI-prefix" + +#: kqalculate.cpp:1078 +msgid "Enable Denominator Prefixes" +msgstr "Aktivera prefix i nämnaren" + +#: kqalculate.cpp:1080 +msgid "Place Units Separately" +msgstr "Placera enheter separat" + +#: kqalculate.cpp:1082 +msgid "No Automatic Conversion" +msgstr "Ingen automatisk omvandling" + +#: kqalculate.cpp:1088 +msgid "Degrees" +msgstr "Grader" + +#: kqalculate.cpp:1090 +msgid "Radians" +msgstr "Radianer" + +#: kqalculate.cpp:1092 +msgid "Gradians" +msgstr "Gradienter" + +#: kqalculate.cpp:1096 +msgid "Abbreviate Names" +msgstr "Förkorta namn" + +#: kqalculate.cpp:1098 +msgid "Enable Variables" +msgstr "Aktivera variabler" + +#: kqalculate.cpp:1100 +msgid "Enable Functions" +msgstr "Aktivera funktioner" + +#: kqalculate.cpp:1102 +msgid "Enable Units" +msgstr "Aktivera enheter" + +#: kqalculate.cpp:1104 +msgid "Enable Unknowns" +msgstr "Aktivera okända" + +#: kqalculate.cpp:1106 +msgid "Calculate Variables" +msgstr "Beräkna variabler" + +#: kqalculate.cpp:1108 +msgid "Allow Complex Result" +msgstr "Tillåt complext resultat" + +#: kqalculate.cpp:1110 +msgid "Allow Infinite Result" +msgstr "Tillåt oändligt resultat" + +#: kqalculate.cpp:1112 +msgid "Try Exact" +msgstr "Försök exakt" + +#: kqalculate.cpp:1114 +msgid "Always Exact" +msgstr "Alltid exakt" + +#: kqalculate.cpp:1116 qalculateeditdataobjectdialog.cpp:70 +msgid "Approximate" +msgstr "Approximera" + +#: kqalculate.cpp:1118 kqalculate.cpp:1132 +#: qalculateeditunknownvariabledialog.cpp:65 +#: qalculateeditunknownvariabledialog.cpp:78 +#: qalculateperiodictabledialog.cpp:235 +msgid "Unknown" +msgstr "Ökänd" + +#: kqalculate.cpp:1120 qalculateeditunknownvariabledialog.cpp:66 +msgid "Not Matrix" +msgstr "Inte matris" + +#: kqalculate.cpp:1122 qalculateeditdatasetdialog.cpp:468 +#: qalculateeditfunctiondialog.cpp:590 +#: qalculateeditunknownvariabledialog.cpp:67 +msgid "Number" +msgstr "Nummer" + +#: kqalculate.cpp:1124 +msgid "Complex" +msgstr "Komplex" + +#: kqalculate.cpp:1126 +msgid "Real" +msgstr "Reell" + +#: kqalculate.cpp:1128 +msgid "Rational" +msgstr "Rationell" + +#: kqalculate.cpp:1130 qalculateeditfunctiondialog.cpp:591 +#: qalculateeditunknownvariabledialog.cpp:71 +msgid "Integer" +msgstr "Heltal" + +#: kqalculate.cpp:1134 qalculateeditunknownvariabledialog.cpp:83 +msgid "Non-Zero" +msgstr "Ej noll" + +#: kqalculate.cpp:1136 qalculateeditunknownvariabledialog.cpp:79 +msgid "Positive" +msgstr "Positiv" + +#: kqalculate.cpp:1138 qalculateeditunknownvariabledialog.cpp:80 +msgid "Non-Negative" +msgstr "Ej negativ" + +#: kqalculate.cpp:1140 qalculateeditunknownvariabledialog.cpp:81 +msgid "Negative" +msgstr "Negativ" + +#: kqalculate.cpp:1142 qalculateeditunknownvariabledialog.cpp:82 +msgid "Non-Positive" +msgstr "Ej positiv" + +#: kqalculate.cpp:1144 +msgid "Non-Zero Denominators" +msgstr "Nämnare ej noll" + +#: kqalculate.cpp:1146 +msgid "Warn About Denominators Assumed Non-Zero" +msgstr "Varna om nämnare antagna som ej noll" + +#: kqalculate.cpp:1154 +msgid "Read Precision" +msgstr "Läs precision" + +#: kqalculate.cpp:1156 +msgid "Limit Implicit Multiplication" +msgstr "Begränsa implicit multiplikation" + +#: kqalculate.cpp:1158 +msgid "RPN Mode" +msgstr "RPN läge" + +#: kqalculate.cpp:1160 +msgid "RPN Syntax" +msgstr "RPN-syntax" + +#: kqalculate.cpp:1162 qalculateprecisiondialog.cpp:31 +msgid "Precision" +msgstr "Precision" + +#: kqalculate.cpp:1163 qalculatedecimalsdialog.cpp:27 +msgid "Decimals" +msgstr "Decimaler" + +#: kqalculate.cpp:1164 +msgid "Save Mode..." +msgstr "Spara läge..." + +#: kqalculate.cpp:1165 +msgid "Delete Mode..." +msgstr "Radera läge..." + +#: kqalculate.cpp:1167 +msgid "Save Default Mode" +msgstr "Spara förvalt läge" + +#: kqalculate.cpp:1168 +msgid "Clear Stack" +msgstr "Töm stacken" + +#: kqalculate.cpp:1172 +msgid "Exp RPN Operation" +msgstr "Exp RPN-operation" + +#: kqalculate.cpp:1860 +msgid "and" +msgstr "och" + +#: kqalculate.cpp:1865 +msgid "or" +msgstr "eller" + +#: kqalculate.cpp:2122 +msgid "undefined" +msgstr "odefinierad" + +#: kqalculate.cpp:2164 +msgid "EXACT" +msgstr "EXAKT" + +#: kqalculate.cpp:2167 +msgid "APPROX" +msgstr "APPROX" + +#: kqalculate.cpp:2171 +msgid "RPN" +msgstr "RPN" + +#: kqalculate.cpp:2179 +msgid "BIN" +msgstr "BIN" + +#: kqalculate.cpp:2184 +msgid "OCT" +msgstr "OKT" + +#: kqalculate.cpp:2189 +msgid "HEX" +msgstr "HEX" + +#: kqalculate.cpp:2194 +msgid "ROMAN" +msgstr "ROMERSKA" + +#: kqalculate.cpp:2206 +msgid "DEG" +msgstr "DEG" + +#: kqalculate.cpp:2211 +msgid "RAD" +msgstr "RAD" + +#: kqalculate.cpp:2216 +msgid "GRA" +msgstr "GRA" + +#: kqalculate.cpp:2223 +msgid "PREC" +msgstr "PREC" + +#: kqalculate.cpp:2228 +msgid "FUNC" +msgstr "FUNK" + +#: kqalculate.cpp:2234 +msgid "UNIT" +msgstr "ENHET" + +#: kqalculate.cpp:2240 +msgid "VAR" +msgstr "VAR" + +#: kqalculate.cpp:2246 +msgid "INF" +msgstr "INF" + +#: kqalculate.cpp:2252 +msgid "CPLX" +msgstr "KPLX" + +#: kqalculate.cpp:2333 kqalculate.cpp:2351 kqalculate.cpp:2581 +msgid "aborted" +msgstr "avbruten" + +#: kqalculate.cpp:2352 +msgid "calculation was aborted" +msgstr "beräkningen avbröts" + +#: kqalculate.cpp:2588 +msgid "result processing was aborted" +msgstr "resultatbehandlingen avbröts" + +#: kqalculate.cpp:2636 +msgid "Processing..." +msgstr "Behandlar..." + +#: kqalculate.cpp:2640 kqalculate.cpp:2885 kqalculate.cpp:3145 +msgid "Abort" +msgstr "Avbryt" + +#: kqalculate.cpp:2873 +msgid "Factorizing..." +msgstr "Faktoriserar..." + +#: kqalculate.cpp:2877 +msgid "Simplifying..." +msgstr "Förenklar..." + +#: kqalculate.cpp:3141 +msgid "Calculating..." +msgstr "Beräknar..." + +#: kqalculate.cpp:3191 +msgid "RPN Operation" +msgstr "RPN-operation" + +#: kqalculate.cpp:3259 +msgid "Errors" +msgstr "Fel" + +#: kqalculate.cpp:3260 +msgid "Warnings" +msgstr "Varningar" + +#: kqalculate.cpp:3270 +msgid "Couldn't write definitions" +msgstr "Kunde inte spara definitioner" + +#: kqalculate.cpp:3538 +msgid "Prefixes" +msgstr "Prefix" + +#: kqalculate.cpp:3665 +msgid "No Prefix" +msgstr "Inget prefix" + +#: kqalculate.cpp:3816 qalculatevariablesdialog.cpp:191 +#: qalculatevariablesdialog.cpp:337 +msgid "Variable does not exist anymore." +msgstr "Variabeln existerar inte längre." + +#: kqalculate.cpp:3832 qalculateconvertunitsdialog.cpp:153 +#: qalculateunitsdialog.cpp:223 qalculateunitsdialog.cpp:337 +msgid "Unit does not exist anymore." +msgstr "Enheten existerar inte längre." + +#: kqalculate.cpp:3905 +msgid "Failed to download exchange rates from ECB." +msgstr "Misslyckades med att hämta växelkurser från ECB." + +#: kqalculate.cpp:4752 +msgid "Save Mode" +msgstr "Spara läge" + +#: kqalculate.cpp:4755 +msgid "Mode name:" +msgstr "Lägesnamn:" + +#: kqalculate.cpp:4765 +msgid "Shortcut:" +msgstr "Snabbtangent:" + +#: kqalculate.cpp:4792 +msgid "Empty mode name." +msgstr "Tomt fält för lägesnamn" + +#: kqalculate.cpp:4795 +msgid "Preset mode cannot be overwritten." +msgstr "Förinställt läge kan inte skrivas över." + +#: kqalculate.cpp:4827 +msgid "Delete Mode" +msgstr "Radera läge" + +#: kqalculate.cpp:4827 +msgid "Mode:" +msgstr "Läge:" + +#: kqalculate.cpp:5001 +msgid "log10 function not found." +msgstr "Kunde inte finna log10 funktionen." + +#: kqalculate.cpp:5545 main.cpp:156 main.cpp:159 main.cpp:160 main.cpp:161 +#: main.cpp:162 +msgid "Temporary" +msgstr "Temporära" + +#: kqalculate.cpp:5567 kqalculate.cpp:5594 qalculatefunctionsdialog.cpp:191 +#: qalculatefunctionsdialog.cpp:300 +msgid "Function does not exist anymore." +msgstr "Funktionen existerar inte längre." + +#: kqalculate.cpp:5697 kqalculate.cpp:5733 +msgid "My Variables" +msgstr "Mina variabler" + +#: kqalculate.cpp:5709 qalculateimportcsvdialog.cpp:56 +msgid "Vectors" +msgstr "Vektorer" + +#: kqalculate.cpp:5721 +msgid "Matrices" +msgstr "Matriser" + +#: kqalculate.cpp:5762 qalculateplotdialog.cpp:726 +msgid "Save Image" +msgstr "Spara bild" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "" +"A file named \"%1\" already exists. Are you sure you want to overwrite it?" +msgstr "En fil med namnet \"%i\" finns redan. Vill du ersätta den?" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "Overwrite File?" +msgstr "Ersätt filen" + +#: kqalculate.cpp:5767 qalculateplotdialog.cpp:731 +msgid "&Overwrite" +msgstr "Ersätt" + +#: kqalculate.cpp:5801 +msgid "Failed to save image." +msgstr "Misslyckedes med att spara bild." + +#: kqalculate.cpp:6027 +msgid "No unknowns in result." +msgstr "Ingen okända värden i resultatet." + +#: kqalculate.cpp:6030 +msgid "Set Unknowns" +msgstr "Ange okända värden" + +#: kqalculate.cpp:6194 +msgid "Too many arguments for %1()." +msgstr "För många parametrar för %1()" + +#: kqalculate.cpp:6220 qalculatedatasetsdialog.cpp:342 +#: qalculatefunctionsdialog.cpp:343 qalculateresultdisplay.cpp:120 +msgid "argument" +msgstr "parameter" + +#: kqalculate.cpp:6442 kqalculate.cpp:6446 +msgid "Edit Expression" +msgstr "Redigera uttrycket" + +#: kqalculate.cpp:6451 +msgid "Edit Result" +msgstr "Redigera namnet" + +#: kqalculate.cpp:6454 +msgid "Insert Result Variable" +msgstr "Infoga resultatvariabel" + +#: main.cpp:45 +msgid "A powerful and easy to use desktop calculator" +msgstr "En kraftfull och användarvänlig miniräknare" + +#: main.cpp:51 +msgid "Calculate X11-clipboard content (selected text)" +msgstr "Beräkna X11-klippbordets innehåll (vald text)" + +#: main.cpp:52 +msgid "Initial expression to calculate" +msgstr "Initialt uttryck att beräkna" + +#: main.cpp:134 +msgid "Enter a mathematical expression above.
Ex. 5 + 2 / 3" +msgstr "Skriv in ett matematiskt uttryck ovan.
Ex. 5 + 2 / 3" + +#: main.cpp:143 +msgid "" +"You need to download exchange rates to be able to convert between different " +"currencies. You can later get current exchange rates by selecting \"Update " +"Exchange Rates\" under the File menu.\n" +"\n" +"Do you want to fetch exchange rates now from the Internet?" +msgstr "" +"Du behöver ladda ner växelkurser för att kunna omvandla mellan olika " +"valutor. Du kan senare hämta nuvarande växelkurser genom välja \"Uppdatera " +"växelkurser\" under filmenyn.\n" +"\n" +"Vill du hämta växelkurser från Internet nu?" + +#: main.cpp:143 +msgid "Update exchange rates?" +msgstr "Uppdatera växelkurser?" + +#: main.cpp:155 +msgid "ans" +msgstr "" + +#: main.cpp:156 +msgid "Last Answer" +msgstr "Senaste svaret" + +#: main.cpp:157 +msgid "answer" +msgstr "svar" + +#: main.cpp:159 +msgid "Answer 2" +msgstr "Svar 2" + +#: main.cpp:160 +msgid "Answer 3" +msgstr "Svar 3" + +#: main.cpp:161 +msgid "Answer 4" +msgstr "Svar 4" + +#: main.cpp:162 +msgid "Answer 5" +msgstr "Svar 5" + +#: main.cpp:166 +msgid "Failed to load global definitions!" +msgstr "Fel vid inhämtande av systemvida definitioner!" + +#: main.cpp:290 +msgid "Qalculate!" +msgstr "" + +#: preferences.cpp:208 +msgid "Preset" +msgstr "Förinställt" + +#: preferences.cpp:669 +#, c-format +msgid "" +"Couldn't write preferences to\n" +"%s" +msgstr "" +"Kunde inte spara inställningar till\n" +"%s" + +#: qalculateconvertnumberbasesdialog.cpp:31 qalculatesetbasedialog.cpp:29 +msgid "Number Bases" +msgstr "Nummerbaser" + +#: qalculateconvertnumberbasesdialog.cpp:37 +msgid "Decimal:" +msgstr "Decimalt:" + +#: qalculateconvertnumberbasesdialog.cpp:41 +msgid "Binary:" +msgstr "Binärt:" + +#: qalculateconvertnumberbasesdialog.cpp:45 +msgid "Octal:" +msgstr "Oktalt:" + +#: qalculateconvertnumberbasesdialog.cpp:49 +msgid "Hexadecimal:" +msgstr "Hexadecimalt:" + +#: qalculateconvertunitsdialog.cpp:44 +msgid "Selector" +msgstr "Väljare" + +#: qalculateconvertunitsdialog.cpp:50 qalculateeditdatasetdialog.cpp:482 +msgid "Unit expression:" +msgstr "Enhetsuttryck:" + +#: qalculateconvertunitsdialog.cpp:63 qalculatefunctionsdialog.cpp:55 +#: qalculateunitsdialog.cpp:63 qalculatevariablesdialog.cpp:57 +msgid "Category" +msgstr "Kategori" + +#: qalculateconvertunitsdialog.cpp:85 qalculateconvertunitsdialog.cpp:86 +#: qalculateconvertunitsdialog.cpp:141 qalculateconvertunitsdialog.cpp:180 +#: qalculatefunctionsdialog.cpp:118 qalculatefunctionsdialog.cpp:119 +#: qalculatefunctionsdialog.cpp:183 qalculatefunctionsdialog.cpp:505 +#: qalculateunitsdialog.cpp:150 qalculateunitsdialog.cpp:151 +#: qalculateunitsdialog.cpp:215 qalculateunitsdialog.cpp:416 +#: qalculatevariablesdialog.cpp:116 qalculatevariablesdialog.cpp:117 +#: qalculatevariablesdialog.cpp:183 qalculatevariablesdialog.cpp:462 +msgid "All" +msgstr "Alla" + +#: qalculateconvertunitsdialog.cpp:132 qalculateconvertunitsdialog.cpp:133 +#: qalculateconvertunitsdialog.cpp:134 qalculateconvertunitsdialog.cpp:182 +#: qalculatefunctionsdialog.cpp:165 qalculatefunctionsdialog.cpp:166 +#: qalculatefunctionsdialog.cpp:167 qalculatefunctionsdialog.cpp:236 +#: qalculatefunctionsdialog.cpp:262 qalculatefunctionsdialog.cpp:285 +#: qalculatefunctionsdialog.cpp:507 qalculateunitsdialog.cpp:197 +#: qalculateunitsdialog.cpp:198 qalculateunitsdialog.cpp:199 +#: qalculateunitsdialog.cpp:273 qalculateunitsdialog.cpp:299 +#: qalculateunitsdialog.cpp:322 qalculateunitsdialog.cpp:418 +#: qalculatevariablesdialog.cpp:165 qalculatevariablesdialog.cpp:166 +#: qalculatevariablesdialog.cpp:167 qalculatevariablesdialog.cpp:258 +#: qalculatevariablesdialog.cpp:284 qalculatevariablesdialog.cpp:322 +#: qalculatevariablesdialog.cpp:464 +msgid "Uncategorized" +msgstr "Okategoriserade" + +#: qalculatedatasetsdialog.cpp:46 qalculateeditdatasetdialog.cpp:232 +msgid "Data Sets" +msgstr "Dataset" + +#: qalculatedatasetsdialog.cpp:61 +msgid "Data Sets:" +msgstr "Dataset:" + +#: qalculatedatasetsdialog.cpp:68 qalculatedatasetsdialog.cpp:91 +#: qalculateeditdatasetdialog.cpp:107 qalculateeditdatasetdialog.cpp:629 +#: qalculateeditfunctiondialog.cpp:133 qalculateeditfunctiondialog.cpp:492 +#: qalculateeditnamesdialog.cpp:64 qalculatefunctionsdialog.cpp:67 +#: qalculateunitsdialog.cpp:91 qalculatevariablesdialog.cpp:66 +msgid "New" +msgstr "Ny" + +#: qalculatedatasetsdialog.cpp:77 qalculateeditdatasetdialog.cpp:79 +#: qalculateeditdatasetdialog.cpp:456 qalculateeditfunctiondialog.cpp:98 +msgid "Description:" +msgstr "Beskrivning:" + +#: qalculatedatasetsdialog.cpp:84 +msgid "Objects:" +msgstr "Objekt:" + +#: qalculatedatasetsdialog.cpp:87 qalculateeditdatasetdialog.cpp:236 +#: qalculateeditfunctiondialog.cpp:598 +msgid "Object" +msgstr "Objekt" + +#: qalculatedatasetsdialog.cpp:100 +msgid "Attributes:" +msgstr "Attribut:" + +#: qalculatedatasetsdialog.cpp:157 qalculatedatasetsdialog.cpp:218 +msgid "Data set does not exist anymore." +msgstr "Datasetet existerar inte längre." + +#: qalculatedatasetsdialog.cpp:300 qalculateeditdatasetdialog.cpp:195 +#: qalculatefunctionsdialog.cpp:456 +msgid "key" +msgstr "nyckel" + +#: qalculatedatasetsdialog.cpp:316 +msgid "Data Retrieval Function" +msgstr "Dataåtkomstfunktion" + +#: qalculatedecimalsdialog.cpp:31 +msgid "Max decimals:" +msgstr "Max decimaler:" + +#: qalculatedecimalsdialog.cpp:39 +msgid "Min decimals:" +msgstr "Min decimaler:" + +#: qalculateeditdataobjectdialog.cpp:30 qalculateeditdataobjectdialog.cpp:40 +msgid "Edit Object" +msgstr "Redigera objekt" + +#: qalculateeditdataobjectdialog.cpp:42 +msgid "New Object" +msgstr "Nytt objekt" + +#: qalculateeditdataobjectdialog.cpp:48 qalculateeditdatasetdialog.cpp:242 +msgid "Property" +msgstr "Egenskap" + +#. i18n: file ./qalculate_kdeui.rc line 116 +#: qalculateeditdataobjectdialog.cpp:51 rc.cpp:39 +#, no-c-format +msgid "Approximation" +msgstr "Approximering" + +#: qalculateeditdatasetdialog.cpp:53 qalculateeditdatasetdialog.cpp:307 +msgid "Edit Data Set" +msgstr "Redigera dataset" + +#: qalculateeditdatasetdialog.cpp:68 qalculateeditfunctiondialog.cpp:70 +#: qalculatepreferencesdialog.cpp:157 +msgid "General" +msgstr "Allmänt" + +#: qalculateeditdatasetdialog.cpp:73 qalculateplotdialog.cpp:86 +#: qalculateplotdialog.cpp:189 +msgid "Title:" +msgstr "Titel:" + +#: qalculateeditdatasetdialog.cpp:76 +msgid "Data file:" +msgstr "Datafil:" + +#: qalculateeditdatasetdialog.cpp:87 +msgid "Copyright:" +msgstr "Upphovsrätt:" + +#: qalculateeditdatasetdialog.cpp:97 +msgid "Properties:" +msgstr "Egenskaper:" + +#: qalculateeditdatasetdialog.cpp:99 qalculateplotdialog.cpp:153 +msgid "Title" +msgstr "Titel" + +#: qalculateeditdatasetdialog.cpp:100 qalculateeditdatasetdialog.cpp:620 +#: qalculateeditfunctiondialog.cpp:124 qalculateeditnamesdialog.cpp:41 +#: qalculateeditunitdialog.cpp:50 +msgid "Name" +msgstr "Namn" + +#: qalculateeditdatasetdialog.cpp:101 qalculateeditfunctiondialog.cpp:125 +#: qalculateeditunitdialog.cpp:75 qalculateeditunknownvariabledialog.cpp:60 +msgid "Type" +msgstr "Typ" + +#: qalculateeditdatasetdialog.cpp:115 qalculateeditdatasetdialog.cpp:442 +#: qalculateeditfunctiondialog.cpp:74 qalculateeditfunctiondialog.cpp:583 +#: qalculateeditmatrixvectordialog.cpp:78 qalculateeditunitdialog.cpp:55 +#: qalculateeditunknownvariabledialog.cpp:47 +#: qalculateeditvariabledialog.cpp:49 qalculateimportcsvdialog.cpp:60 +msgid "Name:" +msgstr "Namn:" + +#: qalculateeditdatasetdialog.cpp:124 qalculateeditdatasetdialog.cpp:451 +#: qalculateeditfunctiondialog.cpp:83 qalculateeditmatrixvectordialog.cpp:87 +#: qalculateeditunitdialog.cpp:64 qalculateeditunknownvariabledialog.cpp:56 +#: qalculateeditvariabledialog.cpp:60 +msgid "Names Details" +msgstr "Namndetaljer" + +#: qalculateeditdatasetdialog.cpp:126 +msgid "Object argument name:" +msgstr "Objektparameterns namn" + +#: qalculateeditdatasetdialog.cpp:129 +msgid "Property argument name:" +msgstr "Egenskapsparameterns namn:" + +#: qalculateeditdatasetdialog.cpp:132 +msgid "Default property:" +msgstr "Förvald egenskap:" + +#: qalculateeditdatasetdialog.cpp:173 +msgid "text" +msgstr "text" + +#: qalculateeditdatasetdialog.cpp:178 qalculateeditdatasetdialog.cpp:186 +msgid "approximate" +msgstr "approximerat" + +#: qalculateeditdatasetdialog.cpp:181 qalculateexpressionedit.cpp:712 +#: qalculatevariablesdialog.cpp:428 +msgid "number" +msgstr "nummer" + +#: qalculateeditdatasetdialog.cpp:189 +msgid "expression" +msgstr "uttryck" + +#: qalculateeditdatasetdialog.cpp:213 qalculateeditdatasetdialog.cpp:499 +#: qalculateeditfunctiondialog.cpp:190 qalculateeditmatrixvectordialog.cpp:185 +#: qalculateeditunitdialog.cpp:146 qalculateeditunknownvariabledialog.cpp:132 +#: qalculateeditvariabledialog.cpp:102 +msgid "Empty name field" +msgstr "Tomt namnfält" + +#: qalculateeditdatasetdialog.cpp:217 qalculateeditfunctiondialog.cpp:201 +msgid "" +"A function with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"En funktion med samma namn finns redan.\n" +"Vill du ersätta den?" + +#: qalculateeditdatasetdialog.cpp:309 +msgid "Edit Data Set (global)" +msgstr "Redigera dataset (systemvitt)" + +#: qalculateeditdatasetdialog.cpp:311 +msgid "New Data Set" +msgstr "Nytt dataset" + +#: qalculateeditdatasetdialog.cpp:322 +msgid "info" +msgstr "info" + +#: qalculateeditdatasetdialog.cpp:435 qalculateeditdatasetdialog.cpp:548 +msgid "Edit Property" +msgstr "Redigera egneskap" + +#: qalculateeditdatasetdialog.cpp:453 qalculateeditfunctiondialog.cpp:90 +#: qalculateeditmatrixvectordialog.cpp:93 qalculateeditunitdialog.cpp:66 +#: qalculateeditunknownvariabledialog.cpp:90 +#: qalculateeditvariabledialog.cpp:80 qalculateimportcsvdialog.cpp:63 +msgid "Descriptive name:" +msgstr "Beskrivande namn:" + +#: qalculateeditdatasetdialog.cpp:464 +msgid "Value type:" +msgstr "Värdetyp:" + +#: qalculateeditdatasetdialog.cpp:467 qalculateeditfunctiondialog.cpp:593 +msgid "Text" +msgstr "Text" + +#: qalculateeditdatasetdialog.cpp:469 qalculateeditfunctiondialog.cpp:482 +#: qalculateplotdialog.cpp:154 +msgid "Expression" +msgstr "Uttryck" + +#: qalculateeditdatasetdialog.cpp:474 +msgid "Use as key" +msgstr "Använd som nyckel" + +#: qalculateeditdatasetdialog.cpp:476 +msgid "Approximate value" +msgstr "Approximerat värde" + +#: qalculateeditdatasetdialog.cpp:478 +msgid "Case sensitive value" +msgstr "Storlekskänsligt värde" + +#: qalculateeditdatasetdialog.cpp:480 +msgid "Value uses brackets" +msgstr "Värdet användar klammrar" + +#: qalculateeditdatasetdialog.cpp:550 +msgid "New Property" +msgstr "Ny egenskap" + +#: qalculateeditdatasetdialog.cpp:615 qalculateeditnamesdialog.cpp:34 +msgid "Edit Names" +msgstr "Redigera namn" + +#: qalculateeditdatasetdialog.cpp:621 qalculateeditfunctiondialog.cpp:481 +#: qalculateeditnamesdialog.cpp:46 +msgid "Reference" +msgstr "Referens" + +#: qalculateeditfunctiondialog.cpp:55 qalculateeditfunctiondialog.cpp:286 +msgid "Edit Function" +msgstr "Redigera funktion" + +#: qalculateeditfunctiondialog.cpp:85 qalculateeditmatrixvectordialog.cpp:89 +#: qalculateeditunitdialog.cpp:87 qalculateeditunknownvariabledialog.cpp:85 +#: qalculateeditvariabledialog.cpp:74 qalculateimportcsvdialog.cpp:66 +msgid "Category:" +msgstr "Kategori:" + +#: qalculateeditfunctiondialog.cpp:96 +msgid "Hide function" +msgstr "Göm funktionen" + +#: qalculateeditfunctiondialog.cpp:106 qalculateplotdialog.cpp:89 +msgid "Expression:" +msgstr "Uttryck:" + +#: qalculateeditfunctiondialog.cpp:115 +msgid "Condition:" +msgstr "Villkor:" + +#: qalculateeditfunctiondialog.cpp:120 qalculateeditfunctiondialog.cpp:476 +msgid "Sub-Functions" +msgstr "Subfunktioner" + +#: qalculateeditfunctiondialog.cpp:122 +msgid "Arguments:" +msgstr "Parametrar:" + +#: qalculateeditfunctiondialog.cpp:197 +msgid "Empty expression field" +msgstr "Tomt uttrycksfält" + +#: qalculateeditfunctiondialog.cpp:288 +msgid "Edit Function (global)" +msgstr "Redigera funktion (systemvid)" + +#: qalculateeditfunctiondialog.cpp:290 +msgid "New Function" +msgstr "Ny funktion" + +#: qalculateeditfunctiondialog.cpp:483 +msgid "Precalculate" +msgstr "Förberäkna" + +#: qalculateeditfunctiondialog.cpp:579 qalculateeditfunctiondialog.cpp:675 +msgid "Edit Argument" +msgstr "Redigera parameter" + +#: qalculateeditfunctiondialog.cpp:586 +msgid "Type:" +msgstr "Typ:" + +#: qalculateeditfunctiondialog.cpp:589 +msgid "Free" +msgstr "Fri" + +#: qalculateeditfunctiondialog.cpp:592 +msgid "Symbol" +msgstr "Symbol" + +#: qalculateeditfunctiondialog.cpp:594 qalculateinsertfunctiondialog.cpp:353 +msgid "Date" +msgstr "Datum" + +#: qalculateeditfunctiondialog.cpp:597 +msgid "Boolean" +msgstr "Boolskt värde" + +#: qalculateeditfunctiondialog.cpp:603 +msgid "Angle" +msgstr "Vinkel" + +#: qalculateeditfunctiondialog.cpp:605 +msgid "Enable rules and type test" +msgstr "Aktivera villkors- och typtest" + +#: qalculateeditfunctiondialog.cpp:607 +msgid "Custom condition:" +msgstr "Anpassat villkor:" + +#: qalculateeditfunctiondialog.cpp:611 +msgid "Allow matrix" +msgstr "Tillåt matris" + +#: qalculateeditfunctiondialog.cpp:613 +msgid "Forbid zero" +msgstr "Förbjud noll" + +#: qalculateeditfunctiondialog.cpp:615 +msgid "Allow complex" +msgstr "Tillåt komplext" + +#: qalculateeditfunctiondialog.cpp:617 qalculateplotdialog.cpp:164 +msgid "Min:" +msgstr "Min:" + +#: qalculateeditfunctiondialog.cpp:624 qalculateeditfunctiondialog.cpp:633 +msgid "Include equals" +msgstr "Inkludera lika med" + +#: qalculateeditfunctiondialog.cpp:626 qalculateplotdialog.cpp:167 +msgid "Max:" +msgstr "Max:" + +#: qalculateeditfunctiondialog.cpp:677 +msgid "New Argument" +msgstr "Ny parameter" + +#: qalculateeditmatrixvectordialog.cpp:71 +#: qalculateeditunknownvariabledialog.cpp:40 +#: qalculateeditvariabledialog.cpp:41 qalculateeditvariabledialog.cpp:180 +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Edit Variable" +msgstr "Redigera variabel" + +#: qalculateeditmatrixvectordialog.cpp:96 +#: qalculateinsertmatrixvectordialog.cpp:75 +msgid "Rows:" +msgstr "Rader:" + +#: qalculateeditmatrixvectordialog.cpp:99 +#: qalculateinsertmatrixvectordialog.cpp:78 +msgid "Columns:" +msgstr "Kolumner:" + +#: qalculateeditmatrixvectordialog.cpp:112 +#: qalculateeditmatrixvectordialog.cpp:133 +#: qalculateeditmatrixvectordialog.cpp:295 +#: qalculateinsertmatrixvectordialog.cpp:91 +#: qalculateinsertmatrixvectordialog.cpp:115 +#: qalculateinsertmatrixvectordialog.cpp:275 +msgid "Elements:" +msgstr "Element:" + +#: qalculateeditmatrixvectordialog.cpp:146 +#: qalculateeditmatrixvectordialog.cpp:292 +#: qalculateinsertmatrixvectordialog.cpp:128 +#: qalculateinsertmatrixvectordialog.cpp:272 +msgid "Elements (in horizontal order):" +msgstr "Element (radvis)" + +#: qalculateeditmatrixvectordialog.cpp:189 +#: qalculateeditunknownvariabledialog.cpp:136 +#: qalculateeditvariabledialog.cpp:114 +msgid "" +"An unit or variable with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"En enhet eller variabel med samma namn finns redan.\n" +"Vill du ersätta den?" + +#: qalculateeditmatrixvectordialog.cpp:301 +msgid "Edit Vector" +msgstr "Redigera vektor" + +#: qalculateeditmatrixvectordialog.cpp:303 +msgid "Edit Vector (global)" +msgstr "Redigera vektor (systemvid)" + +#: qalculateeditmatrixvectordialog.cpp:305 +msgid "New Vector" +msgstr "Ny vektor" + +#: qalculateeditmatrixvectordialog.cpp:310 +msgid "Edit Matrix" +msgstr "Redigera matris" + +#: qalculateeditmatrixvectordialog.cpp:312 +msgid "Edit Matrix (global)" +msgstr "Redigera matris (systemvid)" + +#: qalculateeditmatrixvectordialog.cpp:314 +msgid "New Matrix" +msgstr "Ny matris" + +#: qalculateeditnamesdialog.cpp:42 +msgid "Abbreviation" +msgstr "Förkortning" + +#: qalculateeditnamesdialog.cpp:44 +msgid "Plural" +msgstr "Plural" + +#: qalculateeditnamesdialog.cpp:48 +msgid "Avoid Input" +msgstr "Undvik input" + +#: qalculateeditnamesdialog.cpp:50 +msgid "Unicode" +msgstr "Unicode" + +#: qalculateeditnamesdialog.cpp:52 +msgid "Suffix" +msgstr "Suffix" + +#: qalculateeditnamesdialog.cpp:54 +msgid "Case Sensitive" +msgstr "Storlekskänslig" + +#: qalculateeditunitdialog.cpp:43 qalculateeditunitdialog.cpp:287 +msgid "Edit Unit" +msgstr "Redigera enhet" + +#: qalculateeditunitdialog.cpp:72 +msgid "Hide unit" +msgstr "Göm enheten" + +#: qalculateeditunitdialog.cpp:80 +msgid "Class:" +msgstr "Klass:" + +#: qalculateeditunitdialog.cpp:83 +msgid "Base Unit" +msgstr "Basenhet" + +#: qalculateeditunitdialog.cpp:84 +msgid "Alias" +msgstr "Alias" + +#: qalculateeditunitdialog.cpp:85 +msgid "Composite Unit" +msgstr "Sammansatt enhet" + +#: qalculateeditunitdialog.cpp:92 +msgid "System:" +msgstr "System:" + +#: qalculateeditunitdialog.cpp:95 +msgid "SI" +msgstr "SI" + +#: qalculateeditunitdialog.cpp:96 +msgid "CGS" +msgstr "CGS" + +#: qalculateeditunitdialog.cpp:97 +msgid "Imperial" +msgstr "Imperial" + +#: qalculateeditunitdialog.cpp:98 +msgid "US Survey" +msgstr "US Survey" + +#: qalculateeditunitdialog.cpp:102 +msgid "Relation" +msgstr "Relation" + +#: qalculateeditunitdialog.cpp:107 +msgid "Base unit:" +msgstr "Basenhet:" + +#: qalculateeditunitdialog.cpp:110 +msgid "Exponent:" +msgstr "Exponent:" + +#: qalculateeditunitdialog.cpp:114 +msgid "Relation:" +msgstr "Relation:" + +#: qalculateeditunitdialog.cpp:121 +msgid "Relation is exact" +msgstr "Relationen är exakt" + +#: qalculateeditunitdialog.cpp:123 +msgid "Inverse relation:" +msgstr "Omvänd relation:" + +#: qalculateeditunitdialog.cpp:150 +msgid "" +"A variable or unit with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"En variabel eller enhet med samma namn finns redan.\n" +"Vill du ersätta den?" + +#: qalculateeditunitdialog.cpp:175 qalculateeditunitdialog.cpp:219 +msgid "Base unit does not exist" +msgstr "Basenheten finns inte" + +#: qalculateeditunitdialog.cpp:289 +msgid "Edit Unit (global)" +msgstr "Redigera enhet (systemvid)" + +#: qalculateeditunitdialog.cpp:291 +msgid "New Unit" +msgstr "Ny enhet" + +#: qalculateeditunknownvariabledialog.cpp:58 +msgid "Custom assumptions:" +msgstr "Anpassade antaganden:" + +#: qalculateeditunknownvariabledialog.cpp:68 +msgid "Complex Number" +msgstr "Komplext nummer" + +#: qalculateeditunknownvariabledialog.cpp:69 +msgid "Real Number" +msgstr "Reellt tal" + +#: qalculateeditunknownvariabledialog.cpp:70 +msgid "Rational Number" +msgstr "Rationellt tal" + +#: qalculateeditunknownvariabledialog.cpp:73 +msgid "Sign" +msgstr "Tecken" + +#: qalculateeditunknownvariabledialog.cpp:199 +msgid "Edit Unknown Variable" +msgstr "Redigera okänd variabel" + +#: qalculateeditunknownvariabledialog.cpp:201 +msgid "Edit Unknown Variable (global)" +msgstr "Redigera okänd variabel (systemvid)" + +#: qalculateeditunknownvariabledialog.cpp:203 +msgid "New Unknown Variable" +msgstr "Ny okänd variabel" + +#: qalculateeditvariabledialog.cpp:63 qalculateinsertfunctiondialog.cpp:91 +msgid "Value:" +msgstr "Värde:" + +#: qalculateeditvariabledialog.cpp:71 +msgid "Value is exact" +msgstr "Värdet är exakt" + +#: qalculateeditvariabledialog.cpp:110 +msgid "Empty value field" +msgstr "Tomt värdefält" + +#: qalculateeditvariabledialog.cpp:182 +msgid "Edit Variable (global)" +msgstr "Redigera variabel (systemvid)" + +#: qalculateeditvariabledialog.cpp:185 +msgid "New Variable" +msgstr "Ny variabel" + +#: qalculateexportcsvdialog.cpp:37 qalculateexportcsvdialog.cpp:54 +msgid "Export CSV File" +msgstr "Exportera CSV-fil" + +#: qalculateexportcsvdialog.cpp:42 +msgid "Current result" +msgstr "Nuvarande resultat" + +#: qalculateexportcsvdialog.cpp:46 +msgid "Matrix/vector variable" +msgstr "Matris/vektorvariabel" + +#: qalculateexportcsvdialog.cpp:51 qalculateimportcsvdialog.cpp:43 +msgid "File:" +msgstr "Fil:" + +#: qalculateexportcsvdialog.cpp:56 qalculateimportcsvdialog.cpp:80 +msgid "Delimiter:" +msgstr "Avgränsare:" + +#: qalculateexportcsvdialog.cpp:59 qalculateimportcsvdialog.cpp:83 +msgid "Comma" +msgstr "Komma" + +#: qalculateexportcsvdialog.cpp:60 qalculateimportcsvdialog.cpp:84 +msgid "Tabulator" +msgstr "Tabulator" + +#: qalculateexportcsvdialog.cpp:61 qalculateimportcsvdialog.cpp:85 +msgid "Semicolon" +msgstr "Semikolon" + +#: qalculateexportcsvdialog.cpp:62 qalculateimportcsvdialog.cpp:86 +msgid "Space" +msgstr "Mellanslag" + +#: qalculateexportcsvdialog.cpp:63 qalculateimportcsvdialog.cpp:87 +msgid "Other" +msgstr "Annan" + +#: qalculateexportcsvdialog.cpp:93 qalculateimportcsvdialog.cpp:116 +msgid "No file name entered." +msgstr "Inget filnamn angivet." + +#: qalculateexportcsvdialog.cpp:122 qalculateimportcsvdialog.cpp:145 +msgid "No delimiter selected." +msgstr "Ingen avgränsare vald." + +#: qalculateexportcsvdialog.cpp:135 +msgid "No variable name entered." +msgstr "Inget variabelnamn angivet." + +#: qalculateexportcsvdialog.cpp:147 +msgid "No known variable with entered name found." +msgstr "Det finns ingen känd variabel med angivet namn." + +#: qalculateexportcsvdialog.cpp:154 +#, c-format +msgid "" +"Could not export to file \n" +"%s" +msgstr "" +"Kunde inte exportera till \n" +"%s" + +#: qalculateexpressionedit.cpp:146 +msgid "Disable Completion" +msgstr "Avaktivera komplettering" + +#: qalculateexpressionedit.cpp:147 +msgid "Enable Completion" +msgstr "Aktivera komplettering" + +#. i18n: file ./qalculate_kdeui.rc line 154 +#: qalculateexpressionedit.cpp:161 qalculateresultdisplay.cpp:333 rc.cpp:48 +#, no-c-format +msgid "Meta Modes" +msgstr "Metalägen" + +#: qalculateexpressionedit.cpp:655 qalculatevariablesdialog.cpp:366 +msgid "a previous result" +msgstr "ett tidigare resultat" + +#: qalculateexpressionedit.cpp:661 qalculatevariablesdialog.cpp:376 +msgid "matrix" +msgstr "matris" + +#: qalculateexpressionedit.cpp:663 qalculatevariablesdialog.cpp:378 +msgid "vector" +msgstr "vektor" + +#: qalculateexpressionedit.cpp:672 qalculatevariablesdialog.cpp:387 +msgid "positive" +msgstr "positivt" + +#: qalculateexpressionedit.cpp:676 qalculatevariablesdialog.cpp:391 +msgid "non-positive" +msgstr "ej positivt" + +#: qalculateexpressionedit.cpp:680 qalculatevariablesdialog.cpp:395 +msgid "negative" +msgstr "negativt" + +#: qalculateexpressionedit.cpp:684 qalculatevariablesdialog.cpp:399 +msgid "non-negative" +msgstr "ej negativt" + +#: qalculateexpressionedit.cpp:688 qalculatevariablesdialog.cpp:403 +msgid "non-zero" +msgstr "ej noll" + +#: qalculateexpressionedit.cpp:696 qalculatevariablesdialog.cpp:412 +msgid "integer" +msgstr "heltal" + +#: qalculateexpressionedit.cpp:700 qalculatevariablesdialog.cpp:416 +msgid "rational" +msgstr "rationell" + +#: qalculateexpressionedit.cpp:704 qalculatevariablesdialog.cpp:420 +msgid "real" +msgstr "reell" + +#: qalculateexpressionedit.cpp:708 qalculatevariablesdialog.cpp:424 +msgid "complex" +msgstr "komplex" + +#: qalculateexpressionedit.cpp:716 qalculatevariablesdialog.cpp:432 +msgid "(not matrix)" +msgstr "(inte matris)" + +#: qalculateexpressionedit.cpp:721 qalculatevariablesdialog.cpp:438 +msgid "unknown" +msgstr "okänd" + +#: qalculateexpressionedit.cpp:723 qalculatevariablesdialog.cpp:440 +msgid "default assumptions" +msgstr "förvalda antaganden" + +#: qalculatefunctionsdialog.cpp:47 +msgid "Functions" +msgstr "Funktioner" + +#: qalculatefunctionsdialog.cpp:59 +msgid "Function Name" +msgstr "Funktionsnamn" + +#: qalculatefunctionsdialog.cpp:75 qalculatefunctionsdialog.cpp:313 +#: qalculateunitsdialog.cpp:99 qalculateunitsdialog.cpp:352 +#: qalculatevariablesdialog.cpp:74 qalculatevariablesdialog.cpp:349 +msgid "Deactivate" +msgstr "Avaktivera" + +#: qalculatefunctionsdialog.cpp:174 qalculatefunctionsdialog.cpp:175 +#: qalculatefunctionsdialog.cpp:176 qalculatefunctionsdialog.cpp:234 +#: qalculatefunctionsdialog.cpp:260 qalculatefunctionsdialog.cpp:283 +#: qalculatefunctionsdialog.cpp:509 qalculateunitsdialog.cpp:206 +#: qalculateunitsdialog.cpp:207 qalculateunitsdialog.cpp:208 +#: qalculateunitsdialog.cpp:271 qalculateunitsdialog.cpp:297 +#: qalculateunitsdialog.cpp:320 qalculateunitsdialog.cpp:420 +#: qalculatevariablesdialog.cpp:174 qalculatevariablesdialog.cpp:175 +#: qalculatevariablesdialog.cpp:176 qalculatevariablesdialog.cpp:256 +#: qalculatevariablesdialog.cpp:282 qalculatevariablesdialog.cpp:320 +#: qalculatevariablesdialog.cpp:466 +msgid "Inactive" +msgstr "Avaktiverade" + +#: qalculatefunctionsdialog.cpp:315 qalculateunitsdialog.cpp:354 +#: qalculatevariablesdialog.cpp:351 +msgid "Activate" +msgstr "Aktivera" + +#: qalculatefunctionsdialog.cpp:367 qalculateresultdisplay.cpp:148 +#, c-format +msgid "" +"Retrieves data from the %s data set for a given object and property. If " +"\"info\" is typed as property, a dialog window will pop up with all " +"properties of the object." +msgstr "" +"Inhämtar data från \"%s\" datasetet för ett givet objekt och egenskap. Om " +"\"info\" anges som egenskap, visas ett fönster med alla egenskaper för " +"objektet." + +#: qalculatefunctionsdialog.cpp:391 +msgid "Arguments" +msgstr "Parametrar" + +#: qalculatefunctionsdialog.cpp:412 qalculateinsertfunctiondialog.cpp:194 +#: qalculateinsertfunctiondialog.cpp:227 +msgid "optional" +msgstr "frivillig" + +#: qalculatefunctionsdialog.cpp:416 +msgid "default: " +msgstr "förvald:" + +#: qalculatefunctionsdialog.cpp:426 +msgid "Requirement" +msgstr "Krav" + +#: qalculateimportcsvdialog.cpp:39 qalculateimportcsvdialog.cpp:46 +msgid "Import CSV File" +msgstr "Importera CSV-fil" + +#: qalculateimportcsvdialog.cpp:48 +msgid "Import as:" +msgstr "Importera som:" + +#: qalculateimportcsvdialog.cpp:71 +msgid "First row:" +msgstr "Första raden:" + +#: qalculateimportcsvdialog.cpp:77 +msgid "Includes headings" +msgstr "Inkluderar kolumnnamn" + +#: qalculateimportcsvdialog.cpp:149 +msgid "An error occured when importing the CSV file." +msgstr "Ett fel uppstod vid import av CSV-fil." + +#: qalculateinsertfunctiondialog.cpp:50 qalculateinsertfunctiondialog.cpp:57 +msgid "Execute" +msgstr "Exekvera" + +#: qalculateinsertfunctiondialog.cpp:93 +msgid "Argument" +msgstr "Parameter" + +#: qalculateinsertfunctiondialog.cpp:152 +msgid "True" +msgstr "Sant" + +#: qalculateinsertfunctiondialog.cpp:153 +msgid "False" +msgstr "Falskt" + +#: qalculateinsertfunctiondialog.cpp:184 +msgid "Info" +msgstr "Info" + +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Insert Selection" +msgstr "Infoga markering" + +#: qalculateinsertmatrixvectordialog.cpp:293 +msgid "Vector Result" +msgstr "Vektorresultat" + +#: qalculateinsertmatrixvectordialog.cpp:295 +msgid "Matrix Result" +msgstr "Matrisresultat" + +#: qalculateperiodictabledialog.cpp:195 +msgid "Element Data" +msgstr "Elementdata" + +#: qalculateperiodictabledialog.cpp:221 +msgid "Classification" +msgstr "Klassificering" + +#: qalculateperiodictabledialog.cpp:224 +msgid "Alkali Metal" +msgstr "Alkalimetall" + +#: qalculateperiodictabledialog.cpp:225 +msgid "Alkaline-Earth Metal" +msgstr "Jordalkalimetall" + +#: qalculateperiodictabledialog.cpp:226 +msgid "Lanthanide" +msgstr "Lantanid" + +#: qalculateperiodictabledialog.cpp:227 +msgid "Actinide" +msgstr "Aktinid" + +#: qalculateperiodictabledialog.cpp:228 +msgid "Transition Metal" +msgstr "Övergångsmetall" + +#: qalculateperiodictabledialog.cpp:229 +msgid "Metal" +msgstr "Metall" + +#: qalculateperiodictabledialog.cpp:230 +msgid "Metalloid" +msgstr "Halvmetall" + +#: qalculateperiodictabledialog.cpp:231 +msgid "Non-Metal" +msgstr "Icke-metall" + +#: qalculateperiodictabledialog.cpp:232 +msgid "Halogen" +msgstr "" + +#: qalculateperiodictabledialog.cpp:233 +msgid "Noble Gas" +msgstr "Ädelgas" + +#: qalculateperiodictabledialog.cpp:234 +msgid "Transactinide" +msgstr "Transaktinid" + +#: qalculateplotdialog.cpp:64 +msgid "Plot" +msgstr "Diagram" + +#: qalculateplotdialog.cpp:82 +msgid "Data" +msgstr "Data" + +#: qalculateplotdialog.cpp:83 +msgid "Function Range" +msgstr "Funktionsomfång" + +#: qalculateplotdialog.cpp:101 +msgid "Vector/matrix" +msgstr "Vektor/matris" + +#: qalculateplotdialog.cpp:104 +msgid "Paired matrix" +msgstr "Parvis matris" + +#: qalculateplotdialog.cpp:107 +msgid "Rows" +msgstr "Rader" + +#: qalculateplotdialog.cpp:109 +msgid "X variable:" +msgstr "X-variabel" + +#: qalculateplotdialog.cpp:113 +msgid "Style:" +msgstr "Stil:" + +#: qalculateplotdialog.cpp:115 +msgid "Line" +msgstr "Kurva" + +#: qalculateplotdialog.cpp:116 +msgid "Points" +msgstr "Punkter" + +#: qalculateplotdialog.cpp:117 +msgid "Line with points" +msgstr "Kurva med punkter" + +#: qalculateplotdialog.cpp:118 +msgid "Boxes/bars" +msgstr "Boxar/staplar" + +#: qalculateplotdialog.cpp:119 +msgid "Histogram" +msgstr "Histogram" + +#: qalculateplotdialog.cpp:120 +msgid "Steps" +msgstr "Steg" + +#: qalculateplotdialog.cpp:121 +msgid "Candlesticks" +msgstr "Ljusstakar" + +#: qalculateplotdialog.cpp:122 +msgid "Dots" +msgstr "Små punkter" + +#: qalculateplotdialog.cpp:124 +msgid "Smoothing:" +msgstr "Utjämning:" + +#: qalculateplotdialog.cpp:127 +msgid "Monotonic" +msgstr "Monoton" + +#: qalculateplotdialog.cpp:128 +msgid "Natural cubic splines" +msgstr "" + +#: qalculateplotdialog.cpp:129 +msgid "Bezier" +msgstr "" + +#: qalculateplotdialog.cpp:130 +msgid "Bezier (monotonic)" +msgstr "Bezier (monoton)" + +#: qalculateplotdialog.cpp:132 +msgid "Y-axis:" +msgstr "Y-axel:" + +#: qalculateplotdialog.cpp:136 +msgid "Primary" +msgstr "Primär" + +#: qalculateplotdialog.cpp:139 +msgid "Secondary" +msgstr "Sekundär" + +#: qalculateplotdialog.cpp:171 +msgid "Sampling rate:" +msgstr "Frekvens:" + +#: qalculateplotdialog.cpp:176 +msgid "Step size:" +msgstr "Stegstorlek:" + +#: qalculateplotdialog.cpp:194 +msgid "Display grid" +msgstr "Visa rutnät" + +#: qalculateplotdialog.cpp:196 +msgid "Display full border" +msgstr "Visa helram" + +#: qalculateplotdialog.cpp:199 +msgid "Logarithmic x scale:" +msgstr "Logaritmisk x-skala:" + +#: qalculateplotdialog.cpp:203 +msgid "Logarithmic y scale:" +msgstr "Logaritmisk y-skala:" + +#: qalculateplotdialog.cpp:207 +msgid "X-axis label:" +msgstr "Namn på x-axeln:" + +#: qalculateplotdialog.cpp:210 +msgid "Y-axis label:" +msgstr "Namn på y-axeln:" + +#: qalculateplotdialog.cpp:213 +msgid "Color display:" +msgstr "Färgvisning:" + +#: qalculateplotdialog.cpp:217 +msgid "Color" +msgstr "Färg" + +#: qalculateplotdialog.cpp:220 +msgid "Monochrome" +msgstr "Monokrom" + +#: qalculateplotdialog.cpp:224 +msgid "Legend placement:" +msgstr "Textplacering:" + +#: qalculateplotdialog.cpp:227 +msgid "Top-left" +msgstr "Uppe till vänster" + +#: qalculateplotdialog.cpp:228 +msgid "Top-right" +msgstr "Uppe till höger" + +#: qalculateplotdialog.cpp:229 +msgid "Bottom-left" +msgstr "Nere till vänster" + +#: qalculateplotdialog.cpp:230 +msgid "Bottom-right" +msgstr "Nere till höger" + +#: qalculateplotdialog.cpp:231 +msgid "Below" +msgstr "Under" + +#: qalculateplotdialog.cpp:232 +msgid "Outside" +msgstr "Utanför" + +#: qalculateplotdialog.cpp:403 qalculateplotdialog.cpp:458 +#: qalculateplotdialog.cpp:506 +msgid "Empty expression." +msgstr "Tomt uttryck." + +#: qalculateplotdialog.cpp:472 qalculateplotdialog.cpp:519 +msgid "Empty x variable." +msgstr "Tom x-variabel." + +#: qalculateprecisiondialog.cpp:34 qalculateprecisiondialog.cpp:36 +msgid "Recalculate" +msgstr "Omräkna" + +#: qalculateprecisiondialog.cpp:41 +msgid "Precision:" +msgstr "Precision:" + +#: qalculatepreferencesdialog.cpp:100 +msgid "Choose..." +msgstr "Välj..." + +#: qalculatepreferencesdialog.cpp:147 +msgid "Preferences" +msgstr "Inställningar" + +#: qalculatepreferencesdialog.cpp:161 +msgid "Close to system tray" +msgstr "Stäng till aktivitetsfältet" + +#: qalculatepreferencesdialog.cpp:162 +msgid "" +"If the application will reside in the system tray when the window is closed" +msgstr "" +"Om programmet skall befinna sig i aktivitetsfältet när fönstret är stängt" + +#: qalculatepreferencesdialog.cpp:164 +msgid "Display expression status" +msgstr "Visa uttrycksstatus." + +#: qalculatepreferencesdialog.cpp:165 +msgid "" +"If as-you-type expression status shall be displayed below the expression " +"entry" +msgstr "Om uttrycksstatus skall visas under uttrycksfältet medans text skrivs" + +#: qalculatepreferencesdialog.cpp:167 +msgid "Use icon buttons" +msgstr "Använd ikonknappar" + +#: qalculatepreferencesdialog.cpp:168 +msgid "" +"Use icons instead of text on the top-right buttons. The third state uses the " +"style setting for icons on buttons." +msgstr "" +"Använd ikoner istället för text på knapparna uppe till höger. Det tredje " +"läget använder stilinställningarna för ikoner på knappar." + +#: qalculatepreferencesdialog.cpp:171 +msgid "Update exchange rates on start" +msgstr "Uppdatera växelkurser vid start" + +#: qalculatepreferencesdialog.cpp:172 +msgid "" +"If current exchange rates shall be downloaded from the internet at program " +"start" +msgstr "" +"Huruvida uppdaterade växelkurser skall hämtas från intenet vid programstart" + +#: qalculatepreferencesdialog.cpp:174 +msgid "Save mode on exit" +msgstr "Spara läge vid avslut" + +#: qalculatepreferencesdialog.cpp:175 +msgid "If the mode of the calculator shall be restored" +msgstr "Huruvida kalkulatorns läge skall återskapas" + +#: qalculatepreferencesdialog.cpp:177 +msgid "Save definitions on exit" +msgstr "Spara definitioner vid avslut" + +#: qalculatepreferencesdialog.cpp:178 +msgid "" +"If changes to functions, units and variables shall be saved automatically" +msgstr "" +"Huruvida modifieringar av funktioner, enheter och variabler skall sparas " +"automatiskt" + +#: qalculatepreferencesdialog.cpp:180 +msgid "Use only keypad keys for RPN" +msgstr "Använd enbart knappsatstangenter för RPN" + +#: qalculatepreferencesdialog.cpp:181 +msgid "" +"Use only keypad keys for RPN operations (+-*/^) and use the rest of the " +"keyboard for expression entry" +msgstr "" +"Använd enbart knappsatstangenter för RPN operationer (+-*/^) och använd " +"resten av tangentbordet för att skriva uttryck" + +#: qalculatepreferencesdialog.cpp:183 +msgid "Ignores dots in numbers" +msgstr "Bortse från punkter nummer" + +#: qalculatepreferencesdialog.cpp:184 +msgid "" +"Allow dots, '.', to be used as thousands separator instead of as an " +"alternative to decimal sign" +msgstr "" +"Tillåt att punkter, '.', används som tusentalsseparator istället för som ett " +"alternativt decimaltecken" + +#: qalculatepreferencesdialog.cpp:187 +msgid "Enable unicode signs" +msgstr "Använd unicodetecken" + +#: qalculatepreferencesdialog.cpp:188 +msgid "Disable this if you have problems with some fancy characters" +msgstr "Avaktivera om du har problem med konstiga tecken" + +#: qalculatepreferencesdialog.cpp:190 +msgid "Use lower case in numbers" +msgstr "Använd små bokstäver i nummer" + +#: qalculatepreferencesdialog.cpp:191 +msgid "If lower case letters should be used in numbers with non-decimal base" +msgstr "Huruvida små bokstäver skall användas i nummer med icke-decimal bas" + +#: qalculatepreferencesdialog.cpp:193 +msgid "Use lower case \"e\"" +msgstr "Använd litet \"e\"" + +#: qalculatepreferencesdialog.cpp:194 +msgid "If \"e\"; shall be used instead of \"E\" in numbers" +msgstr "Om \"e\" skall anvädas istället för \"E\" i nummer" + +#: qalculatepreferencesdialog.cpp:196 +msgid "Alternative base prefixes" +msgstr "Alternativa basprefix" + +#: qalculatepreferencesdialog.cpp:197 +msgid "" +"If hexadecimal numbers shall be displayed with \"0x0\" and binary numbers " +"with \"0b00\" as prefixes" +msgstr "" +"Om hexadecimala tal ska visas med \"0x0\" och binära tal med \"0b00\" som " +"prefix" + +#: qalculatepreferencesdialog.cpp:199 +msgid "Spell out logical operators" +msgstr "Visa ord för logiska operatorer" + +#: qalculatepreferencesdialog.cpp:200 +msgid "If logical and/or shall be displayed as \"&&\"/\"||\" or \"and\"/\"or\"" +msgstr "" +"Om logiskt och/eller ska visas som \"&&\"/\"||\" eller \"och\"/\"eller\" " + +#: qalculatepreferencesdialog.cpp:203 +msgid "Multiplication sign:" +msgstr "Multiplikationstecken:" + +#: qalculatepreferencesdialog.cpp:215 +msgid "Division sign:" +msgstr "Divisionstecken:" + +#: qalculatepreferencesdialog.cpp:230 +msgid "Custom result font" +msgstr "Anpassat teckensnitt för resultat" + +#: qalculatepreferencesdialog.cpp:234 +msgid "Custom expression font" +msgstr "Anpassat teckensnitt för uttryck" + +#: qalculatepreferencesdialog.cpp:238 +msgid "Custom status font" +msgstr "Anpassat teckensnitt för status" + +#: qalculatepreferencesdialog.cpp:243 +msgid "Status error color:" +msgstr "Statusfelsfärg" + +#: qalculatepreferencesdialog.cpp:250 +msgid "Status warning color:" +msgstr "Statusvarningsfärg" + +#: qalculateresultdisplay.cpp:52 +msgid "a matrix" +msgstr "en matris" + +#: qalculateresultdisplay.cpp:54 +msgid "a vector" +msgstr "en vektor" + +#: qalculateresultdisplay.cpp:57 +msgid "double-click to view/edit" +msgstr "dubbelkicka för att visa/redigera" + +#: qalculateresultdisplay.cpp:60 +msgid "Unknown variable" +msgstr "Okänd variabel" + +#: qalculateresultdisplay.cpp:72 +msgid "Prefix" +msgstr "Prefix" + +#: qalculateresultdisplay.cpp:336 +msgid "Show Parsed Expression" +msgstr "Visa uttryckstolkning" + +#: qalculateresultdisplay.cpp:342 qalculateresultdisplay.cpp:353 +msgid "Show Object Info" +msgstr "Visa objektinfo" + +#: qalculateresultdisplay.cpp:348 +msgid "View/Edit Matrix" +msgstr "Visa/redigera matris" + +#: qalculateresultdisplay.cpp:350 +msgid "View/Edit Vector" +msgstr "Visa/redigera vektor" + +#: qalculateresultdisplay.cpp:382 +msgid "Parsed expression:" +msgstr "Tolkat uttryck:" + +#: qalculatesetbasedialog.cpp:33 +msgid "Result Base" +msgstr "Resultatbas" + +#: qalculatesetbasedialog.cpp:39 qalculatesetbasedialog.cpp:52 +msgid "Other:" +msgstr "Annan:" + +#: qalculatesetbasedialog.cpp:43 +msgid "Time format" +msgstr "Tidsformat" + +#: qalculatesetbasedialog.cpp:44 qalculatesetbasedialog.cpp:55 +msgid "Roman numerals" +msgstr "Romerska siffror" + +#: qalculatesetbasedialog.cpp:46 +msgid "Expression Base" +msgstr "Uttrycksbas" + +#: qalculateunitsdialog.cpp:54 +msgid "Units" +msgstr "Enheter" + +#: qalculateunitsdialog.cpp:68 +msgid "Names" +msgstr "Namn" + +#: qalculateunitsdialog.cpp:69 +msgid "Base" +msgstr "Bas" + +#: qalculateunitsdialog.cpp:72 +msgid "Conversion" +msgstr "Omvandling" + +#: qalculateunitsdialog.cpp:105 +msgid "Convert Result" +msgstr "Omvandla resultat" + +#: qalculateunitsdialog.cpp:250 +msgid "Cannot delete unit as it is needed by other units." +msgstr "Kan inte ta bort enheten eftersom den används av andra enheter." + +#: qalculatevariablesdialog.cpp:51 +msgid "Variables" +msgstr "Variabler" + +#: qalculatevariablesdialog.cpp:60 +msgid "Variable Name" +msgstr "Variabelnamn" + +#. i18n: file ./qalculate_kdeui.rc line 5 +#: rc.cpp:6 +#, no-c-format +msgid "&New" +msgstr "&Ny" + +#. i18n: file ./qalculate_kdeui.rc line 37 +#: rc.cpp:12 +#, no-c-format +msgid "&Set Prefix" +msgstr "&Välj prefix" + +#. i18n: file ./qalculate_kdeui.rc line 39 +#: rc.cpp:15 +#, no-c-format +msgid "&Convert To Unit" +msgstr "&Omvandla till enhet" + +#. i18n: file ./qalculate_kdeui.rc line 54 +#: rc.cpp:18 +#, no-c-format +msgid "&Mode" +msgstr "&Läge" + +#. i18n: file ./qalculate_kdeui.rc line 55 +#: rc.cpp:21 +#, no-c-format +msgid "Number Base" +msgstr "Nummerbas" + +#. i18n: file ./qalculate_kdeui.rc line 67 +#: rc.cpp:24 +#, no-c-format +msgid "Numerical Display" +msgstr "Numerisk visning" + +#. i18n: file ./qalculate_kdeui.rc line 80 +#: rc.cpp:27 +#, no-c-format +msgid "Fractional Display" +msgstr "Bråktalsvisning" + +#. i18n: file ./qalculate_kdeui.rc line 86 +#: rc.cpp:30 +#, no-c-format +msgid "Unit Display" +msgstr "Enhetsvisning" + +#. i18n: file ./qalculate_kdeui.rc line 96 +#: rc.cpp:33 +#, no-c-format +msgid "Angle Unit" +msgstr "Vinkelenhet" + +#. i18n: file ./qalculate_kdeui.rc line 104 +#: rc.cpp:36 +#, no-c-format +msgid "Enabled Objects" +msgstr "Aktiverade objekt" + +#. i18n: file ./qalculate_kdeui.rc line 121 +#: rc.cpp:42 +#, no-c-format +msgid "Assumptions" +msgstr "Antaganden" + +#. i18n: file ./qalculate_kdeui.rc line 137 +#: rc.cpp:45 +#, no-c-format +msgid "Algebraic Mode" +msgstr "Algebraiskt läge" + +#. i18n: file ./qalculate_kdeui.rc line 161 +#: rc.cpp:51 +#, no-c-format +msgid "Fu&nctions" +msgstr "Fu&nktioner" + +#. i18n: file ./qalculate_kdeui.rc line 163 +#: rc.cpp:54 +#, no-c-format +msgid "&Variables" +msgstr "&Variabler" + +#. i18n: file ./qalculate_kdeui.rc line 165 +#: rc.cpp:57 +#, no-c-format +msgid "&Units" +msgstr "&Enheter" diff --git a/po/zh_CN.po b/po/zh_CN.po new file mode 100644 index 0000000..68db4e8 --- /dev/null +++ b/po/zh_CN.po @@ -0,0 +1,2604 @@ +# translation of qalculate_kde.po to Simplified Chinese +# translation of qalculate_kde.po to +# This file is put in the public domain. +# +# Roy Qu , 2007. +# Roy Qu , 2007. +msgid "" +msgstr "" +"Project-Id-Version: qalculate_kde\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2006-11-05 10:12+0100\n" +"PO-Revision-Date: 2007-08-01 13:17+0800\n" +"Last-Translator: Roy Qu \n" +"Language-Team: Simplified Chinese\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#: _translatorinfo.cpp:1 +msgid "" +"_: NAME OF TRANSLATORS\n" +"Your names" +msgstr "Roy Qu" + +#: _translatorinfo.cpp:3 +msgid "" +"_: EMAIL OF TRANSLATORS\n" +"Your emails" +msgstr "royqh1979@gmail.com" + +#: kqalculate.cpp:264 +msgid "Remove from System Tray" +msgstr "从系统托盘中移除" + +#: kqalculate.cpp:265 qalculateeditdatasetdialog.cpp:471 +#: qalculateplotdialog.cpp:226 +msgid "Hide" +msgstr "隐藏" + +#: kqalculate.cpp:286 kqalculate.cpp:4481 kqalculate.cpp:5912 +msgid "Enter" +msgstr "输入" + +#: kqalculate.cpp:287 kqalculate.cpp:513 kqalculate.cpp:4482 +#: kqalculate.cpp:4489 kqalculate.cpp:5913 +msgid "=" +msgstr "=" + +#: kqalculate.cpp:289 kqalculate.cpp:514 kqalculate.cpp:4486 +#: kqalculate.cpp:4487 +msgid "Calculate expression and add to stack" +msgstr "计算表达式,并将结果加入到数据栈中" + +#: kqalculate.cpp:290 kqalculate.cpp:515 kqalculate.cpp:4490 +#: kqalculate.cpp:4491 +msgid "Calculate expression" +msgstr "计算表达式" + +#: kqalculate.cpp:296 kqalculate.cpp:5915 +msgid "Store" +msgstr "暂存" + +#: kqalculate.cpp:298 +msgid "Store result as variable" +msgstr "将结果暂存为变量" + +#: kqalculate.cpp:301 kqalculate.cpp:5917 qalculateconvertunitsdialog.cpp:42 +msgid "Convert" +msgstr "换算" + +#: kqalculate.cpp:303 +msgid "Convert units in result" +msgstr "换算结果中的单位" + +#: kqalculate.cpp:313 +msgid "Enter expression here" +msgstr "在这里输入表达式" + +#: kqalculate.cpp:322 +msgid "status" +msgstr "状态" + +#: kqalculate.cpp:354 qalculateeditdataobjectdialog.cpp:71 +msgid "Exact" +msgstr "精确" + +#: kqalculate.cpp:355 +msgid "Toggle exact mode" +msgstr "切换精确模式" + +#: kqalculate.cpp:358 kqalculate.cpp:1070 +msgid "Fraction" +msgstr "分数" + +#: kqalculate.cpp:359 +msgid "Toggle fractional display" +msgstr "切换分数显示" + +#: kqalculate.cpp:363 +msgid "Numerical display" +msgstr "数值显示格式" + +#: kqalculate.cpp:366 kqalculate.cpp:1046 qalculateresultdisplay.cpp:288 +msgid "Normal" +msgstr "普通" + +#: kqalculate.cpp:367 kqalculate.cpp:1048 qalculateresultdisplay.cpp:291 +msgid "Engineering" +msgstr "工程" + +#: kqalculate.cpp:368 kqalculate.cpp:1050 qalculateresultdisplay.cpp:294 +msgid "Scientific" +msgstr "科学" + +#: kqalculate.cpp:369 +msgid "Pure" +msgstr "纯浮点" + +#: kqalculate.cpp:370 kqalculate.cpp:1054 +msgid "Simple" +msgstr "简单" + +#: kqalculate.cpp:372 +msgid "Base in result" +msgstr "结果所用进制" + +#: kqalculate.cpp:376 kqalculate.cpp:1029 qalculatesetbasedialog.cpp:35 +#: qalculatesetbasedialog.cpp:48 +msgid "Binary" +msgstr "二进制" + +#: kqalculate.cpp:377 kqalculate.cpp:1031 qalculatesetbasedialog.cpp:36 +#: qalculatesetbasedialog.cpp:49 +msgid "Octal" +msgstr "八进制" + +#: kqalculate.cpp:378 kqalculate.cpp:1033 kqalculate.cpp:1066 +#: qalculatesetbasedialog.cpp:37 qalculatesetbasedialog.cpp:50 +msgid "Decimal" +msgstr "十进制" + +#: kqalculate.cpp:379 kqalculate.cpp:1035 qalculatesetbasedialog.cpp:38 +#: qalculatesetbasedialog.cpp:51 +msgid "Hexadecimal" +msgstr "十六进制" + +#: kqalculate.cpp:380 kqalculate.cpp:1039 qalculatesetbasedialog.cpp:42 +msgid "Sexagesimal" +msgstr "六十进制" + +#: kqalculate.cpp:381 kqalculate.cpp:1041 +msgid "Time Format" +msgstr "日期格式" + +#: kqalculate.cpp:383 kqalculate.cpp:1037 +msgid "Other..." +msgstr "其它..." + +#: kqalculate.cpp:389 +msgid "f(x)" +msgstr "f(x)" + +#: kqalculate.cpp:393 +msgid "Open functions manager" +msgstr "打开函数管理器" + +#: kqalculate.cpp:395 +msgid "sqrt" +msgstr "sqrt" + +#: kqalculate.cpp:396 +msgid "Square root" +msgstr "平方根" + +#: kqalculate.cpp:399 kqalculate.cpp:947 +msgid "xy" +msgstr "xy" + +#: kqalculate.cpp:400 +msgid "Raise (Ctrl+*)" +msgstr "上标(Ctrl+))" + +#: kqalculate.cpp:403 kqalculate.cpp:946 +msgid "x2" +msgstr "x2" + +#: kqalculate.cpp:404 +msgid "Square" +msgstr "平方" + +#: kqalculate.cpp:406 +msgid "log" +msgstr "log" + +#: kqalculate.cpp:407 +msgid "Base-10 logarithm" +msgstr "以10为底的对数" + +#: kqalculate.cpp:409 +msgid "ln" +msgstr "ln" + +#: kqalculate.cpp:410 +msgid "Natural logarithm" +msgstr "自然对数" + +#: kqalculate.cpp:412 +msgid "x!" +msgstr "x!" + +#: kqalculate.cpp:413 +msgid "Factorial" +msgstr "阶乘" + +#: kqalculate.cpp:415 +msgid "cos" +msgstr "cos" + +#: kqalculate.cpp:416 +msgid "Cosine" +msgstr "余弦" + +#: kqalculate.cpp:418 +msgid "tan" +msgstr "tan" + +#: kqalculate.cpp:419 +msgid "Tangent" +msgstr "正切" + +#: kqalculate.cpp:421 +msgid "hyp" +msgstr "hyp" + +#: kqalculate.cpp:422 +msgid "Toggle hyperbolic functions" +msgstr "切换双曲函数" + +#: kqalculate.cpp:425 +msgid "inv" +msgstr "inv" + +#: kqalculate.cpp:426 +msgid "Toggle inverse functions" +msgstr "切换反函数" + +#: kqalculate.cpp:429 +msgid "sin" +msgstr "sin" + +#: kqalculate.cpp:430 +msgid "Sine" +msgstr "正弦" + +#: kqalculate.cpp:435 +msgid "Deg" +msgstr "Deg" + +#: kqalculate.cpp:436 +msgid "Angle Unit: Degrees" +msgstr "角度单位:度" + +#: kqalculate.cpp:439 +msgid "Rad" +msgstr "Rad" + +#: kqalculate.cpp:440 +msgid "Angle Unit: Radians" +msgstr "角度单位:弧度" + +#: kqalculate.cpp:443 +msgid "Gra" +msgstr "Gra" + +#: kqalculate.cpp:444 +msgid "Angle Unit: Gradians" +msgstr "角度单位:梯度" + +#: kqalculate.cpp:447 kqalculate.cpp:1094 kqalculate.cpp:1152 +#: qalculateplotdialog.cpp:126 +msgid "None" +msgstr "无" + +#: kqalculate.cpp:464 +msgid "7" +msgstr " 7" + +#: kqalculate.cpp:466 +msgid "8" +msgstr "8" + +#: kqalculate.cpp:468 +msgid "9" +msgstr "9" + +#: kqalculate.cpp:470 +msgid "4" +msgstr "4" + +#: kqalculate.cpp:472 +msgid "5" +msgstr "5" + +#: kqalculate.cpp:474 +msgid "6" +msgstr "6" + +#: kqalculate.cpp:476 +msgid "1" +msgstr "1" + +#: kqalculate.cpp:478 +msgid "2" +msgstr "2" + +#: kqalculate.cpp:480 +msgid "3" +msgstr "3" + +#: kqalculate.cpp:482 +msgid "0" +msgstr "0" + +#: kqalculate.cpp:485 +msgid "Decimal point" +msgstr "小数点" + +#: kqalculate.cpp:487 +msgid "EXP" +msgstr "EXP" + +#: kqalculate.cpp:488 +msgid "10^x (Ctrl+Shift+E)" +msgstr "10^x (Ctrl+Shift+E)" + +#: kqalculate.cpp:491 +msgid "Del" +msgstr "删除" + +#: kqalculate.cpp:494 +msgid "AC" +msgstr "AC" + +#: kqalculate.cpp:498 +msgid "Multiply" +msgstr "乘" + +#: kqalculate.cpp:501 +msgid "Divide" +msgstr "除" + +#: kqalculate.cpp:507 +msgid "Subtract" +msgstr "减" + +#: kqalculate.cpp:509 +msgid "Ans" +msgstr "Ans" + +#: kqalculate.cpp:510 +msgid "Previous result" +msgstr "前一个结果" + +#: kqalculate.cpp:512 kqalculate.cpp:4485 +msgid "Ent" +msgstr "Ent" + +#: kqalculate.cpp:535 +msgid "Index" +msgstr "索引" + +#: kqalculate.cpp:536 qalculateeditdataobjectdialog.cpp:49 +#: qalculatevariablesdialog.cpp:61 +msgid "Value" +msgstr "值" + +#: kqalculate.cpp:555 kqalculate.cpp:5921 +msgid "Up" +msgstr "上" + +#: kqalculate.cpp:556 +msgid "Move selected register up" +msgstr "向上移动选中的寄存器" + +#: kqalculate.cpp:560 kqalculate.cpp:5923 +msgid "Down" +msgstr "下" + +#: kqalculate.cpp:561 +msgid "Move selected register down" +msgstr "向上移动选中的寄存器" + +#: kqalculate.cpp:566 +msgid "Edit value of selected register" +msgstr "编辑选中的寄存器里的值" + +#: kqalculate.cpp:571 +msgid "Delete selected register" +msgstr "删除选中的寄存器" + +#: kqalculate.cpp:576 +msgid "Clear the RPN stack" +msgstr "清空逆波兰范式栈" + +#: kqalculate.cpp:592 +msgid "Keypad" +msgstr "小键盘" + +#: kqalculate.cpp:593 +msgid "Show/hide keypad" +msgstr "显示/隐藏小键盘" + +#: kqalculate.cpp:596 +msgid "History" +msgstr "历史" + +#: kqalculate.cpp:597 +msgid "Show/hide history" +msgstr "显示/隐藏历史" + +#: kqalculate.cpp:600 +msgid "RPN Stack" +msgstr "逆波兰范式栈" + +#: kqalculate.cpp:601 +msgid "Show/hide RPN stack" +msgstr "显示/隐藏逆波兰范式栈" + +#: kqalculate.cpp:716 kqalculate.cpp:2524 +msgid "RPN Register Moved" +msgstr "逆波兰范式寄存器已被移动" + +#: kqalculate.cpp:752 kqalculate.cpp:784 kqalculate.cpp:2135 +#: kqalculate.cpp:2699 kqalculate.cpp:2736 +msgid "approx." +msgstr "约" + +#: kqalculate.cpp:894 kqalculate.cpp:4810 +msgid "Load meta mode: %1" +msgstr "载入元模式:%1" + +#: kqalculate.cpp:966 +msgid "Qalculate! - Scientific Calculator" +msgstr "Qalculate! - 科学计算器" + +#: kqalculate.cpp:985 qalculateeditfunctiondialog.cpp:601 +#: qalculateresultdisplay.cpp:62 +msgid "Variable" +msgstr "变量" + +#: kqalculate.cpp:986 qalculateeditfunctiondialog.cpp:596 +#: qalculateeditmatrixvectordialog.cpp:106 qalculateimportcsvdialog.cpp:52 +#: qalculateinsertmatrixvectordialog.cpp:85 +#: qalculateinsertmatrixvectordialog.cpp:310 +msgid "Matrix" +msgstr "矩阵" + +#: kqalculate.cpp:987 qalculateeditfunctiondialog.cpp:595 +#: qalculateeditmatrixvectordialog.cpp:109 +#: qalculateinsertmatrixvectordialog.cpp:88 +#: qalculateinsertmatrixvectordialog.cpp:308 +msgid "Vector" +msgstr "向量" + +#: kqalculate.cpp:988 +msgid "Unknown Variable" +msgstr "未知变量" + +#: kqalculate.cpp:989 qalculateeditdatasetdialog.cpp:70 +#: qalculateeditfunctiondialog.cpp:71 qalculateeditfunctiondialog.cpp:599 +#: qalculateplotdialog.cpp:98 qalculateresultdisplay.cpp:92 +msgid "Function" +msgstr "函数" + +#: kqalculate.cpp:990 qalculatedatasetsdialog.cpp:64 +msgid "Data Set" +msgstr "数据集" + +#: kqalculate.cpp:991 qalculateconvertunitsdialog.cpp:68 +#: qalculateeditfunctiondialog.cpp:600 qalculateresultdisplay.cpp:67 +#: qalculateunitsdialog.cpp:67 +msgid "Unit" +msgstr "单位" + +#: kqalculate.cpp:992 +msgid "Import CSV File..." +msgstr "导入CSV文件..." + +#: kqalculate.cpp:993 +msgid "Export CSV File..." +msgstr "导出CSV文件..." + +#: kqalculate.cpp:994 +msgid "Store Result..." +msgstr "保存结果..." + +#: kqalculate.cpp:995 +msgid "Save Result Image..." +msgstr "保存结果图像..." + +#: kqalculate.cpp:996 +msgid "Save Definitions" +msgstr "保存定义" + +#: kqalculate.cpp:997 +msgid "Update Exchange Rates" +msgstr "更新汇率" + +#: kqalculate.cpp:998 +msgid "Plot Functions/Data" +msgstr "绘制函数/数据图" + +#: kqalculate.cpp:1000 +msgid "Convert Number Bases" +msgstr "转换数据进制" + +#: kqalculate.cpp:1001 qalculateperiodictabledialog.cpp:40 +msgid "Periodic Table" +msgstr "周期表" + +#: kqalculate.cpp:1008 +msgid "Show/hide main Qalculate! window" +msgstr "显示/隐藏Qalculate!主窗口" + +#: kqalculate.cpp:1011 +msgid "Configure &Global Shortcuts..." +msgstr "配置全局快捷方式(&G)..." + +#: kqalculate.cpp:1013 +msgid "Manage Variables" +msgstr "管理变量" + +#: kqalculate.cpp:1014 +msgid "Manage Functions" +msgstr "管理函数" + +#: kqalculate.cpp:1015 +msgid "Manage Units" +msgstr "管理单位" + +#: kqalculate.cpp:1016 +msgid "Manage Data Sets" +msgstr "管理数据集" + +#: kqalculate.cpp:1017 kqalculate.cpp:1150 +msgid "Factorize" +msgstr "因式分解" + +#: kqalculate.cpp:1018 kqalculate.cpp:1148 +msgid "Simplify" +msgstr "化简" + +#: kqalculate.cpp:1019 +msgid "Set Unknowns..." +msgstr "设置未知数..." + +#: kqalculate.cpp:1020 +msgid "Convert to Unit Expression..." +msgstr "转化成单位表达式..." + +#: kqalculate.cpp:1021 kqalculate.cpp:1084 +msgid "Convert to Base Units" +msgstr "转化成基本单位" + +#: kqalculate.cpp:1022 kqalculate.cpp:1086 +msgid "Convert to Best Unit" +msgstr "转化成最佳单位" + +#: kqalculate.cpp:1023 +msgid "Insert Matrix..." +msgstr "插入矩阵..." + +#: kqalculate.cpp:1024 +msgid "Insert Vector..." +msgstr "插入向量..." + +#: kqalculate.cpp:1025 +msgid "Copy Result" +msgstr "拷贝结果" + +#: kqalculate.cpp:1026 +msgid "Clear History" +msgstr "清空历史" + +#: kqalculate.cpp:1027 +msgid "Configure Qalculate!" +msgstr "配置Qaclculate!" + +#: kqalculate.cpp:1043 +msgid "Roman Numerals" +msgstr "罗马数字" + +#: kqalculate.cpp:1045 +msgid "Select Result and Expression Base..." +msgstr "选择结果和表达式的进制..." + +#: kqalculate.cpp:1052 +msgid "Purely Scientific" +msgstr "纯科学计算" + +#: kqalculate.cpp:1056 +msgid "Indicate Infinite Series" +msgstr "指出无穷序列" + +#: kqalculate.cpp:1058 +msgid "Sort Minus Last" +msgstr "" + +#: kqalculate.cpp:1060 +msgid "Negative Exponents" +msgstr "负指数" + +#: kqalculate.cpp:1062 +msgid "Show Ending Zeroes" +msgstr "显示结尾的零" + +#: kqalculate.cpp:1064 +msgid "Round Halfway Numbers to Even" +msgstr "" + +#: kqalculate.cpp:1068 +msgid "Decimal (Try Exact)" +msgstr "小数(尽量精确)" + +#: kqalculate.cpp:1072 +msgid "Combined" +msgstr "带分数" + +#: kqalculate.cpp:1074 +msgid "Enable Prefixes" +msgstr "启用前缀" + +#: kqalculate.cpp:1076 +msgid "Enable Use of All SI Prefixes" +msgstr "启用使用全部国际单位制前缀" + +#: kqalculate.cpp:1078 +msgid "Enable Denominator Prefixes" +msgstr "启用分母前缀" + +#: kqalculate.cpp:1080 +msgid "Place Units Separately" +msgstr "将单位与表达式分开" + +#: kqalculate.cpp:1082 +msgid "No Automatic Conversion" +msgstr "不自动换算" + +#: kqalculate.cpp:1088 +msgid "Degrees" +msgstr "度" + +#: kqalculate.cpp:1090 +msgid "Radians" +msgstr "弧度" + +#: kqalculate.cpp:1092 +msgid "Gradians" +msgstr "梯度" + +#: kqalculate.cpp:1096 +msgid "Abbreviate Names" +msgstr "使用缩写" + +#: kqalculate.cpp:1098 +msgid "Enable Variables" +msgstr "启用变量" + +#: kqalculate.cpp:1100 +msgid "Enable Functions" +msgstr "启用函数" + +#: kqalculate.cpp:1102 +msgid "Enable Units" +msgstr "启用单位" + +#: kqalculate.cpp:1104 +msgid "Enable Unknowns" +msgstr "启用未知数" + +#: kqalculate.cpp:1106 +msgid "Calculate Variables" +msgstr "计算变量" + +#: kqalculate.cpp:1108 +msgid "Allow Complex Result" +msgstr "允许复数结果" + +#: kqalculate.cpp:1110 +msgid "Allow Infinite Result" +msgstr "允许无穷结果" + +#: kqalculate.cpp:1112 +msgid "Try Exact" +msgstr "尝试精确" + +#: kqalculate.cpp:1114 +msgid "Always Exact" +msgstr "总是精确" + +#: kqalculate.cpp:1116 qalculateeditdataobjectdialog.cpp:70 +msgid "Approximate" +msgstr "近似" + +#: kqalculate.cpp:1118 kqalculate.cpp:1132 +#: qalculateeditunknownvariabledialog.cpp:65 +#: qalculateeditunknownvariabledialog.cpp:78 +#: qalculateperiodictabledialog.cpp:235 +msgid "Unknown" +msgstr "未知" + +#: kqalculate.cpp:1120 qalculateeditunknownvariabledialog.cpp:66 +msgid "Not Matrix" +msgstr "不是矩阵" + +#: kqalculate.cpp:1122 qalculateeditdatasetdialog.cpp:468 +#: qalculateeditfunctiondialog.cpp:590 +#: qalculateeditunknownvariabledialog.cpp:67 +msgid "Number" +msgstr "数字" + +#: kqalculate.cpp:1124 +msgid "Complex" +msgstr "复数" + +#: kqalculate.cpp:1126 +msgid "Real" +msgstr "实数" + +#: kqalculate.cpp:1128 +msgid "Rational" +msgstr "有理数" + +#: kqalculate.cpp:1130 qalculateeditfunctiondialog.cpp:591 +#: qalculateeditunknownvariabledialog.cpp:71 +msgid "Integer" +msgstr "整数" + +#: kqalculate.cpp:1134 qalculateeditunknownvariabledialog.cpp:83 +msgid "Non-Zero" +msgstr "非零" + +#: kqalculate.cpp:1136 qalculateeditunknownvariabledialog.cpp:79 +msgid "Positive" +msgstr "为正" + +#: kqalculate.cpp:1138 qalculateeditunknownvariabledialog.cpp:80 +msgid "Non-Negative" +msgstr "非负" + +#: kqalculate.cpp:1140 qalculateeditunknownvariabledialog.cpp:81 +msgid "Negative" +msgstr "为负" + +#: kqalculate.cpp:1142 qalculateeditunknownvariabledialog.cpp:82 +msgid "Non-Positive" +msgstr "非正" + +#: kqalculate.cpp:1144 +msgid "Non-Zero Denominators" +msgstr "非零分母" + +#: kqalculate.cpp:1146 +msgid "Warn About Denominators Assumed Non-Zero" +msgstr "假设分母非零时警告" + +#: kqalculate.cpp:1154 +msgid "Read Precision" +msgstr "读取精度" + +#: kqalculate.cpp:1156 +msgid "Limit Implicit Multiplication" +msgstr "限制暗示乘法" + +#: kqalculate.cpp:1158 +msgid "RPN Mode" +msgstr "逆波兰范式模式" + +#: kqalculate.cpp:1160 +msgid "RPN Syntax" +msgstr "逆波兰语法" + +#: kqalculate.cpp:1162 qalculateprecisiondialog.cpp:31 +msgid "Precision" +msgstr "精度" + +#: kqalculate.cpp:1163 qalculatedecimalsdialog.cpp:27 +msgid "Decimals" +msgstr "小数点" + +#: kqalculate.cpp:1164 +msgid "Save Mode..." +msgstr "保存模式..." + +#: kqalculate.cpp:1165 +msgid "Delete Mode..." +msgstr "删除模式..." + +#: kqalculate.cpp:1167 +msgid "Save Default Mode" +msgstr "保存缺省模式" + +#: kqalculate.cpp:1168 +msgid "Clear Stack" +msgstr "清空栈" + +#: kqalculate.cpp:1172 +msgid "Exp RPN Operation" +msgstr "" + +#: kqalculate.cpp:1865 +msgid "and" +msgstr "and" + +#: kqalculate.cpp:1870 +msgid "or" +msgstr "or" + +#: kqalculate.cpp:2119 +msgid "undefined" +msgstr "undefined" + +#: kqalculate.cpp:2161 +msgid "EXACT" +msgstr "精确" + +#: kqalculate.cpp:2164 +msgid "APPROX" +msgstr "近似" + +#: kqalculate.cpp:2168 +msgid "RPN" +msgstr "逆波兰" + +#: kqalculate.cpp:2176 +msgid "BIN" +msgstr "二进制" + +#: kqalculate.cpp:2181 +msgid "OCT" +msgstr "八进制" + +#: kqalculate.cpp:2186 +msgid "HEX" +msgstr "十六进制" + +#: kqalculate.cpp:2191 +msgid "ROMAN" +msgstr "罗马数字" + +#: kqalculate.cpp:2203 +msgid "DEG" +msgstr "度" + +#: kqalculate.cpp:2208 +msgid "RAD" +msgstr "弧度" + +#: kqalculate.cpp:2213 +msgid "GRA" +msgstr "梯度" + +#: kqalculate.cpp:2220 +msgid "PREC" +msgstr "精度" + +#: kqalculate.cpp:2225 +msgid "FUNC" +msgstr "函数" + +#: kqalculate.cpp:2231 +msgid "UNIT" +msgstr "单位" + +#: kqalculate.cpp:2237 +msgid "VAR" +msgstr "变量" + +#: kqalculate.cpp:2243 +msgid "INF" +msgstr "无穷" + +#: kqalculate.cpp:2249 +msgid "CPLX" +msgstr "复数" + +#: kqalculate.cpp:2330 kqalculate.cpp:2348 kqalculate.cpp:2578 +msgid "aborted" +msgstr "已终止" + +#: kqalculate.cpp:2349 +msgid "calculation was aborted" +msgstr "计算已被终止" + +#: kqalculate.cpp:2585 +msgid "result processing was aborted" +msgstr "结果处理已被终止" + +#: kqalculate.cpp:2633 +msgid "Processing..." +msgstr "正在处理..." + +#: kqalculate.cpp:2637 kqalculate.cpp:2882 kqalculate.cpp:3142 +msgid "Abort" +msgstr "终止" + +#: kqalculate.cpp:2870 +msgid "Factorizing..." +msgstr "正在因式分解..." + +#: kqalculate.cpp:2874 +msgid "Simplifying..." +msgstr "正在化简..." + +#: kqalculate.cpp:3138 +msgid "Calculating..." +msgstr "正在计算..." + +#: kqalculate.cpp:3188 +msgid "RPN Operation" +msgstr "逆波兰范式操作" + +#: kqalculate.cpp:3256 +msgid "Errors" +msgstr "错误" + +#: kqalculate.cpp:3257 +msgid "Warnings" +msgstr "警告" + +#: kqalculate.cpp:3267 +msgid "Couldn't write definitions" +msgstr "无法写定义" + +#: kqalculate.cpp:3535 +msgid "Prefixes" +msgstr "前缀" + +#: kqalculate.cpp:3662 +msgid "No Prefix" +msgstr "无前缀" + +#: kqalculate.cpp:3813 qalculatevariablesdialog.cpp:191 +#: qalculatevariablesdialog.cpp:337 +msgid "Variable does not exist anymore." +msgstr "变量不再存在。" + +#: kqalculate.cpp:3829 qalculateconvertunitsdialog.cpp:153 +#: qalculateunitsdialog.cpp:223 qalculateunitsdialog.cpp:337 +msgid "Unit does not exist anymore." +msgstr "单位不再存在。" + +#: kqalculate.cpp:3902 +msgid "Failed to download exchange rates from ECB." +msgstr "从ECB下载汇率失败。" + +#: kqalculate.cpp:4749 +msgid "Save Mode" +msgstr "保存模式" + +#: kqalculate.cpp:4752 +msgid "Mode name:" +msgstr "模式名:" + +#: kqalculate.cpp:4762 +msgid "Shortcut:" +msgstr "快捷方式:" + +#: kqalculate.cpp:4789 +msgid "Empty mode name." +msgstr "空模式名。" + +#: kqalculate.cpp:4792 +msgid "Preset mode cannot be overwritten." +msgstr "不能覆盖预定义模式。" + +#: kqalculate.cpp:4824 +msgid "Delete Mode" +msgstr "删除模式" + +#: kqalculate.cpp:4824 +msgid "Mode:" +msgstr "模式:" + +#: kqalculate.cpp:4998 +msgid "log10 function not found." +msgstr "未找到log10函数。" + +#: kqalculate.cpp:5542 main.cpp:156 main.cpp:159 main.cpp:160 main.cpp:161 +#: main.cpp:162 +msgid "Temporary" +msgstr "临时" + +#: kqalculate.cpp:5564 kqalculate.cpp:5591 qalculatefunctionsdialog.cpp:191 +#: qalculatefunctionsdialog.cpp:300 +msgid "Function does not exist anymore." +msgstr "函数不再存在。" + +#: kqalculate.cpp:5694 kqalculate.cpp:5730 +msgid "My Variables" +msgstr "我的变量" + +#: kqalculate.cpp:5706 qalculateimportcsvdialog.cpp:56 +msgid "Vectors" +msgstr "向量" + +#: kqalculate.cpp:5718 +msgid "Matrices" +msgstr "矩阵" + +#: kqalculate.cpp:5759 qalculateplotdialog.cpp:726 +msgid "Save Image" +msgstr "保存图像" + +#: kqalculate.cpp:5764 qalculateplotdialog.cpp:731 +msgid "A file named \"%1\" already exists. Are you sure you want to overwrite it?" +msgstr "文件\"%1\"已存在。您确定要覆盖它吗?" + +#: kqalculate.cpp:5764 qalculateplotdialog.cpp:731 +msgid "Overwrite File?" +msgstr "覆盖文件?" + +#: kqalculate.cpp:5764 qalculateplotdialog.cpp:731 +msgid "&Overwrite" +msgstr "覆盖(&O)" + +#: kqalculate.cpp:5798 +msgid "Failed to save image." +msgstr "保存问图像失败。" + +#: kqalculate.cpp:6024 +msgid "No unknowns in result." +msgstr "在结果中不存在未知数。" + +#: kqalculate.cpp:6027 +msgid "Set Unknowns" +msgstr "设置未知数。" + +#: kqalculate.cpp:6191 +msgid "Too many arguments for %1()." +msgstr "%1()的参数过多。" + +#: kqalculate.cpp:6217 qalculatedatasetsdialog.cpp:342 +#: qalculatefunctionsdialog.cpp:343 qalculateresultdisplay.cpp:120 +msgid "argument" +msgstr "参数" + +#: kqalculate.cpp:6439 kqalculate.cpp:6443 +msgid "Edit Expression" +msgstr "编辑表达式" + +#: kqalculate.cpp:6448 +msgid "Edit Result" +msgstr "编辑结果" + +#: kqalculate.cpp:6451 +msgid "Insert Result Variable" +msgstr "插入结果变量" + +#: main.cpp:45 +msgid "A powerful and easy to use desktop calculator" +msgstr "一个强大而且易用的桌面计算器" + +#: main.cpp:51 +msgid "Calculate X11-clipboard content (selected text)" +msgstr "计算X11剪贴板里的内容(选中的文本)" + +#: main.cpp:52 +msgid "Initial expression to calculate" +msgstr "初始化表达式进行计算" + +#: main.cpp:134 +msgid "Enter a mathematical expression above.
Ex. 5 + 2 / 3" +msgstr "" +"在上面输入一个数学表达式。\n" +"例如,5 + 2 / 3" + +#: main.cpp:143 +msgid "" +"You need to download exchange rates to be able to convert between different " +"currencies. You can later get current exchange rates by selecting \"Update " +"Exchange Rates\" under the File menu.\n" +"\n" +"Do you want to fetch exchange rates now from the Internet?" +msgstr "" +"您需要下载汇率,才能在不同货币间进行换算。您可以之后通过\"文件\"菜单里的\"更新汇率\"项来获取当前的汇率。 \n" +"\n" +"现在是否从因特网下载汇率?" + +#: main.cpp:143 +msgid "Update exchange rates?" +msgstr "更新汇率?" + +#: main.cpp:155 +msgid "ans" +msgstr "ans" + +#: main.cpp:156 +msgid "Last Answer" +msgstr "最后一个答案" + +#: main.cpp:157 +msgid "answer" +msgstr "答案" + +#: main.cpp:159 +msgid "Answer 2" +msgstr "答案2" + +#: main.cpp:160 +msgid "Answer 3" +msgstr "答案3" + +#: main.cpp:161 +msgid "Answer 4" +msgstr "答案4" + +#: main.cpp:162 +msgid "Answer 5" +msgstr "答案5" + +#: main.cpp:166 +msgid "Failed to load global definitions!" +msgstr "载入全局定义失败!" + +#: main.cpp:290 +msgid "Qalculate!" +msgstr "Qalculate!" + +#: preferences.cpp:208 +msgid "Preset" +msgstr "预设参数" + +#: preferences.cpp:669 +#, c-format +msgid "" +"Couldn't write preferences to\n" +"%s" +msgstr "" +"无法将偏好设置写入\n" +"%s" + +#: qalculateconvertnumberbasesdialog.cpp:31 qalculatesetbasedialog.cpp:29 +msgid "Number Bases" +msgstr "数字进制" + +#: qalculateconvertnumberbasesdialog.cpp:37 +msgid "Decimal:" +msgstr "十进制:" + +#: qalculateconvertnumberbasesdialog.cpp:41 +msgid "Binary:" +msgstr "二进制:" + +#: qalculateconvertnumberbasesdialog.cpp:45 +msgid "Octal:" +msgstr "八进制:" + +#: qalculateconvertnumberbasesdialog.cpp:49 +msgid "Hexadecimal:" +msgstr "十六进制:" + +#: qalculateconvertunitsdialog.cpp:44 +msgid "Selector" +msgstr "选择器" + +#: qalculateconvertunitsdialog.cpp:50 qalculateeditdatasetdialog.cpp:482 +msgid "Unit expression:" +msgstr "单位表达式:" + +#: qalculateconvertunitsdialog.cpp:63 qalculatefunctionsdialog.cpp:55 +#: qalculateunitsdialog.cpp:63 qalculatevariablesdialog.cpp:57 +msgid "Category" +msgstr "分类" + +#: qalculateconvertunitsdialog.cpp:85 qalculateconvertunitsdialog.cpp:86 +#: qalculateconvertunitsdialog.cpp:141 qalculateconvertunitsdialog.cpp:180 +#: qalculatefunctionsdialog.cpp:118 qalculatefunctionsdialog.cpp:119 +#: qalculatefunctionsdialog.cpp:183 qalculatefunctionsdialog.cpp:505 +#: qalculateunitsdialog.cpp:150 qalculateunitsdialog.cpp:151 +#: qalculateunitsdialog.cpp:215 qalculateunitsdialog.cpp:416 +#: qalculatevariablesdialog.cpp:116 qalculatevariablesdialog.cpp:117 +#: qalculatevariablesdialog.cpp:183 qalculatevariablesdialog.cpp:462 +msgid "All" +msgstr "全部" + +#: qalculateconvertunitsdialog.cpp:132 qalculateconvertunitsdialog.cpp:133 +#: qalculateconvertunitsdialog.cpp:134 qalculateconvertunitsdialog.cpp:182 +#: qalculatefunctionsdialog.cpp:165 qalculatefunctionsdialog.cpp:166 +#: qalculatefunctionsdialog.cpp:167 qalculatefunctionsdialog.cpp:236 +#: qalculatefunctionsdialog.cpp:262 qalculatefunctionsdialog.cpp:285 +#: qalculatefunctionsdialog.cpp:507 qalculateunitsdialog.cpp:197 +#: qalculateunitsdialog.cpp:198 qalculateunitsdialog.cpp:199 +#: qalculateunitsdialog.cpp:273 qalculateunitsdialog.cpp:299 +#: qalculateunitsdialog.cpp:322 qalculateunitsdialog.cpp:418 +#: qalculatevariablesdialog.cpp:165 qalculatevariablesdialog.cpp:166 +#: qalculatevariablesdialog.cpp:167 qalculatevariablesdialog.cpp:258 +#: qalculatevariablesdialog.cpp:284 qalculatevariablesdialog.cpp:322 +#: qalculatevariablesdialog.cpp:464 +msgid "Uncategorized" +msgstr "未分类" + +#: qalculatedatasetsdialog.cpp:46 qalculateeditdatasetdialog.cpp:232 +msgid "Data Sets" +msgstr "数据集" + +#: qalculatedatasetsdialog.cpp:61 +msgid "Data Sets:" +msgstr "数据集:" + +#: qalculatedatasetsdialog.cpp:68 qalculatedatasetsdialog.cpp:91 +#: qalculateeditdatasetdialog.cpp:107 qalculateeditdatasetdialog.cpp:629 +#: qalculateeditfunctiondialog.cpp:133 qalculateeditfunctiondialog.cpp:492 +#: qalculateeditnamesdialog.cpp:64 qalculatefunctionsdialog.cpp:67 +#: qalculateunitsdialog.cpp:91 qalculatevariablesdialog.cpp:66 +msgid "New" +msgstr "新建" + +#: qalculatedatasetsdialog.cpp:77 qalculateeditdatasetdialog.cpp:79 +#: qalculateeditdatasetdialog.cpp:456 qalculateeditfunctiondialog.cpp:98 +msgid "Description:" +msgstr "描述:" + +#: qalculatedatasetsdialog.cpp:84 +msgid "Objects:" +msgstr "对象:" + +#: qalculatedatasetsdialog.cpp:87 qalculateeditdatasetdialog.cpp:236 +#: qalculateeditfunctiondialog.cpp:598 +msgid "Object" +msgstr "对象" + +#: qalculatedatasetsdialog.cpp:100 +msgid "Attributes:" +msgstr "属性:" + +#: qalculatedatasetsdialog.cpp:157 qalculatedatasetsdialog.cpp:218 +msgid "Data set does not exist anymore." +msgstr "数据集不再存在。" + +#: qalculatedatasetsdialog.cpp:300 qalculateeditdatasetdialog.cpp:195 +#: qalculatefunctionsdialog.cpp:456 +msgid "key" +msgstr "关键字" + +#: qalculatedatasetsdialog.cpp:316 +msgid "Data Retrieval Function" +msgstr "数据获取函数" + +#: qalculatedecimalsdialog.cpp:31 +msgid "Max decimals:" +msgstr "最大精度位数:" + +#: qalculatedecimalsdialog.cpp:39 +msgid "Min decimals:" +msgstr "最小精度位数:" + +#: qalculateeditdataobjectdialog.cpp:30 qalculateeditdataobjectdialog.cpp:40 +msgid "Edit Object" +msgstr "编辑对象" + +#: qalculateeditdataobjectdialog.cpp:42 +msgid "New Object" +msgstr "新对象" + +#: qalculateeditdataobjectdialog.cpp:48 qalculateeditdatasetdialog.cpp:242 +msgid "Property" +msgstr "属性" + +#. i18n: file ./qalculate_kdeui.rc line 116 +#: qalculateeditdataobjectdialog.cpp:51 rc.cpp:39 +#, no-c-format +msgid "Approximation" +msgstr "近似" + +#: qalculateeditdatasetdialog.cpp:53 qalculateeditdatasetdialog.cpp:307 +msgid "Edit Data Set" +msgstr "编辑数据集" + +#: qalculateeditdatasetdialog.cpp:68 qalculateeditfunctiondialog.cpp:70 +#: qalculatepreferencesdialog.cpp:157 +msgid "General" +msgstr "常规" + +#: qalculateeditdatasetdialog.cpp:73 qalculateplotdialog.cpp:86 +#: qalculateplotdialog.cpp:189 +msgid "Title:" +msgstr "标题:" + +#: qalculateeditdatasetdialog.cpp:76 +msgid "Data file:" +msgstr "数据文件:" + +#: qalculateeditdatasetdialog.cpp:87 +msgid "Copyright:" +msgstr "版权:" + +#: qalculateeditdatasetdialog.cpp:97 +msgid "Properties:" +msgstr "属性:" + +#: qalculateeditdatasetdialog.cpp:99 qalculateplotdialog.cpp:153 +msgid "Title" +msgstr "标题" + +#: qalculateeditdatasetdialog.cpp:100 qalculateeditdatasetdialog.cpp:620 +#: qalculateeditfunctiondialog.cpp:124 qalculateeditnamesdialog.cpp:41 +#: qalculateeditunitdialog.cpp:50 +msgid "Name" +msgstr "名称" + +#: qalculateeditdatasetdialog.cpp:101 qalculateeditfunctiondialog.cpp:125 +#: qalculateeditunitdialog.cpp:75 qalculateeditunknownvariabledialog.cpp:60 +msgid "Type" +msgstr "类别" + +#: qalculateeditdatasetdialog.cpp:115 qalculateeditdatasetdialog.cpp:442 +#: qalculateeditfunctiondialog.cpp:74 qalculateeditfunctiondialog.cpp:583 +#: qalculateeditmatrixvectordialog.cpp:78 qalculateeditunitdialog.cpp:55 +#: qalculateeditunknownvariabledialog.cpp:47 +#: qalculateeditvariabledialog.cpp:49 qalculateimportcsvdialog.cpp:60 +msgid "Name:" +msgstr "名称:" + +#: qalculateeditdatasetdialog.cpp:124 qalculateeditdatasetdialog.cpp:451 +#: qalculateeditfunctiondialog.cpp:83 qalculateeditmatrixvectordialog.cpp:87 +#: qalculateeditunitdialog.cpp:64 qalculateeditunknownvariabledialog.cpp:56 +#: qalculateeditvariabledialog.cpp:60 +msgid "Names Details" +msgstr "名称详细信息" + +#: qalculateeditdatasetdialog.cpp:126 +msgid "Object argument name:" +msgstr "对象参数名:" + +#: qalculateeditdatasetdialog.cpp:129 +msgid "Property argument name:" +msgstr "属性参数名:" + +#: qalculateeditdatasetdialog.cpp:132 +msgid "Default property:" +msgstr "缺省属性:" + +#: qalculateeditdatasetdialog.cpp:173 +msgid "text" +msgstr "文字" + +#: qalculateeditdatasetdialog.cpp:178 qalculateeditdatasetdialog.cpp:186 +msgid "approximate" +msgstr "近似" + +#: qalculateeditdatasetdialog.cpp:181 qalculateexpressionedit.cpp:696 +#: qalculatevariablesdialog.cpp:428 +msgid "number" +msgstr "数字" + +#: qalculateeditdatasetdialog.cpp:189 +msgid "expression" +msgstr "表达式" + +#: qalculateeditdatasetdialog.cpp:213 qalculateeditdatasetdialog.cpp:499 +#: qalculateeditfunctiondialog.cpp:190 qalculateeditmatrixvectordialog.cpp:185 +#: qalculateeditunitdialog.cpp:146 qalculateeditunknownvariabledialog.cpp:132 +#: qalculateeditvariabledialog.cpp:102 +msgid "Empty name field" +msgstr "空白名称域" + +#: qalculateeditdatasetdialog.cpp:217 qalculateeditfunctiondialog.cpp:201 +msgid "" +"A function with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"同名函数已存在。\n" +"您想要覆盖它吗?" + +#: qalculateeditdatasetdialog.cpp:309 +msgid "Edit Data Set (global)" +msgstr "编辑(全局)数据集" + +#: qalculateeditdatasetdialog.cpp:311 +msgid "New Data Set" +msgstr "新数据集" + +#: qalculateeditdatasetdialog.cpp:322 +msgid "info" +msgstr "信息" + +#: qalculateeditdatasetdialog.cpp:435 qalculateeditdatasetdialog.cpp:548 +msgid "Edit Property" +msgstr "编辑属性" + +#: qalculateeditdatasetdialog.cpp:453 qalculateeditfunctiondialog.cpp:90 +#: qalculateeditmatrixvectordialog.cpp:93 qalculateeditunitdialog.cpp:66 +#: qalculateeditunknownvariabledialog.cpp:90 +#: qalculateeditvariabledialog.cpp:80 qalculateimportcsvdialog.cpp:63 +msgid "Descriptive name:" +msgstr "描述性名称:" + +#: qalculateeditdatasetdialog.cpp:464 +msgid "Value type:" +msgstr "值类型:" + +#: qalculateeditdatasetdialog.cpp:467 qalculateeditfunctiondialog.cpp:593 +msgid "Text" +msgstr "文字" + +#: qalculateeditdatasetdialog.cpp:469 qalculateeditfunctiondialog.cpp:482 +#: qalculateplotdialog.cpp:154 +msgid "Expression" +msgstr "表达式" + +#: qalculateeditdatasetdialog.cpp:474 +msgid "Use as key" +msgstr "用作关键字" + +#: qalculateeditdatasetdialog.cpp:476 +msgid "Approximate value" +msgstr "近似值" + +#: qalculateeditdatasetdialog.cpp:478 +msgid "Case sensitive value" +msgstr "大小写敏感值" + +#: qalculateeditdatasetdialog.cpp:480 +msgid "Value uses brackets" +msgstr "在值中使用方括号" + +#: qalculateeditdatasetdialog.cpp:550 +msgid "New Property" +msgstr "新建属性" + +#: qalculateeditdatasetdialog.cpp:615 qalculateeditnamesdialog.cpp:34 +msgid "Edit Names" +msgstr "编辑名称" + +#: qalculateeditdatasetdialog.cpp:621 qalculateeditfunctiondialog.cpp:481 +#: qalculateeditnamesdialog.cpp:46 +msgid "Reference" +msgstr "引用" + +#: qalculateeditfunctiondialog.cpp:55 qalculateeditfunctiondialog.cpp:286 +msgid "Edit Function" +msgstr "编辑函数" + +#: qalculateeditfunctiondialog.cpp:85 qalculateeditmatrixvectordialog.cpp:89 +#: qalculateeditunitdialog.cpp:87 qalculateeditunknownvariabledialog.cpp:85 +#: qalculateeditvariabledialog.cpp:74 qalculateimportcsvdialog.cpp:66 +msgid "Category:" +msgstr "类别:" + +#: qalculateeditfunctiondialog.cpp:96 +msgid "Hide function" +msgstr "隐藏函数" + +#: qalculateeditfunctiondialog.cpp:106 qalculateplotdialog.cpp:89 +msgid "Expression:" +msgstr "表达式:" + +#: qalculateeditfunctiondialog.cpp:115 +msgid "Condition:" +msgstr "条件:" + +#: qalculateeditfunctiondialog.cpp:120 qalculateeditfunctiondialog.cpp:476 +msgid "Sub-Functions" +msgstr "子函数" + +#: qalculateeditfunctiondialog.cpp:122 +msgid "Arguments:" +msgstr "自变量:" + +#: qalculateeditfunctiondialog.cpp:197 +msgid "Empty expression field" +msgstr "空白表达式项" + +#: qalculateeditfunctiondialog.cpp:288 +msgid "Edit Function (global)" +msgstr "编辑(全局)函数" + +#: qalculateeditfunctiondialog.cpp:290 +msgid "New Function" +msgstr "新建函数" + +#: qalculateeditfunctiondialog.cpp:483 +msgid "Precalculate" +msgstr "预计算" + +#: qalculateeditfunctiondialog.cpp:579 qalculateeditfunctiondialog.cpp:675 +msgid "Edit Argument" +msgstr "编辑自变量" + +#: qalculateeditfunctiondialog.cpp:586 +msgid "Type:" +msgstr "类型:" + +#: qalculateeditfunctiondialog.cpp:589 +msgid "Free" +msgstr "自由变量" + +#: qalculateeditfunctiondialog.cpp:592 +msgid "Symbol" +msgstr "符号" + +#: qalculateeditfunctiondialog.cpp:594 qalculateinsertfunctiondialog.cpp:353 +msgid "Date" +msgstr "日期" + +#: qalculateeditfunctiondialog.cpp:597 +msgid "Boolean" +msgstr "逻辑型" + +#: qalculateeditfunctiondialog.cpp:603 +msgid "Angle" +msgstr "角度" + +#: qalculateeditfunctiondialog.cpp:605 +msgid "Enable rules and type test" +msgstr "启用规则和类型测试" + +#: qalculateeditfunctiondialog.cpp:607 +msgid "Custom condition:" +msgstr "自定义条件:" + +#: qalculateeditfunctiondialog.cpp:611 +msgid "Allow matrix" +msgstr "允许矩阵" + +#: qalculateeditfunctiondialog.cpp:613 +msgid "Forbid zero" +msgstr "禁止出现零" + +#: qalculateeditfunctiondialog.cpp:615 +msgid "Allow complex" +msgstr "允许复数" + +#: qalculateeditfunctiondialog.cpp:617 qalculateplotdialog.cpp:164 +msgid "Min:" +msgstr "最小值:" + +#: qalculateeditfunctiondialog.cpp:624 qalculateeditfunctiondialog.cpp:633 +msgid "Include equals" +msgstr "包含相等关系" + +#: qalculateeditfunctiondialog.cpp:626 qalculateplotdialog.cpp:167 +msgid "Max:" +msgstr "最大值:" + +#: qalculateeditfunctiondialog.cpp:677 +msgid "New Argument" +msgstr "新自变量" + +#: qalculateeditmatrixvectordialog.cpp:71 +#: qalculateeditunknownvariabledialog.cpp:40 +#: qalculateeditvariabledialog.cpp:41 qalculateeditvariabledialog.cpp:180 +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Edit Variable" +msgstr "编辑变量" + +#: qalculateeditmatrixvectordialog.cpp:96 +#: qalculateinsertmatrixvectordialog.cpp:75 +msgid "Rows:" +msgstr "行:" + +#: qalculateeditmatrixvectordialog.cpp:99 +#: qalculateinsertmatrixvectordialog.cpp:78 +msgid "Columns:" +msgstr "列:" + +#: qalculateeditmatrixvectordialog.cpp:112 +#: qalculateeditmatrixvectordialog.cpp:133 +#: qalculateeditmatrixvectordialog.cpp:295 +#: qalculateinsertmatrixvectordialog.cpp:91 +#: qalculateinsertmatrixvectordialog.cpp:115 +#: qalculateinsertmatrixvectordialog.cpp:275 +msgid "Elements:" +msgstr "元素:" + +#: qalculateeditmatrixvectordialog.cpp:146 +#: qalculateeditmatrixvectordialog.cpp:292 +#: qalculateinsertmatrixvectordialog.cpp:128 +#: qalculateinsertmatrixvectordialog.cpp:272 +msgid "Elements (in horizontal order):" +msgstr "元素(水平顺序):" + +#: qalculateeditmatrixvectordialog.cpp:189 +#: qalculateeditunknownvariabledialog.cpp:136 +#: qalculateeditvariabledialog.cpp:114 +msgid "" +"An unit or variable with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"同名的单位或变量已存在。\n" +"您要覆盖它吗?" + +#: qalculateeditmatrixvectordialog.cpp:301 +msgid "Edit Vector" +msgstr "编辑向量" + +#: qalculateeditmatrixvectordialog.cpp:303 +msgid "Edit Vector (global)" +msgstr "编辑向量(全局)" + +#: qalculateeditmatrixvectordialog.cpp:305 +msgid "New Vector" +msgstr "新建向量" + +#: qalculateeditmatrixvectordialog.cpp:310 +msgid "Edit Matrix" +msgstr "编辑矩阵" + +#: qalculateeditmatrixvectordialog.cpp:312 +msgid "Edit Matrix (global)" +msgstr "编辑矩阵(全局)" + +#: qalculateeditmatrixvectordialog.cpp:314 +msgid "New Matrix" +msgstr "新建矩阵" + +#: qalculateeditnamesdialog.cpp:42 +msgid "Abbreviation" +msgstr "缩写" + +#: qalculateeditnamesdialog.cpp:44 +msgid "Plural" +msgstr "复数" + +#: qalculateeditnamesdialog.cpp:48 +msgid "Avoid Input" +msgstr "避免输入" + +#: qalculateeditnamesdialog.cpp:50 +msgid "Unicode" +msgstr "Unicode" + +#: qalculateeditnamesdialog.cpp:52 +msgid "Suffix" +msgstr "后缀" + +#: qalculateeditnamesdialog.cpp:54 +msgid "Case Sensitive" +msgstr "大小写敏感" + +#: qalculateeditunitdialog.cpp:43 qalculateeditunitdialog.cpp:287 +msgid "Edit Unit" +msgstr "编辑单位" + +#: qalculateeditunitdialog.cpp:72 +msgid "Hide unit" +msgstr "隐藏单位" + +#: qalculateeditunitdialog.cpp:80 +msgid "Class:" +msgstr "类别:" + +#: qalculateeditunitdialog.cpp:83 +msgid "Base Unit" +msgstr "基准单位" + +#: qalculateeditunitdialog.cpp:84 +msgid "Alias" +msgstr "别名" + +#: qalculateeditunitdialog.cpp:85 +msgid "Composite Unit" +msgstr "复合单位" + +#: qalculateeditunitdialog.cpp:92 +msgid "System:" +msgstr "体系:" + +#: qalculateeditunitdialog.cpp:95 +msgid "SI" +msgstr "国际单位制" + +#: qalculateeditunitdialog.cpp:96 +msgid "CGS" +msgstr "CGS" + +#: qalculateeditunitdialog.cpp:97 +msgid "Imperial" +msgstr "英制" + +#: qalculateeditunitdialog.cpp:98 +msgid "US Survey" +msgstr "美制" + +#: qalculateeditunitdialog.cpp:102 +msgid "Relation" +msgstr "关系" + +#: qalculateeditunitdialog.cpp:107 +msgid "Base unit:" +msgstr "基准单位:" + +#: qalculateeditunitdialog.cpp:110 +msgid "Exponent:" +msgstr "指数:" + +#: qalculateeditunitdialog.cpp:114 +msgid "Relation:" +msgstr "关系:" + +#: qalculateeditunitdialog.cpp:121 +msgid "Relation is exact" +msgstr "" + +#: qalculateeditunitdialog.cpp:123 +msgid "Inverse relation:" +msgstr "倒转关系:" + +#: qalculateeditunitdialog.cpp:150 +msgid "" +"A variable or unit with the same name already exists.\n" +"Do you want to overwrite it?" +msgstr "" +"同名的变量或单位已存在。\n" +"您是否要覆盖它?" + +#: qalculateeditunitdialog.cpp:175 qalculateeditunitdialog.cpp:219 +msgid "Base unit does not exist" +msgstr "基准单位不存在" + +#: qalculateeditunitdialog.cpp:289 +msgid "Edit Unit (global)" +msgstr "编辑单位(全局)" + +#: qalculateeditunitdialog.cpp:291 +msgid "New Unit" +msgstr "新单位" + +#: qalculateeditunknownvariabledialog.cpp:58 +msgid "Custom assumptions:" +msgstr "自定义假设:" + +#: qalculateeditunknownvariabledialog.cpp:68 +msgid "Complex Number" +msgstr "复数" + +#: qalculateeditunknownvariabledialog.cpp:69 +msgid "Real Number" +msgstr "实数" + +#: qalculateeditunknownvariabledialog.cpp:70 +msgid "Rational Number" +msgstr "有理数" + +#: qalculateeditunknownvariabledialog.cpp:73 +msgid "Sign" +msgstr "符号" + +#: qalculateeditunknownvariabledialog.cpp:199 +msgid "Edit Unknown Variable" +msgstr "编辑未知数变量" + +#: qalculateeditunknownvariabledialog.cpp:201 +msgid "Edit Unknown Variable (global)" +msgstr "编辑未知数变量(全局)" + +#: qalculateeditunknownvariabledialog.cpp:203 +msgid "New Unknown Variable" +msgstr "新建未知数变量" + +#: qalculateeditvariabledialog.cpp:63 qalculateinsertfunctiondialog.cpp:91 +msgid "Value:" +msgstr "值:" + +#: qalculateeditvariabledialog.cpp:71 +msgid "Value is exact" +msgstr "" + +#: qalculateeditvariabledialog.cpp:110 +msgid "Empty value field" +msgstr "空白值项" + +#: qalculateeditvariabledialog.cpp:182 +msgid "Edit Variable (global)" +msgstr "编辑变量(全局)" + +#: qalculateeditvariabledialog.cpp:185 +msgid "New Variable" +msgstr "新变量" + +#: qalculateexportcsvdialog.cpp:37 qalculateexportcsvdialog.cpp:54 +msgid "Export CSV File" +msgstr "输出CSV文件" + +#: qalculateexportcsvdialog.cpp:42 +msgid "Current result" +msgstr "当前结果" + +#: qalculateexportcsvdialog.cpp:46 +msgid "Matrix/vector variable" +msgstr "矩阵/向量变量" + +#: qalculateexportcsvdialog.cpp:51 qalculateimportcsvdialog.cpp:43 +msgid "File:" +msgstr "文件:" + +#: qalculateexportcsvdialog.cpp:56 qalculateimportcsvdialog.cpp:80 +msgid "Delimiter:" +msgstr "分隔符:" + +#: qalculateexportcsvdialog.cpp:59 qalculateimportcsvdialog.cpp:83 +msgid "Comma" +msgstr "逗号" + +#: qalculateexportcsvdialog.cpp:60 qalculateimportcsvdialog.cpp:84 +msgid "Tabulator" +msgstr "制表符" + +#: qalculateexportcsvdialog.cpp:61 qalculateimportcsvdialog.cpp:85 +msgid "Semicolon" +msgstr "分号" + +#: qalculateexportcsvdialog.cpp:62 qalculateimportcsvdialog.cpp:86 +msgid "Space" +msgstr "空格" + +#: qalculateexportcsvdialog.cpp:63 qalculateimportcsvdialog.cpp:87 +msgid "Other" +msgstr "其它" + +#: qalculateexportcsvdialog.cpp:93 qalculateimportcsvdialog.cpp:116 +msgid "No file name entered." +msgstr "未输入文件名。" + +#: qalculateexportcsvdialog.cpp:122 qalculateimportcsvdialog.cpp:145 +msgid "No delimiter selected." +msgstr "未选择分隔符" + +#: qalculateexportcsvdialog.cpp:135 +msgid "No variable name entered." +msgstr "未输入变量名" + +#: qalculateexportcsvdialog.cpp:147 +msgid "No known variable with entered name found." +msgstr "未能找到指定名称的变量" + +#: qalculateexportcsvdialog.cpp:154 +#, c-format +msgid "" +"Could not export to file \n" +"%s" +msgstr "" +"无法导出到文件\n" +"%s" + +#: qalculateexpressionedit.cpp:146 +msgid "Disable Completion" +msgstr "停用自动完成" + +#: qalculateexpressionedit.cpp:147 +msgid "Enable Completion" +msgstr "启用自动完成" + +#. i18n: file ./qalculate_kdeui.rc line 154 +#: qalculateexpressionedit.cpp:161 qalculateresultdisplay.cpp:333 rc.cpp:48 +#, no-c-format +msgid "Meta Modes" +msgstr "元模式" + +#: qalculateexpressionedit.cpp:639 qalculatevariablesdialog.cpp:366 +msgid "a previous result" +msgstr "之前的结果" + +#: qalculateexpressionedit.cpp:645 qalculatevariablesdialog.cpp:376 +msgid "matrix" +msgstr "矩阵" + +#: qalculateexpressionedit.cpp:647 qalculatevariablesdialog.cpp:378 +msgid "vector" +msgstr "向量" + +#: qalculateexpressionedit.cpp:656 qalculatevariablesdialog.cpp:387 +msgid "positive" +msgstr "正数" + +#: qalculateexpressionedit.cpp:660 qalculatevariablesdialog.cpp:391 +msgid "non-positive" +msgstr "非正" + +#: qalculateexpressionedit.cpp:664 qalculatevariablesdialog.cpp:395 +msgid "negative" +msgstr "负数" + +#: qalculateexpressionedit.cpp:668 qalculatevariablesdialog.cpp:399 +msgid "non-negative" +msgstr "非负" + +#: qalculateexpressionedit.cpp:672 qalculatevariablesdialog.cpp:403 +msgid "non-zero" +msgstr "非零" + +#: qalculateexpressionedit.cpp:680 qalculatevariablesdialog.cpp:412 +msgid "integer" +msgstr "整数" + +#: qalculateexpressionedit.cpp:684 qalculatevariablesdialog.cpp:416 +msgid "rational" +msgstr "有理数" + +#: qalculateexpressionedit.cpp:688 qalculatevariablesdialog.cpp:420 +msgid "real" +msgstr "实数" + +#: qalculateexpressionedit.cpp:692 qalculatevariablesdialog.cpp:424 +msgid "complex" +msgstr "复数" + +#: qalculateexpressionedit.cpp:700 qalculatevariablesdialog.cpp:432 +msgid "(not matrix)" +msgstr "(非矩阵)" + +#: qalculateexpressionedit.cpp:705 qalculatevariablesdialog.cpp:438 +msgid "unknown" +msgstr "未知" + +#: qalculateexpressionedit.cpp:707 qalculatevariablesdialog.cpp:440 +msgid "default assumptions" +msgstr "缺省假设" + +#: qalculatefunctionsdialog.cpp:47 +msgid "Functions" +msgstr "函数" + +#: qalculatefunctionsdialog.cpp:59 +msgid "Function Name" +msgstr "函数名" + +#: qalculatefunctionsdialog.cpp:75 qalculatefunctionsdialog.cpp:313 +#: qalculateunitsdialog.cpp:99 qalculateunitsdialog.cpp:352 +#: qalculatevariablesdialog.cpp:74 qalculatevariablesdialog.cpp:349 +msgid "Deactivate" +msgstr "停止" + +#: qalculatefunctionsdialog.cpp:174 qalculatefunctionsdialog.cpp:175 +#: qalculatefunctionsdialog.cpp:176 qalculatefunctionsdialog.cpp:234 +#: qalculatefunctionsdialog.cpp:260 qalculatefunctionsdialog.cpp:283 +#: qalculatefunctionsdialog.cpp:509 qalculateunitsdialog.cpp:206 +#: qalculateunitsdialog.cpp:207 qalculateunitsdialog.cpp:208 +#: qalculateunitsdialog.cpp:271 qalculateunitsdialog.cpp:297 +#: qalculateunitsdialog.cpp:320 qalculateunitsdialog.cpp:420 +#: qalculatevariablesdialog.cpp:174 qalculatevariablesdialog.cpp:175 +#: qalculatevariablesdialog.cpp:176 qalculatevariablesdialog.cpp:256 +#: qalculatevariablesdialog.cpp:282 qalculatevariablesdialog.cpp:320 +#: qalculatevariablesdialog.cpp:466 +msgid "Inactive" +msgstr "不活动的" + +#: qalculatefunctionsdialog.cpp:315 qalculateunitsdialog.cpp:354 +#: qalculatevariablesdialog.cpp:351 +msgid "Activate" +msgstr "激活" + +#: qalculatefunctionsdialog.cpp:367 qalculateresultdisplay.cpp:148 +#, c-format +msgid "" +"Retrieves data from the %s data set for a given object and property. If " +"\"info\" is typed as property, a dialog window will pop up with all " +"properties of the object." +msgstr "" +"为给定的对象和属性从数据集%s中提取数据。如果\"信息\"作为属性被输入, " +"将会弹出一个对话框显示对象的全部属性。" + +#: qalculatefunctionsdialog.cpp:391 +msgid "Arguments" +msgstr "自变量" + +#: qalculatefunctionsdialog.cpp:412 qalculateinsertfunctiondialog.cpp:194 +#: qalculateinsertfunctiondialog.cpp:227 +msgid "optional" +msgstr "可选的" + +#: qalculatefunctionsdialog.cpp:416 +msgid "default: " +msgstr "缺省:" + +#: qalculatefunctionsdialog.cpp:426 +msgid "Requirement" +msgstr "要求" + +#: qalculateimportcsvdialog.cpp:39 qalculateimportcsvdialog.cpp:46 +msgid "Import CSV File" +msgstr "导入CSV文件" + +#: qalculateimportcsvdialog.cpp:48 +msgid "Import as:" +msgstr "导入为:" + +#: qalculateimportcsvdialog.cpp:71 +msgid "First row:" +msgstr "第一行:" + +#: qalculateimportcsvdialog.cpp:77 +msgid "Includes headings" +msgstr "包括标题" + +#: qalculateimportcsvdialog.cpp:149 +msgid "An error occured when importing the CSV file." +msgstr "导入CSV文件时出错" + +#: qalculateinsertfunctiondialog.cpp:50 qalculateinsertfunctiondialog.cpp:57 +msgid "Execute" +msgstr "执行" + +#: qalculateinsertfunctiondialog.cpp:93 +msgid "Argument" +msgstr "自变量" + +#: qalculateinsertfunctiondialog.cpp:152 +msgid "True" +msgstr "真" + +#: qalculateinsertfunctiondialog.cpp:153 +msgid "False" +msgstr "假" + +#: qalculateinsertfunctiondialog.cpp:184 +msgid "Info" +msgstr "信息" + +#: qalculateinsertmatrixvectordialog.cpp:71 +msgid "Insert Selection" +msgstr "插入所选内容" + +#: qalculateinsertmatrixvectordialog.cpp:293 +msgid "Vector Result" +msgstr "向量结果" + +#: qalculateinsertmatrixvectordialog.cpp:295 +msgid "Matrix Result" +msgstr "矩阵结果" + +#: qalculateperiodictabledialog.cpp:195 +msgid "Element Data" +msgstr "元素数据" + +#: qalculateperiodictabledialog.cpp:221 +msgid "Classification" +msgstr "分类" + +#: qalculateperiodictabledialog.cpp:224 +msgid "Alkali Metal" +msgstr "碱金属" + +#: qalculateperiodictabledialog.cpp:225 +msgid "Alkaline-Earth Metal" +msgstr "碱土金属" + +#: qalculateperiodictabledialog.cpp:226 +msgid "Lanthanide" +msgstr "镧系元素" + +#: qalculateperiodictabledialog.cpp:227 +msgid "Actinide" +msgstr "锕系元素" + +#: qalculateperiodictabledialog.cpp:228 +msgid "Transition Metal" +msgstr "过渡金属元素" + +#: qalculateperiodictabledialog.cpp:229 +msgid "Metal" +msgstr "金属" + +#: qalculateperiodictabledialog.cpp:230 +msgid "Metalloid" +msgstr "半金属元素" + +#: qalculateperiodictabledialog.cpp:231 +msgid "Non-Metal" +msgstr "非金属" + +#: qalculateperiodictabledialog.cpp:232 +msgid "Halogen" +msgstr "卤素" + +#: qalculateperiodictabledialog.cpp:233 +msgid "Noble Gas" +msgstr "惰性气体" + +#: qalculateperiodictabledialog.cpp:234 +msgid "Transactinide" +msgstr "锕系后元素" + +#: qalculateplotdialog.cpp:64 +msgid "Plot" +msgstr "绘图" + +#: qalculateplotdialog.cpp:82 +msgid "Data" +msgstr "数据" + +#: qalculateplotdialog.cpp:83 +msgid "Function Range" +msgstr "函数范围" + +#: qalculateplotdialog.cpp:101 +msgid "Vector/matrix" +msgstr "向量/矩阵" + +#: qalculateplotdialog.cpp:104 +msgid "Paired matrix" +msgstr "" + +#: qalculateplotdialog.cpp:107 +msgid "Rows" +msgstr "行" + +#: qalculateplotdialog.cpp:109 +msgid "X variable:" +msgstr "X轴变量" + +#: qalculateplotdialog.cpp:113 +msgid "Style:" +msgstr "样式:" + +#: qalculateplotdialog.cpp:115 +msgid "Line" +msgstr "线条" + +#: qalculateplotdialog.cpp:116 +msgid "Points" +msgstr "点" + +#: qalculateplotdialog.cpp:117 +msgid "Line with points" +msgstr "点和线" + +#: qalculateplotdialog.cpp:118 +msgid "Boxes/bars" +msgstr "箱形图/柱状图" + +#: qalculateplotdialog.cpp:119 +msgid "Histogram" +msgstr "直方图" + +#: qalculateplotdialog.cpp:120 +msgid "Steps" +msgstr "步骤" + +#: qalculateplotdialog.cpp:121 +msgid "Candlesticks" +msgstr "" + +#: qalculateplotdialog.cpp:122 +msgid "Dots" +msgstr "" + +#: qalculateplotdialog.cpp:124 +msgid "Smoothing:" +msgstr "平滑" + +#: qalculateplotdialog.cpp:127 +msgid "Monotonic" +msgstr "单调的" + +#: qalculateplotdialog.cpp:128 +msgid "Natural cubic splines" +msgstr "自然三次样条曲线" + +#: qalculateplotdialog.cpp:129 +msgid "Bezier" +msgstr "贝赛尔曲线" + +#: qalculateplotdialog.cpp:130 +msgid "Bezier (monotonic)" +msgstr "贝赛尔曲线(单调的)" + +#: qalculateplotdialog.cpp:132 +msgid "Y-axis:" +msgstr "Y轴:" + +#: qalculateplotdialog.cpp:136 +msgid "Primary" +msgstr "主" + +#: qalculateplotdialog.cpp:139 +msgid "Secondary" +msgstr "从" + +#: qalculateplotdialog.cpp:171 +msgid "Sampling rate:" +msgstr "采样率:" + +#: qalculateplotdialog.cpp:176 +msgid "Step size:" +msgstr "步长:" + +#: qalculateplotdialog.cpp:194 +msgid "Display grid" +msgstr "显示网格" + +#: qalculateplotdialog.cpp:196 +msgid "Display full border" +msgstr "显示完整边界" + +#: qalculateplotdialog.cpp:199 +msgid "Logarithmic x scale:" +msgstr "对数X轴刻度" + +#: qalculateplotdialog.cpp:203 +msgid "Logarithmic y scale:" +msgstr "对数Y轴刻度" + +#: qalculateplotdialog.cpp:207 +msgid "X-axis label:" +msgstr "X轴标签" + +#: qalculateplotdialog.cpp:210 +msgid "Y-axis label:" +msgstr "Y轴标签" + +#: qalculateplotdialog.cpp:213 +msgid "Color display:" +msgstr "颜色显示:" + +#: qalculateplotdialog.cpp:217 +msgid "Color" +msgstr "彩色" + +#: qalculateplotdialog.cpp:220 +msgid "Monochrome" +msgstr "单色" + +#: qalculateplotdialog.cpp:224 +msgid "Legend placement:" +msgstr "图例布置:" + +#: qalculateplotdialog.cpp:227 +msgid "Top-left" +msgstr "左上角" + +#: qalculateplotdialog.cpp:228 +msgid "Top-right" +msgstr "右上角" + +#: qalculateplotdialog.cpp:229 +msgid "Bottom-left" +msgstr "左下角" + +#: qalculateplotdialog.cpp:230 +msgid "Bottom-right" +msgstr "右下角" + +#: qalculateplotdialog.cpp:231 +msgid "Below" +msgstr "下方" + +#: qalculateplotdialog.cpp:232 +msgid "Outside" +msgstr "外面" + +#: qalculateplotdialog.cpp:403 qalculateplotdialog.cpp:458 +#: qalculateplotdialog.cpp:506 +msgid "Empty expression." +msgstr "空白表达式。" + +#: qalculateplotdialog.cpp:472 qalculateplotdialog.cpp:519 +msgid "Empty x variable." +msgstr "空白X轴变量。" + +#: qalculateprecisiondialog.cpp:34 qalculateprecisiondialog.cpp:36 +msgid "Recalculate" +msgstr "重新计算" + +#: qalculateprecisiondialog.cpp:41 +msgid "Precision:" +msgstr "精度:" + +#: qalculatepreferencesdialog.cpp:100 +msgid "Choose..." +msgstr "选择..." + +#: qalculatepreferencesdialog.cpp:147 +msgid "Preferences" +msgstr "偏好设置" + +#: qalculatepreferencesdialog.cpp:161 +msgid "Close to system tray" +msgstr "关闭到系统托盘" + +#: qalculatepreferencesdialog.cpp:162 +msgid "If the application will reside in the system tray when the window is closed" +msgstr "当关闭窗口时,程序是否驻留到系统托盘中。" + +#: qalculatepreferencesdialog.cpp:164 +msgid "Display expression status" +msgstr "显示表达式状态" + +#: qalculatepreferencesdialog.cpp:165 +msgid "" +"If as-you-type expression status shall be displayed below the expression " +"entry" +msgstr "在您输入表达式,是否在表达式项下方实时显示表达式状态" + +#: qalculatepreferencesdialog.cpp:167 +msgid "Use icon buttons" +msgstr "使用图标按钮" + +#: qalculatepreferencesdialog.cpp:168 +msgid "" +"Use icons instead of text on the top-right buttons. The third state uses the " +"style setting for icons on buttons." +msgstr "在右上方的按钮中,使用图标代替文字说明。第三个状态为按钮使用图标的样式设置。" + +#: qalculatepreferencesdialog.cpp:171 +msgid "Update exchange rates on start" +msgstr "在启动时更新汇率。" + +#: qalculatepreferencesdialog.cpp:172 +msgid "" +"If current exchange rates shall be downloaded from the internet at program " +"start" +msgstr "在程序启动时是否自动下载最新的汇率。" + +#: qalculatepreferencesdialog.cpp:174 +msgid "Save mode on exit" +msgstr "退出时保存模式" + +#: qalculatepreferencesdialog.cpp:175 +msgid "If the mode of the calculator shall be restored" +msgstr "是否自动恢复计算器的模式" + +#: qalculatepreferencesdialog.cpp:177 +msgid "Save definitions on exit" +msgstr "在退出时保存定义" + +#: qalculatepreferencesdialog.cpp:178 +msgid "If changes to functions, units and variables shall be saved automatically" +msgstr "是否自动保存对函数、单位和变量的改动。" + +#: qalculatepreferencesdialog.cpp:180 +msgid "Use only keypad keys for RPN" +msgstr "在逆波兰范式中只使用小键盘键" + +#: qalculatepreferencesdialog.cpp:181 +msgid "" +"Use only keypad keys for RPN operations (+-*/^) and use the rest of the " +"keyboard for expression entry" +msgstr "在逆波兰范式中只使用小键盘键输入运算符(+-*/^),使用其它键作为表达式输入项。" + +#: qalculatepreferencesdialog.cpp:183 +msgid "Ignores dots in numbers" +msgstr "忽略数字中的点" + +#: qalculatepreferencesdialog.cpp:184 +msgid "" +"Allow dots, '.', to be used as thousands separator instead of as an " +"alternative to decimal sign" +msgstr "允许在数字中使用点(\".\")作为千位分隔符" + +#: qalculatepreferencesdialog.cpp:187 +msgid "Enable unicode signs" +msgstr "启用unicode符号" + +#: qalculatepreferencesdialog.cpp:188 +msgid "Disable this if you have problems with some fancy characters" +msgstr "如果某些字符无法正确显示,请关闭此项" + +#: qalculatepreferencesdialog.cpp:190 +msgid "Use lower case in numbers" +msgstr "在数字中使用小写字母" + +#: qalculatepreferencesdialog.cpp:191 +msgid "If lower case letters should be used in numbers with non-decimal base" +msgstr "在表示非十进制数字时是否应该使用小写字母" + +#: qalculatepreferencesdialog.cpp:193 +msgid "Use lower case \"e\"" +msgstr "使用小写的\"e\"" + +#: qalculatepreferencesdialog.cpp:194 +msgid "If \"e\"; shall be used instead of \"E\" in numbers" +msgstr "在数字中是否用\"e\"代替\"E\"" + +#: qalculatepreferencesdialog.cpp:196 +msgid "Alternative base prefixes" +msgstr "切换进制前缀" + +#: qalculatepreferencesdialog.cpp:197 +msgid "" +"If hexadecimal numbers shall be displayed with \"0x0\" and binary numbers " +"with \"0b00\" as prefixes" +msgstr "十六进制和二进制数是否以\"0x0\"和\"0b00\"的格式显示" + +#: qalculatepreferencesdialog.cpp:199 +msgid "Spell out logical operators" +msgstr "拼写出逻辑运算符" + +#: qalculatepreferencesdialog.cpp:200 +msgid "If logical and/or shall be displayed as \"&&\"/\"||\" or \"and\"/\"or\"" +msgstr "逻辑\"与\"/\"或\"应该被表示为\"&&\"/\"||\"还是\"and\"/\"or\"。" + +#: qalculatepreferencesdialog.cpp:203 +msgid "Multiplication sign:" +msgstr "乘号:" + +#: qalculatepreferencesdialog.cpp:215 +msgid "Division sign:" +msgstr "除号:" + +#: qalculatepreferencesdialog.cpp:230 +msgid "Custom result font" +msgstr "自定义结果色:" + +#: qalculatepreferencesdialog.cpp:234 +msgid "Custom expression font" +msgstr "自定义表达式色:" + +#: qalculatepreferencesdialog.cpp:238 +msgid "Custom status font" +msgstr "自定义状态色:" + +#: qalculatepreferencesdialog.cpp:243 +msgid "Status error color:" +msgstr "状态错误色:" + +#: qalculatepreferencesdialog.cpp:250 +msgid "Status warning color:" +msgstr "状态警告色:" + +#: qalculateresultdisplay.cpp:52 +msgid "a matrix" +msgstr "一个矩阵" + +#: qalculateresultdisplay.cpp:54 +msgid "a vector" +msgstr "一个向量" + +#: qalculateresultdisplay.cpp:57 +msgid "double-click to view/edit" +msgstr "双击以查看/编辑" + +#: qalculateresultdisplay.cpp:60 +msgid "Unknown variable" +msgstr "未知数变量" + +#: qalculateresultdisplay.cpp:72 +msgid "Prefix" +msgstr "前缀" + +#: qalculateresultdisplay.cpp:336 +msgid "Show Parsed Expression" +msgstr "显示已解析的表达式" + +#: qalculateresultdisplay.cpp:342 qalculateresultdisplay.cpp:353 +msgid "Show Object Info" +msgstr "显示对象信息" + +#: qalculateresultdisplay.cpp:348 +msgid "View/Edit Matrix" +msgstr "查看/编辑矩阵" + +#: qalculateresultdisplay.cpp:350 +msgid "View/Edit Vector" +msgstr "查看/编辑向量" + +#: qalculateresultdisplay.cpp:382 +msgid "Parsed expression:" +msgstr "已解析表达式:" + +#: qalculatesetbasedialog.cpp:33 +msgid "Result Base" +msgstr "结果进制" + +#: qalculatesetbasedialog.cpp:39 qalculatesetbasedialog.cpp:52 +msgid "Other:" +msgstr "其它:" + +#: qalculatesetbasedialog.cpp:43 +msgid "Time format" +msgstr "日期格式" + +#: qalculatesetbasedialog.cpp:44 qalculatesetbasedialog.cpp:55 +msgid "Roman numerals" +msgstr "罗马数字" + +#: qalculatesetbasedialog.cpp:46 +msgid "Expression Base" +msgstr "表达式进制" + +#: qalculateunitsdialog.cpp:54 +msgid "Units" +msgstr "单位" + +#: qalculateunitsdialog.cpp:68 +msgid "Names" +msgstr "名称" + +#: qalculateunitsdialog.cpp:69 +msgid "Base" +msgstr "进制" + +#: qalculateunitsdialog.cpp:72 +msgid "Conversion" +msgstr "换算" + +#: qalculateunitsdialog.cpp:105 +msgid "Convert Result" +msgstr "换算结果" + +#: qalculateunitsdialog.cpp:250 +msgid "Cannot delete unit as it is needed by other units." +msgstr "无法删除此单位,因为它被别的单位引用了。" + +#: qalculatevariablesdialog.cpp:51 +msgid "Variables" +msgstr "变量" + +#: qalculatevariablesdialog.cpp:60 +msgid "Variable Name" +msgstr "变量名" + +#. i18n: file ./qalculate_kdeui.rc line 5 +#: rc.cpp:6 +#, no-c-format +msgid "&New" +msgstr "新建(&N)" + +#. i18n: file ./qalculate_kdeui.rc line 37 +#: rc.cpp:12 +#, no-c-format +msgid "&Set Prefix" +msgstr "设定前缀(&S)" + +#. i18n: file ./qalculate_kdeui.rc line 39 +#: rc.cpp:15 +#, no-c-format +msgid "&Convert To Unit" +msgstr "换算成单位(&C)" + +#. i18n: file ./qalculate_kdeui.rc line 54 +#: rc.cpp:18 +#, no-c-format +msgid "&Mode" +msgstr "模式(&M)" + +#. i18n: file ./qalculate_kdeui.rc line 55 +#: rc.cpp:21 +#, no-c-format +msgid "Number Base" +msgstr "数字进制" + +#. i18n: file ./qalculate_kdeui.rc line 67 +#: rc.cpp:24 +#, no-c-format +msgid "Numerical Display" +msgstr "数字显示" + +#. i18n: file ./qalculate_kdeui.rc line 80 +#: rc.cpp:27 +#, no-c-format +msgid "Fractional Display" +msgstr "分数显示" + +#. i18n: file ./qalculate_kdeui.rc line 86 +#: rc.cpp:30 +#, no-c-format +msgid "Unit Display" +msgstr "单位显示" + +#. i18n: file ./qalculate_kdeui.rc line 96 +#: rc.cpp:33 +#, no-c-format +msgid "Angle Unit" +msgstr "角度单位" + +#. i18n: file ./qalculate_kdeui.rc line 104 +#: rc.cpp:36 +#, no-c-format +msgid "Enabled Objects" +msgstr "启用对象" + +#. i18n: file ./qalculate_kdeui.rc line 121 +#: rc.cpp:42 +#, no-c-format +msgid "Assumptions" +msgstr "假设" + +#. i18n: file ./qalculate_kdeui.rc line 137 +#: rc.cpp:45 +#, no-c-format +msgid "Algebraic Mode" +msgstr "代数模式" + +#. i18n: file ./qalculate_kdeui.rc line 161 +#: rc.cpp:51 +#, no-c-format +msgid "Fu&nctions" +msgstr "函数(&n)" + +#. i18n: file ./qalculate_kdeui.rc line 163 +#: rc.cpp:54 +#, no-c-format +msgid "&Variables" +msgstr "变量(&V)" + +#. i18n: file ./qalculate_kdeui.rc line 165 +#: rc.cpp:57 +#, no-c-format +msgid "&Units" +msgstr "单位(&U)" + diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..c5991ba --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,58 @@ +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project + + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/qalculate_kde.pot + +KDE_ICON = AUTO + +######################################################################### +# APPLICATION SECTION +######################################################################### +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = qalculate-kde + +# the application source, library search path, and link libraries +qalculate_kde_SOURCES = buttonwithindexsignal.cpp kqalculate.cpp \ + main.cpp preferences.cpp qalculatebuttonwithdata.cpp qalculateconvertnumberbasesdialog.cpp \ + qalculateconvertunitsdialog.cpp qalculatedatasetsdialog.cpp qalculatedecimalsdialog.cpp qalculateeditdataobjectdialog.cpp \ + qalculateeditdatasetdialog.cpp qalculateeditfunctiondialog.cpp qalculateeditmatrixvectordialog.cpp qalculateeditnamesdialog.cpp \ + qalculateeditunitdialog.cpp qalculateeditunknownvariabledialog.cpp qalculateeditvariabledialog.cpp qalculateexportcsvdialog.cpp \ + qalculateexpressionedit.cpp qalculatefunctionsdialog.cpp qalculateimportcsvdialog.cpp qalculateinsertfunctiondialog.cpp \ + qalculateinsertmatrixvectordialog.cpp qalculate_kde_utils.cpp qalculateperiodictabledialog.cpp qalculateplotdialog.cpp \ + qalculateprecisiondialog.cpp qalculatepreferencesdialog.cpp qalculatesetbasedialog.cpp \ + qalculateunitsdialog.cpp qalculatevariablesdialog.cpp qalculateresultdisplay.cpp + +qalculate_kde_LDFLAGS = $(KDE_RPATH) $(all_libraries) +qalculate_kde_LDADD = $(LIB_KDEUI) $(LIB_KIO) + +# this is where the desktop file will go +shelldesktopdir = $(xdg_appsdir) +shelldesktop_DATA = qalculate_kde.desktop + +# this is where the shell's XML-GUI resource file goes +shellrcdir = $(kde_datadir)/qalculate_kde +shellrc_DATA = qalculate_kdeui.rc + + +noinst_HEADERS = preferences.h qalculateinsertfunctiondialog.h qalculateinsertmatrixvectordialog.h \ + buttonwithindexsignal.h qalculateexpressionedit.h qalculateconvertnumberbasesdialog.h \ + qalculatebuttonwithdata.h qalculatesetbasedialog.h \ + qalculatevariablesdialog.h qalculatefunctionsdialog.h qalculateunitsdialog.h \ + qalculateeditunknownvariabledialog.h qalculatedecimalsdialog.h qalculateconvertunitsdialog.h \ + qalculateprecisiondialog.h qalculateeditunitdialog.h qalculateeditnamesdialog.h \ + qalculateeditfunctiondialog.h qalculateplotdialog.h qalculateimportcsvdialog.h \ + qalculateexportcsvdialog.h qalculatepreferencesdialog.h qalculateeditmatrixvectordialog.h \ + qalculatedatasetsdialog.h qalculateeditdatasetdialog.h qalculateeditdataobjectdialog.h \ + qalculateresultdisplay.h + +install-exec-local: + cd $(DESTDIR)$(bindir) && rm -f qalculate; $(LN_S) qalculate-kde qalculate diff --git a/src/buttonwithindexsignal.cpp b/src/buttonwithindexsignal.cpp new file mode 100644 index 0000000..34fe66e --- /dev/null +++ b/src/buttonwithindexsignal.cpp @@ -0,0 +1,31 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "buttonwithindexsignal.h" + +ButtonWithIndexSignal::ButtonWithIndexSignal(const QString & text, int index, QWidget *parent, const char *name) : QPushButton(text, parent, name) { + i = index; + connect(this, SIGNAL(clicked()), this, SLOT(emitClickedWithIndex())); +} +ButtonWithIndexSignal::~ButtonWithIndexSignal() {} +void ButtonWithIndexSignal::emitClickedWithIndex() { + emit clickedWithIndex(i); +} + +#include "buttonwithindexsignal.moc" diff --git a/src/buttonwithindexsignal.h b/src/buttonwithindexsignal.h new file mode 100644 index 0000000..0c0fcfe --- /dev/null +++ b/src/buttonwithindexsignal.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef BUTTONWITHINDEXSIGNAL_H +#define BUTTONWITHINDEXSIGNAL_H + +#include + +class ButtonWithIndexSignal : public QPushButton { + Q_OBJECT + +public: + ButtonWithIndexSignal(const QString & text, int index, QWidget *parent = 0, const char *name = 0); + virtual ~ButtonWithIndexSignal(); + int i; +public slots: + void emitClickedWithIndex(); +signals: + void clickedWithIndex(int); + +}; + +#endif diff --git a/src/hi128-app-qalculate_kde.png b/src/hi128-app-qalculate_kde.png new file mode 100644 index 0000000..133985c Binary files /dev/null and b/src/hi128-app-qalculate_kde.png differ diff --git a/src/hi16-app-qalculate_kde.png b/src/hi16-app-qalculate_kde.png new file mode 100644 index 0000000..0a46460 Binary files /dev/null and b/src/hi16-app-qalculate_kde.png differ diff --git a/src/hi22-app-qalculate_kde.png b/src/hi22-app-qalculate_kde.png new file mode 100644 index 0000000..c3d3fe1 Binary files /dev/null and b/src/hi22-app-qalculate_kde.png differ diff --git a/src/hi32-action-qalculate_convert.png b/src/hi32-action-qalculate_convert.png new file mode 100644 index 0000000..e032855 Binary files /dev/null and b/src/hi32-action-qalculate_convert.png differ diff --git a/src/hi32-app-qalculate_kde.png b/src/hi32-app-qalculate_kde.png new file mode 100644 index 0000000..8fc50d3 Binary files /dev/null and b/src/hi32-app-qalculate_kde.png differ diff --git a/src/hi48-app-qalculate_kde.png b/src/hi48-app-qalculate_kde.png new file mode 100644 index 0000000..fdde4fc Binary files /dev/null and b/src/hi48-app-qalculate_kde.png differ diff --git a/src/hi64-app-qalculate_kde.png b/src/hi64-app-qalculate_kde.png new file mode 100644 index 0000000..0c6adbf Binary files /dev/null and b/src/hi64-app-qalculate_kde.png differ diff --git a/src/kqalculate.cpp b/src/kqalculate.cpp new file mode 100644 index 0000000..ce0ac09 --- /dev/null +++ b/src/kqalculate.cpp @@ -0,0 +1,6676 @@ +/*************************************************************************** + * Copyright (C) 2005-2007 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "kqalculate.h" +#include "qalculateinsertfunctiondialog.h" +#include "qalculate_kde_utils.h" +#include "preferences.h" +#include "qalculatepreferencesdialog.h" +#include "qalculateimportcsvdialog.h" +#include "qalculateexportcsvdialog.h" +#include "qalculateexpressionedit.h" +#include "qalculateprecisiondialog.h" +#include "qalculatedecimalsdialog.h" +#include "qalculateeditvariabledialog.h" +#include "qalculateeditmatrixvectordialog.h" +#include "qalculateeditunitdialog.h" +#include "qalculateeditfunctiondialog.h" +#include "qalculateeditdatasetdialog.h" +#include "qalculateeditunknownvariabledialog.h" +#include "qalculatevariablesdialog.h" +#include "qalculatefunctionsdialog.h" +#include "qalculateunitsdialog.h" +#include "qalculatedatasetsdialog.h" +#include "qalculateconvertunitsdialog.h" +#include "qalculateconvertnumberbasesdialog.h" +#include "qalculateperiodictabledialog.h" +#include "qalculateplotdialog.h" +#include "qalculatesetbasedialog.h" +#include "qalculateinsertmatrixvectordialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "qalculateresultdisplay.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR > 1 +#include +#endif +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR >= 4 +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR >= 2 +#include +#endif +#include +#include +#include +#include +#include +#include + +MathStructure *mstruct, *matrix_mstruct, *parsed_mstruct, *parsed_tostruct; +QString result_text, result_history_text, parsed_text; +QWidget *expressionWidget, *resultWidget, *statusWidget_l; +QWidget *topWidget; +KQalculate *mainWin = 0; +bool prev_result_approx; +extern bool close_to_systray; +extern bool display_expression_status; +extern QColor status_error_color; +extern QColor status_warning_color; +extern int use_icon_buttons; +extern bool enable_expression_completion; + +extern QString initial_history; +extern tree_struct function_cats, unit_cats, variable_cats; +extern vector ia_units, ia_variables, ia_functions; +extern vector recent_functions; +extern vector recent_variables; +extern vector recent_units; +vector result_parts; + +KnownVariable *vans[5]; +int vans_id_start[5]; +int vans_id_end[5]; + +extern PrintOptions printops; +extern EvaluationOptions evalops; +extern bool rpn_mode, rpn_keypad_only; +extern bool save_mode_on_exit, save_defs_on_exit; + +extern bool canplot; + +extern bool use_custom_result_font, use_custom_expression_font, use_custom_status_font; +extern QString custom_result_font, custom_expression_font, custom_status_font; + +extern QTimer *error_timer; + +extern QStringList expression_history; + +bool expression_has_changed, expression_has_changed2, had_errors_before, had_warnings_before, block_result_update; + +FILE *view_pipe_r, *view_pipe_w, *command_pipe_r, *command_pipe_w; +pthread_t view_thread, command_thread; +pthread_attr_t view_thread_attr, command_thread_attr; +bool b_busy, command_thread_started; +int saved_divisionline_height = 0; +uint initial_result_index = 0; + +extern bool show_keypad, show_history, show_stack; + +extern vector modes; + +extern QValueVector inhistory; +extern QValueVector inhistory_type; +extern QValueVector inhistory_id; +extern int inhistory_current_id; +int initial_inhistory_index = 0; + +const MathStructure *KQalculate::getResultPart(int i) { + if(i < 1 || (size_t) i > result_parts.size()) return NULL; + return &result_parts[(size_t) i - 1]; +} + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 +#include +#include +QPixmap loadSystrayIcon(const QString &icon) { + KConfig *appCfg = kapp->config(); + KConfigGroupSaver configSaver(appCfg, "System Tray"); + int iconWidth = appCfg->readNumEntry("systrayIconWidth", 22); + return KGlobal::instance()->iconLoader()->loadIcon(icon, KIcon::Panel, iconWidth); +} +#endif + +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR >= 3 +#define ICON_SIZE_SMALL_MEDIUM KIcon::SizeSmallMedium +#else +#define ICON_SIZE_SMALL_MEDIUM 22 +#endif + +ModeObject::ModeObject(int mode) : i_mode(mode) {} +void ModeObject::loadMode() { + mainWin->loadMode(i_mode); +} + +KQalculate::KQalculate(KUniqueApplication *parent, const char* name, WFlags fl) : KMainWindow(0, name, fl) { + + if(!name) setName("kqalculate"); + + m_parent = parent; + + vans_id_start[0] = -1; + vans_id_end[0] = -1; + vans_id_start[1] = -1; + vans_id_end[1] = -1; + vans_id_start[2] = -1; + vans_id_end[2] = -1; + vans_id_start[3] = -1; + vans_id_end[3] = -1; + vans_id_start[4] = -1; + vans_id_end[4] = -1; + + QStyleSheet::setDefaultSheet(new QalculateStyleSheet()); + + insert_matrix_dialog = NULL; + preferences_dialog = NULL; + precisionDialog = NULL; + decimalsDialog = NULL; + variable_edit_dialog = NULL; + store_dialog = NULL; + matrix_edit_dialog = NULL; + import_csv_dialog = NULL; + export_csv_dialog = NULL; + unit_edit_dialog = NULL; + function_edit_dialog = NULL; + dataset_edit_dialog = NULL; + unknown_edit_dialog = NULL; + variables_dialog = NULL; + functions_dialog = NULL; + units_dialog = NULL; + datasets_dialog = NULL; + convert_to_unit_expression_dialog = NULL; + convert_number_bases_dialog = NULL; + periodic_table_dialog = NULL; + plot_dialog = NULL; + set_base_dialog = NULL; + + prev_result_approx = false; + expression_has_changed = false; + expression_has_changed2 = false; + had_errors_before = false; + had_warnings_before = false; + block_result_update = false; + + history_height = 0; + + trayicon = NULL; + ActionHideSystemTrayIcon = new KAction(i18n("Remove from System Tray"), "hidesystemtrayicon", 0, this, SLOT(hideSystemTrayIcon()), actionCollection(), "hide_system_tray_icon"); + ActionHide = new KAction(i18n("Hide"), "hide", 0, this, SLOT(hide()), actionCollection(), "hide"); + showSystemTrayIcon(close_to_systray); + + setCentralWidget(new QWidget(this)); + QVBoxLayout *mainLayout = new QVBoxLayout(centralWidget(), 11, 6); + mainLayout->setResizeMode(QLayout::Minimum); + + QHBoxLayout *topLayout = new QHBoxLayout(0, 0, 6); + + bool use_button_pixmaps = false; + if(use_icon_buttons > 0) { + use_button_pixmaps = true; + } else if(use_icon_buttons < 0) { + KConfig config("kdeglobals", true, false); + config.setGroup("KDE"); + use_button_pixmaps = config.readBoolEntry("ShowIconsOnPushButtons", false); + } + + if(use_button_pixmaps) leftButtonsLayout = new QVBoxLayout(0, 0, 3); + else leftButtonsLayout = new QVBoxLayout(0, 0, 6); + if(use_button_pixmaps) executeButton = new QalculateButton(KApplication::kApplication()->iconLoader()->loadIconSet("exec", KIcon::Small, ICON_SIZE_SMALL_MEDIUM), "", centralWidget()); + else if(rpn_mode) executeButton = new QalculateButton(i18n("Enter"), centralWidget()); + else executeButton = new QalculateButton(i18n("="), centralWidget()); + executeButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, false); + if(rpn_mode) QToolTip::add(executeButton, i18n("Calculate expression and add to stack")); + else QToolTip::add(executeButton, i18n("Calculate expression")); + leftButtonsLayout->addWidget(executeButton); + leftButtonsSeparator = new KSeparator(Qt::Horizontal, centralWidget()); + leftButtonsLayout->addWidget(leftButtonsSeparator); + if(use_button_pixmaps) leftButtonsSeparator->hide(); + if(use_button_pixmaps) storeButton = new QalculateButton(KApplication::kApplication()->iconLoader()->loadIconSet("filesaveas", KIcon::Small, ICON_SIZE_SMALL_MEDIUM), "", centralWidget()); + else storeButton = new QalculateButton(i18n("Store"), centralWidget()); + storeButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, false); + QToolTip::add(storeButton, i18n("Store result as variable")); + leftButtonsLayout->addWidget(storeButton); + if(use_button_pixmaps) convertButton = new QalculateButton(KApplication::kApplication()->iconLoader()->loadIconSet("qalculate_convert", KIcon::Small, ICON_SIZE_SMALL_MEDIUM), "", centralWidget()); + else convertButton = new QalculateButton(i18n("Convert"), centralWidget()); + convertButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, false); + QToolTip::add(convertButton, i18n("Convert units in result")); + leftButtonsLayout->addWidget(convertButton); + leftButtonsLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Minimum)); + + QVBoxLayout *expressionLayout = new QVBoxLayout(0, 0, 0); + expressionEdit = new QalculateExpressionEdit(true, centralWidget()); + expressionLayout->addWidget(expressionEdit); + expressionEdit->setFocus(); + expressionEdit->expression_history = expression_history; + if(!enable_expression_completion) expressionEdit->disableCompletion(); + QToolTip::add(expressionEdit, i18n("Enter expression here")); + QHBoxLayout *statusLayout = new QHBoxLayout(0, 0, 6); + statusLabel_l = new QalculateParseLabel(centralWidget()); + statusLabel_l->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + statusLabel_l->setLineWidth(0); + statusLabel_l->setMargin(0); + statusLabel_l->setAlignment(int(QLabel::AlignTop | QLabel::AlignLeft)); + if(!display_expression_status) statusLabel_l->hide(); + statusLayout->addWidget(statusLabel_l); + statusLabel_r = new QLabel(i18n("status"), centralWidget()); + statusLabel_r->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum, false); + statusLabel_r->setLineWidth(0); + statusLabel_r->setMargin(0); + statusLabel_r->setTextFormat(Qt::RichText); + statusLabel_r->setAlignment(int(QLabel::AlignTop | QLabel::AlignRight)); + statusLayout->addWidget(statusLabel_r); + expressionLayout->addLayout(statusLayout); + resultLabel = new QalculateResultDisplay(centralWidget()); + resultLabel->setRightMargin(10); + expressionLayout->addWidget(resultLabel); + + topLayout->addLayout(expressionLayout); + topLayout->addLayout(leftButtonsLayout); + mainLayout->addLayout(topLayout); + + resultLabel->setWordWrap(QTextEdit::WidgetWidth); + resultLabel->setMargin(0); + + bottomLine = new KSeparator(Qt::Horizontal, centralWidget()); + mainLayout->addWidget(bottomLine); + + mainStack = new QWidgetStack(centralWidget()); + mainStack->setEnabled(true); + mainStack->setSizePolicy(QSizePolicy((QSizePolicy::SizeType) 5, (QSizePolicy::SizeType) 7, 0, 0, mainStack->sizePolicy().hasHeightForWidth())); + + keypadPage = new QWidget(mainStack); + QVBoxLayout *keypadPageLayout = new QVBoxLayout(keypadPage, 0, 12); + + keypadPageLayout->addWidget(new KSeparator(Qt::Horizontal, keypadPage)); + + QHBoxLayout *keypadTopLayout = new QHBoxLayout(0, 0, 6); + kpExact = new QalculateButton(i18n("Exact"), keypadPage); + QToolTip::add(kpExact, i18n("Toggle exact mode")); + kpExact->setToggleButton(true); + keypadTopLayout->addWidget(kpExact); + kpFraction = new QalculateButton(i18n("Fraction"), keypadPage); + QToolTip::add(kpFraction, i18n("Toggle fractional display")); + kpFraction->setToggleButton(true); + keypadTopLayout->addWidget(kpFraction); + kpNumericCombo = new QComboBox(true, keypadPage); + QToolTip::add(kpNumericCombo, i18n("Numerical display")); + kpNumericCombo->setEditable(false); + keypadTopLayout->addWidget(kpNumericCombo); + kpNumericCombo->insertItem(i18n("Normal")); + kpNumericCombo->insertItem(i18n("Engineering")); + kpNumericCombo->insertItem(i18n("Scientific")); + kpNumericCombo->insertItem(i18n("Pure")); + kpNumericCombo->insertItem(i18n("Simple")); + kpBaseCombo = new QComboBox(true, keypadPage); + QToolTip::add(kpBaseCombo, i18n("Base in result")); + kpBaseCombo->setEditable(false); + keypadTopLayout->addWidget(kpBaseCombo); + keypadPageLayout->addLayout(keypadTopLayout); + kpBaseCombo->insertItem(i18n("Binary")); + kpBaseCombo->insertItem(i18n("Octal")); + kpBaseCombo->insertItem(i18n("Decimal")); + kpBaseCombo->insertItem(i18n("Hexadecimal")); + kpBaseCombo->insertItem(i18n("Sexagesimal")); + kpBaseCombo->insertItem(i18n("Time Format")); + kpBaseCombo->insertItem(i18n("Roman")); + kpBaseCombo->insertItem(i18n("Other...")); + + QHBoxLayout *keypadBottomLayout = new QHBoxLayout(0, 0, 24); + + QGridLayout *keypadFunctionsLayout = new QGridLayout(0, 5, 3, 0, 6); + + functionsButton = new QalculateButton(i18n("f(x)"), keypadPage); + QFont fb_font(functionsButton->font()); + fb_font.setItalic(true); + functionsButton->setFont(fb_font); + QToolTip::add(functionsButton, i18n("Open functions manager")); + keypadFunctionsLayout->addWidget(functionsButton, 0, 0); + kpSqrt = new QalculateButton(i18n("sqrt"), keypadPage); + QToolTip::add(kpSqrt, i18n("Square root")); + keypadFunctionsLayout->addWidget(kpSqrt, 1, 0); + kpRaise = new QalculateButton(keypadPage); + kpRaise->setMarkup(i18n("xy")); + QToolTip::add(kpRaise, i18n("Raise (Ctrl+*)")); + keypadFunctionsLayout->addWidget(kpRaise, 0, 1); + kpSquare = new QalculateButton(keypadPage); + kpSquare->setMarkup(i18n("x2")); + QToolTip::add(kpSquare, i18n("Square")); + keypadFunctionsLayout->addWidget(kpSquare, 0, 2); + kpLog = new QalculateButton(i18n("log"), keypadPage); + QToolTip::add(kpLog, i18n("Base-10 logarithm")); + keypadFunctionsLayout->addWidget(kpLog, 1, 1); + kpLn = new QalculateButton(i18n("ln"), keypadPage); + QToolTip::add(kpLn, i18n("Natural logarithm")); + keypadFunctionsLayout->addWidget(kpLn, 1, 2); + kpFactorial = new QalculateButton(i18n("x!"), keypadPage); + QToolTip::add(kpFactorial, i18n("Factorial")); + keypadFunctionsLayout->addWidget(kpFactorial, 2, 0); + kpCos = new QalculateButton(i18n("cos"), keypadPage); + QToolTip::add(kpCos, i18n("Cosine")); + keypadFunctionsLayout->addWidget(kpCos, 2, 1); + kpTan = new QalculateButton(i18n("tan"), keypadPage); + QToolTip::add(kpTan, i18n("Tangent")); + keypadFunctionsLayout->addWidget(kpTan, 2, 2); + kpHyp = new QalculateButton(i18n("hyp"), keypadPage); + QToolTip::add(kpHyp, i18n("Toggle hyperbolic functions")); + kpHyp->setToggleButton(true); + keypadFunctionsLayout->addWidget(kpHyp, 3, 0); + kpInv = new QalculateButton(i18n("inv"), keypadPage); + QToolTip::add(kpInv, i18n("Toggle inverse functions")); + kpInv->setToggleButton(true); + keypadFunctionsLayout->addWidget(kpInv, 3, 1); + kpSin = new QalculateButton(i18n("sin"), keypadPage); + QToolTip::add(kpSin, i18n("Sine")); + keypadFunctionsLayout->addWidget(kpSin, 3, 2); + QHBoxLayout *keypadAngleLayout = new QHBoxLayout(0, 0, 6); + kpAngleGroup = new QButtonGroup(); + kpAngleGroup->setExclusive(true); + kpDegreesButton = new QRadioButton(i18n("Deg"), keypadPage); + QToolTip::add(kpDegreesButton, i18n("Angle Unit: Degrees")); + kpAngleGroup->insert(kpDegreesButton, 0); + keypadAngleLayout->addWidget(kpDegreesButton); + kpRadiansButton = new QRadioButton(i18n("Rad"), keypadPage); + QToolTip::add(kpRadiansButton, i18n("Angle Unit: Radians")); + kpAngleGroup->insert(kpRadiansButton, 1); + keypadAngleLayout->addWidget(kpRadiansButton); + kpGradiansButton = new QRadioButton(i18n("Gra"), keypadPage); + QToolTip::add(kpGradiansButton, i18n("Angle Unit: Gradians")); + kpAngleGroup->insert(kpGradiansButton, 2); + keypadAngleLayout->addWidget(kpGradiansButton); + kpNoAngleUnitButton = new QRadioButton(i18n("None"), keypadPage); + kpAngleGroup->insert(kpNoAngleUnitButton, 3); + keypadAngleLayout->addWidget(kpNoAngleUnitButton); + kpNoAngleUnitButton->hide(); + keypadAngleLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum)); + keypadFunctionsLayout->addMultiCellLayout(keypadAngleLayout, 4, 4, 0, 2); + +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR >= 4 + KAcceleratorManager::setNoAccel(kpDegreesButton); + KAcceleratorManager::setNoAccel(kpRadiansButton); + KAcceleratorManager::setNoAccel(kpGradiansButton); + KAcceleratorManager::setNoAccel(kpNoAngleUnitButton); +#endif + + keypadBottomLayout->addLayout(keypadFunctionsLayout); + + QGridLayout *keypadBasicsLayout = new QGridLayout(0, 1, 1, 0, 6); + kp7 = new QalculateButton(i18n("7"), keypadPage); + keypadBasicsLayout->addWidget(kp7, 0, 0); + kp8 = new QalculateButton(i18n("8"), keypadPage); + keypadBasicsLayout->addWidget(kp8, 0, 1); + kp9 = new QalculateButton(i18n("9"), keypadPage); + keypadBasicsLayout->addWidget(kp9, 0, 2); + kp4 = new QalculateButton(i18n("4"), keypadPage); + keypadBasicsLayout->addWidget(kp4, 1, 0); + kp5 = new QalculateButton(i18n("5"), keypadPage); + keypadBasicsLayout->addWidget(kp5, 1, 1); + kp6 = new QalculateButton(i18n("6"), keypadPage); + keypadBasicsLayout->addWidget(kp6, 1, 2); + kp1 = new QalculateButton(i18n("1"), keypadPage); + keypadBasicsLayout->addWidget(kp1, 2, 0); + kp2 = new QalculateButton(i18n("2"), keypadPage); + keypadBasicsLayout->addWidget(kp2, 2, 1); + kp3 = new QalculateButton(i18n("3"), keypadPage); + keypadBasicsLayout->addWidget(kp3, 2, 2); + kp0 = new QalculateButton(i18n("0"), keypadPage); + keypadBasicsLayout->addWidget(kp0, 3, 0); + kpDot = new QalculateButton(".", keypadPage); + QToolTip::add(kpDot, i18n("Decimal point")); + keypadBasicsLayout->addWidget(kpDot, 3, 1); + kpExp = new QalculateButton(i18n("EXP"), keypadPage); + QToolTip::add(kpExp, i18n("10^x (Ctrl+Shift+E)")); + keypadBasicsLayout->addWidget(kpExp, 3, 2); + + kpDel = new QalculateButton(i18n("Del"), keypadPage); + QToolTip::add(kpDel, i18n("Delete")); + keypadBasicsLayout->addWidget(kpDel, 0, 3); + kpClear = new QalculateButton(i18n("AC"), keypadPage); + QToolTip::add(kpClear, i18n("Clear")); + keypadBasicsLayout->addWidget(kpClear, 0, 4); + kpTimes = new QalculateButton("*", keypadPage); + QToolTip::add(kpTimes, i18n("Multiply")); + keypadBasicsLayout->addWidget(kpTimes, 1, 3); + kpDivision = new QalculateButton("/", keypadPage); + QToolTip::add(kpDivision, i18n("Divide")); + keypadBasicsLayout->addWidget(kpDivision, 1, 4); + kpPlus = new QalculateButton("+", keypadPage); + QToolTip::add(kpPlus, i18n("Add")); + keypadBasicsLayout->addWidget(kpPlus, 2, 3); + kpMinus = new QalculateButton("-", keypadPage); + QToolTip::add(kpMinus, i18n("Subtract")); + keypadBasicsLayout->addWidget(kpMinus, 2, 4); + kpAns = new QalculateButton(i18n("Ans"), keypadPage); + QToolTip::add(kpAns, i18n("Previous result")); + keypadBasicsLayout->addWidget(kpAns, 3, 3); + if(rpn_mode) kpEquals = new QalculateButton(i18n("Ent"), keypadPage); + else kpEquals = new QalculateButton(i18n("="), keypadPage); + if(rpn_mode) QToolTip::add(kpEquals, i18n("Calculate expression and add to stack")); + else QToolTip::add(kpEquals, i18n("Calculate expression")); + keypadBasicsLayout->addWidget(kpEquals, 3, 4); + keypadBottomLayout->addLayout(keypadBasicsLayout); + + keypadPageLayout->addLayout(keypadBottomLayout); + + keypadPageLayout->addWidget(new KSeparator(Qt::Horizontal, keypadPage)); + mainStack->addWidget(keypadPage, 0); + + historyPage = new QWidget(mainStack, "historyPage"); + QVBoxLayout *historyPageLayout = new QVBoxLayout(historyPage, 0, 0); + historyBrowser = new QalculateHistoryBrowser(historyPage, "historyBrowser"); + historyBrowser->setTextFormat(KTextBrowser::RichText); + historyBrowser->setWordWrap(KTextBrowser::NoWrap); + historyPageLayout->addWidget(historyBrowser); + mainStack->addWidget(historyPage, 1); + + stackPage = new QWidget(mainStack, "stackPage"); + QHBoxLayout *stackPageLayout = new QHBoxLayout(stackPage, 0, 6); + stackList = new QalculateRPNStackListView(stackPage, "stackList"); + stackList->addColumn(i18n("Index")); + stackList->addColumn(i18n("Value")); + stackList->setColumnAlignment(0, Qt::AlignCenter); + stackList->setColumnAlignment(1, Qt::AlignRight); + stackList->setFullWidth(true); + stackList->setResizeMode(QListView::LastColumn); + stackList->setSelectionMode(QListView::Single); + stackList->setAllColumnsShowFocus(true); + stackList->setRootIsDecorated(false); + stackList->setItemsMovable(true); + stackList->setDragEnabled(true); + stackList->setAcceptDrops(true); + stackList->setSorting(-1); + stackList->setItemsRenameable(true); + stackList->setRenameable(1, true); + stackList->setRenameable(0, false); + stackPageLayout->addWidget(stackList); + if(use_button_pixmaps) stackPageButtonsLayout = new QVBoxLayout(stackPageLayout, 3); + else stackPageButtonsLayout = new QVBoxLayout(stackPageLayout, 6); + if(use_button_pixmaps) registerUpButton = new QalculateButton(KApplication::kApplication()->iconLoader()->loadIconSet("up", KIcon::Small, ICON_SIZE_SMALL_MEDIUM), "", stackPage); + else registerUpButton = new QalculateButton(i18n("Up"), stackPage); + QToolTip::add(registerUpButton, i18n("Move selected register up")); + registerUpButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, false); + stackPageButtonsLayout->addWidget(registerUpButton); + if(use_button_pixmaps) registerDownButton = new QalculateButton(KApplication::kApplication()->iconLoader()->loadIconSet("down", KIcon::Small, ICON_SIZE_SMALL_MEDIUM), "", stackPage); + else registerDownButton = new QalculateButton(i18n("Down"), stackPage); + QToolTip::add(registerDownButton, i18n("Move selected register down")); + registerDownButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, false); + stackPageButtonsLayout->addWidget(registerDownButton); + if(use_button_pixmaps) editRegisterButton = new QalculateButton(KApplication::kApplication()->iconLoader()->loadIconSet("edit", KIcon::Small, ICON_SIZE_SMALL_MEDIUM), "", stackPage); + else editRegisterButton = new QalculateButton(i18n("Edit"), stackPage); + QToolTip::add(editRegisterButton, i18n("Edit value of selected register")); + editRegisterButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, false); + stackPageButtonsLayout->addWidget(editRegisterButton); + if(use_button_pixmaps) deleteRegisterButton = new QalculateButton(KApplication::kApplication()->iconLoader()->loadIconSet("editdelete", KIcon::Small, ICON_SIZE_SMALL_MEDIUM), "", stackPage); + else deleteRegisterButton = new QalculateButton(i18n("Delete"), stackPage); + QToolTip::add(deleteRegisterButton, i18n("Delete selected register")); + deleteRegisterButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, false); + stackPageButtonsLayout->addWidget(deleteRegisterButton); + if(use_button_pixmaps) clearStackButton = new QalculateButton(KApplication::kApplication()->iconLoader()->loadIconSet("view_remove", KIcon::Small, ICON_SIZE_SMALL_MEDIUM), "", stackPage); + else clearStackButton = new QalculateButton(i18n("Clear"), stackPage); + QToolTip::add(clearStackButton, i18n("Clear the RPN stack")); + clearStackButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, false); + registerUpButton->setEnabled(false); + registerDownButton->setEnabled(false); + editRegisterButton->setEnabled(false); + deleteRegisterButton->setEnabled(false); + clearStackButton->setEnabled(false); + stackPageButtonsLayout->addWidget(clearStackButton); + stackPageButtonsLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding)); + mainStack->addWidget(stackPage, 2); + + updateButtonWidths(); + + mainLayout->addWidget(mainStack); + + QHBoxLayout *bottomLayout = new QHBoxLayout(0, 0, 6); + keypadButton = new QPushButton(i18n("Keypad"), centralWidget()); + QToolTip::add(keypadButton, i18n("Show/hide keypad")); + keypadButton->setToggleButton(true); + bottomLayout->addWidget(keypadButton); + historyButton = new QPushButton(i18n("History"), centralWidget()); + QToolTip::add(historyButton, i18n("Show/hide history")); + historyButton->setToggleButton(true); + bottomLayout->addWidget(historyButton); + stackButton = new QPushButton(i18n("RPN Stack"), centralWidget()); + QToolTip::add(stackButton, i18n("Show/hide RPN stack")); + stackButton->setToggleButton(true); + bottomLayout->addWidget(stackButton); + if(!rpn_mode) stackButton->hide(); + bottomLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum)); + mainLayout->addLayout(bottomLayout); + + connect(stackList, SIGNAL(selectionChanged()), this, SLOT(registerSelected())); + connect(stackList, SIGNAL(itemRenamed(QListViewItem*)), this, SLOT(stackRegisterSet(QListViewItem*))); + connect(stackList, SIGNAL(moved()), this, SLOT(stackRegisterMoved())); + connect(stackList, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), this, SLOT(popupStackMenu(KListView*, QListViewItem*, const QPoint&))); + connect(registerUpButton, SIGNAL(clicked()), this, SLOT(registerUp())); + connect(registerDownButton, SIGNAL(clicked()), this, SLOT(registerDown())); + connect(editRegisterButton, SIGNAL(clicked()), this, SLOT(editRegister())); + connect(deleteRegisterButton, SIGNAL(clicked()), this, SLOT(deleteRegister())); + connect(clearStackButton, SIGNAL(clicked()), this, SLOT(clearStack())); + connect(stackButton, SIGNAL(toggled(bool)), this, SLOT(toggleStack(bool))); + connect(historyButton, SIGNAL(toggled(bool)), this, SLOT(toggleHistory(bool))); + connect(keypadButton, SIGNAL(toggled(bool)), this, SLOT(toggleKeypad(bool))); + connect(kp0, SIGNAL(clicked()), this, SLOT(insertKP0())); + connect(kp1, SIGNAL(clicked()), this, SLOT(insertKP1())); + connect(kp2, SIGNAL(clicked()), this, SLOT(insertKP2())); + connect(kp3, SIGNAL(clicked()), this, SLOT(insertKP3())); + connect(kp4, SIGNAL(clicked()), this, SLOT(insertKP4())); + connect(kp5, SIGNAL(clicked()), this, SLOT(insertKP5())); + connect(kp6, SIGNAL(clicked()), this, SLOT(insertKP6())); + connect(kp7, SIGNAL(clicked()), this, SLOT(insertKP7())); + connect(kp8, SIGNAL(clicked()), this, SLOT(insertKP8())); + connect(kp9, SIGNAL(clicked()), this, SLOT(insertKP9())); + connect(kpDot, SIGNAL(clicked()), this, SLOT(insertDot())); + connect(kpExp, SIGNAL(clicked()), this, SLOT(insertExp())); + connect(kpAns, SIGNAL(clicked()), this, SLOT(insertAns())); + connect(kpEquals, SIGNAL(clicked()), this, SLOT(execute())); + connect(kpPlus, SIGNAL(clicked()), this, SLOT(insertPlus())); + connect(kpMinus, SIGNAL(clicked()), this, SLOT(insertMinus())); + connect(kpTimes, SIGNAL(clicked()), this, SLOT(insertTimes())); + connect(kpDivision, SIGNAL(clicked()), this, SLOT(insertDivision())); + connect(kpDel, SIGNAL(clicked()), this, SLOT(expressionDel())); + connect(kpClear, SIGNAL(clicked()), this, SLOT(clearExpression())); + connect(kpSin, SIGNAL(clicked()), this, SLOT(insertSin())); + connect(kpCos, SIGNAL(clicked()), this, SLOT(insertCos())); + connect(kpTan, SIGNAL(clicked()), this, SLOT(insertTan())); + connect(kpSqrt, SIGNAL(clicked()), this, SLOT(insertSqrt())); + connect(kpLog, SIGNAL(clicked()), this, SLOT(insertLog())); + connect(kpLn, SIGNAL(clicked()), this, SLOT(insertLn())); + connect(kpRaise, SIGNAL(clicked()), this, SLOT(insertRaise())); + connect(kpSquare, SIGNAL(clicked()), this, SLOT(insertSquare())); + connect(kpFraction, SIGNAL(toggled(bool)), this, SLOT(setFractionMode(bool))); + connect(kpExact, SIGNAL(toggled(bool)), this, SLOT(setExactMode(bool))); + connect(kpAngleGroup, SIGNAL(clicked(int)), this, SLOT(kpSetAngleUnit(int))); + connect(kpBaseCombo->listBox(), SIGNAL(selected(int)), this, SLOT(kpSetBaseSelected(int))); + connect(kpBaseCombo, SIGNAL(activated(int)), this, SLOT(kpSetBase(int))); + connect(kpNumericCombo, SIGNAL(activated(int)), this, SLOT(kpSetNumericalMode(int))); + //connect(kpMod, SIGNAL(clicked()), this, SLOT(insertMod())); + connect(kpFactorial, SIGNAL(clicked()), this, SLOT(insertFactorial())); + //connect(expressionEdit, SIGNAL(returnPressed()), this, SLOT(execute())); + connect(expressionEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onExpressionChanged())); + connect(storeButton, SIGNAL(clicked()), this, SLOT(storeResult())); + connect(executeButton, SIGNAL(clicked()), this, SLOT(execute())); + connect(convertButton, SIGNAL(clicked()), this, SLOT(convertToUnitExpression())); + connect(functionsButton, SIGNAL(clicked()), this, SLOT(manageFunctions())); + connect(expressionEdit, SIGNAL(cursorMoved()), this, SLOT(displayParseStatus())); + connect(expressionEdit->qalculateCompletionBox, SIGNAL(hidden()), statusLabel_l, SLOT(update())); + + //tab order + setTabOrder(expressionEdit, resultLabel); + setTabOrder(resultLabel, historyBrowser); + setTabOrder(historyBrowser, keypadButton); + setTabOrder(keypadButton, historyButton); + setTabOrder(historyButton, stackButton); + + if(show_stack && rpn_mode) { + bottomLine->hide(); + stackButton->setOn(true); + mainStack->raiseWidget(2); + mainStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + } else if(show_keypad) { + bottomLine->hide(); + keypadButton->setOn(true); + mainStack->raiseWidget(0); + mainStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + } else if(show_history) { + bottomLine->hide(); + historyButton->setOn(true); + mainStack->raiseWidget(1); + mainStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + } else { + mainStack->hide(); + mainStack->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + } + + initial_history = ""; + + for(QValueVector::size_type i = 0; i < inhistory.size(); i++) { + switch(inhistory_type[i]) { + case QALCULATE_HISTORY_EXPRESSION: { + if(i != 0) { + initial_history += "

"; + } + initial_history += ""; + initial_history += inhistory[i]; + initial_history += ""; + initial_history += " "; + break; + } + case QALCULATE_HISTORY_REGISTER_MOVED: { + if(i != 0) { + initial_history += "

"; + } + initial_history += i18n("RPN Register Moved"); + initial_history += "
"; + break; + } + case QALCULATE_HISTORY_TRANSFORMATION: { + initial_history += ""; + initial_history += ""; + initial_history += inhistory[i]; + initial_history += ""; + initial_history += ": "; + break; + } + case QALCULATE_HISTORY_RESULT: { + initial_history += ""; + initial_history += "= "; + initial_history += ""; + initial_history += ""; + initial_history += ""; + initial_history += inhistory[i]; + initial_history += ""; + initial_history += ""; + initial_history += "
"; + break; + } + case QALCULATE_HISTORY_RESULT_APPROXIMATE: { + initial_history += ""; + if(printops.use_unicode_signs && can_display_unicode_string_function(SIGN_ALMOST_EQUAL, (void*) historyBrowser)) { + initial_history += SIGN_ALMOST_EQUAL " "; + } else { + initial_history += "= "; + initial_history += i18n("approx."); + initial_history += " "; + } + initial_history += ""; + initial_history += ""; + initial_history += ""; + initial_history += inhistory[i]; + initial_history += ""; + initial_history += ""; + initial_history += "
"; + break; + } + case QALCULATE_HISTORY_PARSE: { + initial_history += "  = "; + initial_history += ""; + initial_history += ""; + initial_history += inhistory[i]; + initial_history += ""; + initial_history += ""; + initial_history += "
"; + break; + } + case QALCULATE_HISTORY_PARSE_APPROXIMATE: { + initial_history += "  "; + if(printops.use_unicode_signs && can_display_unicode_string_function(SIGN_ALMOST_EQUAL, (void*) historyBrowser)) { + initial_history += SIGN_ALMOST_EQUAL " "; + } else { + initial_history += "= "; + initial_history += i18n("approx."); + initial_history += " "; + } + initial_history += ""; + initial_history += ""; + initial_history += inhistory[i]; + initial_history += ""; + initial_history += ""; + initial_history += "
"; + break; + } + case QALCULATE_HISTORY_WARNING: { + initial_history += ""; + initial_history += "- "; + initial_history += inhistory[i]; + initial_history += ""; + initial_history += "
"; + break; + } + case QALCULATE_HISTORY_ERROR: { + initial_history += ""; + initial_history += "- "; + initial_history += inhistory[i]; + initial_history += ""; + initial_history += "
"; + break; + } + case QALCULATE_HISTORY_OLD: { + initial_history += inhistory[i]; + initial_history += "
"; + break; + } + } + } + + historyBrowser->setText(initial_history); + initial_history = ""; + + if(use_custom_result_font) { + QFont new_font(resultLabel->font()); + new_font.fromString(custom_result_font); + resultLabel->setFont(new_font); + } else { + resultLabel->unsetFont(); + } + if(use_custom_expression_font) { + QFont new_font(expressionEdit->font()); + new_font.fromString(custom_expression_font); + expressionEdit->setFont(new_font); + } else { + expressionEdit->unsetFont(); + } + updateStatusLabelFonts(); + + set_unicode_buttons(); + + setupActions(); + + stackMenu = new QPopupMenu(this); + ActionEditRegister->plug(stackMenu); + ActionDeleteRegister->plug(stackMenu); + stackMenu->insertSeparator(); + ActionClearStack->plug(stackMenu); + + update_status_text(); + + bottomLine->setMinimumWidth(1000); + + createGUI("qalculate_kdeui.rc"); + + menuBar()->sizeHint(); + int h = menuBar()->height(); + int w = 300; + while(menuBar()->heightForWidth(w) > h && w < 1000) { + w += 10; + } + if(w >= 1000) { + bottomLine->setMinimumWidth(0); + w = 0; + } else { + bottomLine->setMinimumWidth(w - 22); + } + + if(!isShown()) adjustSize(); + setAutoSaveSettings(); + + if(show_history || (rpn_mode && show_stack)) { + resize(QSize(10, height()).expandedTo(minimumSizeHint())); + } else if(show_keypad) { + resize(minimumSizeHint()); + } else { + resize(QSize(width(), 10).expandedTo(minimumSizeHint())); + } + + menu_functions = (QPopupMenu*) factory()->container("functions", this); + menu_variables = (QPopupMenu*) factory()->container("variables", this); + menu_units = (QPopupMenu*) factory()->container("units", this); + menu_to_unit = (QPopupMenu*) factory()->container("convert_to_unit", this); + menu_set_prefix = (QPopupMenu*) factory()->container("set_prefix", this); + menu_modes = (QPopupMenu*) factory()->container("modes", this); + + QObject::connect(menu_modes, SIGNAL(activated(int)), this, SLOT(onModesMenuItemActivated(int))); + for(size_t i = 0; i < modes.size(); i++) { + menu_modes->insertItem(modes[i].name, -1, i); + if(i > 1) { + ModeObject *mo = new ModeObject(i); + mo->i_mode = i; + mode_objects.push_back(mo); + accel()->insert(QString("Load mode: ") + modes[i].name, i18n("Load meta mode: %1").arg(modes[i].name), QString::null, modes[i].shortcut, mo, SLOT(loadMode())); + } + } + + QObject::connect(menu_functions, SIGNAL(activated(int)), this, SLOT(onFunctionMenuItemActivated(int))); + QObject::connect(menu_variables, SIGNAL(activated(int)), this, SLOT(onVariableMenuItemActivated(int))); + QObject::connect(menu_units, SIGNAL(activated(int)), this, SLOT(onUnitMenuItemActivated(int))); + QObject::connect(menu_to_unit, SIGNAL(activated(int)), this, SLOT(onConvertToUnitMenuItemActivated(int))); + QObject::connect(menu_set_prefix, SIGNAL(activated(int)), this, SLOT(onSetPrefixMenuItemActivated(int))); + +} + +KQalculate::~KQalculate() {} + +void KQalculate::updateStatusLabelFonts() { + if(use_custom_status_font) { + QFont new_font(statusLabel_l->font()); + new_font.fromString(custom_status_font); + statusLabel_l->setFont(new_font); + new_font.setPointSizeFloat(new_font.pointSizeFloat() / 1.2); + statusLabel_r->setFont(new_font); + } else { + statusLabel_l->unsetFont(); + statusLabel_r->unsetFont(); + QFont new_font = statusLabel_l->font(); + new_font.setPointSizeFloat(new_font.pointSizeFloat() / 1.2); + statusLabel_l->setFont(new_font); + new_font = statusLabel_r->font(); + new_font.setPointSizeFloat(new_font.pointSizeFloat() / 1.44); + statusLabel_r->setFont(new_font); + } +} + +void KQalculate::updateButtonWidths() { + int button_width = executeButton->sizeHint().width(); + if(storeButton->sizeHint().width() > button_width) button_width = storeButton->sizeHint().width(); + if(convertButton->sizeHint().width() > button_width) button_width = convertButton->sizeHint().width(); + if(registerUpButton->sizeHint().width() > button_width) button_width = registerUpButton->sizeHint().width(); + if(registerDownButton->sizeHint().width() > button_width) button_width = registerDownButton->sizeHint().width(); + if(editRegisterButton->sizeHint().width() > button_width) button_width = editRegisterButton->sizeHint().width(); + if(deleteRegisterButton->sizeHint().width() > button_width) button_width = deleteRegisterButton->sizeHint().width(); + if(clearStackButton->sizeHint().width() > button_width) button_width = clearStackButton->sizeHint().width(); + clearStackButton->setMinimumWidth(button_width); + executeButton->setMinimumWidth(button_width); +} + +void KQalculate::fontChange(const QFont &old_font) { + updateStatusLabelFonts(); + functionsButton->unsetFont(); + QFont fb_font(functionsButton->font()); + fb_font.setItalic(true); + functionsButton->setFont(fb_font); + kpSquare->setMarkup(i18n("x2")); + kpRaise->setMarkup(i18n("xy")); + result_display_updated(); + KMainWindow::fontChange(old_font); + updateButtonWidths(); +} + +void KQalculate::showSystemTrayIcon(bool do_show) { + if(do_show && !trayicon) { + trayicon = new KSystemTray(this); + QObject::connect(trayicon, SIGNAL(quitSelected()), qApp, SLOT(quit())); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + trayicon->setPixmap(loadSystrayIcon(PACKAGE)); +#else + trayicon->setPixmap(trayicon->loadIcon(PACKAGE)); +#endif +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR >= 2 + KPopupMenu* traypop = trayicon->contextMenu(); + ActionHideSystemTrayIcon->plug(traypop, 1); +#endif + QToolTip::add(trayicon, i18n("Qalculate! - Scientific Calculator")); + } + if(do_show) { + trayicon->show(); + } else if(trayicon) { + trayicon->hide(); + } +} +void KQalculate::hideSystemTrayIcon() { + showSystemTrayIcon(false); + close_to_systray = false; + show(); +} + +#define SET_TOGGLE_ACTION(action, value) action->blockSignals(true); action->setChecked(value); action->blockSignals(false); +#define SET_TOGGLE_ACTION_ON(action) action->blockSignals(true); action->setChecked(true); action->blockSignals(false); + +void KQalculate::setupActions() { + + ActionNewVariable = new KAction(i18n("Variable"), "filenew", 0, this, SLOT(newVariable()), actionCollection(), "new_variable"); + ActionNewMatrix = new KAction(i18n("Matrix"), "filenew", 0, this, SLOT(newMatrix()), actionCollection(), "new_matrix"); + ActionNewVector = new KAction(i18n("Vector"), "filenew", 0, this, SLOT(newVector()), actionCollection(), "new_vector"); + ActionNewUnknownVariable = new KAction(i18n("Unknown Variable"), "filenew", 0, this, SLOT(newUnknownVariable()), actionCollection(), "new_unknown_variable"); + ActionNewFunction = new KAction(i18n("Function"), "filenew", 0, this, SLOT(newFunction()), actionCollection(), "new_function"); + ActionNewDataSet = new KAction(i18n("Data Set"), "filenew", 0, this, SLOT(newDataSet()), actionCollection(), "new_data_set"); + ActionNewUnit = new KAction(i18n("Unit"), "filenew", 0, this, SLOT(newUnit()), actionCollection(), "new_unit"); + ActionImportCSVFile = new KAction(i18n("Import CSV File..."), "fileimport", 0, this, SLOT(importCSVFile()), actionCollection(), "import_csv_file"); + ActionExportCSVFile = new KAction(i18n("Export CSV File..."), "filexport", 0, this, SLOT(exportCSVFile()), actionCollection(), "export_csv_file"); + ActionStoreResult = new KAction(i18n("Store Result..."), "filesave", CTRL+Key_S, this, SLOT(storeResult()), actionCollection(), "store_result"); + ActionSaveAsImage = new KAction(i18n("Save Result Image..."), "filesave", 0, this, SLOT(saveAsImage()), actionCollection(), "save_as_image"); + ActionSaveDefinitions = new KAction(i18n("Save Definitions"), "filesave", 0, this, SLOT(saveDefinitions()), actionCollection(), "save_definitions"); + ActionUpdateExchangeRates = new KAction(i18n("Update Exchange Rates"), "reload", 0, this, SLOT(updateExchangeRates()), actionCollection(), "update_exchange_rates"); + ActionPlotFunctionsData = new KAction(i18n("Plot Functions/Data"), 0, this, SLOT(plotFunctionsData()), actionCollection(), "plot_functions_data"); + ActionPlotFunctionsData->setEnabled(canplot); + ActionConvertNumberBases = new KAction(i18n("Convert Number Bases"), 0, this, SLOT(convertNumberBases()), actionCollection(), "convert_number_bases"); + ActionPeriodicTable = new KAction(i18n("Periodic Table"), 0, this, SLOT(periodicTable()), actionCollection(), "periodic_table"); + if(close_to_systray) { + ActionClose = KStdAction::close(this, SLOT(close()), actionCollection()); + } else { + ActionClose = NULL; + } + globalAccel = new KGlobalAccel(this); + globalAccel->insert("Show/hide Qalculate!", i18n("Show/hide main Qalculate! window"), QString::null, KShortcut(), KShortcut(), this, SLOT(showHide())); + globalAccel->readSettings(); + globalAccel->updateConnections(); + ActionConfigureGlobalShortcuts = new KAction(i18n("Configure &Global Shortcuts..."), "configure_shortcuts", 0, this, SLOT(configureGlobalShortcuts()), actionCollection(), "configure_global_shortcuts"); + ActionQuit = KStdAction::quit(qApp, SLOT(quit()), actionCollection()); + ActionManageVariables = new KAction(i18n("Manage Variables"), Key_F2, this, SLOT(manageVariables()), actionCollection(), "manage_variables"); + ActionManageFunctions = new KAction(i18n("Manage Functions"), Key_F3, this, SLOT(manageFunctions()), actionCollection(), "manage_functions"); + ActionManageUnits = new KAction(i18n("Manage Units"), Key_F4, this, SLOT(manageUnits()), actionCollection(), "manage_units"); + ActionManageDataSets = new KAction(i18n("Manage Data Sets"), 0, this, SLOT(manageDataSets()), actionCollection(), "manage_data_sets"); + ActionFactorize = new KAction(i18n("Factorize"), 0, this, SLOT(factorize()), actionCollection(), "factorize"); + ActionSimplify = new KAction(i18n("Simplify"), 0, this, SLOT(simplify()), actionCollection(), "simplify"); + ActionSetUnknowns = new KAction(i18n("Set Unknowns..."), 0, this, SLOT(setUnknowns()), actionCollection(), "set_unknowns"); + ActionConvertToUnitExpression = new KAction(i18n("Convert to Unit Expression..."), CTRL+Key_T, this, SLOT(convertToUnitExpression()), actionCollection(), "convert_to_unit_expression"); + ActionConvertToBaseUnits = new KAction(i18n("Convert to Base Units"), 0, this, SLOT(convertToBaseUnits()), actionCollection(), "convert_to_base_units"); + ActionConvertToBestUnit = new KAction(i18n("Convert to Best Unit"), 0, this, SLOT(convertToBestUnit()), actionCollection(), "convert_to_best_unit"); + ActionInsertMatrix = new KAction(i18n("Insert Matrix..."), 0, this, SLOT(insertMatrix()), actionCollection(), "insert_matrix"); + ActionInsertVector = new KAction(i18n("Insert Vector..."), 0, this, SLOT(insertVector()), actionCollection(), "insert_vector"); + ActionCopyResult = new KAction(i18n("Copy Result"), "editcopy", Key_F5, this, SLOT(copyResult()), actionCollection(), "copy_result"); + ActionClearHistory = new KAction(i18n("Clear History"), "editclear", 0, this, SLOT(clearHistory()), actionCollection(), "clear_history"); + ActionPreferences = new KAction(i18n("Configure Qalculate!"), "configure", 0, this, SLOT(preferences()), actionCollection(), "preferences"); + KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection(), "keybindings"); + ActionNumberBaseBinary = new KRadioAction(i18n("Binary"), 0, this, SLOT(numberBaseBinary()), actionCollection(), "number_base_binary"); + ActionNumberBaseBinary->setExclusiveGroup("group_number_base"); + ActionNumberBaseOctal = new KRadioAction(i18n("Octal"), 0, this, SLOT(numberBaseOctal()), actionCollection(), "number_base_octal"); + ActionNumberBaseOctal->setExclusiveGroup("group_number_base"); + ActionNumberBaseDecimal = new KRadioAction(i18n("Decimal"), 0, this, SLOT(numberBaseDecimal()), actionCollection(), "number_base_decimal"); + ActionNumberBaseDecimal->setExclusiveGroup("group_number_base"); + ActionNumberBaseHexadecimal = new KRadioAction(i18n("Hexadecimal"), 0, this, SLOT(numberBaseHexadecimal()), actionCollection(), "number_base_hexadecimal"); + ActionNumberBaseHexadecimal->setExclusiveGroup("group_number_base"); + ActionNumberBaseOther = new KRadioAction(i18n("Other..."), 0, this, SLOT(numberBaseOther()), actionCollection(), "number_base_other"); + ActionNumberBaseOther->setExclusiveGroup("group_number_base"); + ActionNumberBaseSexagesimal = new KRadioAction(i18n("Sexagesimal"), 0, this, SLOT(numberBaseSexagesimal()), actionCollection(), "number_base_sexagesimal"); + ActionNumberBaseSexagesimal->setExclusiveGroup("group_number_base"); + ActionNumberBaseTimeFormat = new KRadioAction(i18n("Time Format"), 0, this, SLOT(numberBaseTimeFormat()), actionCollection(), "number_base_time_format"); + ActionNumberBaseTimeFormat->setExclusiveGroup("group_number_base"); + ActionNumberBaseRomanNumerals = new KRadioAction(i18n("Roman Numerals"), 0, this, SLOT(numberBaseRomanNumerals()), actionCollection(), "number_base_roman_numerals"); + ActionNumberBaseRomanNumerals->setExclusiveGroup("group_number_base"); + ActionSetBase = new KAction(i18n("Select Result and Expression Base..."), CTRL+Key_B, this, SLOT(setBase()), actionCollection(), "set_base"); + ActionNumericalDisplayNormal = new KRadioAction(i18n("Normal"), 0, this, SLOT(numericalDisplayNormal()), actionCollection(), "numerical_display_normal"); + ActionNumericalDisplayNormal->setExclusiveGroup("group_numberical_display"); + ActionNumericalDisplayEngineering = new KRadioAction(i18n("Engineering"), 0, this, SLOT(numericalDisplayEngineering()), actionCollection(), "numerical_display_engineering"); + ActionNumericalDisplayEngineering->setExclusiveGroup("group_numberical_display"); + ActionNumericalDisplayScientific = new KRadioAction(i18n("Scientific"), 0, this, SLOT(numericalDisplayScientific()), actionCollection(), "numerical_display_scientific"); + ActionNumericalDisplayScientific->setExclusiveGroup("group_numberical_display"); + ActionNumericalDisplayPurelyScientific = new KRadioAction(i18n("Purely Scientific"), 0, this, SLOT(numericalDisplayPurelyScientific()), actionCollection(), "numerical_display_purely_scientific"); + ActionNumericalDisplayPurelyScientific->setExclusiveGroup("group_numberical_display"); + ActionNumericalDisplaySimple = new KRadioAction(i18n("Simple"), 0, this, SLOT(numericalDisplaySimple()), actionCollection(), "numerical_display_simple"); + ActionNumericalDisplaySimple->setExclusiveGroup("group_numberical_display"); + ActionIndicateInfiniteSeries = new KToggleAction(i18n("Indicate Infinite Series"), 0, actionCollection(), "indicate_infinite_series"); + QObject::connect(ActionIndicateInfiniteSeries, SIGNAL(toggled(bool)), this, SLOT(indicateInfiniteSeries(bool))); + ActionSortMinusLast = new KToggleAction(i18n("Sort Minus Last"), 0, actionCollection(), "sort_minus_last"); + QObject::connect(ActionSortMinusLast, SIGNAL(toggled(bool)), this, SLOT(sortMinusLast(bool))); + ActionNegativeExponents = new KToggleAction(i18n("Negative Exponents"), 0, actionCollection(), "negative_exponents"); + QObject::connect(ActionNegativeExponents, SIGNAL(toggled(bool)), this, SLOT(negativeExponents(bool))); + ActionShowEndingZeroes = new KToggleAction(i18n("Show Ending Zeroes"), 0, actionCollection(), "show_ending_zeroes"); + QObject::connect(ActionShowEndingZeroes, SIGNAL(toggled(bool)), this, SLOT(showEndingZeroes(bool))); + ActionRoundHalfwayNumbersToEven = new KToggleAction(i18n("Round Halfway Numbers to Even"), 0, actionCollection(), "round_halfway_numbers_to_even"); + QObject::connect(ActionRoundHalfwayNumbersToEven, SIGNAL(toggled(bool)), this, SLOT(roundHalfwayNumbersToEven(bool))); + ActionFractionalDisplayDecimal = new KRadioAction(i18n("Decimal"), 0, this, SLOT(fractionalDisplayDecimal()), actionCollection(), "fractional_display_decimal"); + ActionFractionalDisplayDecimal->setExclusiveGroup("group_fractional_display"); + ActionFractionalDisplayDecimalTryExact = new KRadioAction(i18n("Decimal (Try Exact)"), 0, this, SLOT(fractionalDisplayDecimalTryExact()), actionCollection(), "fractional_display_decimal_try_exact"); + ActionFractionalDisplayDecimalTryExact->setExclusiveGroup("group_fractional_display"); + ActionFractionalDisplayFraction = new KRadioAction(i18n("Fraction"), 0, this, SLOT(fractionalDisplayFraction()), actionCollection(), "fractional_display_fraction"); + ActionFractionalDisplayFraction->setExclusiveGroup("group_fractional_display"); + ActionFractionalDisplayCombined = new KRadioAction(i18n("Combined"), 0, this, SLOT(fractionalDisplayCombined()), actionCollection(), "fractional_display_combined"); + ActionFractionalDisplayCombined->setExclusiveGroup("group_fractional_display"); + ActionEnablePrefixes = new KToggleAction(i18n("Enable Prefixes"), 0, actionCollection(), "enable_prefixes"); + QObject::connect(ActionEnablePrefixes, SIGNAL(toggled(bool)), this, SLOT(enablePrefixes(bool))); + ActionEnableUseOfAllPrefixes = new KToggleAction(i18n("Enable Use of All SI Prefixes"), 0, actionCollection(), "enable_use_of_all_prefixes"); + QObject::connect(ActionEnableUseOfAllPrefixes, SIGNAL(toggled(bool)), this, SLOT(enableUseOfAllPrefixes(bool))); + ActionEnableDenominatorPrefixes = new KToggleAction(i18n("Enable Denominator Prefixes"), 0, actionCollection(), "enable_denominator_prefixes"); + QObject::connect(ActionEnableDenominatorPrefixes, SIGNAL(toggled(bool)), this, SLOT(enableDenominatorPrefixes(bool))); + ActionPlaceUnitsSeparately = new KToggleAction(i18n("Place Units Separately"), 0, actionCollection(), "place_units_separately"); + QObject::connect(ActionPlaceUnitsSeparately, SIGNAL(toggled(bool)), this, SLOT(placeUnitsSeparately(bool))); + ActionAutoNoConversion = new KRadioAction(i18n("No Automatic Conversion"), 0, this, SLOT(autoNoConversion()), actionCollection(), "auto_no_conversion"); + ActionAutoNoConversion->setExclusiveGroup("group_auto_conversion"); + ActionAutoConvertToBaseUnits = new KRadioAction(i18n("Convert to Base Units"), 0, this, SLOT(autoConvertToBaseUnits()), actionCollection(), "auto_convert_to_base_units"); + ActionAutoConvertToBaseUnits->setExclusiveGroup("group_auto_conversion"); + ActionAutoConvertToBestUnit = new KRadioAction(i18n("Convert to Best Unit"), 0, this, SLOT(autoConvertToBestUnit()), actionCollection(), "auto_convert_to_best_unit"); + ActionAutoConvertToBestUnit->setExclusiveGroup("group_auto_conversion"); + ActionAngleUnitDegrees = new KRadioAction(i18n("Degrees"), 0, this, SLOT(angleUnitDegrees()), actionCollection(), "angle_unit_degrees"); + ActionAngleUnitDegrees->setExclusiveGroup("group_angle_unit"); + ActionAngleUnitRadians = new KRadioAction(i18n("Radians"), 0, this, SLOT(angleUnitRadians()), actionCollection(), "angle_unit_radians"); + ActionAngleUnitRadians->setExclusiveGroup("group_angle_unit"); + ActionAngleUnitGradians = new KRadioAction(i18n("Gradians"), 0, this, SLOT(angleUnitGradians()), actionCollection(), "angle_unit_gradians"); + ActionAngleUnitGradians->setExclusiveGroup("group_angle_unit"); + ActionAngleUnitNone = new KRadioAction(i18n("None"), 0, this, SLOT(angleUnitNone()), actionCollection(), "angle_unit_none"); + ActionAngleUnitNone->setExclusiveGroup("group_angle_unit"); + ActionAbbreviateNames = new KToggleAction(i18n("Abbreviate Names"), 0, actionCollection(), "abbreviate_names"); + QObject::connect(ActionAbbreviateNames, SIGNAL(toggled(bool)), this, SLOT(abbreviateNames(bool))); + ActionEnableVariables = new KToggleAction(i18n("Enable Variables"), 0, actionCollection(), "enable_variables"); + QObject::connect(ActionEnableVariables, SIGNAL(toggled(bool)), this, SLOT(enableVariables(bool))); + ActionEnableFunctions = new KToggleAction(i18n("Enable Functions"), 0, actionCollection(), "enable_functions"); + QObject::connect(ActionEnableFunctions, SIGNAL(toggled(bool)), this, SLOT(enableFunctions(bool))); + ActionEnableUnits = new KToggleAction(i18n("Enable Units"), 0, actionCollection(), "enable_units"); + QObject::connect(ActionEnableUnits, SIGNAL(toggled(bool)), this, SLOT(enableUnits(bool))); + ActionEnableUnknowns = new KToggleAction(i18n("Enable Unknowns"), 0, actionCollection(), "enable_unknowns"); + QObject::connect(ActionEnableUnknowns, SIGNAL(toggled(bool)), this, SLOT(enableUnknowns(bool))); + ActionCalculateVariables = new KToggleAction(i18n("Calculate Variables"), 0, actionCollection(), "calculate_variables"); + QObject::connect(ActionCalculateVariables, SIGNAL(toggled(bool)), this, SLOT(calculateVariables(bool))); + ActionAllowComplexResult = new KToggleAction(i18n("Allow Complex Result"), 0, actionCollection(), "allow_complex_result"); + QObject::connect(ActionAllowComplexResult, SIGNAL(toggled(bool)), this, SLOT(allowComplexResult(bool))); + ActionAllowInfiniteResult = new KToggleAction(i18n("Allow Infinite Result"), 0, actionCollection(), "allow_infinite_result"); + QObject::connect(ActionAllowInfiniteResult, SIGNAL(toggled(bool)), this, SLOT(allowInfiniteResult(bool))); + ActionApproximationTryExact = new KRadioAction(i18n("Try Exact"), 0, this, SLOT(approximationTryExact()), actionCollection(), "approximation_try_exact"); + ActionApproximationTryExact->setExclusiveGroup("group_approximation"); + ActionApproximationAlwaysExact = new KRadioAction(i18n("Always Exact"), 0, this, SLOT(approximationAlwaysExact()), actionCollection(), "approximation_always_exact"); + ActionApproximationAlwaysExact->setExclusiveGroup("group_approximation"); + ActionApproximationApproximate = new KRadioAction(i18n("Approximate"), 0, this, SLOT(approximationApproximate()), actionCollection(), "approximation_approximate"); + ActionApproximationApproximate->setExclusiveGroup("group_approximation"); + ActionAssumptionTypeUnknown = new KRadioAction(i18n("Unknown"), 0, this, SLOT(assumptionTypeUnknown()), actionCollection(), "assumption_type_unknown"); + ActionAssumptionTypeUnknown->setExclusiveGroup("group_assumption_type"); + ActionAssumptionTypeNonMatrix = new KRadioAction(i18n("Not Matrix"), 0, this, SLOT(assumptionTypeNonMatrix()), actionCollection(), "assumption_type_nonmatrix"); + ActionAssumptionTypeNonMatrix->setExclusiveGroup("group_assumption_type"); + ActionAssumptionTypeNumber = new KRadioAction(i18n("Number"), 0, this, SLOT(assumptionTypeNumber()), actionCollection(), "assumption_type_number"); + ActionAssumptionTypeNumber->setExclusiveGroup("group_assumption_type"); + ActionAssumptionTypeComplex = new KRadioAction(i18n("Complex"), 0, this, SLOT(assumptionTypeComplex()), actionCollection(), "assumption_type_complex"); + ActionAssumptionTypeComplex->setExclusiveGroup("group_assumption_type"); + ActionAssumptionTypeReal = new KRadioAction(i18n("Real"), 0, this, SLOT(assumptionTypeReal()), actionCollection(), "assumption_type_real"); + ActionAssumptionTypeReal->setExclusiveGroup("group_assumption_type"); + ActionAssumptionTypeRational = new KRadioAction(i18n("Rational"), 0, this, SLOT(assumptionTypeRational()), actionCollection(), "assumption_type_rational"); + ActionAssumptionTypeRational->setExclusiveGroup("group_assumption_type"); + ActionAssumptionTypeInteger = new KRadioAction(i18n("Integer"), 0, this, SLOT(assumptionTypeInteger()), actionCollection(), "assumption_type_integer"); + ActionAssumptionTypeInteger->setExclusiveGroup("group_assumption_type"); + ActionAssumptionSignUnknown = new KRadioAction(i18n("Unknown"), 0, this, SLOT(assumptionSignUnknown()), actionCollection(), "assumption_sign_unknown"); + ActionAssumptionSignUnknown->setExclusiveGroup("group_assumption_sign"); + ActionAssumptionSignNonZero = new KRadioAction(i18n("Non-Zero"), 0, this, SLOT(assumptionSignNonZero()), actionCollection(), "assumption_sign_non_zero"); + ActionAssumptionSignNonZero->setExclusiveGroup("group_assumption_sign"); + ActionAssumptionSignPositive = new KRadioAction(i18n("Positive"), 0, this, SLOT(assumptionSignPositive()), actionCollection(), "assumption_sign_positive"); + ActionAssumptionSignPositive->setExclusiveGroup("group_assumption_sign"); + ActionAssumptionSignNonNegative = new KRadioAction(i18n("Non-Negative"), 0, this, SLOT(assumptionSignNonNegative()), actionCollection(), "assumption_sign_non_negative"); + ActionAssumptionSignNonNegative->setExclusiveGroup("group_assumption_sign"); + ActionAssumptionSignNegative = new KRadioAction(i18n("Negative"), 0, this, SLOT(assumptionSignNegative()), actionCollection(), "assumption_sign_negative"); + ActionAssumptionSignNegative->setExclusiveGroup("group_assumption_sign"); + ActionAssumptionSignNonPositive = new KRadioAction(i18n("Non-Positive"), 0, this, SLOT(assumptionSignNonPositive()), actionCollection(), "assumption_sign_non_positive"); + ActionAssumptionSignNonPositive->setExclusiveGroup("group_assumption_sign"); + ActionNonZeroDenominators = new KToggleAction(i18n("Non-Zero Denominators"), 0, actionCollection(), "non_zero_denominators"); + QObject::connect(ActionNonZeroDenominators, SIGNAL(toggled(bool)), this, SLOT(nonZeroDenominators(bool))); + ActionWarnAboutDenominatorsAssumedNonZero = new KToggleAction(i18n("Warn About Denominators Assumed Non-Zero"), 0, actionCollection(), "warn_about_denominators_assumed_nonzero"); + QObject::connect(ActionWarnAboutDenominatorsAssumedNonZero, SIGNAL(toggled(bool)), this, SLOT(warnAboutDenominatorsAssumedNonZero(bool))); + ActionAlgebraicModeSimplify = new KRadioAction(i18n("Simplify"), 0, this, SLOT(algebraicModeSimplify()), actionCollection(), "algebraic_mode_simplify"); + ActionAlgebraicModeSimplify->setExclusiveGroup("group_alebraic_mode"); + ActionAlgebraicModeFactorize = new KRadioAction(i18n("Factorize"), 0, this, SLOT(algebraicModeFactorize()), actionCollection(), "algebraic_mode_factorize"); + ActionAlgebraicModeFactorize->setExclusiveGroup("group_alebraic_mode"); + ActionAlgebraicModeNone = new KRadioAction(i18n("None"), 0, this, SLOT(algebraicModeNone()), actionCollection(), "algebraic_mode_none"); + ActionAlgebraicModeNone->setExclusiveGroup("group_alebraic_mode"); + ActionReadPrecision = new KToggleAction(i18n("Read Precision"), 0, actionCollection(), "read_precision"); + QObject::connect(ActionReadPrecision, SIGNAL(toggled(bool)), this, SLOT(readPrecision(bool))); + ActionLimitImplicitMultiplication = new KToggleAction(i18n("Limit Implicit Multiplication"), 0, actionCollection(), "limit_implicit_multiplication"); + QObject::connect(ActionLimitImplicitMultiplication, SIGNAL(toggled(bool)), this, SLOT(limitImplicitMultiplication(bool))); + ActionRPNMode = new KToggleAction(i18n("RPN Mode"), CTRL+Key_R, actionCollection(), "rpn_mode"); + QObject::connect(ActionRPNMode, SIGNAL(toggled(bool)), this, SLOT(rpnMode(bool))); + ActionRPNSyntax = new KToggleAction(i18n("RPN Syntax"), 0, actionCollection(), "rpn_syntax"); + QObject::connect(ActionRPNSyntax, SIGNAL(toggled(bool)), this, SLOT(rpnSyntax(bool))); + ActionPrecision = new KAction(i18n("Precision"), 0, this, SLOT(precision()), actionCollection(), "precision"); + ActionDecimals = new KAction(i18n("Decimals"), 0, this, SLOT(decimals()), actionCollection(), "decimals"); + ActionSaveModeAs = new KAction(i18n("Save Mode..."), "filesave", 0, this, SLOT(saveModeAs()), actionCollection(), "save_mode_as"); + ActionDeleteMode = new KAction(i18n("Delete Mode..."), "editdelete", 0, this, SLOT(deleteMode()), actionCollection(), "delete_mode"); + ActionDeleteMode->setEnabled(modes.size() > 2); + ActionSaveMode = new KAction(i18n("Save Default Mode"), "filesave", 0, this, SLOT(saveMode()), actionCollection(), "save_mode"); + ActionClearStack = new KAction(i18n("Clear Stack"), "view_remove", 0, this, SLOT(clearStack()), actionCollection(), "clear_stack"); + ActionDeleteRegister = new KAction(i18n("Delete"), "editdelete", 0, this, SLOT(deleteRegister()), actionCollection(), "delete_register"); + ActionEditRegister = new KAction(i18n("Edit"), "edit", 0, this, SLOT(editRegister()), actionCollection(), "edit_register"); + + new KAction(i18n("Exp RPN Operation"), CTRL+SHIFT+Key_E, this, SLOT(insertExp()), actionCollection(), "rpn_exp10"); + + setModeActions(); + +} +void KQalculate::setAssumptionsMenu() { + switch(CALCULATOR->defaultAssumptions()->sign()) { + case ASSUMPTION_SIGN_POSITIVE: {SET_TOGGLE_ACTION_ON(ActionAssumptionSignPositive); break;} + case ASSUMPTION_SIGN_NONPOSITIVE: {SET_TOGGLE_ACTION_ON(ActionAssumptionSignNonPositive); break;} + case ASSUMPTION_SIGN_NEGATIVE: {SET_TOGGLE_ACTION_ON(ActionAssumptionSignNegative); break;} + case ASSUMPTION_SIGN_NONNEGATIVE: {SET_TOGGLE_ACTION_ON(ActionAssumptionSignNonNegative); break;} + case ASSUMPTION_SIGN_NONZERO: {SET_TOGGLE_ACTION_ON(ActionAssumptionSignNonZero); break;} + default: {SET_TOGGLE_ACTION_ON(ActionAssumptionSignUnknown); } + } + switch(CALCULATOR->defaultAssumptions()->type()) { + case ASSUMPTION_TYPE_INTEGER: {SET_TOGGLE_ACTION_ON(ActionAssumptionTypeInteger); break;} + case ASSUMPTION_TYPE_RATIONAL: {SET_TOGGLE_ACTION_ON(ActionAssumptionTypeRational); break;} + case ASSUMPTION_TYPE_COMPLEX: {SET_TOGGLE_ACTION_ON(ActionAssumptionTypeComplex); break;} + case ASSUMPTION_TYPE_NUMBER: {SET_TOGGLE_ACTION_ON(ActionAssumptionTypeNumber); break;} + case ASSUMPTION_TYPE_REAL: {SET_TOGGLE_ACTION_ON(ActionAssumptionTypeReal); break;} + case ASSUMPTION_TYPE_NONMATRIX: {SET_TOGGLE_ACTION_ON(ActionAssumptionTypeNonMatrix); break;} + default: {SET_TOGGLE_ACTION_ON(ActionAssumptionTypeUnknown); } + } +} +void KQalculate::setModeActions() { + + SET_TOGGLE_ACTION(ActionAllowComplexResult, evalops.allow_complex) + SET_TOGGLE_ACTION(ActionAllowInfiniteResult, evalops.allow_infinite) + SET_TOGGLE_ACTION(ActionEnableVariables, evalops.parse_options.variables_enabled) + SET_TOGGLE_ACTION(ActionEnableFunctions, evalops.parse_options.functions_enabled) + SET_TOGGLE_ACTION(ActionEnableUnits, evalops.parse_options.units_enabled) + SET_TOGGLE_ACTION(ActionEnableUnknowns, evalops.parse_options.unknowns_enabled) + SET_TOGGLE_ACTION(ActionCalculateVariables, evalops.calculate_variables) + SET_TOGGLE_ACTION(ActionReadPrecision, evalops.parse_options.read_precision != DONT_READ_PRECISION) + SET_TOGGLE_ACTION(ActionLimitImplicitMultiplication, evalops.parse_options.limit_implicit_multiplication) + SET_TOGGLE_ACTION(ActionRPNSyntax, evalops.parse_options.rpn) + SET_TOGGLE_ACTION(ActionRPNMode, rpn_mode) + SET_TOGGLE_ACTION(ActionNonZeroDenominators, evalops.assume_denominators_nonzero) + SET_TOGGLE_ACTION(ActionWarnAboutDenominatorsAssumedNonZero, evalops.warn_about_denominators_assumed_nonzero) + SET_TOGGLE_ACTION(ActionAbbreviateNames, printops.abbreviate_names) + SET_TOGGLE_ACTION(ActionIndicateInfiniteSeries, printops.indicate_infinite_series) + SET_TOGGLE_ACTION(ActionSortMinusLast, printops.sort_options.minus_last) + SET_TOGGLE_ACTION(ActionNegativeExponents, printops.negative_exponents) + SET_TOGGLE_ACTION(ActionShowEndingZeroes, printops.show_ending_zeroes) + SET_TOGGLE_ACTION(ActionRoundHalfwayNumbersToEven, printops.round_halfway_to_even) + SET_TOGGLE_ACTION(ActionEnablePrefixes, printops.use_unit_prefixes) + SET_TOGGLE_ACTION(ActionEnableUseOfAllPrefixes, printops.use_all_prefixes) + SET_TOGGLE_ACTION(ActionEnableDenominatorPrefixes, printops.use_denominator_prefix) + SET_TOGGLE_ACTION(ActionPlaceUnitsSeparately, printops.place_units_separately) + + kpExact->blockSignals(true); + switch(evalops.approximation) { + case APPROXIMATION_EXACT: { + SET_TOGGLE_ACTION_ON(ActionApproximationAlwaysExact); + kpExact->setOn(true); + break; + } + case APPROXIMATION_TRY_EXACT: { + SET_TOGGLE_ACTION_ON(ActionApproximationTryExact); + kpExact->setOn(false); + break; + } + case APPROXIMATION_APPROXIMATE: { + SET_TOGGLE_ACTION_ON(ActionApproximationApproximate); + kpExact->setOn(false); + break; + } + } + kpExact->blockSignals(false); + switch(evalops.auto_post_conversion) { + case POST_CONVERSION_BEST: { + SET_TOGGLE_ACTION_ON(ActionAutoConvertToBestUnit); + break; + } + case POST_CONVERSION_BASE: { + SET_TOGGLE_ACTION_ON(ActionAutoConvertToBaseUnits); + break; + } + default: { + SET_TOGGLE_ACTION_ON(ActionAutoNoConversion); + } + } + kpAngleGroup->blockSignals(true); + switch(evalops.parse_options.angle_unit) { + case ANGLE_UNIT_DEGREES: { + SET_TOGGLE_ACTION_ON(ActionAngleUnitDegrees); + kpAngleGroup->setButton(0); + break; + } + case ANGLE_UNIT_RADIANS: { + SET_TOGGLE_ACTION_ON(ActionAngleUnitRadians); + kpAngleGroup->setButton(1); + break; + } + case ANGLE_UNIT_GRADIANS: { + SET_TOGGLE_ACTION_ON(ActionAngleUnitGradians); + kpAngleGroup->setButton(2); + break; + } + default: { + SET_TOGGLE_ACTION_ON(ActionAngleUnitNone); + kpAngleGroup->setButton(3); + } + } + kpAngleGroup->blockSignals(false); + + kpBaseCombo->blockSignals(true); + switch(printops.base) { + case BASE_BINARY: { + SET_TOGGLE_ACTION_ON(ActionNumberBaseBinary); + kpBaseCombo->setCurrentItem(0); + break; + } + case BASE_OCTAL: { + SET_TOGGLE_ACTION_ON(ActionNumberBaseOctal); + kpBaseCombo->setCurrentItem(1); + break; + } + case BASE_DECIMAL: { + SET_TOGGLE_ACTION_ON(ActionNumberBaseDecimal); + kpBaseCombo->setCurrentItem(2); + break; + } + case BASE_HEXADECIMAL: { + SET_TOGGLE_ACTION_ON(ActionNumberBaseHexadecimal); + kpBaseCombo->setCurrentItem(3); + break; + } + case BASE_ROMAN_NUMERALS: { + SET_TOGGLE_ACTION_ON(ActionNumberBaseRomanNumerals); + kpBaseCombo->setCurrentItem(6); + break; + } + case BASE_SEXAGESIMAL: { + SET_TOGGLE_ACTION_ON(ActionNumberBaseSexagesimal); + kpBaseCombo->setCurrentItem(4); + break; + } + case BASE_TIME: { + SET_TOGGLE_ACTION_ON(ActionNumberBaseTimeFormat); + kpBaseCombo->setCurrentItem(5); + break; + } + default: { + SET_TOGGLE_ACTION_ON(ActionNumberBaseOther); + kpBaseCombo->setCurrentItem(7); + } + } + kpBaseCombo->blockSignals(false); + + kpNumericCombo->blockSignals(true); + switch(printops.min_exp) { + case EXP_PRECISION: { + SET_TOGGLE_ACTION_ON(ActionNumericalDisplayNormal); + kpNumericCombo->setCurrentItem(0); + break; + } + case EXP_BASE_3: { + SET_TOGGLE_ACTION_ON(ActionNumericalDisplayEngineering); + kpNumericCombo->setCurrentItem(1); + break; + } + case EXP_SCIENTIFIC: { + SET_TOGGLE_ACTION_ON(ActionNumericalDisplayScientific); + kpNumericCombo->setCurrentItem(2); + break; + } + case EXP_PURE: { + SET_TOGGLE_ACTION_ON(ActionNumericalDisplayPurelyScientific); + kpNumericCombo->setCurrentItem(3); + break; + } + case EXP_NONE: { + SET_TOGGLE_ACTION_ON(ActionNumericalDisplaySimple); + kpNumericCombo->setCurrentItem(4); + break; + } + } + kpNumericCombo->blockSignals(false); + + kpFraction->blockSignals(true); + switch (printops.number_fraction_format) { + case FRACTION_DECIMAL: { + SET_TOGGLE_ACTION_ON(ActionFractionalDisplayDecimal); + kpFraction->setOn(false); + break; + } + case FRACTION_DECIMAL_EXACT: { + SET_TOGGLE_ACTION_ON(ActionFractionalDisplayDecimalTryExact); + kpFraction->setOn(false); + break; + } + case FRACTION_COMBINED: { + SET_TOGGLE_ACTION_ON(ActionFractionalDisplayCombined); + kpFraction->setOn(true); + break; + } + case FRACTION_FRACTIONAL: { + SET_TOGGLE_ACTION_ON(ActionFractionalDisplayFraction); + kpFraction->setOn(true); + break; + } + } + kpFraction->blockSignals(false); + + setAssumptionsMenu(); + switch(evalops.structuring) { + case STRUCTURING_SIMPLIFY: {SET_TOGGLE_ACTION_ON(ActionAlgebraicModeSimplify); break;} + case STRUCTURING_FACTORIZE: {SET_TOGGLE_ACTION_ON(ActionAlgebraicModeFactorize); break;} + default: {SET_TOGGLE_ACTION_ON(ActionAlgebraicModeNone); } + } + +} + +#define TEXT_TAGS "" +#define TEXT_TAGS_END "" +#define TEXT_TAGS_SMALL "" +#define TEXT_TAGS_SMALL_END "" +#define TEXT_TAGS_XSMALL "" +#define TEXT_TAGS_XSMALL_END "" + +#define STR_MARKUP_ADD_SMALL(str, str_add) if(ips.power_depth > 0) {str += TEXT_TAGS ""; str += str_add; str += "" TEXT_TAGS_END;} else {str += TEXT_TAGS_SMALL; str += str_add; str += TEXT_TAGS_SMALL_END;} + +#define STR_MARKUP_ADD(str, str_add) if(ips.power_depth > 0) {str += TEXT_TAGS ""; str += str_add; str += "" TEXT_TAGS_END;} else {str += str_add;} + +#define STR_MARKUP_PREPEND(str, str_add) QString str_prepend; if(ips.power_depth > 0) {str_prepend += TEXT_TAGS ""; str_prepend += str_add; str_prepend += "" TEXT_TAGS_END;} else {str_prepend += str_add;} str.prepend(str_prepend); + +#define STR_MARKUP_BEGIN(str) if(ips.power_depth > 0) {str += TEXT_TAGS "";} +#define STR_MARKUP_END(str) if(ips.power_depth > 0) {str +="" TEXT_TAGS_END;} + +#define STR_MARKUP_BEGIN_SMALL(str) if(ips.power_depth > 0) {str += TEXT_TAGS_SMALL "";} else {str += TEXT_TAGS_SMALL;} +#define STR_MARKUP_END_SMALL(str) if(ips.power_depth > 0) {str +="" TEXT_TAGS_SMALL_END;} else {str += TEXT_TAGS_SMALL_END;} + +#define STR_MARKUP_BEGIN_CURSIVE(str) if(ips.power_depth > 0) {str += TEXT_TAGS "";} else {str += "";} +#define STR_MARKUP_END_CURSIVE(str) if(ips.power_depth > 0) {str +="" TEXT_TAGS_END;} else {str += "";} + +QString draw_structure(MathStructure &m, const QFont &font, const QColorGroup &cg, PrintOptions po = default_print_options, InternalPrintStruct ips = top_ips, bool in_matrix = false) { + + if(ips.depth == 0 && po.is_approximate) *po.is_approximate = false; + + QString mstr; + + InternalPrintStruct ips_n = ips; + if(m.isApproximate()) ips_n.parent_approximate = true; + if(m.precision() > 0 && (ips_n.parent_precision < 1 || m.precision() < ips_n.parent_precision)) ips_n.parent_precision = m.precision(); + switch(m.type()) { + case STRUCT_NUMBER: { + string exp = ""; + bool exp_minus; + ips_n.exp = &exp; + ips_n.exp_minus = &exp_minus; + STR_MARKUP_BEGIN(mstr); + mstr += m.number().print(po, ips_n).c_str(); + if(!exp.empty()) { + if(po.lower_case_e) { + mstr += "e"; + } else { + STR_MARKUP_ADD_SMALL(mstr, "E"); + } + if(exp_minus) { + mstr += "-"; + } + mstr += exp.c_str(); + } + if(po.base != BASE_DECIMAL && po.base != BASE_HEXADECIMAL && po.base > 0 && po.base <= 36) { + if(ips.power_depth == 0) { + mstr += ""; + mstr += QString::number(po.base); + mstr += ""; + } else { + mstr += TEXT_TAGS_SMALL ""; + mstr += QString::number(po.base); + mstr += "" TEXT_TAGS_SMALL_END; + } + } + STR_MARKUP_END(mstr); + break; + } + case STRUCT_SYMBOLIC: { + result_parts.push_back(m); + mstr = ""; + STR_MARKUP_BEGIN_CURSIVE(mstr); + mstr += m.symbol().c_str(); + STR_MARKUP_END_CURSIVE(mstr); + mstr += ""; + mstr += ""; + break; + } + case STRUCT_ADDITION: { + + ips_n.depth++; + + vector terms; + vector do_space; + for(size_t i = 0; i < m.size(); i++) { + if(m[i].type() == STRUCT_NEGATE && i > 0) { + ips_n.wrap = m[i][0].needsParenthesis(po, ips_n, m, i + 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + terms.push_back(draw_structure(m[i][0], font, cg, po, ips_n)); + } else { + ips_n.wrap = m[i].needsParenthesis(po, ips_n, m, i + 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + terms.push_back(draw_structure(m[i], font, cg, po, ips_n)); + } + do_space.push_back(!terms[i].endsWith("valign=\"middle\">")); + } + for(size_t i = 0; i < terms.size(); i++) { + if(i > 0) { + if(do_space[i - 1]) STR_MARKUP_ADD(mstr, " "); + if(m[i].type() == STRUCT_NEGATE) { + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_MINUS, po.can_display_unicode_string_arg))) { + STR_MARKUP_ADD(mstr, SIGN_MINUS); + } else { + STR_MARKUP_ADD(mstr, "-"); + } + } else { + STR_MARKUP_ADD(mstr, "+"); + } + if(do_space[i]) STR_MARKUP_ADD(mstr, " "); + } + mstr += terms[i]; + } + break; + } + case STRUCT_NEGATE: { + + ips_n.depth++; + + ips_n.wrap = m[0].needsParenthesis(po, ips_n, m, 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_MINUS, po.can_display_unicode_string_arg))) { + STR_MARKUP_ADD(mstr, SIGN_MINUS); + } else { + STR_MARKUP_ADD(mstr, "-"); + } + mstr += draw_structure(m[0], font, cg, po, ips_n); + break; + } + case STRUCT_MULTIPLICATION: { + + ips_n.depth++; + + QString mul_str; + if(po.use_unicode_signs && po.multiplication_sign == MULTIPLICATION_SIGN_DOT && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_MULTIDOT, po.can_display_unicode_string_arg))) { + STR_MARKUP_ADD(mul_str, SIGN_MULTIDOT); + } else if(po.use_unicode_signs && po.multiplication_sign == MULTIPLICATION_SIGN_DOT && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_MULTIBULLET, po.can_display_unicode_string_arg))) { + STR_MARKUP_ADD(mul_str, SIGN_MULTIBULLET); + } else if(po.use_unicode_signs && po.multiplication_sign == MULTIPLICATION_SIGN_DOT && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_SMALLCIRCLE, po.can_display_unicode_string_arg))) { + STR_MARKUP_ADD(mul_str, SIGN_SMALLCIRCLE); + } else if(po.use_unicode_signs && po.multiplication_sign == MULTIPLICATION_SIGN_X && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_MULTIPLICATION, po.can_display_unicode_string_arg))) { + STR_MARKUP_ADD(mul_str, SIGN_MULTIPLICATION); + } else { + STR_MARKUP_ADD(mul_str, "*"); + } + + bool par_prev = false; + vector nm; + vector terms; + vector do_space; + for(size_t i = 0; i < m.size(); i++) { + ips_n.wrap = m[i].needsParenthesis(po, ips_n, m, i + 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + terms.push_back(draw_structure(m[i], font, cg, po, ips_n)); + if(!po.short_multiplication && i > 0) { + nm.push_back(-1); + } else if(i > 0) { + nm.push_back(m[i].neededMultiplicationSign(po, ips_n, m, i + 1, ips_n.wrap || (m[i].isPower() && m[i][0].needsParenthesis(po, ips_n, m[i], 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0)), par_prev, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0)); + } else { + nm.push_back(-1); + } + do_space.push_back(!terms[i].endsWith("valign=\"middle\">")); + par_prev = ips_n.wrap; + } + for(size_t i = 0; i < terms.size(); i++) { + if(!po.short_multiplication && i > 0) { + if(do_space[i - 1]) STR_MARKUP_ADD(mstr, " "); + mstr += mul_str; + if(do_space[i]) STR_MARKUP_ADD(mstr, " "); + } else if(i > 0) { + switch(nm[i]) { + case MULTIPLICATION_SIGN_SPACE: { + if(do_space[i - 1] && do_space[i]) STR_MARKUP_ADD(mstr, " "); + break; + } + case MULTIPLICATION_SIGN_OPERATOR: { + if(do_space[i - 1]) STR_MARKUP_ADD(mstr, " "); + mstr += mul_str; + if(do_space[i]) STR_MARKUP_ADD(mstr, " "); + break; + } + case MULTIPLICATION_SIGN_OPERATOR_SHORT: { + mstr += mul_str; + break; + } + } + } + mstr += terms[i]; + } + break; + } + case STRUCT_INVERSE: {} + case STRUCT_DIVISION: { + + ips_n.depth++; + ips_n.division_depth++; + + bool flat = ips.division_depth > 0 || ips.power_depth > 0; + if(!flat && po.place_units_separately) { + flat = true; + size_t i = 0; + if(m.isDivision()) { + i = 1; + } + if(m[i].isMultiplication()) { + for(size_t i2 = 0; i2 < m[i].size(); i2++) { + if(!m[i][i2].isUnit_exp()) { + flat = false; + break; + } + } + } else if(!m[i].isUnit_exp()) { + flat = false; + } + if(flat) { + ips_n.division_depth--; + } + } + QString num_str, den_str; + if(m.type() == STRUCT_DIVISION) { + ips_n.wrap = (!m[0].isDivision() || !flat || ips.division_depth > 0 || ips.power_depth > 0) && m[0].needsParenthesis(po, ips_n, m, 1, flat, ips.power_depth > 0); + num_str = draw_structure(m[0], font, cg, po, ips_n); + } else { + MathStructure onestruct(1, 1); + ips_n.wrap = false; + num_str = draw_structure(onestruct, font, cg, po, ips_n); + } + if(m.type() == STRUCT_DIVISION) { + ips_n.wrap = m[1].needsParenthesis(po, ips_n, m, 2, flat, ips.power_depth > 0); + den_str = draw_structure(m[1], font, cg, po, ips_n); + } else { + ips_n.wrap = m[0].needsParenthesis(po, ips_n, m, 2, flat, ips.power_depth > 0); + den_str = draw_structure(m[0], font, cg, po, ips_n); + } + + if(flat) { + QString div_str; + if(po.use_unicode_signs && po.division_sign == DIVISION_SIGN_DIVISION && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_DIVISION, po.can_display_unicode_string_arg))) { + STR_MARKUP_ADD(div_str, " " SIGN_DIVISION " "); + } else if(po.use_unicode_signs && po.division_sign == DIVISION_SIGN_DIVISION_SLASH && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_DIVISION_SLASH, po.can_display_unicode_string_arg))) { + STR_MARKUP_ADD(div_str, " " SIGN_DIVISION_SLASH " "); + } else { + STR_MARKUP_ADD(div_str, " / "); + } + mstr = num_str; + mstr += div_str; + mstr += den_str; + } else { + + int den_w, num_w, w = 0, h = 0; + + num_str.prepend(TEXT_TAGS); + num_str += TEXT_TAGS_END; + den_str.prepend(TEXT_TAGS); + den_str += TEXT_TAGS_END; + + QSimpleRichText text_r(num_str, font); text_r.setWidth(10000); + num_w = text_r.widthUsed(); + QSimpleRichText text_rn(den_str, font); text_rn.setWidth(10000); + den_w = text_rn.widthUsed(); + + w = den_w; + if(num_w > w) w = num_w; + w += 2; + + QSimpleRichText textsmall("X", font); + h = (int) (textsmall.height() / 1.5); + h += h % 2; + + string filename = getLocalDir(); + if(saved_divisionline_height != h) { + + QPixmap *pixmap = new QPixmap(10, h); + pixmap->fill(cg.background()); + QPainter p(pixmap); + QPen ppen = p.pen(); + ppen.setColor(cg.foreground()); + p.setPen(ppen); + p.drawLine(0, h / 2, 10, h / 2); + p.drawLine(0, h / 2 + 1, 10, h / 2 + 1); + p.flush(); + p.end(); + + pixmap->setMask(pixmap->createHeuristicMask()); + mkdir(filename.c_str(), S_IRWXU); + filename += "tmp/"; + mkdir(filename.c_str(), S_IRWXU); + filename += "divline.png"; + pixmap->save(filename.c_str(), "PNG", 100); + + delete pixmap; + + saved_divisionline_height = h; + + } else { + + filename += "tmp/divline.png"; + + } + + mstr = TEXT_TAGS_END; + mstr = ""; + mstr += num_str; + mstr += "

"; + mstr += den_str; + mstr += ""; + mstr += TEXT_TAGS; + + } + break; + } + case STRUCT_POWER: { + + ips_n.depth++; + + ips_n.wrap = m[0].needsParenthesis(po, ips_n, m, 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + + ips_n.division_depth++; + mstr += draw_structure(m[0], font, cg, po, ips_n); + ips_n.division_depth--; + + ips_n.power_depth++; + ips_n.wrap = m[1].needsParenthesis(po, ips_n, m, 2, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + + PrintOptions po2 = po; + po2.show_ending_zeroes = false; + if(ips.power_depth > 0) { + mstr += TEXT_TAGS "" "^" "" TEXT_TAGS_END; + mstr += draw_structure(m[1], font, cg, po2, ips_n); + } else { + mstr += draw_structure(m[1], font, cg, po2, ips_n); + } + + break; + } + case STRUCT_LOGICAL_AND: { + if(!po.preserve_format && m.size() == 2 && m[0].isComparison() && m[1].isComparison() && m[0].comparisonType() != COMPARISON_EQUALS && m[0].comparisonType() != COMPARISON_NOT_EQUALS && m[1].comparisonType() != COMPARISON_EQUALS && m[1].comparisonType() != COMPARISON_NOT_EQUALS && m[0][0] == m[1][0]) { + + ips_n.depth++; + + bool do_space = true; + QString tstr; + ips_n.wrap = m[0][1].needsParenthesis(po, ips_n, m[0], 2, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + tstr = draw_structure(m[0][1], font, cg, po, ips_n); + do_space = !tstr.endsWith("valign=\"middle\">"); + mstr += tstr; + STR_MARKUP_BEGIN(mstr); + if(do_space) mstr += " "; + switch(m[0].comparisonType()) { + case COMPARISON_LESS: { + mstr += ">"; + break; + } + case COMPARISON_GREATER: { + mstr += "<"; + break; + } + case COMPARISON_EQUALS_LESS: { + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_GREATER_OR_EQUAL, po.can_display_unicode_string_arg))) { + mstr += SIGN_GREATER_OR_EQUAL; + } else { + mstr += ">="; + } + break; + } + case COMPARISON_EQUALS_GREATER: { + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_LESS_OR_EQUAL, po.can_display_unicode_string_arg))) { + mstr += SIGN_LESS_OR_EQUAL; + } else { + mstr += "<="; + } + break; + } + default: {} + } + + ips_n.wrap = m[0][0].needsParenthesis(po, ips_n, m[0], 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + tstr = draw_structure(m[0][0], font, cg, po, ips_n); + do_space = !tstr.endsWith("valign=\"middle\">"); + if(do_space) mstr += " "; + STR_MARKUP_END(mstr); + mstr += tstr; + STR_MARKUP_BEGIN(mstr); + if(do_space) mstr += " "; + + switch(m[1].comparisonType()) { + case COMPARISON_GREATER: { + mstr += ">"; + break; + } + case COMPARISON_LESS: { + mstr += "<"; + break; + } + case COMPARISON_EQUALS_GREATER: { + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_GREATER_OR_EQUAL, po.can_display_unicode_string_arg))) { + mstr += SIGN_GREATER_OR_EQUAL; + } else { + mstr += ">="; + } + break; + } + case COMPARISON_EQUALS_LESS: { + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_LESS_OR_EQUAL, po.can_display_unicode_string_arg))) { + mstr += SIGN_LESS_OR_EQUAL; + } else { + mstr += "<="; + } + break; + } + default: {} + } + + ips_n.wrap = m[1][1].needsParenthesis(po, ips_n, m[1], 2, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + tstr = draw_structure(m[1][1], font, cg, po, ips_n); + do_space = !tstr.endsWith("valign=\"middle\">"); + if(do_space) mstr += " "; + STR_MARKUP_END(mstr); + mstr += tstr; + + break; + } + } + case STRUCT_COMPARISON: {} + case STRUCT_LOGICAL_XOR: {} + case STRUCT_LOGICAL_OR: {} + case STRUCT_BITWISE_AND: {} + case STRUCT_BITWISE_XOR: {} + case STRUCT_BITWISE_OR: { + + ips_n.depth++; + + QString str; + if(m.type() == STRUCT_COMPARISON) { + switch(m.comparisonType()) { + case COMPARISON_EQUALS: { + break; + } + case COMPARISON_NOT_EQUALS: { + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_NOT_EQUAL, po.can_display_unicode_string_arg))) { + str += SIGN_NOT_EQUAL; + } else { + str += "!="; + } + break; + } + case COMPARISON_GREATER: { + str += ">"; + break; + } + case COMPARISON_LESS: { + str += "<"; + break; + } + case COMPARISON_EQUALS_GREATER: { + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_GREATER_OR_EQUAL, po.can_display_unicode_string_arg))) { + str += SIGN_GREATER_OR_EQUAL; + } else { + str += ">="; + } + break; + } + case COMPARISON_EQUALS_LESS: { + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_LESS_OR_EQUAL, po.can_display_unicode_string_arg))) { + str += SIGN_LESS_OR_EQUAL; + } else { + str += "<="; + } + break; + } + } + } else if(m.type() == STRUCT_LOGICAL_AND) { + str += ""; + if(po.spell_out_logical_operators) str += i18n("and"); + else str += "&&"; + str += ""; + } else if(m.type() == STRUCT_LOGICAL_OR) { + str += ""; + if(po.spell_out_logical_operators) str += i18n("or"); + else str += "||"; + str += ""; + } else if(m.type() == STRUCT_LOGICAL_XOR) { + str += "XOR"; + } else if(m.type() == STRUCT_BITWISE_AND) { + str += "&"; + } else if(m.type() == STRUCT_BITWISE_OR) { + str += "|"; + } else if(m.type() == STRUCT_BITWISE_XOR) { + str += "XOR"; + } + + bool do_space = true, do_space_prev = true; + QString tstr; + for(size_t i = 0; i < m.size(); i++) { + do_space_prev = do_space; + ips_n.wrap = m[i].needsParenthesis(po, ips_n, m, i + 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + tstr = draw_structure(m[i], font, cg, po, ips_n); + do_space = !tstr.endsWith("valign=\"middle\">"); + if(i > 0) { + STR_MARKUP_BEGIN(mstr); + if(do_space_prev) mstr += " "; + if(m.isComparison() && m.comparisonType() == COMPARISON_EQUALS) { + if(ips.depth == 0 && po.use_unicode_signs && (*po.is_approximate || m.isApproximate()) && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_ALMOST_EQUAL, po.can_display_unicode_string_arg))) { + mstr += SIGN_ALMOST_EQUAL; + } else { + mstr += "="; + } + } else { + mstr += str; + } + if(do_space) mstr += " "; + STR_MARKUP_END(mstr); + } + mstr += tstr; + } + break; + } + case STRUCT_BITWISE_NOT: { + + ips_n.depth++; + + STR_MARKUP_BEGIN(mstr); + + mstr += "~"; + + ips_n.wrap = m[0].needsParenthesis(po, ips_n, m, 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + mstr += draw_structure(m[0], font, cg, po, ips_n); + + STR_MARKUP_END(mstr); + + break; + } + case STRUCT_LOGICAL_NOT: { + + ips_n.depth++; + + STR_MARKUP_BEGIN(mstr); + + mstr += "!"; + + ips_n.wrap = m[0].needsParenthesis(po, ips_n, m, 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + mstr += draw_structure(m[0], font, cg, po, ips_n); + + STR_MARKUP_END(mstr); + + break; + } + case STRUCT_VECTOR: { + + ips_n.depth++; + + bool is_matrix = m.isMatrix(); + if(!in_matrix) { + result_parts.push_back(m); + mstr = ""; + } + + if(m.size() == 0) { + STR_MARKUP_ADD(mstr, "( "); + } else { + STR_MARKUP_ADD(mstr, "("); + } + for(size_t index = 0; index < m.size(); index++) { + if(index > 0) { + STR_MARKUP_BEGIN(mstr); + mstr += CALCULATOR->getComma().c_str(); + mstr += " "; + STR_MARKUP_END(mstr); + } + ips_n.wrap = m[index].needsParenthesis(po, ips_n, m, index + 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0); + mstr += draw_structure(m[index], font, cg, po, ips_n, is_matrix); + } + STR_MARKUP_ADD(mstr, ")"); + if(!in_matrix) mstr += ""; + break; + } + case STRUCT_UNIT: { + + result_parts.push_back(m); + mstr = ""; + + STR_MARKUP_BEGIN(mstr); + + QString str; + const ExpressionName *ename = &m.unit()->preferredDisplayName(po.abbreviate_names, po.use_unicode_signs, m.isPlural(), po.use_reference_names, po.can_display_unicode_string_function, po.can_display_unicode_string_arg); + if(m.prefix()) { + str += m.prefix()->name(po.abbreviate_names && ename->abbreviation && (ename->suffix || ename->name.find("_") == string::npos), po.use_unicode_signs, po.can_display_unicode_string_function, po.can_display_unicode_string_arg).c_str(); + } + if(ename->suffix && ename->name.length() > 1) { + size_t i = ename->name.rfind('_'); + bool b = i == string::npos || i == ename->name.length() - 1 || i == 0; + size_t i2 = 1; + if(b) { + if(is_in(NUMBERS, ename->name[ename->name.length() - 1])) { + while(ename->name.length() > i2 + 1 && is_in(NUMBERS, ename->name[ename->name.length() - 1 - i2])) { + i2++; + } + } + str += ename->name.substr(0, ename->name.length() - i2).c_str(); + } else { + str += ename->name.substr(0, i).c_str(); + } + if(ips.power_depth == 0) str += ""; + else str += TEXT_TAGS_SMALL ""; + if(b) str += ename->name.substr(ename->name.length() - i2, i2).c_str(); + else str += ename->name.substr(i + 1, ename->name.length() - (i + 1)).c_str(); + if(ips.power_depth == 0) str += ""; + else str += "" TEXT_TAGS_SMALL_END; + } else { + str += ename->name.c_str(); + } + str.replace("_", " "); + mstr += str; + + STR_MARKUP_END(mstr); + mstr += ""; + mstr += ""; + + break; + } + case STRUCT_VARIABLE: { + + result_parts.push_back(m); + mstr = ""; + if(m.variable() == CALCULATOR->v_i) { + STR_MARKUP_BEGIN(mstr); + } else { + STR_MARKUP_BEGIN_CURSIVE(mstr); + } + + QString str; + const ExpressionName *ename = &m.variable()->preferredDisplayName(po.abbreviate_names, po.use_unicode_signs, false, po.use_reference_names, po.can_display_unicode_string_function, po.can_display_unicode_string_arg); + if(ename->suffix && ename->name.length() > 1) { + size_t i = ename->name.rfind('_'); + bool b = i == string::npos || i == ename->name.length() - 1 || i == 0; + size_t i2 = 1; + if(b) { + if(is_in(NUMBERS, ename->name[ename->name.length() - 1])) { + while(ename->name.length() > i2 + 1 && is_in(NUMBERS, ename->name[ename->name.length() - 1 - i2])) { + i2++; + } + } + str += ename->name.substr(0, ename->name.length() - i2).c_str(); + } else { + str += ename->name.substr(0, i).c_str(); + } + if(ips.power_depth == 0) str += ""; + else str += TEXT_TAGS_SMALL ""; + if(b) str += ename->name.substr(ename->name.length() - i2, i2).c_str(); + else str += ename->name.substr(i + 1, ename->name.length() - (i + 1)).c_str(); + if(ips.power_depth == 0) str += ""; + else str += "" TEXT_TAGS_SMALL_END; + } else { + str += ename->name.c_str(); + } + str.replace("_", " "); + mstr += str; + + if(m.variable() == CALCULATOR->v_i) { + STR_MARKUP_END(mstr); + } else { + STR_MARKUP_END_CURSIVE(mstr); + } + mstr += ""; + /*result_parts.push_back(m); + mstr += "";*/ + break; + } + case STRUCT_FUNCTION: { + + ips_n.depth++; + + result_parts.push_back(m); + mstr = ""; + + STR_MARKUP_BEGIN(mstr); + + QString str; + const ExpressionName *ename = &m.function()->preferredDisplayName(po.abbreviate_names, po.use_unicode_signs, false, po.use_reference_names, po.can_display_unicode_string_function, po.can_display_unicode_string_arg); + if(ename->suffix && ename->name.length() > 1) { + size_t i = ename->name.rfind('_'); + bool b = i == string::npos || i == ename->name.length() - 1 || i == 0; + size_t i2 = 1; + if(b) { + if(is_in(NUMBERS, ename->name[ename->name.length() - 1])) { + while(ename->name.length() > i2 + 1 && is_in(NUMBERS, ename->name[ename->name.length() - 1 - i2])) { + i2++; + } + } + str += ename->name.substr(0, ename->name.length() - i2).c_str(); + } else { + str += ename->name.substr(0, i).c_str(); + } + if(ips.power_depth == 0) str += ""; + else str += TEXT_TAGS_SMALL ""; + if(b) str += ename->name.substr(ename->name.length() - i2, i2).c_str(); + else str += ename->name.substr(i + 1, ename->name.length() - (i + 1)).c_str(); + if(ips.power_depth == 0) str += ""; + else str += "" TEXT_TAGS_SMALL_END; + } else { + str += ename->name.c_str(); + } + str.replace("_", " "); + mstr += str; + + mstr += "("; + STR_MARKUP_END(mstr); + mstr += ""; + + for(size_t index = 0; index < m.size(); index++) { + if(index > 0) { + STR_MARKUP_BEGIN(mstr); + mstr += po.comma().c_str(); + mstr += " "; + STR_MARKUP_END(mstr); + } + mstr += draw_structure(m[index], font, cg, po, ips_n); + } + STR_MARKUP_ADD(mstr, ")"); + + break; + } + case STRUCT_UNDEFINED: { + STR_MARKUP_ADD(mstr, i18n("undefined")); + break; + } + default: { + } + } + if(ips.wrap) { + STR_MARKUP_PREPEND(mstr, "("); + STR_MARKUP_ADD(mstr, ")"); + } + if(ips.depth == 0 && !(m.isComparison() && (!(*po.is_approximate || m.isApproximate()) || (m.comparisonType() == COMPARISON_EQUALS && po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_ALMOST_EQUAL, po.can_display_unicode_string_arg)))))) { + QString equals_str; + if(*po.is_approximate || m.isApproximate()) { + if(po.use_unicode_signs && (!po.can_display_unicode_string_function || (*po.can_display_unicode_string_function) (SIGN_ALMOST_EQUAL, po.can_display_unicode_string_arg))) { + equals_str = SIGN_ALMOST_EQUAL " "; + } else { + equals_str += i18n("approx."); + equals_str += " "; + } + } else { + equals_str = "= "; + } + mstr.prepend(equals_str); + } + if(ips.depth == 0) { + mstr.prepend(TEXT_TAGS); + mstr += TEXT_TAGS_END; + } + + return mstr; + +} + +#define STATUS_SPACE if(b) str += " "; else b = true; + +void KQalculate::update_status_text() { + + QString str; + bool b = false; + + if(evalops.approximation == APPROXIMATION_EXACT) { + STATUS_SPACE + str += i18n("EXACT"); + } else if(evalops.approximation == APPROXIMATION_APPROXIMATE) { + STATUS_SPACE + str += i18n("APPROX"); + } + if(evalops.parse_options.rpn) { + STATUS_SPACE + str += i18n("RPN"); + } + switch(evalops.parse_options.base) { + case BASE_DECIMAL: { + break; + } + case BASE_BINARY: { + STATUS_SPACE + str += i18n("BIN"); + break; + } + case BASE_OCTAL: { + STATUS_SPACE + str += i18n("OCT"); + break; + } + case BASE_HEXADECIMAL: { + STATUS_SPACE + str += i18n("HEX"); + break; + } + case BASE_ROMAN_NUMERALS: { + STATUS_SPACE + str += i18n("ROMAN"); + break; + } + default: { + STATUS_SPACE + str += QString::number(evalops.parse_options.base); + break; + } + } + switch (evalops.parse_options.angle_unit) { + case ANGLE_UNIT_DEGREES: { + STATUS_SPACE + str += i18n("DEG"); + break; + } + case ANGLE_UNIT_RADIANS: { + STATUS_SPACE + str += i18n("RAD"); + break; + } + case ANGLE_UNIT_GRADIANS: { + STATUS_SPACE + str += i18n("GRA"); + break; + } + default: {} + } + if(evalops.parse_options.read_precision != DONT_READ_PRECISION) { + STATUS_SPACE + str += i18n("PREC"); + } + if(!evalops.parse_options.functions_enabled) { + STATUS_SPACE + str += ""; + str += i18n("FUNC"); + str += ""; + } + if(!evalops.parse_options.units_enabled) { + STATUS_SPACE + str += ""; + str += i18n("UNIT"); + str += ""; + } + if(!evalops.parse_options.variables_enabled) { + STATUS_SPACE + str += ""; + str += i18n("VAR"); + str += ""; + } + if(!evalops.allow_infinite) { + STATUS_SPACE + str += ""; + str += i18n("INF"); + str += ""; + } + if(!evalops.allow_complex) { + STATUS_SPACE + str += ""; + str += i18n("CPLX"); + str += ""; + } + str = str.stripWhiteSpace(); + if(b) str += " "; + else str += "  "; + + if(str != statusLabel_r->text()) { + statusLabel_r->setText(str); + qApp->processEvents(); + displayParseStatus(); + } + +} + + +void on_abort_display() { + pthread_cancel(view_thread); + CALCULATOR->restoreState(); + CALCULATOR->clearBuffers(); + b_busy = false; + pthread_create(&view_thread, &view_thread_attr, view_proc, view_pipe_r); +} + +void *view_proc(void *pipe) { + + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + FILE *view_pipe = (FILE*) pipe; + + while(true) { + + bool *do_wrap; + void *x = NULL; + fread(&x, sizeof(void*), 1, view_pipe); + KQalculate *win = (KQalculate*) x; + fread(&x, sizeof(void*), 1, view_pipe); + MathStructure m(*((MathStructure*) x)); + fread(&x, sizeof(void*), 1, view_pipe); + MathStructure *mm = (MathStructure*) x; + fread(&do_wrap, sizeof(bool*), 1, view_pipe); + fread(&x, sizeof(void*), 1, view_pipe); + printops.can_display_unicode_string_arg = (void*) win->historyBrowser; + if(x) { + PrintOptions po; + po.preserve_format = true; + po.show_ending_zeroes = true; + po.lower_case_e = printops.lower_case_e; + po.lower_case_numbers = printops.lower_case_numbers; + po.base_display = printops.base_display; + po.abbreviate_names = false; + po.use_unicode_signs = printops.use_unicode_signs; + po.multiplication_sign = printops.multiplication_sign; + po.division_sign = printops.division_sign; + po.short_multiplication = false; + po.excessive_parenthesis = true; + po.improve_division_multipliers = false; + po.can_display_unicode_string_function = &can_display_unicode_string_function; + po.can_display_unicode_string_arg = (void*) win->statusLabel_l; + po.spell_out_logical_operators = printops.spell_out_logical_operators; + po.restrict_to_parent_precision = false; + MathStructure mp(*((MathStructure*) x)); + fread(&po.is_approximate, sizeof(bool*), 1, view_pipe); + mp.format(po); + parsed_text = mp.print(po).c_str(); + fread(&x, sizeof(void*), 1, view_pipe); + mp.set(*((MathStructure*) x)); + if(!mp.isUndefined()) { + mp.format(po); + parsed_text += CALCULATOR->localToString().c_str(); + parsed_text += mp.print(po).c_str(); + } + } + printops.allow_non_usable = false; + if(mm && m.isMatrix()) { + mm->set(m); + MathStructure mm2(m); + string mstr; + int c = mm->columns(), r = mm->rows(); + for(int index_r = 0; index_r < r; index_r++) { + for(int index_c = 0; index_c < c; index_c++) { + mm->getElement(index_r + 1, index_c + 1)->set(i18n("aborted").ascii()); + } + } + for(int index_r = 0; index_r < r; index_r++) { + for(int index_c = 0; index_c < c; index_c++) { + mm2.getElement(index_r + 1, index_c + 1)->format(printops); + mstr = mm2.getElement(index_r + 1, index_c + 1)->print(printops); + mm->getElement(index_r + 1, index_c + 1)->set(mstr); + } + } + } + m.format(printops); + result_history_text = m.print(printops).c_str(); + printops.can_display_unicode_string_arg = NULL; + /*if(result_history_text.length() > 5000) { + result_text = i18n("result is too long\nsee history"); + *printops.is_approximate = false; + } else */ + if(mm && result_text == i18n("aborted")) { + result_text = i18n("calculation was aborted"); + *printops.is_approximate = false; + } else if(mm) { + printops.allow_non_usable = true; + printops.can_display_unicode_string_arg = (void*) win->resultLabel; + QFont font(win->resultLabel->font()); + result_text = draw_structure(m, font, win->resultLabel->colorGroup(), printops); + if(result_text.find("") >= 0) { + result_text.prepend("
"); + result_text += "
"; + *do_wrap = false; + } else { + result_text.prepend("
 
"); + result_text += "
"; + *do_wrap = true; + } + printops.can_display_unicode_string_arg = NULL; + printops.allow_non_usable = false; + } + b_busy = false; + } + return NULL; +} + +void KQalculate::clearresult() { + resultLabel->setRightMargin(10); + resultLabel->setText(" "); + parsed_text = ""; + result_parts.clear(); +} + +void reduceDivLineSize(QalculateResultDisplay *resultLabel) { + + QString str = result_text; + QColorGroup cg = resultLabel->colorGroup(); + int rt_i = 0; + while(true) { + + int i2 = str.find("", 0); + if(i2 < 0) break; + str.remove(0, i2 + 48); + rt_i += i2 + 48; + i2 = str.find("
", 0); + if(i2 < 0) break; + int width_i = rt_i + i2 + 43; + QString num_str = str; + num_str.truncate(i2); + + i2 = str.find("
", i2 + 4); + if(i2 < 0) break; + str.remove(0, i2 + 11); + rt_i += i2 + 11; + i2 = str.find("", 0); + if(i2 < 0) break; + QString den_str = str; + den_str.truncate(i2); + str.remove(0, i2 + 48); + rt_i += i2 + 48; + + int den_w, num_w, w = 0, h = 0; + QSimpleRichText text_r(num_str, resultLabel->font()); text_r.setWidth(10000); + num_w = text_r.widthUsed(); + QSimpleRichText text_rn(den_str, resultLabel->font()); text_rn.setWidth(10000); + den_w = text_rn.widthUsed(); + + w = den_w; + if(num_w > w) w = num_w; + w += 2; + + QSimpleRichText textsmall("X", resultLabel->font()); + h = (int) (textsmall.height() / 1.5); + h += h % 2; + + string filename = getLocalDir(); + if(saved_divisionline_height != h) { + + QPixmap *pixmap = new QPixmap(10, h); + pixmap->fill(cg.background()); + QPainter p(pixmap); + QPen ppen = p.pen(); + ppen.setColor(cg.foreground()); + p.setPen(ppen); + p.drawLine(0, h / 2, 10, h / 2); + p.drawLine(0, h / 2 + 1, 10, h / 2 + 1); + p.flush(); + p.end(); + + pixmap->setMask(pixmap->createHeuristicMask()); + mkdir(filename.c_str(), S_IRWXU); + filename += "tmp/"; + mkdir(filename.c_str(), S_IRWXU); + filename += "divline.png"; + pixmap->save(filename.c_str(), "PNG", 100); + + delete pixmap; + + saved_divisionline_height = h; + + } else { + + filename += "tmp/divline.png"; + + } + + int height_i = result_text.find(" height=", width_i); + if(height_i < 0) break; + num_str = QString::number(w); + result_text.replace(width_i, height_i - width_i, num_str); + int i_diff = num_str.length() - (height_i - width_i); + rt_i += i_diff; + height_i += i_diff; + height_i += 8; + int height_i_end = result_text.find(" src=", height_i); + if(height_i_end < 0) break; + num_str = QString::number(h); + result_text.replace(height_i, height_i_end - height_i, num_str); + i_diff = num_str.length() - (height_i_end - height_i); + rt_i += i_diff; + + } + +} + +Prefix *set_result_prefix; +bool set_result_update_history; +bool set_result_update_parse; +bool set_result_force; +QString set_result_transformation; +size_t set_result_stack_index; +bool set_result_register_moved; + +void KQalculate::setResult(Prefix *prefix, bool update_history, bool update_parse, bool force, QString transformation, size_t stack_index, bool register_moved) { + if(expression_has_changed && !rpn_mode) { + if(!force) return; + execute_expression(); + if(!prefix) return; + } + set_result_prefix = prefix; + set_result_update_history = update_history; + set_result_update_parse = update_parse; + set_result_force = force; + set_result_transformation = transformation; + set_result_stack_index = stack_index; + set_result_register_moved = register_moved; + QTimer::singleShot(0, this, SLOT(setResult2())); +} +void KQalculate::setResult2() { + if(block_result_update) return; + Prefix *prefix = set_result_prefix; + bool update_history = set_result_update_history; + bool update_parse = set_result_update_parse; + bool force = set_result_force; + bool register_moved = set_result_register_moved; + QString transformation = set_result_transformation; + size_t stack_index = set_result_stack_index; + + if(!rpn_mode) stack_index = 0; + if(stack_index != 0) { + update_history = true; + update_parse = false; + } + if(register_moved) { + update_history = true; + update_parse = false; + } + + error_timer->stop(); + b_busy = true; + + uint history_index = 0; + int inhistory_index = 0; + if(update_history) { + if(update_parse || register_moved) { + QString text; + if(register_moved) { + text = i18n("RPN Register Moved"); + inhistory.insert(inhistory.begin(), QString::null); + inhistory_type.insert(inhistory_type.begin(), QALCULATE_HISTORY_REGISTER_MOVED); + inhistory_id.insert(inhistory_id.begin(), inhistory_current_id); + inhistory_current_id++; + inhistory_index++; + } else { + QString text2 = result_history_text; + text2.replace("&", "&"); + text2.replace(">", ">"); + text2.replace("<", "<"); + text = ""; + text += text2; + text += ""; + inhistory.insert(inhistory.begin(), text2); + inhistory_type.insert(inhistory_type.begin(), QALCULATE_HISTORY_EXPRESSION); + inhistory_id.insert(inhistory_id.begin(), inhistory_current_id); + inhistory_index++; + inhistory_current_id++; + } + int l = text.length(); + text += "

"; + text += historyBrowser->text(); + history_index = l + 1; + historyBrowser->setText(text); + } else if(initial_result_index == 0) { + b_busy = false; + error_timer->start(100); + return; + } else { + inhistory_index = initial_inhistory_index; + if(!transformation.isEmpty()) { + transformation.replace("&", "&"); + transformation.replace(">", ">"); + transformation.replace("<", "<"); + inhistory.insert(inhistory.begin(), transformation); + inhistory_type.insert(inhistory_type.begin() + inhistory_index, QALCULATE_HISTORY_TRANSFORMATION); + inhistory_id.insert(inhistory_id.begin() + inhistory_index, inhistory_current_id); + inhistory_current_id++; + inhistory_index++; + transformation.insert(0, ""); + transformation += ":
"; + QString text = historyBrowser->text(); + text.insert(initial_result_index, transformation); + historyBrowser->setText(text); + initial_result_index += transformation.length() - 4; + } + history_index = initial_result_index; + } + result_history_text = "?"; + } + if(update_parse) { + parsed_text = i18n("aborted"); + } + + if(stack_index == 0) { + resultLabel->setRightMargin(10); + resultLabel->setText(" "); + result_parts.clear(); + result_text = i18n("result processing was aborted"); + } + + *printops.is_approximate = false; + + printops.prefix = prefix; + + CALCULATOR->saveState(); + + bool parsed_approx = false; + bool do_wrap = true; + KQalculate *win = this; + fwrite(&win, sizeof(void*), 1, view_pipe_w); + if(stack_index == 0) { + fwrite(&mstruct, sizeof(void*), 1, view_pipe_w); + matrix_mstruct->clear(); + fwrite(&matrix_mstruct, sizeof(void*), 1, view_pipe_w); + } else { + MathStructure *mreg = CALCULATOR->getRPNRegister(stack_index + 1); + fwrite(&mreg, sizeof(void*), 1, view_pipe_w); + void *x = NULL; + fwrite(&x, sizeof(void*), 1, view_pipe_w); + } + bool *b = &do_wrap; + fwrite(&b, sizeof(bool*), 1, view_pipe_w); + if(update_parse) { + fwrite(&parsed_mstruct, sizeof(void*), 1, view_pipe_w); + bool *parsed_approx_p = &parsed_approx; + fwrite(&parsed_approx_p, sizeof(void*), 1, view_pipe_w); + fwrite(&parsed_tostruct, sizeof(void*), 1, view_pipe_w); + } else { + void *x = NULL; + fwrite(&x, sizeof(void*), 1, view_pipe_w); + } + fflush(view_pipe_w); + + struct timespec rtime; + rtime.tv_sec = 0; + rtime.tv_nsec = 20000000; + int i = 0; + while(b_busy && i < 50) { + nanosleep(&rtime, NULL); + i++; + } + i = 0; + + KProgressDialog *dialog = NULL; + if(b_busy) { + dialog = new KProgressDialog(this, "display_progress_dialog", i18n("Processing..."), i18n("Processing..."), true); + dialog->progressBar()->setPercentageVisible(false); + dialog->progressBar()->setTotalSteps(0); + dialog->showCancelButton(true); + dialog->setButtonText(i18n("Abort")); + dialog->show(); + } + if(dialog && dialog->wasCancelled()) on_abort_display(); + rtime.tv_nsec = 100000000; + while(b_busy) { + dialog->progressBar()->advance(1); + qApp->processEvents(); + nanosleep(&rtime, NULL); + if(dialog->wasCancelled()) on_abort_display(); + } + + b_busy = true; + if(dialog) { + dialog->hide(); + delete dialog; + } + + if(stack_index == 0) { + if(do_wrap) { + resultLabel->setVScrollBarMode(QScrollView::Auto); + resultLabel->setRightMargin(10); + resultLabel->setWordWrap(QTextEdit::NoWrap); + } else { + resultLabel->setVScrollBarMode(QScrollView::AlwaysOff); + resultLabel->setWordWrap(QTextEdit::NoWrap); + resultLabel->setRightMargin(0); + QString str = result_text; + str.replace("width=1 ", ""); + QSimpleRichText testrt(str, resultLabel->font()); + testrt.setWidth(resultLabel->visibleWidth() * 4); + if(testrt.widthUsed() > resultLabel->visibleWidth()) { + result_text.replace("setText(result_text); + } + + if(register_moved) { + update_parse = true; + parsed_text = result_history_text; + } + + if(update_history) { + if(result_history_text.length() > 500000) { + result_history_text = "(...)"; + } + if(parsed_text.length() > 500000) { + parsed_text = "(...)"; + } + QString new_text; + if(update_parse) { + QString str = "  "; + if(!parsed_approx) { + str += "="; + inhistory_type.insert(inhistory_type.begin() + inhistory_index, QALCULATE_HISTORY_PARSE); + } else { + if(printops.use_unicode_signs && can_display_unicode_string_function(SIGN_ALMOST_EQUAL, (void*) historyBrowser)) { + str += SIGN_ALMOST_EQUAL; + } else { + str += i18n("approx."); + } + inhistory_type.insert(inhistory_type.begin() + inhistory_index, QALCULATE_HISTORY_PARSE_APPROXIMATE); + } + str += " "; + QString str2 = parsed_text; + str2.replace("&", "&"); + str2.replace(">", ">"); + str2.replace("<", "<"); + inhistory.insert(inhistory.begin() + inhistory_index, str2); + inhistory_id.insert(inhistory_id.begin() + inhistory_index, inhistory_current_id); + inhistory_index++; + str += str2; + new_text += ""; + new_text += ""; + new_text += str; + new_text += ""; + new_text += ""; + new_text += "
"; + inhistory_current_id++; + } + if(stack_index == 0) { + display_errors(&new_text, &inhistory_index); + new_text += ""; + if(!(*printops.is_approximate) && !mstruct->isApproximate() && (update_parse || !prev_result_approx)) { + inhistory_type.insert(inhistory_type.begin() + inhistory_index, QALCULATE_HISTORY_RESULT); + new_text += "="; + } else { + inhistory_type.insert(inhistory_type.begin() + inhistory_index, QALCULATE_HISTORY_RESULT_APPROXIMATE); + if(printops.use_unicode_signs && can_display_unicode_string_function(SIGN_ALMOST_EQUAL, (void*) historyBrowser)) { + new_text += SIGN_ALMOST_EQUAL; + } else { + QString str_approx = "= "; + str_approx += i18n("approx."); + new_text += str_approx; + } + } + new_text += " "; + new_text += ""; + } else { + display_errors(); + } + if(rpn_mode && !register_moved) { + RPNRegisterChanged(result_history_text, stack_index); + } + if(stack_index == 0) { + QString str2 = result_history_text; + str2.replace("&", "&"); + str2.replace(">", ">"); + str2.replace("<", "<"); + new_text += ""; + new_text += ""; + new_text += str2; + new_text += " "; + new_text += ""; + inhistory.insert(inhistory.begin() + inhistory_index, str2); + inhistory_id.insert(inhistory_id.begin() + inhistory_index, inhistory_current_id); + inhistory_current_id++; + QString text = historyBrowser->text(); + initial_result_index = history_index + new_text.length() + 4; + initial_inhistory_index = inhistory_index + 1; + if(!update_parse && transformation.isEmpty()) { + new_text += "
"; + } + text.insert(history_index, new_text); + historyBrowser->setText(text); + prev_result_approx = *printops.is_approximate; + } + } + printops.prefix = NULL; + + b_busy = false; + display_errors(); + + if(!register_moved && stack_index == 0 && mstruct->isMatrix() && matrix_mstruct->isMatrix()) { + qApp->processEvents(); + expressionEdit->setFocus(); + if(update_history && update_parse && force) expressionEdit->selectAll(); + insertMatrixVector(matrix_mstruct, false, true, true); + } + error_timer->start(100); +} + +void on_abort_command() { + pthread_cancel(command_thread); + CALCULATOR->restoreState(); + CALCULATOR->clearBuffers(); + b_busy = false; + command_thread_started = false; +} + +void *command_proc(void *pipe) { + + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + FILE *command_pipe = (FILE*) pipe; + + while(true) { + + void *x = NULL; + int command_type; + fread(&command_type, sizeof(int), 1, command_pipe); + fread(&x, sizeof(void*), 1, command_pipe); + switch(command_type) { + case COMMAND_FACTORIZE: { + if(!((MathStructure*) x)->integerFactorize()) { + ((MathStructure*) x)->factorize(evalops); + } + break; + } + case COMMAND_SIMPLIFY: { + ((MathStructure*) x)->simplify(evalops); + break; + } + } + b_busy = false; + + } + return NULL; +} + +int execute_command_command_type; + +void KQalculate::executeCommand(int command_type) { + execute_command_command_type = command_type; + if(expression_has_changed && !rpn_mode) { + execute_expression(); + } + QTimer::singleShot(0, this, SLOT(executeCommand2())); +} +void KQalculate::executeCommand2() { + int command_type = execute_command_command_type; + + error_timer->stop(); + + b_busy = true; + bool command_aborted = false; + CALCULATOR->saveState(); + + if(!command_thread_started) { + pthread_create(&command_thread, &command_thread_attr, command_proc, command_pipe_r); + command_thread_started = true; + } + + fwrite(&command_type, sizeof(int), 1, command_pipe_w); + MathStructure *mfactor = new MathStructure(*mstruct); + fwrite(&mfactor, sizeof(void*), 1, command_pipe_w); + + fflush(command_pipe_w); + + struct timespec rtime; + rtime.tv_sec = 0; + rtime.tv_nsec = 20000000; + int i = 0; + while(b_busy && i < 50) { + nanosleep(&rtime, NULL); + i++; + } + i = 0; + + KProgressDialog *dialog = NULL; + if(b_busy) { + QString progress_str; + switch(command_type) { + case COMMAND_FACTORIZE: { + progress_str = i18n("Factorizing..."); + break; + } + case COMMAND_SIMPLIFY: { + progress_str = i18n("Simplifying..."); + break; + } + } + dialog = new KProgressDialog(this, "display_progress_dialog", progress_str, progress_str, true); + dialog->progressBar()->setPercentageVisible(false); + dialog->progressBar()->setTotalSteps(0); + dialog->showCancelButton(true); + dialog->setButtonText(i18n("Abort")); + dialog->show(); + } + if(dialog && dialog->wasCancelled()) { + on_abort_command(); + command_aborted = true; + } + rtime.tv_nsec = 100000000; + while(b_busy) { + dialog->progressBar()->advance(1); + qApp->processEvents(); + nanosleep(&rtime, NULL); + if(dialog->wasCancelled()) { + on_abort_command(); + command_aborted = true; + } + } + + b_busy = true; + if(dialog) { + dialog->hide(); + delete dialog; + } + + b_busy = false; + + if(!command_aborted) { + mstruct->unref(); + mstruct = mfactor; + switch(command_type) { + case COMMAND_FACTORIZE: { + printops.allow_factorization = true; + break; + } + case COMMAND_SIMPLIFY: { + printops.allow_factorization = false; + break; + } + } + set_result_prefix = NULL; + set_result_update_history = true; + set_result_update_parse = false; + set_result_force = true; + set_result_transformation = ""; + set_result_stack_index = 0; + set_result_register_moved = false; + setResult2(); + expressionEdit->setFocus(); + } + + error_timer->start(100); + +} + +void KQalculate::result_display_updated() { + setResult(NULL, false, false, false); + update_status_text(); + expressionEdit->setFocus(); +} +void KQalculate::result_format_updated() { + setResult(NULL, true, false, false); + update_status_text(); + expressionEdit->setFocus(); +} +void KQalculate::result_action_executed() { + //display_errors(); + printops.allow_factorization = (evalops.structuring == STRUCTURING_FACTORIZE); + setResult(NULL, true, false, true); + expressionEdit->setFocus(); +} +void KQalculate::result_prefix_changed(Prefix *prefix) { + setResult(prefix, true, false, true); + expressionEdit->setFocus(); +} +void KQalculate::expression_calculation_updated() { + expression_has_changed2 = true; + displayParseStatus(); + if(!rpn_mode) execute_expression(false); + update_status_text(); + expressionEdit->setFocus(); +} +void KQalculate::expression_format_updated(bool recalculate) { + if(rpn_mode) recalculate = false; + expression_has_changed2 = true; + displayParseStatus(); + if(!expression_has_changed && !recalculate && !rpn_mode) { + clearresult(); + } + if(recalculate) { + execute_expression(false); + } + update_status_text(); + expressionEdit->setFocus(); +} + +/* + calculate entered expression and display result +*/ +size_t execute_expression_stack_index; +bool execute_expression_do_stack; +bool execute_expression_force; +bool execute_expression_do_mathoperation; +MathOperation execute_expression_op; +MathFunction *execute_expression_f; +void KQalculate::execute_expression(bool force) { + execute_expression_force = force; + execute_expression_do_stack = false; + execute_expression_do_mathoperation = false; + QTimer::singleShot(0, this, SLOT(execute_expression2())); +} +void KQalculate::execute_expression2() { + + bool force = execute_expression_force; + bool do_stack = execute_expression_do_stack; + size_t stack_index = execute_expression_stack_index; + bool do_mathoperation = execute_expression_do_mathoperation; + MathOperation op = execute_expression_op; + MathFunction *f = execute_expression_f; + + QString str; + + if(do_stack) { + str = getRPNRegister(stack_index)->text(1).stripWhiteSpace(); + error_timer->stop(); + } else { + str = expressionEdit->text().stripWhiteSpace(); + if(!force && (expression_has_changed || str.isEmpty())) return; + error_timer->stop(); + expression_has_changed = false; + if(!do_mathoperation && !str.isEmpty()) expressionEdit->addToHistory(expressionEdit->text()); + } + + size_t stack_size = 0; + + b_busy = true; + + if(!do_stack || stack_index == 0) { + parsed_text = ""; + } + if(do_stack) { + stack_size = CALCULATOR->RPNStackSize(); + CALCULATOR->setRPNRegister(stack_index + 1, CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options), 0, evalops, parsed_mstruct, parsed_tostruct, !printops.negative_exponents); + } else if(rpn_mode) { + stack_size = CALCULATOR->RPNStackSize(); + if(do_mathoperation) { + if(f) CALCULATOR->calculateRPN(f, 0, evalops, parsed_mstruct); + else CALCULATOR->calculateRPN(op, 0, evalops, parsed_mstruct); + } else { + string str2 = CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options); + CALCULATOR->parseSigns(str2); + if(str2.length() == 1) { + do_mathoperation = true; + switch(str2[0]) { + case '^': {CALCULATOR->calculateRPN(OPERATION_RAISE, 0, evalops, parsed_mstruct); break;} + case '+': {CALCULATOR->calculateRPN(OPERATION_ADD, 0, evalops, parsed_mstruct); break;} + case '-': {CALCULATOR->calculateRPN(OPERATION_SUBTRACT, 0, evalops, parsed_mstruct); break;} + case '*': {CALCULATOR->calculateRPN(OPERATION_MULTIPLY, 0, evalops, parsed_mstruct); break;} + case '/': {CALCULATOR->calculateRPN(OPERATION_DIVIDE, 0, evalops, parsed_mstruct); break;} + case '&': {CALCULATOR->calculateRPN(OPERATION_BITWISE_AND, 0, evalops, parsed_mstruct); break;} + case '|': {CALCULATOR->calculateRPN(OPERATION_BITWISE_OR, 0, evalops, parsed_mstruct); break;} + case '~': {CALCULATOR->calculateRPNBitwiseNot(0, evalops, parsed_mstruct); break;} + case '!': {CALCULATOR->calculateRPN(CALCULATOR->f_factorial, 0, evalops, parsed_mstruct); break;} + case '>': {CALCULATOR->calculateRPN(OPERATION_GREATER, 0, evalops, parsed_mstruct); break;} + case '<': {CALCULATOR->calculateRPN(OPERATION_LESS, 0, evalops, parsed_mstruct); break;} + case '=': {CALCULATOR->calculateRPN(OPERATION_EQUALS, 0, evalops, parsed_mstruct); break;} + default: {do_mathoperation = false;} + } + } else if(str2.length() == 2) { + if(str2 == "**") { + CALCULATOR->calculateRPN(OPERATION_RAISE, 0, evalops, parsed_mstruct); + do_mathoperation = true; + } else if(str2 == "!!") { + CALCULATOR->calculateRPN(CALCULATOR->f_factorial2, 0, evalops, parsed_mstruct); + do_mathoperation = true; + } else if(str2 == "!=" || str == "=!" || str == "<>") { + CALCULATOR->calculateRPN(OPERATION_NOT_EQUALS, 0, evalops, parsed_mstruct); + do_mathoperation = true; + } else if(str2 == "<=" || str == "=<") { + CALCULATOR->calculateRPN(OPERATION_EQUALS_LESS, 0, evalops, parsed_mstruct); + do_mathoperation = true; + } else if(str2 == ">=" || str == "=>") { + CALCULATOR->calculateRPN(OPERATION_EQUALS_GREATER, 0, evalops, parsed_mstruct); + do_mathoperation = true; + } else if(str2 == "==") { + CALCULATOR->calculateRPN(OPERATION_EQUALS, 0, evalops, parsed_mstruct); + do_mathoperation = true; + } + } + if(!do_mathoperation) { + bool had_nonnum = false, test_function = true; + int in_par = 0; + for(size_t i = 0; i < str2.length(); i++) { + if(is_in(NUMBERS, str2[i])) { + if(!had_nonnum || in_par) { + test_function = false; + break; + } + } else if(str2[i] == '(') { + if(in_par || !had_nonnum) { + test_function = false; + break; + } + in_par = i; + } else if(str2[i] == ')') { + if(i != str2.length() - 1) { + test_function = false; + break; + } + } else if(str2[i] == ' ') { + if(!in_par) { + test_function = false; + break; + } + } else if(is_in(NOT_IN_NAMES, str2[i])) { + test_function = false; + break; + } else { + if(in_par) { + test_function = false; + break; + } + had_nonnum = true; + } + } + f = NULL; + if(test_function) { + if(in_par) f = CALCULATOR->getActiveFunction(str2.substr(0, in_par)); + else f = CALCULATOR->getActiveFunction(str2); + } + if(f && f->minargs() > 1) { + KMessageBox::error(this, "Can only apply functions wich requires one argument on RPN stack."); + f = NULL; + return; + } + if(f && f->minargs() > 0) { + do_mathoperation = true; + CALCULATOR->calculateRPN(f, 0, evalops, parsed_mstruct); + } else { + CALCULATOR->RPNStackEnter(str2, 0, evalops, parsed_mstruct, parsed_tostruct, !printops.negative_exponents); + } + } + } + } else { + CALCULATOR->calculate(mstruct, CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options), 0, evalops, parsed_mstruct, parsed_tostruct, !printops.negative_exponents); + } + struct timespec rtime; + rtime.tv_sec = 0; + rtime.tv_nsec = 20000000; + int i = 0; + while(CALCULATOR->busy() && i < 50) { + nanosleep(&rtime, NULL); + i++; + } + i = 0; + KProgressDialog *dialog = NULL; + if(CALCULATOR->busy()) { + dialog = new KProgressDialog(this, "calculation_progress_dialog", i18n("Calculating..."), i18n("Calculating..."), true); + dialog->progressBar()->setPercentageVisible(false); + dialog->progressBar()->setTotalSteps(0); + dialog->showCancelButton(true); + dialog->setButtonText(i18n("Abort")); + dialog->show(); + } + if(dialog && dialog->wasCancelled()) CALCULATOR->abort(); + rtime.tv_nsec = 100000000; + while(CALCULATOR->busy()) { + dialog->progressBar()->advance(1); + qApp->processEvents(); + nanosleep(&rtime, NULL); + if(dialog->wasCancelled()) CALCULATOR->abort(); + } + if(dialog) { + dialog->hide(); + delete dialog; + expressionEdit->setFocus(); + } + b_busy = false; + + if(rpn_mode && (!do_stack || stack_index == 0)) { + mstruct->unref(); + mstruct = CALCULATOR->getRPNRegister(1); + if(!mstruct) mstruct = new MathStructure(); + else mstruct->ref(); + } + + //update "ans" variables + if(!do_stack || stack_index == 0) { + vans[4]->set(vans[3]->get()); + vans_id_start[4] = vans_id_start[3]; + vans_id_end[4] = vans_id_end[3]; + vans[3]->set(vans[2]->get()); + vans_id_start[3] = vans_id_start[2]; + vans_id_end[3] = vans_id_end[2]; + vans[2]->set(vans[1]->get()); + vans_id_start[2] = vans_id_start[1]; + vans_id_end[2] = vans_id_end[1]; + vans[1]->set(vans[0]->get()); + vans_id_start[1] = vans_id_start[0]; + vans_id_end[1] = inhistory_current_id - 1; + vans[0]->set(*mstruct); + vans_id_start[0] = inhistory_current_id; + vans_id_end[0] = -1; + } + + if(do_stack && stack_index > 0) { + } else if(rpn_mode && do_mathoperation) { + result_history_text = i18n("RPN Operation"); + } else { + result_history_text = str; + } + printops.allow_factorization = (evalops.structuring == STRUCTURING_FACTORIZE); + set_result_prefix = NULL; + set_result_update_history = true; + set_result_update_parse = (!do_stack || stack_index == 0); + set_result_force = true; + set_result_transformation = ""; + set_result_register_moved = false; + if(!do_stack) set_result_stack_index = 0; + else set_result_stack_index = stack_index; + if(rpn_mode && (!do_stack || stack_index == 0)) { + expressionEdit->clear(); + if(CALCULATOR->RPNStackSize() < stack_size) { + RPNRegisterRemoved(1); + } else if(CALCULATOR->RPNStackSize() > stack_size) { + RPNRegisterAdded(""); + } + } + setResult2(); + if(!do_stack || stack_index == 0) { + expressionEdit->setFocus(); + expressionEdit->selectAll(); + } + error_timer->start(100); +} + +void KQalculate::display_errors(QString *new_text, int *inhistory_index) { + if(!CALCULATOR->message()) return; + error_timer->stop(); + bool error = false; + MessageType mtype; + QStringList strlst; + QString error_str = ""; + while(true) { + mtype = CALCULATOR->message()->type(); + if(mtype == MESSAGE_ERROR || mtype == MESSAGE_WARNING) { + QString text = CALCULATOR->message()->message().c_str(); + text.replace("&", "&"); + text.replace(">", ">"); + text.replace("<", "<"); + if(inhistory_index) { + inhistory.insert(inhistory.begin() + *inhistory_index, text); + inhistory_id.insert(inhistory_id.begin() + *inhistory_index, inhistory_current_id); + inhistory_current_id++; + if(mtype == MESSAGE_ERROR) inhistory_type.insert(inhistory_type.begin() + *inhistory_index, QALCULATE_HISTORY_ERROR); + else inhistory_type.insert(inhistory_type.begin() + *inhistory_index, QALCULATE_HISTORY_WARNING); + *inhistory_index += 1; + } + strlst.push_back(CALCULATOR->message()->message().c_str()); + if(mtype == MESSAGE_ERROR) error = true; + if(mtype == MESSAGE_ERROR) error_str += ""; + else error_str += ""; + error_str += "- "; + error_str += text; + error_str += ""; + error_str += "
"; + } else { + KMessageBox::information(this, CALCULATOR->message()->message().c_str()); + } + if(!CALCULATOR->nextMessage()) break; + } + if(!error_str.isEmpty() && new_text) { + new_text->append(error_str); + } + if(strlst.size() > 1) { + if(error) KMessageBox::error(this, strlst.join("\n"), i18n("Errors")); + else KMessageBox::error(this, strlst.join("\n"), i18n("Warnings")); + } else if(strlst.size() == 1) { + if(error) KMessageBox::error(this, strlst[0], i18n("Error")); + else KMessageBox::error(this, strlst[0], i18n("Warning")); + } + error_timer->start(100); +} + +void save_defs() { + if(!CALCULATOR->saveDefinitions()) { + KMessageBox::error(0, i18n("Couldn't write definitions")); + } +} + + +void KQalculate::create_vmenu() { + + QPopupMenu *sub, *sub3; + + menu_variables->clear(); + sub = menu_variables; + Variable *v; + tree_struct *titem, *titem2; + variable_cats.rit = variable_cats.items.rbegin(); + if(variable_cats.rit != variable_cats.items.rend()) { + titem = &*variable_cats.rit; + ++variable_cats.rit; + titem->rit = titem->items.rbegin(); + } else { + titem = NULL; + } + + menu_variables_ids.clear(); + + stack menus; + menus.push(sub); + sub3 = sub; + while(titem) { + sub = new QPopupMenu(); + QObject::connect(sub, SIGNAL(activated(int)), this, SLOT(onVariableMenuItemActivated(int))); + if(titem->item.find('&') != string::npos) { + QString str2 = titem->item.c_str(); + str2.replace("&", "&&"); + sub3->insertItem(str2, sub, -1, 0); + } else { + sub3->insertItem(titem->item.c_str(), sub, -1, 0); + } + menus.push(sub); + sub3 = sub; + for(size_t i = 0; i < titem->objects.size(); i++) { + v = (Variable*) titem->objects[i]; + if(v->isActive() && !v->isHidden()) { + if(v->title(true).find('&') != string::npos) { + QString str2 = v->title(true).c_str(); + str2.replace("&", "&&"); + menu_variables_ids[sub->insertItem(str2)] = v; + } else { + menu_variables_ids[sub->insertItem(v->title(true).c_str())] = v; + } + } + } + while(titem && titem->rit == titem->items.rend()) { + titem = titem->parent; + menus.pop(); + if(menus.size() > 0) sub3 = menus.top(); + } + if(titem) { + titem2 = &*titem->rit; + ++titem->rit; + titem = titem2; + titem->rit = titem->items.rbegin(); + } + + } + + for(size_t i = 0; i < variable_cats.objects.size(); i++) { + v = (Variable*) variable_cats.objects[i]; + if(v->isActive() && !v->isHidden()) { + menu_variables_ids[menu_variables->insertItem(v->title(true).c_str())] = v; + } + } + +} + +void KQalculate::recreate_recent_variables() { + recent_variable_ids.clear(); + bool b = false; + for(size_t i = 0; i < recent_variables.size(); i++) { + if(!CALCULATOR->stillHasVariable(recent_variables[i])) { + recent_variables.erase(recent_variables.begin() + i); + i--; + } else { + if(!b) { + menu_variables->insertSeparator(0); + b = true; + } + int id = menu_variables->insertItem(recent_variables[i]->title(true).c_str(), -1, 0); + recent_variable_ids.push_back(id); + menu_variables_ids[id] = recent_variables[i]; + } + } +} +void KQalculate::update_vmenu() { + generate_variables_tree_struct(); + create_vmenu(); + recreate_recent_variables(); + if(variables_dialog) variables_dialog->updateVariableTree(); + update_completion(); +} + +void KQalculate::create_fmenu() { + + QPopupMenu *sub, *sub3; + + menu_functions->clear(); + sub = menu_functions; + MathFunction *f; + tree_struct *titem, *titem2; + function_cats.rit = function_cats.items.rbegin(); + if(function_cats.rit != function_cats.items.rend()) { + titem = &*function_cats.rit; + ++function_cats.rit; + titem->rit = titem->items.rbegin(); + } else { + titem = NULL; + } + + menu_functions_ids.clear(); + + stack menus; + menus.push(sub); + sub3 = sub; + while(titem) { + sub = new QPopupMenu(); + QObject::connect(sub, SIGNAL(activated(int)), this, SLOT(onFunctionMenuItemActivated(int))); + if(titem->item.find('&') != string::npos) { + QString str2 = titem->item.c_str(); + str2.replace("&", "&&"); + sub3->insertItem(str2, sub, -1, 0); + } else { + sub3->insertItem(titem->item.c_str(), sub, -1, 0); + } + menus.push(sub); + sub3 = sub; + for(size_t i = 0; i < titem->objects.size(); i++) { + f = (MathFunction*) titem->objects[i]; + if(f->isActive() && !f->isHidden()) { + if(f->title(true).find('&') != string::npos) { + QString str2 = f->title(true).c_str(); + str2.replace("&", "&&"); + menu_functions_ids[sub->insertItem(str2)] = f; + } else { + menu_functions_ids[sub->insertItem(f->title(true).c_str())] = f; + } + } + } + while(titem && titem->rit == titem->items.rend()) { + titem = titem->parent; + menus.pop(); + if(menus.size() > 0) sub3 = menus.top(); + } + if(titem) { + titem2 = &*titem->rit; + ++titem->rit; + titem = titem2; + titem->rit = titem->items.rbegin(); + } + + } + + for(size_t i = 0; i < function_cats.objects.size(); i++) { + f = (MathFunction*) function_cats.objects[i]; + if(f->isActive() && !f->isHidden()) { + menu_functions_ids[menu_functions->insertItem(f->title(true).c_str())] = f; + } + } + +} +void KQalculate::recreate_recent_functions() { + recent_function_ids.clear(); + bool b = false; + for(size_t i = 0; i < recent_functions.size(); i++) { + if(!CALCULATOR->stillHasFunction(recent_functions[i])) { + recent_functions.erase(recent_functions.begin() + i); + i--; + } else { + if(!b) { + menu_functions->insertSeparator(0); + b = true; + } + int id = menu_functions->insertItem(recent_functions[i]->title(true).c_str(), -1, 0); + recent_function_ids.push_back(id); + menu_functions_ids[id] = recent_functions[i]; + } + } +} +void KQalculate::update_fmenu() { + generate_functions_tree_struct(); + create_fmenu(); + recreate_recent_functions(); + if(functions_dialog) functions_dialog->updateFunctionTree(); + if(datasets_dialog) { + datasets_dialog->updateDataSetTree(); + if(!datasets_dialog->dataSetsView->selectedItem()) datasets_dialog->dataSetSelected(); + } + update_completion(); +} + +void KQalculate::create_umenu() { + + QPopupMenu *sub, *sub3; + + menu_units->clear(); + sub = menu_units; + Unit *u; + tree_struct *titem, *titem2; + unit_cats.rit = unit_cats.items.rbegin(); + if(unit_cats.rit != unit_cats.items.rend()) { + titem = &*unit_cats.rit; + ++unit_cats.rit; + titem->rit = titem->items.rbegin(); + } else { + titem = NULL; + } + + menu_units_ids.clear(); + + stack menus; + menus.push(sub); + sub3 = sub; + while(titem) { + sub = new QPopupMenu(); + QObject::connect(sub, SIGNAL(activated(int)), this, SLOT(onUnitMenuItemActivated(int))); + if(titem->item.find('&') != string::npos) { + QString str2 = titem->item.c_str(); + str2.replace("&", "&&"); + sub3->insertItem(str2, sub, -1, 0); + } else { + sub3->insertItem(titem->item.c_str(), sub, -1, 0); + } + menus.push(sub); + sub3 = sub; + for(size_t i = 0; i < titem->objects.size(); i++) { + u = (Unit*) titem->objects[i]; + if(u->isActive() && !u->isHidden()) { + if(u->title(true).find('&') != string::npos) { + QString str2 = u->title(true).c_str(); + str2.replace("&", "&&"); + menu_units_ids[sub->insertItem(str2)] = u; + } else { + menu_units_ids[sub->insertItem(u->title(true).c_str())] = u; + } + } + } + while(titem && titem->rit == titem->items.rend()) { + titem = titem->parent; + menus.pop(); + if(menus.size() > 0) sub3 = menus.top(); + } + if(titem) { + titem2 = &*titem->rit; + ++titem->rit; + titem = titem2; + titem->rit = titem->items.rbegin(); + } + + } + + for(size_t i = 0; i < unit_cats.objects.size(); i++) { + u = (Unit*) unit_cats.objects[i]; + if(u->isActive() && !u->isHidden()) { + menu_units_ids[menu_units->insertItem(u->title(true).c_str())] = u; + } + } + + sub = new QPopupMenu(); + QObject::connect(sub, SIGNAL(activated(int)), this, SLOT(onUnitsPrefixMenuItemActivated(int))); + menu_units->insertSeparator(); + menu_units->insertItem(i18n("Prefixes"), sub); + int index = 0; + Prefix *p = CALCULATOR->getPrefix(index); + while(p) { + QString pstr; + switch(p->type()) { + case PREFIX_DECIMAL: { + QTextOStream(&pstr) << p->name(false, true, &can_display_unicode_string_function, (void*) menu_units).c_str() << "\t(10e" << ((DecimalPrefix*) p)->exponent() << ")"; + break; + } + case PREFIX_BINARY: { + QTextOStream(&pstr) << p->name(false, true, &can_display_unicode_string_function, (void*) menu_units).c_str() << "\t(2e" << ((BinaryPrefix*) p)->exponent() << ")"; + break; + } + case PREFIX_NUMBER: { + QTextOStream(&pstr) << p->name(false, true, &can_display_unicode_string_function, (void*) menu_units).c_str(); + break; + } + } + menu_units_prefixes_ids[sub->insertItem(pstr)] = p; + index++; + p = CALCULATOR->getPrefix(index); + } + +} + +void KQalculate::recreate_recent_units() { + recent_unit_ids.clear(); + bool b = false; + for(size_t i = 0; i < recent_units.size(); i++) { + if(!CALCULATOR->stillHasUnit(recent_units[i])) { + recent_units.erase(recent_units.begin() + i); + i--; + } else { + if(!b) { + menu_units->insertSeparator(0); + b = true; + } + int id = menu_units->insertItem(recent_units[i]->title(true).c_str(), -1, 0); + recent_unit_ids.push_back(id); + menu_units_ids[id] = recent_units[i]; + } + } +} +void KQalculate::update_umenus() { + generate_units_tree_struct(); + create_umenu(); + recreate_recent_units(); + create_toumenu(); + if(units_dialog) units_dialog->updateUnitTree(); + if(convert_to_unit_expression_dialog) convert_to_unit_expression_dialog->updateUnitTree(); + update_completion(); +} + +void KQalculate::create_toumenu() { + + QPopupMenu *sub, *sub3; + + menu_to_unit->clear(); + sub = menu_to_unit; + Unit *u; + tree_struct *titem, *titem2; + unit_cats.rit = unit_cats.items.rbegin(); + if(unit_cats.rit != unit_cats.items.rend()) { + titem = &*unit_cats.rit; + ++unit_cats.rit; + titem->rit = titem->items.rbegin(); + } else { + titem = NULL; + } + + menu_to_unit_ids.clear(); + + stack menus; + menus.push(sub); + sub3 = sub; + while(titem) { + sub = new QPopupMenu(); + QObject::connect(sub, SIGNAL(activated(int)), this, SLOT(onConvertToUnitMenuItemActivated(int))); + if(titem->item.find('&') != string::npos) { + QString str2 = titem->item.c_str(); + str2.replace("&", "&&"); + sub3->insertItem(str2, sub, -1, 0); + } else { + sub3->insertItem(titem->item.c_str(), sub, -1, 0); + } + menus.push(sub); + sub3 = sub; + for(size_t i = 0; i < titem->objects.size(); i++) { + u = (Unit*) titem->objects[i]; + if(u->isActive() && !u->isHidden()) { + if(u->title(true).find('&') != string::npos) { + QString str2 = u->title(true).c_str(); + str2.replace("&", "&&"); + menu_to_unit_ids[sub->insertItem(str2)] = u; + } else { + menu_to_unit_ids[sub->insertItem(u->title(true).c_str())] = u; + } + } + } + while(titem && titem->rit == titem->items.rend()) { + titem = titem->parent; + menus.pop(); + if(menus.size() > 0) sub3 = menus.top(); + } + if(titem) { + titem2 = &*titem->rit; + ++titem->rit; + titem = titem2; + titem->rit = titem->items.rbegin(); + } + + } + + for(size_t i = 0; i < unit_cats.objects.size(); i++) { + u = (Unit*) unit_cats.objects[i]; + if(u->isActive() && !u->isHidden()) { + menu_to_unit_ids[menu_to_unit->insertItem(u->title(true).c_str())] = u; + } + } + +} + +void KQalculate::create_setpmenu() { + menu_set_prefix->clear(); + QObject::connect(menu_set_prefix, SIGNAL(activated(int)), this, SLOT(onSetPrefixMenuItemActivated(int))); + int index = 0; + menu_set_prefix_ids[menu_set_prefix->insertItem(i18n("No Prefix"))] = CALCULATOR->decimal_null_prefix; + Prefix *p = CALCULATOR->getPrefix(index); + while(p) { + QString pstr; + switch(p->type()) { + case PREFIX_DECIMAL: { + QTextOStream(&pstr) << p->name(false, true, &can_display_unicode_string_function, (void*) menu_units).c_str() << "\t(10e" << ((DecimalPrefix*) p)->exponent() << ")"; + break; + } + case PREFIX_BINARY: { + QTextOStream(&pstr) << p->name(false, true, &can_display_unicode_string_function, (void*) menu_units).c_str() << "\t(2e" << ((BinaryPrefix*) p)->exponent() << ")"; + break; + } + case PREFIX_NUMBER: { + QTextOStream(&pstr) << p->name(false, true, &can_display_unicode_string_function, (void*) menu_units).c_str(); + break; + } + } + menu_set_prefix_ids[menu_set_prefix->insertItem(pstr)] = p; + index++; + p = CALCULATOR->getPrefix(index); + } +} + + +void KQalculate::insert_text(QString name) { + expressionEdit->insert(name); + expressionEdit->setFocus(); +} +/* + insert one-argument function when button clicked +*/ +void KQalculate::insertButtonFunction(QString text, bool append_space) { + if(expressionEdit->hasSelectedText()) { + //set selection as argument + text += "("; + text += expressionEdit->selectedText(); + text += ")"; + insert_text(text); + } else { + //one-argument functions do not need parenthesis + if(append_space) { + text += " "; + } + insert_text(text); + } +} +void KQalculate::insertButtonFunction(MathFunction *f) { + const ExpressionName *ename = &f->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionEdit); + if(f->minargs() > 1) { + QString text = ename->name.c_str(); + bool b = expressionEdit->hasSelectedText(); + text += "("; + if(b) text += expressionEdit->selectedText(); + for(int i = 1; i < f->minargs(); i++) { + text += CALCULATOR->getComma().c_str(); + text += " "; + } + text += ")"; + insert_text(text); + if(b) expressionEdit->cursorBackward(false, 1 + (f->minargs() - 2) * 2); + else expressionEdit->cursorBackward(false, 1 + (f->minargs() - 1) * 2); + } else { + if(rpn_mode && f->args() == 1) { + calculateRPN(f); + return; + } + insertButtonFunction(ename->name.c_str(), !text_length_is_one(ename->name)); + } +} + +void KQalculate::function_inserted(MathFunction *object) { + if(!object) { + return; + } + if(recent_function_ids.size() <= 0) { + menu_functions->insertSeparator(0); + } + for(size_t i = 0; i < recent_functions.size(); i++) { + if(recent_functions[i] == object) { + recent_functions.erase(recent_functions.begin() + i); + menu_functions->removeItem(recent_function_ids[i]); + recent_function_ids.erase(recent_function_ids.begin() + i); + break; + } + } + if(recent_function_ids.size() >= 5) { + recent_functions.erase(recent_functions.begin()); + menu_functions->removeItem(recent_function_ids[0]); + recent_function_ids.erase(recent_function_ids.begin()); + } + int id = menu_functions->insertItem(object->title(true).c_str(), -1, 0); + menu_functions_ids[id] = object; + recent_function_ids.push_back(id); + recent_functions.push_back(object); +} +void KQalculate::variable_inserted(Variable *object) { + if(!object) { + return; + } + if(recent_variable_ids.size() <= 0) { + menu_variables->insertSeparator(0); + } + for(size_t i = 0; i < recent_variables.size(); i++) { + if(recent_variables[i] == object) { + recent_variables.erase(recent_variables.begin() + i); + menu_variables->removeItem(recent_variable_ids[i]); + recent_variable_ids.erase(recent_variable_ids.begin() + i); + break; + } + } + if(recent_variable_ids.size() >= 5) { + recent_variables.erase(recent_variables.begin()); + menu_variables->removeItem(recent_variable_ids[0]); + recent_variable_ids.erase(recent_variable_ids.begin()); + } + int id = menu_variables->insertItem(object->title(true).c_str(), -1, 0); + menu_variables_ids[id] = object; + recent_variable_ids.push_back(id); + recent_variables.push_back(object); +} +void KQalculate::unit_inserted(Unit *object) { + if(!object) { + return; + } + if(recent_unit_ids.size() <= 0) { + menu_units->insertSeparator(0); + } + for(size_t i = 0; i < recent_units.size(); i++) { + if(recent_units[i] == object) { + recent_units.erase(recent_units.begin() + i); + menu_units->removeItem(recent_unit_ids[i]); + recent_unit_ids.erase(recent_unit_ids.begin() + i); + break; + } + } + if(recent_unit_ids.size() >= 5) { + recent_units.erase(recent_units.begin()); + menu_units->removeItem(recent_unit_ids[0]); + recent_unit_ids.erase(recent_unit_ids.begin()); + } + int id = menu_units->insertItem(object->title(true).c_str(), -1, 0); + menu_units_ids[id] = object; + recent_unit_ids.push_back(id); + recent_units.push_back(object); +} + +void KQalculate::onVariableMenuItemActivated(int id) { + if(!menu_variables_ids.contains(id)) return; + Variable *v = menu_variables_ids[id]; + if(!CALCULATOR->stillHasVariable(v)) { + KMessageBox::error(this, i18n("Variable does not exist anymore.")); + update_vmenu(); + return; + } + insert_text(v->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionEdit).name.c_str()); + variable_inserted(v); +} +void KQalculate::onFunctionMenuItemActivated(int id) { + if(!menu_functions_ids.contains(id)) return; + MathFunction *f = menu_functions_ids[id]; + insertFunction(f, this); +} +void KQalculate::onUnitMenuItemActivated(int id) { + if(!menu_units_ids.contains(id)) return; + Unit *u = menu_units_ids[id]; + if(!CALCULATOR->stillHasUnit(u)) { + KMessageBox::error(this, i18n("Unit does not exist anymore.")); + update_umenus(); + return; + } + if(u->subtype() == SUBTYPE_COMPOSITE_UNIT) { + insert_text(((CompositeUnit*) u)->print(true, printops.abbreviate_names, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) expressionEdit).c_str()); + } else { + insert_text(u->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, true, false, &can_display_unicode_string_function, (void*) expressionEdit).name.c_str()); + } + unit_inserted(u); +} +void KQalculate::onUnitsPrefixMenuItemActivated(int id) { + if(!menu_units_prefixes_ids.contains(id)) return; + insert_text(menu_units_prefixes_ids[id]->name(printops.abbreviate_names, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) expressionEdit).c_str()); +} + +void KQalculate::update_completion() { + expressionEdit->updateCompletion(); + if(plot_dialog) { + plot_dialog->expressionEdit->updateCompletion(); + } +} + +void KQalculate::set_unicode_buttons() { + if(printops.use_unicode_signs) { + if(can_display_unicode_string_function(SIGN_MINUS, (void*) kpMinus)) kpMinus->setText(SIGN_MINUS); + else kpMinus->setText(MINUS); + if(can_display_unicode_string_function(SIGN_PLUS, (void*) kpPlus)) kpPlus->setText(SIGN_PLUS); + else kpPlus->setText(PLUS); + if(can_display_unicode_string_function(SIGN_MULTIPLICATION, (void*) kpTimes)) kpTimes->setText(SIGN_MULTIPLICATION); + else kpTimes->setText(MULTIPLICATION); + if(can_display_unicode_string_function(SIGN_DIVISION_SLASH, (void*) kpDivision)) kpDivision->setText(SIGN_DIVISION_SLASH); + else if(can_display_unicode_string_function(SIGN_DIVISION, (void*) kpDivision)) kpDivision->setText(SIGN_DIVISION); + else kpDivision->setText(DIVISION); + if(can_display_unicode_string_function(SIGN_SQRT, (void*) kpSqrt)) kpSqrt->setText(SIGN_SQRT); + else kpSqrt->setText("Sqrt"); + if(can_display_unicode_string_function(SIGN_MULTIDOT, (void*) kpDot)) kpDot->setText(SIGN_MULTIDOT); + else kpDot->setText(CALCULATOR->getDecimalPoint().c_str()); + } else { + kpMinus->setText(MINUS); + kpPlus->setText(PLUS); + kpTimes->setText(MULTIPLICATION); + kpDivision->setText(DIVISION); + kpSqrt->setText("Sqrt"); + kpDot->setText(CALCULATOR->getDecimalPoint().c_str()); + } +} + +void KQalculate::onExpressionChanged() { + expression_has_changed = true; + expression_has_changed2 = true; + if(!rpn_mode) clearresult(); + if(!expressionEdit->dont_change_index) expressionEdit->expression_history_index = -1; + displayParseStatus(); +} + +void KQalculate::execute() { + execute_expression_force = true; + execute_expression_do_stack = false; + execute_expression_do_mathoperation = false; + execute_expression2(); +} + +bool KQalculate::fetch_exchange_rates(int) { + KURL url(CALCULATOR->getExchangeRatesUrl().c_str()); + QString filename(CALCULATOR->getExchangeRatesFileName().c_str()); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + if(KIO::NetAccess::download(url, filename)) { +#else + if(KIO::NetAccess::download(url, filename, this)) { +#endif + return true; + } else { + QString errorstr = i18n("Failed to download exchange rates from ECB."); + errorstr += "\n"; + errorstr += KIO::NetAccess::lastErrorString(); + KMessageBox::error(this, errorstr); + return false; + } +} + +void KQalculate::onErrorTimeout() { + if(CALCULATOR->checkSaveFunctionCalled()) { + update_vmenu(); + } + display_errors(); +} + +void KQalculate::toggleHistory(bool on) { + if(on) { + bool b = mainStack->isVisible(); + int new_height = height(); + if(bottomLine->isVisible()) new_height -= bottomLine->height(); + if(mainStack->height() > history_height) history_height = mainStack->height(); + bottomLine->hide(); + mainStack->show(); + mainStack->raiseWidget(1); + keypadButton->setOn(false); + stackButton->setOn(false); + mainStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + if(!b) { + new_height += history_height; + resize(width(), new_height); + } else if(history_height != mainStack->height()) { + resize(width(), height() - mainStack->height() + history_height); + } + } else { + if(!keypadButton->isOn() && !stackButton->isOn()) { + history_height = mainStack->height(); + int new_height = height() - mainStack->height(); + mainStack->hide(); + bottomLine->show(); + qApp->processEvents(); + if(new_height < height()) resize(width(), new_height + bottomLine->height()); + mainStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + } + } +} + +void KQalculate::toggleStack(bool on) { + if(on) { + bool b = mainStack->isVisible(); + int new_height = height(); + if(bottomLine->isVisible()) new_height -= bottomLine->height(); + if(mainStack->height() > history_height) history_height = mainStack->height(); + bottomLine->hide(); + mainStack->show(); + mainStack->raiseWidget(2); + keypadButton->setOn(false); + historyButton->setOn(false); + mainStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + if(!b) { + new_height += history_height; + resize(width(), new_height); + } else if(history_height != mainStack->height()) { + resize(width(), height() - mainStack->height() + history_height); + } + } else { + if(!keypadButton->isOn() && !historyButton->isOn()) { + history_height = mainStack->height(); + int new_height = height() - mainStack->height(); + mainStack->hide(); + bottomLine->show(); + qApp->processEvents(); + if(new_height < height()) resize(width(), new_height + bottomLine->height()); + mainStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + } + } +} + +void KQalculate::toggleKeypad(bool on) { + if(on) { + bool b = mainStack->isVisible(); + if(b) history_height = mainStack->height(); + int new_height = height() - bottomLine->height(); + mainStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + mainStack->show(); + bottomLine->hide(); + mainStack->raiseWidget(0); + historyButton->setOn(false); + stackButton->setOn(false); + if(!b) { + qApp->processEvents(); + new_height += mainStack->height(); + resize(width(), new_height); + } else { + resize(width(), minimumSizeHint().height()); + } + } else { + if(!historyButton->isOn() && !stackButton->isOn()) { + int new_height = height() - mainStack->height(); + mainStack->hide(); + bottomLine->show(); + qApp->processEvents(); + if(new_height < height()) resize(width(), new_height + bottomLine->height()); + mainStack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum, false); + resultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, false); + } + } +} + +void KQalculate::showHide() { + if(isVisible()) { + hide(); + } else { +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + KWin::Info info = KWin::info(winId()); + KWin::setOnDesktop(winId(), KWin::currentDesktop()); + move(info.geometry.topLeft()); +#else + KWin::WindowInfo info = KWin::windowInfo(winId(), (unsigned long) NET::WMGeometry); + KWin::setOnDesktop(winId(), KWin::currentDesktop()); + move(info.geometry().topLeft()); +#endif + setShown(true); + show(); + raise(); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + KWin::setActiveWindow(winId()); +#else + KWin::activateWindow(winId()); +#endif + } +} +void KQalculate::configureGlobalShortcuts() { + KKeyDialog::configure(globalAccel, 0, false); + globalAccel->writeSettings(); + globalAccel->updateConnections(); +} + +void KQalculate::abbreviateNames(bool b) { + printops.abbreviate_names = b; + result_format_updated(); +} + +void KQalculate::approximationAlwaysExact() { + kpExact->blockSignals(true); + evalops.approximation = APPROXIMATION_EXACT; + expression_calculation_updated(); + kpExact->setOn(true); + kpExact->blockSignals(false); +} +void KQalculate::approximationTryExact() { + kpExact->blockSignals(true); + evalops.approximation = APPROXIMATION_TRY_EXACT; + expression_calculation_updated(); + kpExact->setOn(false); + kpExact->blockSignals(false); +} +void KQalculate::approximationApproximate() { + kpExact->blockSignals(true); + evalops.approximation = APPROXIMATION_APPROXIMATE; + expression_calculation_updated(); + kpExact->setOn(false); + kpExact->blockSignals(false); +} + +void KQalculate::fractionalDisplayDecimal() { + kpFraction->blockSignals(true); + printops.number_fraction_format = FRACTION_DECIMAL; + result_format_updated(); + kpFraction->setOn(false); + kpFraction->blockSignals(false); +} +void KQalculate::fractionalDisplayDecimalTryExact() { + kpFraction->blockSignals(true); + printops.number_fraction_format = FRACTION_DECIMAL_EXACT; + result_format_updated(); + kpFraction->setOn(false); + kpFraction->blockSignals(false); +} +void KQalculate::fractionalDisplayFraction() { + kpFraction->blockSignals(true); + printops.number_fraction_format = FRACTION_FRACTIONAL; + result_format_updated(); + kpFraction->setOn(true); + kpFraction->blockSignals(false); +} +void KQalculate::fractionalDisplayCombined() { + kpFraction->blockSignals(true); + printops.number_fraction_format = FRACTION_COMBINED; + result_format_updated(); + kpFraction->setOn(true); + kpFraction->blockSignals(false); +} + +void KQalculate::numericalDisplayNormal() { + kpNumericCombo->blockSignals(true); + printops.min_exp = EXP_PRECISION; + result_format_updated(); + kpNumericCombo->setCurrentItem(0); + kpNumericCombo->blockSignals(false); +} +void KQalculate::numericalDisplayEngineering() { + kpNumericCombo->blockSignals(true); + printops.min_exp = EXP_BASE_3; + result_format_updated(); + kpNumericCombo->setCurrentItem(1); + kpNumericCombo->blockSignals(false); +} +void KQalculate::numericalDisplayScientific() { + kpNumericCombo->blockSignals(true); + printops.min_exp = EXP_SCIENTIFIC; + result_format_updated(); + kpNumericCombo->setCurrentItem(2); + kpNumericCombo->blockSignals(false); +} +void KQalculate::numericalDisplayPurelyScientific() { + kpNumericCombo->blockSignals(true); + printops.min_exp = EXP_PURE; + result_format_updated(); + kpNumericCombo->setCurrentItem(3); + kpNumericCombo->blockSignals(false); +} +void KQalculate::numericalDisplaySimple() { + kpNumericCombo->blockSignals(true); + printops.min_exp = EXP_NONE; + result_format_updated(); + kpNumericCombo->setCurrentItem(4); + kpNumericCombo->blockSignals(false); +} + +void KQalculate::roundHalfwayNumbersToEven(bool b) { + printops.round_halfway_to_even = b; + result_format_updated(); +} + + +void KQalculate::indicateInfiniteSeries(bool b) { + printops.indicate_infinite_series = b; + result_format_updated(); +} + +void KQalculate::sortMinusLast(bool b) { + printops.sort_options.minus_last = b; + result_format_updated(); +} + +void KQalculate::negativeExponents(bool b) { + printops.negative_exponents = b; + result_format_updated(); +} + +void KQalculate::showEndingZeroes(bool b) { + printops.show_ending_zeroes = b; + result_format_updated(); +} + +void KQalculate::updateBaseOther() { + if(set_base_dialog) { + set_base_dialog->outputBaseBox->blockSignals(true); + set_base_dialog->radiogroup_output->blockSignals(true); + set_base_dialog->outputBaseBox->setEnabled(false); + switch(printops.base) { + case BASE_BINARY: { + set_base_dialog->radiogroup_output->setButton(0); + break; + } + case BASE_OCTAL: { + set_base_dialog->radiogroup_output->setButton(1); + break; + } + case BASE_DECIMAL: { + set_base_dialog->radiogroup_output->setButton(2); + break; + } + case BASE_HEXADECIMAL: { + set_base_dialog->radiogroup_output->setButton(3); + break; + } + case BASE_SEXAGESIMAL: { + set_base_dialog->radiogroup_output->setButton(5); + break; + } + case BASE_TIME: { + set_base_dialog->radiogroup_output->setButton(6); + break; + } + case BASE_ROMAN_NUMERALS: { + set_base_dialog->radiogroup_output->setButton(7); + break; + } + default: { + set_base_dialog->radiogroup_output->setButton(4); + set_base_dialog->outputBaseBox->setEnabled(true); + set_base_dialog->outputBaseBox->setValue(printops.base); + } + } + set_base_dialog->outputBaseBox->blockSignals(false); + set_base_dialog->radiogroup_output->blockSignals(false); + } +} +void KQalculate::numberBaseBinary() { + kpBaseCombo->blockSignals(true); + printops.base = BASE_BINARY; + updateBaseOther(); + result_format_updated(); + kpBaseCombo->setCurrentItem(0); + kpBaseCombo->blockSignals(false); +} +void KQalculate::numberBaseOctal() { + kpBaseCombo->blockSignals(true); + printops.base = BASE_OCTAL; + updateBaseOther(); + result_format_updated(); + kpBaseCombo->setCurrentItem(1); + kpBaseCombo->blockSignals(false); +} +void KQalculate::numberBaseDecimal() { + kpBaseCombo->blockSignals(true); + printops.base = BASE_DECIMAL; + updateBaseOther(); + result_format_updated(); + kpBaseCombo->setCurrentItem(2); + kpBaseCombo->blockSignals(false); +} +void KQalculate::numberBaseHexadecimal() { + kpBaseCombo->blockSignals(true); + printops.base = BASE_HEXADECIMAL; + updateBaseOther(); + result_format_updated(); + kpBaseCombo->setCurrentItem(3); + kpBaseCombo->blockSignals(false); +} +void KQalculate::numberBaseSexagesimal() { + kpBaseCombo->blockSignals(true); + printops.base = BASE_SEXAGESIMAL; + updateBaseOther(); + result_format_updated(); + kpBaseCombo->setCurrentItem(4); + kpBaseCombo->blockSignals(false); +} +void KQalculate::numberBaseTimeFormat() { + kpBaseCombo->blockSignals(true); + printops.base = BASE_TIME; + updateBaseOther(); + result_format_updated(); + kpBaseCombo->setCurrentItem(5); + kpBaseCombo->blockSignals(false); +} +void KQalculate::numberBaseRomanNumerals() { + kpBaseCombo->blockSignals(true); + printops.base = BASE_ROMAN_NUMERALS; + updateBaseOther(); + result_format_updated(); + kpBaseCombo->setCurrentItem(6); + kpBaseCombo->blockSignals(false); +} +void KQalculate::numberBaseOther() { + setBase(); + set_base_dialog->radiogroup_output->setButton(4); + setBaseInResultFromDialogGroup(4); + set_base_dialog->outputBaseBox->setFocus(); + setBaseInResultFromDialogBox(set_base_dialog->outputBaseBox->value()); +} + +void KQalculate::setBaseInExpressionFromDialogBox(int value) { + evalops.parse_options.base = value; + expression_format_updated(true); +} +void KQalculate::setBaseInExpressionFromDialogGroup(int id) { + switch(id) { + case 0: { + set_base_dialog->inputBaseBox->setEnabled(false); + evalops.parse_options.base = BASE_BINARY; + break; + } + case 1: { + set_base_dialog->inputBaseBox->setEnabled(false); + evalops.parse_options.base = BASE_OCTAL; + break; + } + case 2: { + set_base_dialog->inputBaseBox->setEnabled(false); + evalops.parse_options.base = BASE_DECIMAL; + break; + } + case 3: { + set_base_dialog->inputBaseBox->setEnabled(false); + evalops.parse_options.base = BASE_HEXADECIMAL; + break; + } + case 4: { + set_base_dialog->inputBaseBox->setEnabled(true); + evalops.parse_options.base = set_base_dialog->inputBaseBox->value(); + break; + } + case 5: { + set_base_dialog->inputBaseBox->setEnabled(false); + evalops.parse_options.base = BASE_ROMAN_NUMERALS; + break; + } + } + expression_format_updated(true); +} +void KQalculate::setBaseInResultFromDialogBox(int value) { + bool b = (printops.base == value); + printops.base = value; + kpBaseCombo->blockSignals(true); + switch(value) { + case BASE_BINARY: { + ActionNumberBaseBinary->setChecked(true); + kpBaseCombo->setCurrentItem(0); + break; + } + case BASE_OCTAL: { + ActionNumberBaseOctal->setChecked(true); + kpBaseCombo->setCurrentItem(1); + break; + } + case BASE_DECIMAL: { + ActionNumberBaseDecimal->setChecked(true); + kpBaseCombo->setCurrentItem(2); + break; + } + case BASE_HEXADECIMAL: { + ActionNumberBaseHexadecimal->setChecked(true); + kpBaseCombo->setCurrentItem(3); + break; + } + default: { + ActionNumberBaseOther->setChecked(true); + kpBaseCombo->setCurrentItem(7); + break; + } + } + kpBaseCombo->blockSignals(false); + if(!b) result_format_updated(); +} +void KQalculate::setBaseInResultFromDialogGroup(int id) { + switch(id) { + case 0: { + set_base_dialog->outputBaseBox->setEnabled(false); + ActionNumberBaseBinary->activate(); + break; + } + case 1: { + set_base_dialog->outputBaseBox->setEnabled(false); + ActionNumberBaseOctal->activate(); + break; + } + case 2: { + set_base_dialog->outputBaseBox->setEnabled(false); + ActionNumberBaseDecimal->activate(); + break; + } + case 3: { + set_base_dialog->outputBaseBox->setEnabled(false); + ActionNumberBaseHexadecimal->activate(); + break; + } + case 4: { + set_base_dialog->outputBaseBox->setEnabled(true); + ActionNumberBaseOther->setChecked(true); + kpBaseCombo->blockSignals(true); + bool b = (printops.base == set_base_dialog->outputBaseBox->value()); + printops.base = set_base_dialog->outputBaseBox->value(); + kpBaseCombo->setCurrentItem(7); + kpBaseCombo->blockSignals(false); + if(!b) result_format_updated(); + break; + } + case 5: { + set_base_dialog->outputBaseBox->setEnabled(false); + ActionNumberBaseSexagesimal->activate(); + break; + } + case 6: { + set_base_dialog->outputBaseBox->setEnabled(false); + ActionNumberBaseTimeFormat->activate(); + break; + } + case 7: { + set_base_dialog->outputBaseBox->setEnabled(false); + ActionNumberBaseRomanNumerals->activate(); + break; + } + } +} +void KQalculate::setBase() { + if(!set_base_dialog) { + set_base_dialog = new QalculateSetBaseDialog(this); + QObject::connect(set_base_dialog->radiogroup_input, SIGNAL(clicked(int)), this, SLOT(setBaseInExpressionFromDialogGroup(int))); + QObject::connect(set_base_dialog->inputBaseBox, SIGNAL(valueChanged(int)), this, SLOT(setBaseInExpressionFromDialogBox(int))); + QObject::connect(set_base_dialog->radiogroup_output, SIGNAL(clicked(int)), this, SLOT(setBaseInResultFromDialogGroup(int))); + QObject::connect(set_base_dialog->outputBaseBox, SIGNAL(valueChanged(int)), this, SLOT(setBaseInResultFromDialogBox(int))); + } + set_base_dialog->inputBaseBox->blockSignals(true); + set_base_dialog->radiogroup_input->blockSignals(true); + set_base_dialog->inputBaseBox->setEnabled(false); + switch(evalops.parse_options.base) { + case BASE_BINARY: { + set_base_dialog->radiogroup_input->setButton(0); + break; + } + case BASE_OCTAL: { + set_base_dialog->radiogroup_input->setButton(1); + break; + } + case BASE_DECIMAL: { + set_base_dialog->radiogroup_input->setButton(2); + break; + } + case BASE_HEXADECIMAL: { + set_base_dialog->radiogroup_input->setButton(3); + break; + } + case BASE_ROMAN_NUMERALS: { + set_base_dialog->radiogroup_input->setButton(5); + break; + } + default: { + set_base_dialog->radiogroup_input->setButton(4); + set_base_dialog->inputBaseBox->setEnabled(true); + set_base_dialog->inputBaseBox->setValue(evalops.parse_options.base); + } + } + set_base_dialog->inputBaseBox->blockSignals(false); + set_base_dialog->radiogroup_input->blockSignals(false); + updateBaseOther(); + set_base_dialog->show(); +} + +void KQalculate::nonZeroDenominators(bool b) { + evalops.assume_denominators_nonzero = b; + expression_calculation_updated(); +} +void KQalculate::warnAboutDenominatorsAssumedNonZero(bool b) { + evalops.warn_about_denominators_assumed_nonzero = b; + if(evalops.warn_about_denominators_assumed_nonzero) expression_calculation_updated(); +} + +void KQalculate::readPrecision(bool b) { + if(b) evalops.parse_options.read_precision = READ_PRECISION_WHEN_DECIMALS; + else evalops.parse_options.read_precision = DONT_READ_PRECISION; + expression_format_updated(true); +} + +void KQalculate::limitImplicitMultiplication(bool b) { + evalops.parse_options.limit_implicit_multiplication = b; + printops.limit_implicit_multiplication = b; + expression_format_updated(true); + result_format_updated(); +} + +void KQalculate::rpnMode(bool b) { + if(b == rpn_mode) return; + rpn_mode = b; + if(rpn_mode) { + stackButton->show(); + show_history = historyButton->isOn(); + show_keypad = keypadButton->isOn(); + if(show_stack) { + stackButton->toggle(); + } + } else { + show_stack = stackButton->isOn(); + if(show_stack) { + if(show_history) historyButton->toggle(); + else if(show_keypad) keypadButton->toggle(); + else stackButton->toggle(); + } + stackButton->hide(); + CALCULATOR->clearRPNStack(); + stackList->clear(); + } + if(leftButtonsSeparator->isVisible()) { + if(rpn_mode) executeButton->setText(i18n("Enter")); + else executeButton->setText(i18n("=")); + } + if(rpn_mode) { + kpEquals->setText(i18n("Ent")); + QToolTip::add(kpEquals, i18n("Calculate expression and add to stack")); + QToolTip::add(executeButton, i18n("Calculate expression and add to stack")); + } else { + kpEquals->setText(i18n("=")); + QToolTip::add(kpEquals, i18n("Calculate expression")); + QToolTip::add(executeButton, i18n("Calculate expression")); + } +} + +void KQalculate::rpnSyntax(bool b) { + evalops.parse_options.rpn = b; + expression_format_updated(false); +} + +void KQalculate::setMinDecimals(int i) { + printops.min_decimals = i; + if(i <= 0) printops.use_min_decimals = false; + else printops.use_min_decimals = true; + result_format_updated(); +} +void KQalculate::setMaxDecimals(int i) { + printops.max_decimals = i; + if(i < 0) printops.use_max_decimals = false; + else printops.use_max_decimals = true; + result_format_updated(); +} + +void KQalculate::decimals() { + if(!decimalsDialog) { + decimalsDialog = new QalculateDecimalsDialog(this); + QObject::connect(decimalsDialog->minDecimalsBox, SIGNAL(valueChanged(int)), this, SLOT(setMinDecimals(int))); + QObject::connect(decimalsDialog->maxDecimalsBox, SIGNAL(valueChanged(int)), this, SLOT(setMaxDecimals(int))); + } + decimalsDialog->minDecimalsBox->blockSignals(true); + decimalsDialog->maxDecimalsBox->blockSignals(true); + if(printops.use_min_decimals && printops.min_decimals > 0) decimalsDialog->minDecimalsBox->setValue(printops.min_decimals); + else decimalsDialog->minDecimalsBox->setValue(0); + if(printops.use_max_decimals && printops.max_decimals >= 0) decimalsDialog->maxDecimalsBox->setValue(printops.max_decimals); + else decimalsDialog->maxDecimalsBox->setValue(-1); + decimalsDialog->minDecimalsBox->blockSignals(false); + decimalsDialog->maxDecimalsBox->blockSignals(false); + decimalsDialog->show(); +} + +void KQalculate::setPrecision(int i) { + if(i != CALCULATOR->getPrecision()) CALCULATOR->setPrecision(i); +} +void KQalculate::precision() { + if(!precisionDialog) { + precisionDialog = new QalculatePrecisionDialog(this); + QObject::connect(precisionDialog, SIGNAL(applyClicked()), this, SLOT(precisionRecalculate())); + QObject::connect(precisionDialog->precisionBox, SIGNAL(valueChanged(int)), this, SLOT(setPrecision(int))); + } + precisionDialog->precisionBox->setValue(CALCULATOR->getPrecision()); + precisionDialog->show(); +} + +void KQalculate::precisionRecalculate() { + if(precisionDialog->precisionBox->value() != CALCULATOR->getPrecision()) CALCULATOR->setPrecision(precisionDialog->precisionBox->value()); + expression_calculation_updated(); +} + +void KQalculate::assumptionTypeUnknown() { + CALCULATOR->defaultAssumptions()->setType(ASSUMPTION_TYPE_NONE); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionTypeNonMatrix() { + CALCULATOR->defaultAssumptions()->setType(ASSUMPTION_TYPE_NONMATRIX); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionTypeNumber() { + CALCULATOR->defaultAssumptions()->setType(ASSUMPTION_TYPE_NUMBER); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionTypeComplex() { + CALCULATOR->defaultAssumptions()->setType(ASSUMPTION_TYPE_COMPLEX); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionTypeReal() { + CALCULATOR->defaultAssumptions()->setType(ASSUMPTION_TYPE_REAL); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionTypeRational() { + CALCULATOR->defaultAssumptions()->setType(ASSUMPTION_TYPE_RATIONAL); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionTypeInteger() { + CALCULATOR->defaultAssumptions()->setType(ASSUMPTION_TYPE_INTEGER); + setAssumptionsMenu(); + expression_calculation_updated(); +} + +void KQalculate::assumptionSignUnknown() { + CALCULATOR->defaultAssumptions()->setSign(ASSUMPTION_SIGN_UNKNOWN); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionSignNonZero() { + CALCULATOR->defaultAssumptions()->setSign(ASSUMPTION_SIGN_NONZERO); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionSignPositive() { + CALCULATOR->defaultAssumptions()->setSign(ASSUMPTION_SIGN_POSITIVE); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionSignNonNegative() { + CALCULATOR->defaultAssumptions()->setSign(ASSUMPTION_SIGN_NONNEGATIVE); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionSignNegative() { + CALCULATOR->defaultAssumptions()->setSign(ASSUMPTION_SIGN_NEGATIVE); + setAssumptionsMenu(); + expression_calculation_updated(); +} +void KQalculate::assumptionSignNonPositive() { + CALCULATOR->defaultAssumptions()->setSign(ASSUMPTION_SIGN_NONPOSITIVE); + setAssumptionsMenu(); + expression_calculation_updated(); +} + +void KQalculate::algebraicModeSimplify() { + evalops.structuring = STRUCTURING_SIMPLIFY; + printops.allow_factorization = false; + expression_calculation_updated(); +} +void KQalculate::algebraicModeFactorize() { + evalops.structuring = STRUCTURING_FACTORIZE; + printops.allow_factorization = true; + expression_calculation_updated(); +} +void KQalculate::algebraicModeNone() { + evalops.structuring = STRUCTURING_NONE; + printops.allow_factorization = false; + expression_calculation_updated(); +} + +void KQalculate::onModesMenuItemActivated(int id) { + loadMode(menu_modes->indexOf(id)); +} +void KQalculate::loadMode(int index) { + if(index < 0) return; + size_t i = (size_t) index; + if(i >= modes.size()) return; + printops.min_decimals = modes[i].po.min_decimals; + printops.use_min_decimals = modes[i].po.use_min_decimals; + printops.max_decimals = modes[i].po.max_decimals; + printops.use_max_decimals = modes[i].po.use_max_decimals; + CALCULATOR->setPrecision(modes[i].precision); + printops.min_exp = modes[i].po.min_exp; + printops.negative_exponents = modes[i].po.negative_exponents; + printops.sort_options.minus_last = modes[i].po.sort_options.minus_last; + printops.number_fraction_format = modes[i].po.number_fraction_format; + printops.use_unit_prefixes = modes[i].po.use_unit_prefixes; + printops.abbreviate_names = modes[i].po.abbreviate_names; + printops.use_all_prefixes = modes[i].po.use_all_prefixes; + printops.use_denominator_prefix = modes[i].po.use_denominator_prefix; + printops.place_units_separately = modes[i].po.place_units_separately; + evalops.auto_post_conversion = modes[i].eo.auto_post_conversion; + printops.base = modes[i].po.base; + evalops.parse_options.base = modes[i].eo.parse_options.base; + evalops.parse_options.read_precision = modes[i].eo.parse_options.read_precision; + evalops.assume_denominators_nonzero = modes[i].eo.assume_denominators_nonzero; + evalops.warn_about_denominators_assumed_nonzero = modes[i].eo.warn_about_denominators_assumed_nonzero; + evalops.parse_options.angle_unit = modes[i].eo.parse_options.angle_unit; + evalops.parse_options.functions_enabled = modes[i].eo.parse_options.functions_enabled; + evalops.parse_options.variables_enabled = modes[i].eo.parse_options.variables_enabled; + evalops.calculate_functions = modes[i].eo.calculate_functions; + evalops.calculate_variables = modes[i].eo.calculate_variables; + evalops.sync_units = modes[i].eo.sync_units; + evalops.parse_options.unknowns_enabled = modes[i].eo.parse_options.unknowns_enabled; + evalops.parse_options.units_enabled = modes[i].eo.parse_options.units_enabled; + evalops.allow_complex = modes[i].eo.allow_complex; + evalops.allow_infinite = modes[i].eo.allow_infinite; + evalops.structuring = modes[i].eo.structuring; + printops.indicate_infinite_series = modes[i].po.indicate_infinite_series; + printops.show_ending_zeroes = modes[i].po.show_ending_zeroes; + printops.round_halfway_to_even = modes[i].po.round_halfway_to_even; + evalops.approximation = modes[i].eo.approximation; + evalops.parse_options.rpn = modes[i].eo.parse_options.rpn; + evalops.parse_options.limit_implicit_multiplication = modes[i].eo.parse_options.limit_implicit_multiplication; + printops.limit_implicit_multiplication = modes[i].po.limit_implicit_multiplication; + printops.spacious = modes[i].po.spacious; + printops.excessive_parenthesis = modes[i].po.excessive_parenthesis; + printops.short_multiplication = modes[i].po.short_multiplication; + CALCULATOR->defaultAssumptions()->setType(modes[i].at); + CALCULATOR->defaultAssumptions()->setSign(modes[i].as); + if(modes[i].rpn_mode != rpn_mode) { + rpnMode(modes[i].rpn_mode); + } + + setModeActions(); + + if(decimalsDialog) { + decimalsDialog->minDecimalsBox->blockSignals(true); + decimalsDialog->maxDecimalsBox->blockSignals(true); + if(printops.use_min_decimals && printops.min_decimals > 0) decimalsDialog->minDecimalsBox->setValue(printops.min_decimals); + else decimalsDialog->minDecimalsBox->setValue(0); + if(printops.use_max_decimals && printops.max_decimals >= 0) decimalsDialog->maxDecimalsBox->setValue(printops.max_decimals); + else decimalsDialog->maxDecimalsBox->setValue(-1); + decimalsDialog->minDecimalsBox->blockSignals(false); + decimalsDialog->maxDecimalsBox->blockSignals(false); + } + if(precisionDialog) { + precisionDialog->precisionBox->setValue(CALCULATOR->getPrecision()); + } + updateBaseOther(); + if(set_base_dialog) { + set_base_dialog->inputBaseBox->blockSignals(true); + set_base_dialog->radiogroup_input->blockSignals(true); + set_base_dialog->inputBaseBox->setEnabled(false); + switch(evalops.parse_options.base) { + case BASE_BINARY: { + set_base_dialog->radiogroup_input->setButton(0); + break; + } + case BASE_OCTAL: { + set_base_dialog->radiogroup_input->setButton(1); + break; + } + case BASE_DECIMAL: { + set_base_dialog->radiogroup_input->setButton(2); + break; + } + case BASE_HEXADECIMAL: { + set_base_dialog->radiogroup_input->setButton(3); + break; + } + case BASE_ROMAN_NUMERALS: { + set_base_dialog->radiogroup_input->setButton(5); + break; + } + default: { + set_base_dialog->radiogroup_input->setButton(4); + set_base_dialog->inputBaseBox->setEnabled(true); + set_base_dialog->inputBaseBox->setValue(evalops.parse_options.base); + } + } + set_base_dialog->inputBaseBox->blockSignals(false); + set_base_dialog->radiogroup_input->blockSignals(false); + } + + update_status_text(); + printops.allow_factorization = (evalops.structuring == STRUCTURING_FACTORIZE); + QString str = expressionEdit->text().stripWhiteSpace(); + if(expression_has_changed || str.isEmpty()) { + setResult(NULL, true, false, false); + } else { + execute_expression(false); + } + + expression_has_changed2 = true; + displayParseStatus(); + expressionEdit->setFocus(); +} +QalculateModeDialog::QalculateModeDialog(QWidget *parent) : KDialogBase(parent, 0, true, i18n("Save Mode"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, true) { + setMainWidget(new QWidget(this)); + QGridLayout *grid = new QGridLayout(mainWidget(), 2, 2, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("Mode name:"), mainWidget()), 0, 0); + modeCombo = new KComboBox(mainWidget()); + modeCombo->setEditable(true); + for(size_t i = 2; i < modes.size(); i++) { + modeCombo->insertItem(modes[i].name); + } + modeCombo->lineEdit()->clear(); + modeCombo->setFocus(); + modeCombo->setSizePolicy(QSizePolicy::Expanding, modeCombo->sizePolicy().verData()); + grid->addWidget(modeCombo, 0, 1); + grid->addWidget(new QLabel(i18n("Shortcut:"), mainWidget()), 1, 0); + keyButton = new KKeyButton(mainWidget()); + grid->addWidget(keyButton, 1, 1); + + connect(keyButton, SIGNAL(capturedShortcut(const KShortcut&)), this, SLOT(updateShortcut(const KShortcut&))); + connect(modeCombo, SIGNAL(activated(int)), this, SLOT(modeSelected(int))); + +} +QalculateModeDialog::~QalculateModeDialog() {} +void QalculateModeDialog::modeSelected(int index) { + index += 2; + if(index < (int) modes.size()) { + keyButton->setShortcut(modes[index].shortcut, false); + } +} +void QalculateModeDialog::updateShortcut(const KShortcut &shortcut) { + keyButton->setShortcut(shortcut, false); +} +QString QalculateModeDialog::modeName() { + return modeCombo->currentText(); +} +const KShortcut &QalculateModeDialog::modeShortcut() { + return keyButton->shortcut(); +} +void QalculateModeDialog::slotOk() { + QString name = modeName(); + if(name.isEmpty()) { + KMessageBox::error(this, i18n("Empty mode name.")); + return; + } else if(name == modes[0].name) { + KMessageBox::error(this, i18n("Preset mode cannot be overwritten.")); + return; + } + KDialogBase::slotOk(); +} +void KQalculate::saveModeAs() { + QalculateModeDialog *dialog = new QalculateModeDialog(this); + if(dialog->exec() == QDialog::Accepted) { + bool new_mode = true; + QString name = dialog->modeName().stripWhiteSpace(); + size_t index = save_mode_as(name, &new_mode); + modes[index].shortcut = dialog->modeShortcut(); + if(new_mode) { + menu_modes->insertItem(modes[index].name, -1, index); + ActionDeleteMode->setEnabled(true); + ModeObject *mo = new ModeObject(index); + mo->i_mode = index; + mode_objects.push_back(mo); + accel()->insert(QString("Load mode: ") + modes[index].name, i18n("Load meta mode: %1").arg(modes[index].name), QString::null, modes[index].shortcut, mo, SLOT(loadMode())); + } else { + accel()->setShortcut(QString("Load mode: ") + modes[index].name, modes[index].shortcut); + } + } + delete dialog; +} +void KQalculate::deleteMode() { +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR >= 2 + bool b_ok = false; + QStringList mode_names; + for(size_t i = 2; i < modes.size(); i++) { + mode_names += modes[i].name; + } + QString name = KInputDialog::getItem(i18n("Delete Mode"), i18n("Mode:"), mode_names, 0, false, &b_ok, this).stripWhiteSpace(); + if(b_ok) { + for(size_t i = 2; i < modes.size(); i++) { + if(modes[i].name == name) { + accel()->remove(QString("Load mode: ") + name); + modes.erase(modes.begin() + i); + delete mode_objects[i - 2]; + mode_objects.erase(mode_objects.begin() + (i - 2)); + for(QValueVector::size_type i2 = 0; i2 < mode_objects.size(); i2++) { + mode_objects[i2]->i_mode = i2 + 2; + } + menu_modes->removeItemAt(i); + if(modes.size() < 3) { + ActionDeleteMode->setEnabled(false); + } + } + } + } +#endif +} +void KQalculate::saveMode() { + save_mode(); +} + +void KQalculate::aboutToQuit() { + if(plot_dialog) plot_dialog->saveMode(); + if(save_mode_on_exit) { + save_mode(); + } else { + save_preferences(); + } + if(save_defs_on_exit) { + save_defs(); + } + pthread_cancel(view_thread); + CALCULATOR->terminateThreads(); +} + +void KQalculate::angleUnitDegrees() { + kpAngleGroup->blockSignals(true); + evalops.parse_options.angle_unit = ANGLE_UNIT_DEGREES; + expression_format_updated(true); + kpAngleGroup->setButton(0); + kpAngleGroup->blockSignals(false); +} +void KQalculate::angleUnitRadians() { + kpAngleGroup->blockSignals(true); + evalops.parse_options.angle_unit = ANGLE_UNIT_RADIANS; + expression_format_updated(true); + kpAngleGroup->setButton(1); + kpAngleGroup->blockSignals(false); +} +void KQalculate::angleUnitGradians() { + kpAngleGroup->blockSignals(true); + evalops.parse_options.angle_unit = ANGLE_UNIT_GRADIANS; + expression_format_updated(true); + kpAngleGroup->setButton(2); + kpAngleGroup->blockSignals(false); +} +void KQalculate::angleUnitNone() { + kpAngleGroup->blockSignals(true); + evalops.parse_options.angle_unit = ANGLE_UNIT_NONE; + expression_format_updated(true); + kpAngleGroup->setButton(3); + kpAngleGroup->blockSignals(false); +} + +void KQalculate::placeUnitsSeparately(bool b) { + printops.place_units_separately = b; + result_format_updated(); +} + + +void KQalculate::enableDenominatorPrefixes(bool b) { + printops.use_denominator_prefix = b; + result_format_updated(); +} + + +void KQalculate::enableUseOfAllPrefixes(bool b) { + printops.use_all_prefixes = b; + result_format_updated(); +} + + +void KQalculate::enablePrefixes(bool b) { + printops.use_unit_prefixes = b; + result_format_updated(); +} + +void KQalculate::autoNoConversion() { + evalops.auto_post_conversion = POST_CONVERSION_NONE; + expression_calculation_updated(); +} +void KQalculate::autoConvertToBaseUnits() { + evalops.auto_post_conversion = POST_CONVERSION_BASE; + expression_calculation_updated(); +} +void KQalculate::autoConvertToBestUnit() { + evalops.auto_post_conversion = POST_CONVERSION_BEST; + expression_calculation_updated(); +} + +void KQalculate::allowInfiniteResult(bool b) { + evalops.allow_infinite = b; + expression_calculation_updated(); +} + + +void KQalculate::allowComplexResult(bool b) { + evalops.allow_complex = b; + expression_calculation_updated(); +} + + +void KQalculate::calculateVariables(bool b) { + evalops.calculate_variables = b; + expression_calculation_updated(); +} + + +void KQalculate::enableUnknowns(bool b) { + evalops.parse_options.unknowns_enabled = b; + expression_format_updated(b); +} + + +void KQalculate::enableUnits(bool b) { + evalops.parse_options.units_enabled = b; + expression_format_updated(b); +} + + +void KQalculate::enableFunctions(bool b) { + evalops.parse_options.functions_enabled = b; + expression_format_updated(b); +} + + +void KQalculate::enableVariables(bool b) { + evalops.parse_options.variables_enabled = b; + expression_format_updated(b); +} + +void KQalculate::updateExchangeRates() { + if(fetch_exchange_rates(15)) { + CALCULATOR->loadExchangeRates(); + } + expression_calculation_updated(); +} + +void KQalculate::insertRaise() { + if(rpn_mode) { + calculateRPN(OPERATION_RAISE); + return; + } + if(!evalops.parse_options.rpn) { + expressionEdit->wrapSelection(); + expressionEdit->deselect(); + } + insert_text("^"); +} + + +void KQalculate::insertLn() { + insertButtonFunction(CALCULATOR->f_ln); +} + + +void KQalculate::insertLog() { + MathFunction *f = CALCULATOR->getActiveFunction("log10"); + if(f) { + insertButtonFunction(f); + } else { + KMessageBox::error(this, i18n("log10 function not found.")); + } +} + + +void KQalculate::insertSqrt() { + insertButtonFunction(CALCULATOR->f_sqrt); +} + + +void KQalculate::insertTan() { + if(kpHyp->isOn()) { + if(kpInv->isOn()) { + insertButtonFunction(CALCULATOR->f_atanh); + } else { + insertButtonFunction(CALCULATOR->f_tanh); + } + } else { + if(kpInv->isOn()) { + insertButtonFunction(CALCULATOR->f_atan); + } else { + insertButtonFunction(CALCULATOR->f_tan); + } + } +} + + +void KQalculate::insertSin() { + if(kpHyp->isOn()) { + kpHyp->setOn(false); + if(kpInv->isOn()) { + kpInv->setOn(false); + insertButtonFunction(CALCULATOR->f_asinh); + } else { + insertButtonFunction(CALCULATOR->f_sinh); + } + } else { + if(kpInv->isOn()) { + kpInv->setOn(false); + insertButtonFunction(CALCULATOR->f_asin); + } else { + insertButtonFunction(CALCULATOR->f_sin); + } + } +} + + +void KQalculate::insertCos() { + if(kpHyp->isOn()) { + kpHyp->setOn(false); + if(kpInv->isOn()) { + kpInv->setOn(false); + insertButtonFunction(CALCULATOR->f_acosh); + } else { + insertButtonFunction(CALCULATOR->f_cosh); + } + } else { + if(kpInv->isOn()) { + kpInv->setOn(false); + insertButtonFunction(CALCULATOR->f_acos); + } else { + insertButtonFunction(CALCULATOR->f_cos); + } + } +} + + +void KQalculate::insertDivision() { + if(rpn_mode) { + calculateRPN(OPERATION_DIVIDE); + return; + } + if(!evalops.parse_options.rpn) { + expressionEdit->wrapSelection(); + expressionEdit->deselect(); + } + if(printops.use_unicode_signs && printops.division_sign == DIVISION_SIGN_DIVISION && can_display_unicode_string_function(SIGN_DIVISION, (void*) expressionEdit)) { + insert_text(SIGN_DIVISION); + } else { + insert_text("/"); + } +} + + +void KQalculate::insertTimes() { + if(rpn_mode) { + calculateRPN(OPERATION_MULTIPLY); + return; + } + if(!evalops.parse_options.rpn) { + expressionEdit->wrapSelection(); + expressionEdit->deselect(); + } + if(printops.use_unicode_signs && printops.multiplication_sign == MULTIPLICATION_SIGN_DOT && can_display_unicode_string_function(SIGN_MULTIDOT, (void*) expressionEdit)) { + insert_text(SIGN_MULTIDOT); + } else if(printops.use_unicode_signs && printops.multiplication_sign == MULTIPLICATION_SIGN_DOT && can_display_unicode_string_function(SIGN_SMALLCIRCLE, (void*) expressionEdit)) { + insert_text(SIGN_SMALLCIRCLE); + } else if(printops.use_unicode_signs && printops.multiplication_sign == MULTIPLICATION_SIGN_X && can_display_unicode_string_function(SIGN_MULTIPLICATION, (void*) expressionEdit)) { + insert_text(SIGN_MULTIPLICATION); + } else { + insert_text("*"); + } +} + + +void KQalculate::calculateRPN(int op) { + if(expression_has_changed && !expressionEdit->text().stripWhiteSpace().isEmpty()) { + execute(); + } + execute_expression_force = true; + execute_expression_do_stack = false; + execute_expression_do_mathoperation = true; + execute_expression_op = (MathOperation) op; + execute_expression_f = NULL; + execute_expression2(); +} +void KQalculate::calculateRPN(MathFunction *f) { + if(expression_has_changed && !expressionEdit->text().stripWhiteSpace().isEmpty()) { + execute(); + } + execute_expression_force = true; + execute_expression_do_stack = false; + execute_expression_do_mathoperation = true; + execute_expression_f = f; + execute_expression2(); +} +void KQalculate::RPNStackEnter(Variable *v) { + CALCULATOR->RPNStackEnter(new MathStructure(v), true); + mstruct->unref(); + mstruct = CALCULATOR->getRPNRegister(1); + mstruct->ref(); + RPNRegisterAdded(v->preferredDisplayName(printops.abbreviate_names, printops.use_unicode_signs, false, printops.use_reference_names, printops.can_display_unicode_string_function, (void*) stackList).name.c_str()); +} +void KQalculate::RPNRegisterAdded(const QString &text, size_t index) { + if(index == 0) { + new KListViewItem(stackList, QString::number(index + 1), text); + } else { + new KListViewItem(stackList, getRPNRegister(index - 1), QString::number(index + 1), text); + } + updateRPNIndexes(); + clearStackButton->setEnabled(true); +} +void KQalculate::RPNRegisterRemoved(size_t index) { + delete getRPNRegister(index); + updateRPNIndexes(); + if(CALCULATOR->RPNStackSize() == 0) { + clearStackButton->setEnabled(false); + } +} +void KQalculate::RPNRegisterChanged(const QString &text, size_t index) { + getRPNRegister(index)->setText(1, text); +} +QListViewItem *KQalculate::getRPNRegister(size_t index) { + QListViewItem *li = stackList->firstChild(); + while(li) { + if(index == 0) return li; + index--; + li = li->nextSibling(); + } + return NULL; +} +void KQalculate::clearStack() { + CALCULATOR->clearRPNStack(); + stackList->clear(); + clearresult(); + mstruct->clear(); + clearStackButton->setEnabled(false); +} +void KQalculate::registerUp() { + QListViewItem *li = stackList->selectedItem(); + if(li) { + size_t index = (size_t) li->text(0).toUInt() - 1; + if(index == 0) return; + CALCULATOR->moveRPNRegisterUp(index + 1); + QListViewItem *li2 = li->itemAbove(); + QString str = li2->text(1); + li2->setText(1, li->text(1)); + li->setText(1, str); + stackList->setSelected(li2, true); + if(index == 1) { + mstruct->unref(); + mstruct = CALCULATOR->getRPNRegister(1); + mstruct->ref(); + setResult(NULL, true, false, false, "", 0, true); + } + } +} +void KQalculate::registerDown() { + QListViewItem *li = stackList->selectedItem(); + if(li) { + size_t index = (size_t) li->text(0).toUInt() - 1; + if(index + 1 == CALCULATOR->RPNStackSize()) return; + CALCULATOR->moveRPNRegisterDown(index + 1); + QListViewItem *li2 = li->nextSibling(); + QString str = li2->text(1); + li2->setText(1, li->text(1)); + li->setText(1, str); + stackList->setSelected(li2, true); + if(index == 0) { + mstruct->unref(); + mstruct = CALCULATOR->getRPNRegister(1); + mstruct->ref(); + setResult(NULL, true, false, false, "", 0, true); + } + } +} +void KQalculate::deleteRegister() { + QListViewItem *li = stackList->selectedItem(); + if(li) { + size_t index = (size_t) li->text(0).toUInt() - 1; + CALCULATOR->deleteRPNRegister(index + 1); + delete li; + if(CALCULATOR->RPNStackSize() == 0) { + clearresult(); + mstruct->clear(); + clearStackButton->setEnabled(false); + } else if(index == 0) { + mstruct->unref(); + mstruct = CALCULATOR->getRPNRegister(1); + mstruct->ref(); + setResult(NULL, true, false, false, "", 0, true); + } + updateRPNIndexes(); + } +} +void KQalculate::editRegister() { + QListViewItem *li = stackList->selectedItem(); + if(!li) return; + stackList->rename(li, 1); +} +void KQalculate::updateRPNIndexes() { + QListViewItem *li = stackList->firstChild(); + size_t i = 1; + while(li) { + li->setText(0, QString::number(i)); + i++; + li = li->nextSibling(); + } +} +void KQalculate::stackRegisterMoved() { + QListViewItem *li = stackList->firstChild(); + size_t i = 0; + size_t old_index; + while(li) { + old_index = (size_t) li->text(0).toUInt() - 1; + if(old_index != i) { + CALCULATOR->moveRPNRegister(old_index + 1, i + 1); + if(i == 0) { + mstruct->unref(); + mstruct = CALCULATOR->getRPNRegister(1); + mstruct->ref(); + setResult(NULL, true, false, false, "", 0, true); + } + updateRPNIndexes(); + registerSelected(); + return; + } + i++; + li = li->nextSibling(); + } +} +void KQalculate::stackRegisterSet(QListViewItem *li) { + execute_expression_stack_index = (size_t) li->text(0).toUInt() - 1; + execute_expression_force = true; + execute_expression_do_stack = true; + execute_expression_do_mathoperation = false; + execute_expression2(); +} +void KQalculate::popupStackMenu(KListView*, QListViewItem *li, const QPoint &p) { + stackMenu->setItemEnabled(stackMenu->idAt(0), li != NULL); + stackMenu->setItemEnabled(stackMenu->idAt(1), li != NULL); + stackMenu->setItemEnabled(stackMenu->idAt(3), CALCULATOR->RPNStackSize() > 0); + stackMenu->popup(p); +} +void KQalculate::registerSelected() { + QListViewItem *li = stackList->selectedItem(); + if(li) { + size_t index = (size_t) li->text(0).toUInt() - 1; + registerUpButton->setEnabled(index != 0); + registerDownButton->setEnabled(index + 1 < CALCULATOR->RPNStackSize()); + editRegisterButton->setEnabled(true); + deleteRegisterButton->setEnabled(true); + } else { + registerUpButton->setEnabled(false); + registerDownButton->setEnabled(false); + editRegisterButton->setEnabled(false); + deleteRegisterButton->setEnabled(false); + } +} + +void KQalculate::insertPlus() { + if(rpn_mode) { + calculateRPN(OPERATION_ADD); + return; + } + if(!evalops.parse_options.rpn) { + expressionEdit->wrapSelection(); + expressionEdit->deselect(); + } + insert_text("+"); +} + +void KQalculate::insertMinus() { + if(rpn_mode) { + calculateRPN(OPERATION_SUBTRACT); + return; + } + if(!evalops.parse_options.rpn) { + expressionEdit->wrapSelection(); + expressionEdit->deselect(); + } + if(printops.use_unicode_signs && can_display_unicode_string_function(SIGN_MINUS, (void*) expressionEdit)) insert_text(SIGN_MINUS); + else insert_text("-"); +} + +void KQalculate::insertAns() { + insert_text(vans[0]->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionEdit).name.c_str()); +} + + +void KQalculate::insertExp() { + if(rpn_mode) { + calculateRPN(OPERATION_EXP10); + return; + } + if(printops.lower_case_e) insert_text("e"); + else insert_text("E"); +} + + +void KQalculate::insertDot() { + insert_text(CALCULATOR->getDecimalPoint().c_str()); +} + + +void KQalculate::insertKP0() { + insert_text("0"); +} + + +void KQalculate::insertKP9() { + insert_text("9"); +} + + +void KQalculate::insertKP8() { + insert_text("8"); +} + + +void KQalculate::insertKP7() { + insert_text("7"); +} + + +void KQalculate::insertKP6() { + insert_text("6"); +} + + +void KQalculate::insertKP5() { + insert_text("5"); +} + + +void KQalculate::insertKP4() { + insert_text("4"); +} + + +void KQalculate::insertKP3() { + insert_text("3"); +} + + +void KQalculate::insertKP2() { + insert_text("2"); +} + + +void KQalculate::insertKP1() { + insert_text("1"); +} + +void KQalculate::expressionDel() { + expressionEdit->del(); +} + + +void KQalculate::clearExpression() { + expressionEdit->clear(); +} + +void KQalculate::insertSquare() { + if(rpn_mode) { + calculateRPN(CALCULATOR->f_sq); + return; + } + if(evalops.parse_options.rpn) { + insertButtonFunction(CALCULATOR->f_sq); + } else { + expressionEdit->wrapSelection(); + expressionEdit->deselect(); + insert_text("^2"); + } +} + +void KQalculate::setFractionMode(bool b) { + if(b) { + ActionFractionalDisplayFraction->activate(); + } else { + ActionFractionalDisplayDecimal->activate(); + } +} + +void KQalculate::setExactMode(bool b) { + if(b) { + ActionApproximationAlwaysExact->activate(); + } else { + ActionApproximationTryExact->activate(); + } +} + +void KQalculate::kpSetAngleUnit(int index) { + switch(index) { + case 0: { + ActionAngleUnitDegrees->activate(); + break; + } + case 1: { + ActionAngleUnitRadians->activate(); + break; + } + case 2: { + ActionAngleUnitGradians->activate(); + break; + } + case 3: { + ActionAngleUnitNone->activate(); + break; + } + } +} + +void KQalculate::kpSetNumericalMode(int index) { + switch(index) { + case 0: { + printops.negative_exponents = false; + printops.sort_options.minus_last = true; + ActionNumericalDisplayNormal->activate(); + break; + } + case 1: { + ActionNumericalDisplayEngineering->activate(); + break; + } + case 2: { + printops.negative_exponents = true; + printops.sort_options.minus_last = false; + ActionNumericalDisplayScientific->activate(); + break; + } + case 3: { + printops.negative_exponents = true; + printops.sort_options.minus_last = false; + ActionNumericalDisplayPurelyScientific->activate(); + break; + } + case 4: { + printops.negative_exponents = false; + printops.sort_options.minus_last = true; + ActionNumericalDisplaySimple->activate(); + break; + } + } + ActionNegativeExponents->setChecked(printops.negative_exponents); + ActionSortMinusLast->setChecked(printops.sort_options.minus_last); +} + + +void KQalculate::kpSetBaseSelected(int index) { + switch(index) { + case 7: { + numberBaseOther(); + break; + } + } +} +void KQalculate::kpSetBase(int index) { + switch(index) { + case 0: { + ActionNumberBaseBinary->activate(); + break; + } + case 1: { + ActionNumberBaseOctal->activate(); + break; + } + case 2: { + ActionNumberBaseDecimal->activate(); + break; + } + case 3: { + ActionNumberBaseHexadecimal->activate(); + break; + } + case 4: { + ActionNumberBaseSexagesimal->activate(); + break; + } + case 5: { + ActionNumberBaseTimeFormat->activate(); + break; + } + case 6: { + ActionNumberBaseRomanNumerals->activate(); + break; + } + case 7: { + ActionNumberBaseOther->activate(); + break; + } + } +} + +void KQalculate::insertMod() { + insertButtonFunction(CALCULATOR->f_mod); +} + + +void KQalculate::insertFactorial() { + if(rpn_mode) { + insertButtonFunction(CALCULATOR->f_factorial); + return; + } + expressionEdit->wrapSelection(); + expressionEdit->deselect(); + insert_text("!"); +} + +void KQalculate::storeResult() { + if(!store_dialog) { + store_dialog = new QalculateEditVariableDialog(this); + } + Variable *v = store_dialog->editVariable(i18n("Temporary"), NULL, mstruct, true); + if(v) { + update_vmenu(); + variable_inserted(v); + } +} + +void KQalculate::manageVariables() { + if(!variables_dialog) { + variables_dialog = new QalculateVariablesDialog(); + variables_dialog->updateVariableTree(); + QObject::connect(variables_dialog, SIGNAL(variablesChanged()), this, SLOT(update_vmenu())); + QObject::connect(variables_dialog, SIGNAL(insertRequest(Variable*)), this, SLOT(insertVariable(Variable*))); + } + variables_dialog->show(); +} +void KQalculate::insertVariable(Variable *v) { + insert_text(v->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionEdit).name.c_str()); + variable_inserted(v); +} +void KQalculate::insertFunction(MathFunction *f, QWidget *parent) { + if(!CALCULATOR->stillHasFunction(f)) { + KMessageBox::error(parent, i18n("Function does not exist anymore.")); + update_fmenu(); + return; + } + if(f->args() == 0) { + QString str = f->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionEdit).name.c_str(); + str += "()"; + insert_text(str); + function_inserted(f); + } else { + QalculateInsertFunctionDialog *dialog = new QalculateInsertFunctionDialog(f, parent, expressionEdit->selectedText()); + int rcode = dialog->exec(); + if(rcode != QDialog::Rejected) { + if(rcode == QDialog::Accepted) { + insert_text(dialog->functionExpression()); + } else { + expressionEdit->setText(dialog->functionExpression()); + execute(); + expressionEdit->setFocus(); + } + function_inserted(f); + } + delete dialog; + } +} +void KQalculate::applyFunction(MathFunction *f, QWidget *parent) { + if(!CALCULATOR->stillHasFunction(f)) { + KMessageBox::error(parent, i18n("Function does not exist anymore.")); + update_fmenu(); + return; + } + if(rpn_mode) { + calculateRPN(f); + return; + } + QString str = f->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionEdit).name.c_str(); + if(f->args() == 0) { + str += "()"; + } else { + str += "("; + str += vans[0]->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionEdit).name.c_str(); + str += ")"; + } + insert_text(str); + function_inserted(f); + execute(); +} + +void KQalculate::convertToUnitConvertToDialogExpression() { + error_timer->stop(); + mstruct->set(CALCULATOR->convert(*mstruct, convert_to_unit_expression_dialog->unitExpressionEdit->text().ascii(), evalops)); + result_action_executed(); + error_timer->start(100); +} + +void KQalculate::convertToUnitExpression() { + if(!convert_to_unit_expression_dialog) { + convert_to_unit_expression_dialog = new QalculateConvertUnitsDialog(this); + convert_to_unit_expression_dialog->updateUnitTree(); + QObject::connect(convert_to_unit_expression_dialog, SIGNAL(applyClicked()), this, SLOT(convertToUnitConvertToDialogExpression())); + QObject::connect(convert_to_unit_expression_dialog, SIGNAL(okClicked()), this, SLOT(convertToUnitConvertToDialogExpression())); + QObject::connect(convert_to_unit_expression_dialog, SIGNAL(unitsChanged()), this, SLOT(update_umenus())); + } + convert_to_unit_expression_dialog->show(); +} + +void KQalculate::convertNumberBases() { + if(!convert_number_bases_dialog) { + convert_number_bases_dialog = new QalculateConvertNumberBasesDialog(); + } + convert_number_bases_dialog->show(); +} + +void KQalculate::insertManagedFunction(MathFunction *f) { + insertFunction(f, functions_dialog); +} +void KQalculate::applyManagedFunction(MathFunction *f) { + applyFunction(f, functions_dialog); +} +void KQalculate::manageFunctions() { + if(!functions_dialog) { + functions_dialog = new QalculateFunctionsDialog(); + functions_dialog->updateFunctionTree(); + QObject::connect(functions_dialog, SIGNAL(functionsChanged()), this, SLOT(update_fmenu())); + QObject::connect(functions_dialog, SIGNAL(insertRequest(MathFunction*)), this, SLOT(insertManagedFunction(MathFunction*))); + QObject::connect(functions_dialog, SIGNAL(applyRequest(MathFunction*)), this, SLOT(applyManagedFunction(MathFunction*))); + } + functions_dialog->show(); +} + +void KQalculate::newUnit() { + if(!unit_edit_dialog) { + unit_edit_dialog = new QalculateEditUnitDialog(this); + } + Unit *u = unit_edit_dialog->editUnit(); + if(u) { + update_umenus(); + unit_inserted(u); + } +} + + +void KQalculate::newDataSet() { + if(!dataset_edit_dialog) { + dataset_edit_dialog = new QalculateEditDataSetDialog(this); + } + MathFunction *f = dataset_edit_dialog->editDataSet(); + if(f) { + update_fmenu(); + function_inserted(f); + } +} + + +void KQalculate::newFunction() { + if(!function_edit_dialog) { + function_edit_dialog = new QalculateEditFunctionDialog(this); + } + MathFunction *f = function_edit_dialog->editFunction(); + if(f) { + update_fmenu(); + function_inserted(f); + } +} + + +void KQalculate::newUnknownVariable() { + if(!unknown_edit_dialog) { + unknown_edit_dialog = new QalculateEditUnknownVariableDialog(this); + } + Variable *v = unknown_edit_dialog->editVariable(i18n("My Variables")); + if(v) { + update_vmenu(); + variable_inserted(v); + } +} + + +void KQalculate::newVector() { + if(!matrix_edit_dialog) { + matrix_edit_dialog = new QalculateEditMatrixVectorDialog(this); + } + Variable *v = matrix_edit_dialog->newVector(i18n("Vectors")); + if(v) { + update_vmenu(); + variable_inserted(v); + } +} + + +void KQalculate::newMatrix() { + if(!matrix_edit_dialog) { + matrix_edit_dialog = new QalculateEditMatrixVectorDialog(this); + } + Variable *v = matrix_edit_dialog->newMatrix(i18n("Matrices")); + if(v) { + update_vmenu(); + variable_inserted(v); + } +} + + +void KQalculate::newVariable() { + if(!variable_edit_dialog) { + variable_edit_dialog = new QalculateEditVariableDialog(false); + } + Variable *v = variable_edit_dialog->editVariable(i18n("My Variables")); + if(v) { + update_vmenu(); + variable_inserted(v); + } +} + + +void KQalculate::exportCSVFile() { + if(!export_csv_dialog) { + export_csv_dialog = new QalculateExportCSVDialog(this); + } + export_csv_dialog->exportCSVFile(); +} + + +void KQalculate::importCSVFile() { + if(!import_csv_dialog) { + import_csv_dialog = new QalculateImportCSVDialog(this); + } + if(import_csv_dialog->importCSVFile()) { + update_vmenu(); + } +} + + +void KQalculate::saveAsImage() { + QString filename; + while(true) { + filename = KFileDialog::getSaveFileName("qalculate.png", "image/png", this, i18n("Save Image")); + if(filename.isEmpty()) { + return; + } else { + if(QFile::exists(filename)) { + if(KMessageBox::warningContinueCancel(this, i18n("A file named \"%1\" already exists. Are you sure you want to overwrite it?" ).arg(filename), i18n("Overwrite File?"), i18n( "&Overwrite" )) != KMessageBox::Cancel) { + break; + } + } else { + break; + } + } + } + QString str = result_text; + str.replace("width=1 ", ""); + QSimpleRichText text(str, resultLabel->font()); + QPicture picture; + QPainter p(&picture); + text.setWidth(1000); + text.draw(&p, 0, 0, QRect(), QColorGroup(Qt::black, Qt::white, Qt::white, Qt::white, Qt::white, Qt::black, Qt::white)); + p.flush(); + p.end(); + QPixmap pixmap(picture.boundingRect().width(), picture.boundingRect().height()); + pixmap.fill(Qt::white); + QPainter p2(&pixmap); + p2.drawPicture(-picture.boundingRect().x(), -picture.boundingRect().y(), picture); + p2.flush(); + p2.end(); + QImage image(pixmap.convertToImage()); + image.setAlphaBuffer(true); + int h = image.height(), w = image.width(); + QRgb pixel; + for(int r =0; r < h; r++) { + for(int c =0; c < w; c++) { + pixel = image.pixel(c, r); + image.setPixel(c, r, qRgba(0, 0, 0, 0xff - ((qRed(pixel) + qBlue(pixel) + qGreen(pixel))/ 3))); + } + } + if(!image.save(filename, "PNG")) { + KMessageBox::error(this, i18n("Failed to save image.")); + } +} + + +void KQalculate::saveDefinitions() { + save_defs(); +} + + +void KQalculate::plotFunctionsData() { + if(!plot_dialog) { + plot_dialog = new QalculatePlotDialog(); + } + plot_dialog->expressionEdit->setText(expressionEdit->text()); + plot_dialog->show(); +} + + +void KQalculate::periodicTable() { + if(!periodic_table_dialog) { + periodic_table_dialog = new QalculatePeriodicTableDialog(); + } + periodic_table_dialog->show(); +} + + +void KQalculate::onSetPrefixMenuItemActivated(int id) { + if(!menu_set_prefix_ids.contains(id)) return; + result_prefix_changed(menu_set_prefix_ids[id]); +} + + +void KQalculate::onConvertToUnitMenuItemActivated(int id) { + if(!menu_to_unit_ids.contains(id)) return; + error_timer->stop(); + mstruct->set(CALCULATOR->convert(*mstruct, menu_to_unit_ids[id], evalops)); + result_action_executed(); + error_timer->start(100); +} + + + +void KQalculate::preferences() { + if(!preferences_dialog) { + preferences_dialog = new QalculatePreferencesDialog(this); + } + close_to_systray_was = close_to_systray; + display_expression_status_was = display_expression_status; + preferences_dialog->editPreferences(); +} + +void KQalculate::applyPreferences() { + if(use_custom_result_font) { + QFont font(resultLabel->font()); + font.fromString(custom_result_font); + resultLabel->setFont(font); + } else { + resultLabel->unsetFont(); + } + if(use_custom_expression_font) { + QFont font(expressionEdit->font()); + font.fromString(custom_expression_font); + expressionEdit->setFont(font); + } else { + expressionEdit->unsetFont(); + } + updateStatusLabelFonts(); + set_unicode_buttons(); + result_display_updated(); + if(close_to_systray != close_to_systray_was) { + showSystemTrayIcon(close_to_systray); + } + if(display_expression_status != display_expression_status_was) { + if(display_expression_status) { + statusLabel_l->show(); + } else { + statusLabel_l->hide(); + } + } + displayParseStatus(); + + bool use_button_pixmaps = false; + if(use_icon_buttons > 0) { + use_button_pixmaps = true; + } else if(use_icon_buttons < 0) { + KConfig config("kdeglobals", true, false); + config.setGroup("KDE"); + use_button_pixmaps = config.readBoolEntry("ShowIconsOnPushButtons", false); + } + + if(leftButtonsSeparator->isVisible() == use_button_pixmaps) { + if(use_button_pixmaps) { + leftButtonsLayout->setSpacing(3); + executeButton->setText(""); + executeButton->setIconSet(KApplication::kApplication()->iconLoader()->loadIconSet("exec", KIcon::Small, ICON_SIZE_SMALL_MEDIUM)); + storeButton->setText(""); + storeButton->setIconSet(KApplication::kApplication()->iconLoader()->loadIconSet("filesaveas", KIcon::Small, ICON_SIZE_SMALL_MEDIUM)); + convertButton->setText(""); + convertButton->setIconSet(KApplication::kApplication()->iconLoader()->loadIconSet("qalculate_convert", KIcon::Small, ICON_SIZE_SMALL_MEDIUM)); + leftButtonsSeparator->hide(); + stackPageButtonsLayout->setSpacing(3); + registerUpButton->setText(""); + registerUpButton->setIconSet(KApplication::kApplication()->iconLoader()->loadIconSet("up", KIcon::Small, ICON_SIZE_SMALL_MEDIUM)); + registerDownButton->setText(""); + registerDownButton->setIconSet(KApplication::kApplication()->iconLoader()->loadIconSet("down", KIcon::Small, ICON_SIZE_SMALL_MEDIUM)); + editRegisterButton->setText(""); + editRegisterButton->setIconSet(KApplication::kApplication()->iconLoader()->loadIconSet("edit", KIcon::Small, ICON_SIZE_SMALL_MEDIUM)); + deleteRegisterButton->setText(""); + deleteRegisterButton->setIconSet(KApplication::kApplication()->iconLoader()->loadIconSet("editdelete", KIcon::Small, ICON_SIZE_SMALL_MEDIUM)); + clearStackButton->setText(""); + clearStackButton->setIconSet(KApplication::kApplication()->iconLoader()->loadIconSet("view_remove", KIcon::Small, ICON_SIZE_SMALL_MEDIUM)); + } else { + leftButtonsLayout->setSpacing(6); + if(rpn_mode) executeButton->setText(i18n("Enter")); + else executeButton->setText(i18n("=")); + executeButton->setIconSet(QIconSet()); + storeButton->setText(i18n("Store")); + storeButton->setIconSet(QIconSet()); + convertButton->setText(i18n("Convert")); + convertButton->setIconSet(QIconSet()); + leftButtonsSeparator->show(); + stackPageButtonsLayout->setSpacing(6); + registerUpButton->setText(i18n("Up")); + registerUpButton->setIconSet(QIconSet()); + registerDownButton->setText(i18n("Down")); + registerDownButton->setIconSet(QIconSet()); + editRegisterButton->setText(i18n("Edit")); + editRegisterButton->setIconSet(QIconSet()); + deleteRegisterButton->setText(i18n("Delete")); + deleteRegisterButton->setIconSet(QIconSet()); + clearStackButton->setText(i18n("Clear")); + clearStackButton->setIconSet(QIconSet()); + } + updateButtonWidths(); + } +} + + +void KQalculate::copyResult() { + QApplication::clipboard()->setText(result_history_text, QClipboard::Clipboard); +} + +void KQalculate::clearHistory() { + historyBrowser->setText(" "); + expressionEdit->setFocus(); + inhistory.clear(); + inhistory_type.clear(); + inhistory_current_id = 0; + inhistory_id.clear(); + initial_inhistory_index = 0; + initial_result_index = 0; +} + +void KQalculate::convertToBestUnit() { + error_timer->stop(); + mstruct->set(CALCULATOR->convertToBestUnit(*mstruct, evalops)); + result_action_executed(); + error_timer->start(100); +} + +void KQalculate::convertToBaseUnits() { + error_timer->stop(); + mstruct->set(CALCULATOR->convertToBaseUnits(*mstruct, evalops)); + result_action_executed(); + error_timer->start(100); +} + +void KQalculate::applySetUnknowns(bool okclicked) { + QString str; + QString result_mod = ""; + bool b = false; + mstruct->set(*mstruct_before_unknowns); + for(size_t i = 1; i <= unknowns_mstruct->size(); i++) { + str = unknowns_entries[i - 1]->text().stripWhiteSpace(); + if(unknown_changed[i - 1] || !str.isEmpty()) { + if(!result_mod.isEmpty()) { + result_mod += CALCULATOR->getComma().c_str(); + result_mod += " "; + } + result_mod += unknowns_mstruct->getChild(i)->print().c_str(); + result_mod += "="; + if(str.isEmpty()) { + result_mod += "?"; + } else { + result_mod += str; + mstruct->replace(*unknowns_mstruct->getChild(i), CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options), evalops)); + b = true; + unknown_changed[i - 1] = true; + } + } + } + if(b) { + b_unknowns_changed = true; + if(okclicked && !rpn_mode) { + MathStructure mp(*mstruct); + printops.can_display_unicode_string_arg = historyBrowser; + mp.format(printops); + str = mp.print(printops).c_str(); + expressionEdit->blockSignals(true); + expressionEdit->setText(str); + printops.can_display_unicode_string_arg = NULL; + //expressionEdit->addToHistory(str); + expressionEdit->expression_history_index = -1; + expressionEdit->blockSignals(false); + expressionEdit->setFocus(); + expressionEdit->selectAll(); + expression_has_changed2 = true; + displayParseStatus(); + } + mstruct->eval(evalops); + } + if(b_unknowns_changed) { + printops.allow_factorization = (evalops.structuring == STRUCTURING_FACTORIZE); + setResult(NULL, true, false, false, result_mod); + } + //if(!okclicked && b) mstruct->set(*mstruct_before_unknowns); +} +void KQalculate::setUnknownsApplyClicked() { + applySetUnknowns(false); +} +void KQalculate::setUnknowns() { + if(expression_has_changed && !rpn_mode) execute_expression(true); + unknowns_mstruct = new MathStructure(); + mstruct->findAllUnknowns(*unknowns_mstruct); + if(unknowns_mstruct->size() == 0) { + KMessageBox::error(this, i18n("No unknowns in result.")); + return; + } + KDialogBase *dialog = new KDialogBase(this, 0, true, i18n("Set Unknowns")); + QObject::connect(dialog, SIGNAL(applyClicked()), this, SLOT(setUnknownsApplyClicked())); + QGrid *grid = dialog->makeGridMainWidget(2, Qt::Horizontal); + unknowns_entries.clear(); + for(size_t i = 1; i <= unknowns_mstruct->size(); i++) { + new QLabel(unknowns_mstruct->getChild(i)->print().c_str(), grid); + unknowns_entries.push_back(new KLineEdit(grid)); + if(i == 1) unknowns_entries[0]->setFocus(); + } + mstruct_before_unknowns = new MathStructure(*mstruct); + b_unknowns_changed = false; + unknown_changed.clear(); + unknown_changed.resize(unknowns_mstruct->size(), false); + int response = dialog->exec(); + if(response == QDialog::Accepted) { + applySetUnknowns(true); + } else { + if(b_unknowns_changed) { + QString result_mod = ""; + for(size_t i = 1; i <= unknowns_mstruct->size(); i++) { + if(unknown_changed[i - 1]) { + if(!result_mod.isEmpty()) { + result_mod += CALCULATOR->getComma().c_str(); + result_mod += " "; + } + result_mod += unknowns_mstruct->getChild(i)->print().c_str(); + result_mod += "="; + result_mod += "?"; + } + } + mstruct->set(*mstruct_before_unknowns); + printops.allow_factorization = (evalops.structuring == STRUCTURING_FACTORIZE); + setResult(NULL, true, false, false, result_mod); + expressionEdit->setFocus(); + } + } + delete dialog; + delete mstruct_before_unknowns; + delete unknowns_mstruct; +} + + +void KQalculate::manageDataSets() { + if(!datasets_dialog) { + datasets_dialog = new QalculateDataSetsDialog(); + datasets_dialog->updateDataSetTree(); + QObject::connect(datasets_dialog, SIGNAL(dataSetsChanged()), this, SLOT(update_fmenu())); + } + datasets_dialog->show(); +} + +void KQalculate::factorize() { + executeCommand(COMMAND_FACTORIZE); +} +void KQalculate::simplify() { + executeCommand(COMMAND_SIMPLIFY); +} + +void KQalculate::manageUnits() { + if(!units_dialog) { + units_dialog = new QalculateUnitsDialog(); + units_dialog->updateUnitTree(); + QObject::connect(units_dialog, SIGNAL(unitsChanged()), this, SLOT(update_umenus())); + QObject::connect(units_dialog, SIGNAL(insertRequest(Unit*)), this, SLOT(insertUnit(Unit*))); + QObject::connect(units_dialog, SIGNAL(convertRequest(Unit*)), this, SLOT(convertResult(Unit*))); + } + units_dialog->show(); +} +void KQalculate::insertUnit(Unit *u) { + if(u->subtype() == SUBTYPE_COMPOSITE_UNIT) { + insert_text(((CompositeUnit*) u)->print(true, printops.abbreviate_names, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) expressionEdit).c_str()); + } else { + insert_text(u->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, true, false, &can_display_unicode_string_function, (void*) expressionEdit).name.c_str()); + } + unit_inserted(u); +} +void KQalculate::convertResult(Unit *u) { + error_timer->stop(); + mstruct->set(CALCULATOR->convert(*mstruct, u, evalops)); + result_action_executed(); + error_timer->start(100); +} +void KQalculate::insertMatrixVector(const MathStructure *m, bool do_vector, bool is_text_struct, bool is_result) { + if(!insert_matrix_dialog) { + insert_matrix_dialog = new QalculateInsertMatrixVectorDialog(this); + } + QString str = insert_matrix_dialog->editMatrixVector(m, do_vector, is_text_struct, is_result); + if(!str.isEmpty()) { + insert_text(str); + } +} +void KQalculate::insertMatrix() { + QString str = expressionEdit->selectedText().stripWhiteSpace(); + if(!str.isEmpty()) { + MathStructure mstruct_sel; + CALCULATOR->beginTemporaryStopMessages(); + CALCULATOR->parse(&mstruct_sel, CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options), evalops.parse_options); + CALCULATOR->endTemporaryStopMessages(); + if(mstruct_sel.isMatrix()) { + insertMatrixVector(&mstruct_sel, false); + return; + } + } + insertMatrixVector(NULL, false); +} +void KQalculate::insertVector() { + QString str = expressionEdit->selectedText().stripWhiteSpace(); + if(!str.isEmpty()) { + MathStructure mstruct_sel; + CALCULATOR->beginTemporaryStopMessages(); + CALCULATOR->parse(&mstruct_sel, CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options), evalops.parse_options); + CALCULATOR->endTemporaryStopMessages(); + if(mstruct_sel.isVector() && !mstruct_sel.isMatrix()) { + insertMatrixVector(&mstruct_sel, true); + return; + } + } + insertMatrixVector(NULL, true); +} + +void KQalculate::keyPressEvent(QKeyEvent *e) { + KMainWindow::keyPressEvent(e); + if(e->isAccepted()) return; + if(close_to_systray && e->key() == Key_Escape && e->state() == 0) { + e->accept(); + hide(); + return; + } + if(!expressionEdit->hasFocus() && e->key() != Qt::Key_Control && e->key() != Qt::Key_Meta && e->key() != Qt::Key_Shift && e->key() != Qt::Key_Alt) { + expressionEdit->setFocus(); + expressionEdit->keyPressEvent(e); + } +} + +bool KQalculate::queryClose() { + if(m_parent->sessionSaving() || !close_to_systray) return true; + hide(); + setShown(false); + return false; +} +void KQalculate::saveProperties(KConfig*) { + KConfig *cfg = KGlobal::config(); + cfg->setGroup("Session"); + cfg->writeEntry("docked", isHidden()); +} +void KQalculate::readProperties(KConfig*) { + KConfig *cfg = KGlobal::config(); + cfg->setGroup("Session"); + if(close_to_systray && cfg->readBoolEntry("docked", true)) { + hide(); + } else { + show(); + } +} + +void KQalculate::display_function_hint(MathFunction *f, int arg_index) { + if(!f) return; + int iargs = f->maxargs(); + Argument *arg; + Argument default_arg; + QString str, str2, str3; + const ExpressionName *ename = &f->preferredName(false, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) statusLabel_l); + bool last_is_vctr = f->getArgumentDefinition(iargs) && f->getArgumentDefinition(iargs)->type() == ARGUMENT_TYPE_VECTOR; + if(arg_index > iargs && iargs >= 0 && !last_is_vctr) { + statusLabel_l->setText(i18n("Too many arguments for %1().").arg(ename->name.c_str()), false, false, true); + return; + } + str += ename->name.c_str(); + if(iargs < 0) { + iargs = f->minargs() + 1; + if(arg_index > iargs) arg_index = iargs; + } + if(arg_index > iargs && last_is_vctr) arg_index = iargs; + + str += "("; + int i_reduced = 0; + if(iargs != 0) { + for(int i2 = 1; i2 <= iargs; i2++) { + if(i2 > f->minargs() && arg_index < i2) { + str += "["; + } + if(i2 > 1) { + str += CALCULATOR->getComma().c_str(); + str += " "; + } + if(i2 == arg_index) str += ""; + arg = f->getArgumentDefinition(i2); + if(arg && !arg->name().empty()) { + str2 = arg->name().c_str(); + } else { + str2 = i18n("argument"); + str2 += " "; + str2 += QString::number(i2); + } + if(i2 == arg_index) { + if(arg) { + if(i_reduced == 2) str3 = arg->print().c_str(); + else str3 = arg->printlong().c_str(); + } else { + Argument arg_default; + if(i_reduced == 2) str3 = arg_default.print().c_str(); + else str3 = arg_default.printlong().c_str(); + } + if(!str3.isEmpty()) { + str2 += ": "; + str2 += str3; + } + str2.replace("&", "&"); + str2.replace(">", ">"); + str2.replace("<", "<"); + str += str2; + str += ""; + if(i_reduced < 2) { + QSimpleRichText qsrt(str, statusLabel_l->font()); + qsrt.setWidth(statusLabel_l->contentsRect().width() + 100); + if(qsrt.widthUsed() > statusLabel_l->contentsRect().width() - 4) { + str = ename->name.c_str(); + str += "("; + if(i2 != 1) { + str += "..."; + i_reduced++; + } else { + i_reduced = 2; + } + i2--; + } + } else { + i_reduced = 0; + } + } else { + str2.replace("&", "&"); + str2.replace(">", ">"); + str2.replace("<", "<"); + str += str2; + if(i2 > f->minargs() && arg_index < i2) { + str += "]"; + } + } + } + if(f->maxargs() < 0) { + str += CALCULATOR->getComma().c_str(); + str += " ..."; + } + } + str += ")"; + statusLabel_l->setText(str, false, false, false); +} + +void KQalculate::displayParseStatus() { + if(!display_expression_status) return; + if(expressionEdit->text().length() == 0) { + statusLabel_l->setText("", true, false, false); + parsed_expression = ""; + expression_has_changed2 = false; + had_errors_before = false; + had_warnings_before = false; + return; + } + MathStructure mparse, mfunc; + string str_e, str_u; + int pos = expressionEdit->cursorPosition(); + bool full_parsed = false; + bool had_errors = false, had_warnings = false; + evalops.parse_options.preserve_format = true; + if(pos > 0) { + evalops.parse_options.unended_function = &mfunc; + CALCULATOR->beginTemporaryStopMessages(); + if(pos < (int) expressionEdit->text().length()) { + QString str = expressionEdit->text(); + str.truncate(pos); + str_e = CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options); + if(!CALCULATOR->separateToExpression(str_e, str_u, evalops)) { + CALCULATOR->parse(&mparse, str_e, evalops.parse_options); + } + } else { + str_e = CALCULATOR->unlocalizeExpression(expressionEdit->text().ascii(), evalops.parse_options); + CALCULATOR->separateToExpression(str_e, str_u, evalops); + CALCULATOR->parse(&mparse, str_e, evalops.parse_options); + full_parsed = true; + } + int warnings_count; + had_errors = CALCULATOR->endTemporaryStopMessages(NULL, &warnings_count) > 0; + had_warnings = warnings_count > 0; + evalops.parse_options.unended_function = NULL; + } + if(mfunc.isFunction()) { + if(mfunc.countChildren() == 0) { + display_function_hint(mfunc.function(), 1); + } else { + display_function_hint(mfunc.function(), mfunc.countChildren()); + } + } + if(expression_has_changed2) { + if(!full_parsed) { + CALCULATOR->beginTemporaryStopMessages(); + str_e = CALCULATOR->unlocalizeExpression(expressionEdit->text().ascii(), evalops.parse_options); + CALCULATOR->separateToExpression(str_e, str_u, evalops); + CALCULATOR->parse(&mparse, str_e, evalops.parse_options); + int warnings_count; + had_errors = CALCULATOR->endTemporaryStopMessages(NULL, &warnings_count) > 0; + had_warnings = warnings_count > 0; + } + PrintOptions po; + po.preserve_format = true; + po.show_ending_zeroes = true; + po.lower_case_e = printops.lower_case_e; + po.lower_case_numbers = printops.lower_case_numbers; + po.base_display = printops.base_display; + po.abbreviate_names = false; + po.hide_underscore_spaces = true; + po.use_unicode_signs = printops.use_unicode_signs; + po.multiplication_sign = printops.multiplication_sign; + po.division_sign = printops.division_sign; + po.short_multiplication = false; + po.excessive_parenthesis = true; + po.improve_division_multipliers = false; + po.can_display_unicode_string_function = &can_display_unicode_string_function; + po.can_display_unicode_string_arg = (void*) statusLabel_l; + po.spell_out_logical_operators = printops.spell_out_logical_operators; + po.restrict_to_parent_precision = false; + mparse.format(po); + parsed_expression = mparse.print(po).c_str(); + if(!str_u.empty()) { + parsed_expression += CALCULATOR->localToString().c_str(); + CALCULATOR->beginTemporaryStopMessages(); + CompositeUnit cu("", "temporary_composite_parse", "", str_u); + int warnings_count; + had_errors = CALCULATOR->endTemporaryStopMessages(NULL, &warnings_count) > 0 || had_errors; + had_warnings = had_warnings || warnings_count > 0; + mparse = cu.generateMathStructure(!printops.negative_exponents); + mparse.format(po); + parsed_expression += mparse.print(po).c_str(); + } + parsed_expression.replace("&", "&"); + parsed_expression.replace(">", ">"); + parsed_expression.replace("<", "<"); + if(!mfunc.isFunction()) statusLabel_l->setText(parsed_expression, true, had_errors, had_warnings); + expression_has_changed2 = false; + had_errors_before = had_errors; + had_warnings_before = had_warnings; + } else if(!mfunc.isFunction()) { + statusLabel_l->setText(parsed_expression, true, had_errors_before, had_warnings_before); + } + evalops.parse_options.preserve_format = false; +} + +void KQalculate::editHistoryExpression() { + if(current_history_index < inhistory.size()) { + QString text = inhistory[current_history_index]; + text.replace("&", "&"); + text.replace(">", ">"); + text.replace("<", "<"); + text.replace("
", " "); + expressionEdit->setText(text); + expressionEdit->setFocus(); + } +} +void KQalculate::editHistoryParse() { + if(current_history_index < inhistory.size()) { + QString text = inhistory[current_history_index]; + text.replace("&", "&"); + text.replace(">", ">"); + text.replace("<", "<"); + text.replace("
", " "); + expressionEdit->setText(text); + expressionEdit->setFocus(); + } +} +void KQalculate::editHistoryResult() { + if(current_history_index < inhistory.size()) { + QString text = inhistory[current_history_index]; + text.replace("&", "&"); + text.replace(">", ">"); + text.replace("<", "<"); + text.replace("
", " "); + expressionEdit->setText(text); + expressionEdit->setFocus(); + } +} +void KQalculate::insertHistoryResultVariable() { + if(current_history_index < inhistory.size()) { + int id = inhistory_id[current_history_index]; + for(size_t i = 0; i < 5; i++) { + if(vans_id_start[i] != -1 && id >= vans_id_start[i] && (vans_id_end[i] == -1 || id <= vans_id_end[i])) { + insertVariable(vans[i]); + } + } + } +} + +QalculateHistoryBrowser::QalculateHistoryBrowser(QWidget *parent, const char *name) : KTextBrowser(parent, name) {} +QalculateHistoryBrowser::~QalculateHistoryBrowser() {} + +QPopupMenu *QalculateHistoryBrowser::createPopupMenu(const QPoint &pos) { + + QPopupMenu *menu = KTextBrowser::createPopupMenu(pos); + menu->insertSeparator(); + mainWin->ActionClearHistory->plug(menu); + QString name = anchorAt(pos, Qt::AnchorName); + if(!name.isEmpty()) { + int id = name.toInt(); + QValueVector::size_type i = 0; + for(; i < inhistory_id.size(); i++) { + if(inhistory_id[i] == id) { + break; + } + } + mainWin->current_history_index = i; + if(i < inhistory_id.size()) { + switch(inhistory_type[i]) { + case QALCULATE_HISTORY_PARSE: {} + case QALCULATE_HISTORY_PARSE_APPROXIMATE: { + menu->insertItem(i18n("Edit Expression"), mainWin, SLOT(editHistoryParse())); + break; + } + case QALCULATE_HISTORY_EXPRESSION: { + menu->insertItem(i18n("Edit Expression"), mainWin, SLOT(editHistoryExpression())); + break; + } + case QALCULATE_HISTORY_RESULT_APPROXIMATE: {} + case QALCULATE_HISTORY_RESULT: { + menu->insertItem(i18n("Edit Result"), mainWin, SLOT(editHistoryResult())); + for(size_t i = 0; i < 5; i++) { + if(vans_id_start[i] != -1 && id >= vans_id_start[i] && (vans_id_end[i] == -1 || id <= vans_id_end[i])) { + menu->insertItem(i18n("Insert Result Variable"), mainWin, SLOT(insertHistoryResultVariable())); + break; + } + } + break; + } + default: {} + } + } + } + return menu; + +} + + +QalculateParseLabel::QalculateParseLabel(QWidget *parent, const char *name) : QLabel(parent, name) { + QLabel::setText("A"); + bb = false; + ec = false; + wc = false; +} +QalculateParseLabel::~QalculateParseLabel() {} +void QalculateParseLabel::setText(QString text, bool break_begin, bool error_color, bool warning_color) { + bb = break_begin; + ec = error_color; + wc = warning_color; + parsetext = ""; + parsetext += text; + parsetext += ""; + update(); +} +void QalculateParseLabel::drawContents(QPainter *p) { + QColorGroup cg = colorGroup(); + if(ec) { + cg.setColor(QColorGroup::Text, status_error_color); + } else if(wc) { + cg.setColor(QColorGroup::Text, status_warning_color); + } else if(backgroundMode() != PaletteBase && isEnabled()) { + cg.setColor(QColorGroup::Text, paletteForegroundColor()); + } + + QRect cr = contentsRect(); + cr.setX(cr.x() + 4); + cr.setWidth(cr.width() - 4); + QSimpleRichText qsrt(parsetext, font()); + qsrt.setWidth(p, cr.width() + 100); + if(qsrt.widthUsed() > cr.width()) { + if(bb) { + QSimpleRichText qsrt_dots("...", font()); + qsrt_dots.draw(p, cr.x(), cr.y(), cr, cg, 0); + cr.setX(cr.x() + qsrt_dots.widthUsed()); + cr.setWidth(cr.width() - qsrt_dots.widthUsed()); + qsrt.draw(p, cr.x() + cr.width() - qsrt.widthUsed(), cr.y(), cr, cg, 0); + } else { + QSimpleRichText qsrt_dots("...", font()); + qsrt_dots.draw(p, cr.x() + cr.width() - qsrt_dots.widthUsed(), cr.y(), cr, cg, 0); + cr.setWidth(cr.width() - qsrt_dots.widthUsed()); + qsrt.draw(p, cr.x(), cr.y(), cr, cg, 0); + } + } else { + qsrt.draw(p, cr.x(), cr.y(), cr, cg, 0); + } +} + +QalculateButton::QalculateButton(QWidget *parent, const char *name) : QPushButton(parent, name) { + setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); + umtcw = true; +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR >= 4 + KAcceleratorManager::setNoAccel(this); +#endif + +} +QalculateButton::QalculateButton(const QString &text, QWidget *parent, const char *name) : QPushButton(text, parent, name) { + setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); + umtcw = true; +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR >= 4 + KAcceleratorManager::setNoAccel(this); +#endif +} +QalculateButton::QalculateButton(const QIconSet &icon, const QString &text, QWidget *parent, const char *name) : QPushButton(icon, text, parent, name) { + setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); + umtcw = true; +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR >= 4 + KAcceleratorManager::setNoAccel(this); +#endif +} +QalculateButton::~QalculateButton() {} + +void QalculateButton::setUseMinThreeCharWidth(bool b) { + umtcw = b; +} +void QalculateButton::setMarkup(const QString &str) { + QColorGroup cg(colorGroup()); + cg.setColor(QColorGroup::Text, paletteForegroundColor()); + QSimpleRichText rtext(str, font()); + QPicture picture; + QPainter p(&picture); + rtext.draw(&p, 0, 0, QRect(), cg); + p.flush(); + p.end(); + QRect r = picture.boundingRect(); + QPixmap pixmap(r.width(), rtext.height()); + pixmap.fill(cg.background()); + QPainter p2(&pixmap); + p2.drawPicture(-r.x(), 0, picture); + p2.flush(); + p2.end(); + pixmap.setMask(pixmap.createHeuristicMask()); + setPixmap(pixmap); +} + +QSize QalculateButton::sizeHint() const { + + constPolish(); + + int w = 0, h = 0; + + +#ifndef QT_NO_ICONSET + if(iconSet() && !iconSet()->isNull()) { + w = iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 10; + h = iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height() + 10; + return QSize(w, h).expandedTo(QApplication::globalStrut()); + } +#endif + + QSize sz; + + if(pixmap()) { + QPixmap *pm = (QPixmap *)pixmap(); + w = pm->width(); + h = pm->height(); + if(umtcw) { + QFontMetrics fm = fontMetrics(); + sz = fm.size(ShowPrefix, QString::fromLatin1("XXX")); + if(w < sz.width()) w = sz.width(); + if(w < sz.height()) w = sz.height(); + } + sz.setWidth(w); + sz.setHeight(h); + w += 12; + h += 10; + } else { + QFontMetrics fm = fontMetrics(); + if(umtcw && (text().isEmpty() || text().length() < 3)) { + sz = fm.size(ShowPrefix, QString::fromLatin1("XXX")); + } else { + sz = fm.size(ShowPrefix, text()); + } + w = sz.width() + 12; + h = sz.height() + 10; + } + + return QSize(w, h).boundedTo(style().sizeFromContents(QStyle::CT_PushButton, this, sz)).expandedTo(QApplication::globalStrut()); + +} + +QalculateStyleSheet::QalculateStyleSheet(QObject *parent, const char *name) : QStyleSheet(parent, name) {} +QalculateStyleSheet::~QalculateStyleSheet() {} + +void QalculateStyleSheet::scaleFont(QFont &font, int logicalSize) const { + + if(logicalSize <= 1) { + font.setPixelSize(1); + } else if(logicalSize == 2) { + logicalSize = 1; + } else if(logicalSize > 7) { + logicalSize = 7; + } + + int baseSize = font.pointSize(); + + bool pixel = FALSE; + if(baseSize == -1){ + baseSize = font.pixelSize(); + pixel = TRUE; + } + + float factor = baseSize; + int i; + int scale_level = logicalSize - 3; + + if(scale_level > 0) { + i = 0; + while (i < scale_level) { + factor *= 1.2; + ++i; + } + } else if(scale_level < 0) { + i = scale_level; + while (i < 0) { + factor /= 1.2; + ++i; + } + } + + if(pixel) font.setPixelSize((int) roundf(factor)); + else font.setPointSizeFloat(factor); + +} + +QalculateRPNStackListView::QalculateRPNStackListView(QWidget *parent, const char *name) : KListView(parent, name) {} +QalculateRPNStackListView::~QalculateRPNStackListView() {} + +void QalculateRPNStackListView::keyPressEvent(QKeyEvent *e) { + switch(e->key()) { + case Key_Prior: {} + case Key_Next: {} + case Key_Home: {} + case Key_End: {} + case Key_Up: {} + case Key_Down: { + KListView::keyPressEvent(e); + break; + } + default: { + if(e->key() == KGlobalSettings::contextMenuKey()) KListView::keyPressEvent(e); + else e->ignore(); + } + } +} + +#include "kqalculate.moc" diff --git a/src/kqalculate.h b/src/kqalculate.h new file mode 100644 index 0000000..fb016e0 --- /dev/null +++ b/src/kqalculate.h @@ -0,0 +1,593 @@ +/*************************************************************************** + * Copyright (C) 2005-2007 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ + +#ifndef KQALCULATE_H +#define KQALCULATE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Prefix; +class QalculatePrecisionDialog; +class Variable; +class MathFunction; +class Unit; +class QalculateDecimalsDialog; +class QalculateEditVariableDialog; +class QalculateEditMatrixVectorDialog; +class QalculateEditUnitDialog; +class QalculateEditFunctionDialog; +class QalculateEditDataSetDialog; +class QalculateEditUnknownVariableDialog; +class QalculateVariablesDialog; +class QalculateFunctionsDialog; +class QalculateUnitsDialog; +class QalculateDataSetsDialog; +class QalculateConvertUnitsDialog; +class KAction; +class KRadioAction; +class KToggleAction; +class QToolBar; +class QPopupMenu; +class KPushButton; +class QalculateExpressionEdit; +class QalculateResultDisplay; +class QFrame; +class QWidgetStack; +class QWidget; +class QComboBox; +class QalculateHistoryBrowser; +class QalculateConvertNumberBasesDialog; +class QalculatePeriodicTableDialog; +class QalculatePlotDialog; +class QalculateSetBaseDialog; +class KLineEdit; +class MathStructure; +class QalculateImportCSVDialog; +class QalculateExportCSVDialog; +class QalculatePreferencesDialog; +class QalculateInsertMatrixVectorDialog; +class KSystemTray; +class QalculateParseLabel; +class QButtonGroup; +class QRadioButton; +class QalculateButton; +class QVBoxLayout; +class KSeparator; +class KUniqueApplication; +class KConfig; +class QListViewItem; +class QalculateRPNStackListView; +class KGlobalAccel; +class KKeyButton; + +void *view_proc(void *pipe); +void *command_proc(void *pipe); + +enum { + COMMAND_FACTORIZE, + COMMAND_SIMPLIFY +}; + + +class ModeObject : public QObject { + + Q_OBJECT + + public: + + ModeObject(int mode); + int i_mode; + + public slots: + + void loadMode(); + +}; + +class KQalculate : public KMainWindow { + + Q_OBJECT + +public: + + KQalculate(KUniqueApplication *parent = 0, const char* name = 0, WFlags fl = WType_TopLevel | WDestructiveClose); + virtual ~KQalculate(); + + void setupActions(); + void setAssumptionsMenu(); + void setModeActions(); + void execute_expression(bool force = true); + void setResult(Prefix *prefix = NULL, bool update_history = true, bool update_parse = false, bool force = false, QString transformation = "", size_t stack_index = 0, bool register_moved = false); + void executeCommand(int command_type); + void result_display_updated(); + void result_format_updated(); + void result_action_executed(); + void result_prefix_changed(Prefix *prefix = NULL); + void expression_calculation_updated(); + void expression_format_updated(bool recalculate = false); + void display_errors(QString *new_text = NULL, int *inhistory_index = NULL); + void update_status_text(); + void display_function_hint(MathFunction *f, int arg_index = 1); + void clearresult(); + void create_fmenu(); + void create_vmenu(); + void create_umenu(); + void create_toumenu(); + void create_setpmenu(); + void recreate_recent_functions(); + void recreate_recent_variables(); + void recreate_recent_units(); + void function_inserted(MathFunction *object); + void variable_inserted(Variable *object); + void unit_inserted(Unit *object); + void updateStatusLabelFonts(); + void set_unicode_buttons(); + void insertButtonFunction(QString text, bool append_space = true); + void insertButtonFunction(MathFunction *f); + const MathStructure *getResultPart(int); + void insertMatrixVector(const MathStructure *m = NULL, bool do_vector = false, bool is_text_struct = false, bool is_result = false); + + void calculateRPN(int op); + void calculateRPN(MathFunction *f); + void RPNStackEnter(Variable *v); + void RPNRegisterAdded(const QString &text, size_t index = 0); + void RPNRegisterRemoved(size_t index); + void RPNRegisterChanged(const QString &text, size_t index = 0); + + QalculateInsertMatrixVectorDialog *insert_matrix_dialog; + QalculatePrecisionDialog *precisionDialog; + QalculateDecimalsDialog *decimalsDialog; + QalculateConvertUnitsDialog *convert_to_unit_expression_dialog; + QalculateEditVariableDialog *variable_edit_dialog, *store_dialog; + QalculateEditMatrixVectorDialog *matrix_edit_dialog; + QalculateEditUnitDialog *unit_edit_dialog; + QalculateEditFunctionDialog *function_edit_dialog; + QalculateEditDataSetDialog *dataset_edit_dialog; + QalculateEditUnknownVariableDialog *unknown_edit_dialog; + QalculateVariablesDialog *variables_dialog; + QalculateFunctionsDialog *functions_dialog; + QalculateUnitsDialog *units_dialog; + QalculateDataSetsDialog *datasets_dialog; + QalculateConvertNumberBasesDialog *convert_number_bases_dialog; + QalculatePeriodicTableDialog *periodic_table_dialog; + QalculateImportCSVDialog *import_csv_dialog; + QalculateExportCSVDialog *export_csv_dialog; + QalculatePlotDialog *plot_dialog; + QalculateSetBaseDialog *set_base_dialog; + QalculatePreferencesDialog *preferences_dialog; + QMap menu_variables_ids; + QMap menu_functions_ids; + QMap menu_units_ids, menu_to_unit_ids; + QMap menu_units_prefixes_ids, menu_set_prefix_ids; + QValueVector recent_function_ids; + QValueVector recent_variable_ids; + QValueVector recent_unit_ids; + + QalculateRPNStackListView *stackList; + QVBoxLayout *stackPageButtonsLayout; + QalculateButton *registerUpButton, *registerDownButton, *deleteRegisterButton, *editRegisterButton, *clearStackButton; + QPopupMenu *stackMenu; + KUniqueApplication *m_parent; + KSystemTray *trayicon; + QalculateButton *executeButton, *storeButton, *convertButton; + QalculateButton *functionsButton; + QVBoxLayout *leftButtonsLayout; + KSeparator *leftButtonsSeparator; + QalculateExpressionEdit* expressionEdit; + QLabel *statusLabel_r; + QalculateParseLabel *statusLabel_l; + QalculateResultDisplay* resultLabel; + QWidgetStack* mainStack; + QFrame *bottomLine; + QWidget *keypadPage, *historyPage, *stackPage; + QComboBox* kpNumericCombo, *kpBaseCombo; + QRadioButton *kpDegreesButton, *kpRadiansButton, *kpGradiansButton, *kpNoAngleUnitButton; + QButtonGroup *kpAngleGroup; + QPushButton *kpExact, *kpFraction; + QalculateButton *kpSquare, *kpLog, *kpHyp, *kpSqrt, *kpCos, *kpRaise, *kpInv, *kpSin; + QalculateButton *kpTan, *kpLn, *kpFactorial, *kpMod, *kpAns, *kp8, *kp0, *kp7, *kpDel, *kpDot, *kp5, *kpEquals, *kpClear; + QalculateButton *kp3, *kp1, *kp4, *kp9, *kpDivision, *kpExp, *kp6, *kp2, *kpMinus, *kpTimes, *kpPlus; + QalculateHistoryBrowser *historyBrowser; + QPushButton *historyButton, *keypadButton, *stackButton; + KMenuBar *menubar; + QPopupMenu *menu_functions, *menu_variables, *menu_units, *menu_to_unit, *menu_set_prefix, *menu_modes; + KToggleAction *ActionAbbreviateNames, *ActionReadPrecision, *ActionNonZeroDenominators, *ActionWarnAboutDenominatorsAssumedNonZero; + KToggleAction *ActionLimitImplicitMultiplication, *ActionRPNMode, *ActionRPNSyntax, *ActionIndicateInfiniteSeries, *ActionNegativeExponents, *ActionSortMinusLast; + KToggleAction *ActionShowEndingZeroes, *ActionRoundHalfwayNumbersToEven, *ActionEnablePrefixes; + KToggleAction *ActionEnableUseOfAllPrefixes, *ActionEnableDenominatorPrefixes, *ActionPlaceUnitsSeparately; + KToggleAction *ActionEnableVariables, *ActionEnableFunctions, *ActionEnableUnits, *ActionEnableUnknowns; + KToggleAction *ActionCalculateVariables, *ActionAllowComplexResult, *ActionAllowInfiniteResult; + KRadioAction *ActionApproximationAlwaysExact, *ActionApproximationTryExact, *ActionApproximationApproximate; + KRadioAction *ActionAlgebraicModeSimplify, *ActionAlgebraicModeFactorize, *ActionAlgebraicModeNone; + KRadioAction *ActionFractionalDisplayDecimal, *ActionFractionalDisplayDecimalTryExact; + KRadioAction *ActionFractionalDisplayFraction, *ActionFractionalDisplayCombined; + KRadioAction *ActionNumericalDisplayEngineering, *ActionNumericalDisplayScientific, *ActionNumericalDisplayPurelyScientific, *ActionNumericalDisplaySimple, *ActionNumericalDisplayNormal; + KRadioAction *ActionNumberBaseBinary, *ActionNumberBaseOctal, *ActionNumberBaseDecimal, *ActionNumberBaseHexadecimal, *ActionNumberBaseOther; + KRadioAction *ActionNumberBaseSexagesimal, *ActionNumberBaseTimeFormat, *ActionNumberBaseRomanNumerals; + KRadioAction *ActionAssumptionTypeUnknown, *ActionAssumptionTypeNonMatrix, *ActionAssumptionTypeNumber, *ActionAssumptionTypeComplex, *ActionAssumptionTypeReal; + KRadioAction *ActionAssumptionTypeRational, *ActionAssumptionTypeInteger, *ActionAssumptionSignUnknown, *ActionAssumptionSignNonZero; + KRadioAction *ActionAssumptionSignPositive, *ActionAssumptionSignNonNegative, *ActionAssumptionSignNegative; + KRadioAction *ActionAssumptionSignNonPositive, *ActionAngleUnitDegrees, *ActionAngleUnitRadians, *ActionAngleUnitGradians; + KRadioAction *ActionAngleUnitNone, *ActionAutoNoConversion, *ActionAutoConvertToBaseUnits, *ActionAutoConvertToBestUnit; + KAction *ActionSetBase, *ActionPrecision, *ActionDecimals, *ActionSaveModeAs, *ActionDeleteMode, *ActionSaveMode, *ActionQuit; + KAction *ActionUpdateExchangeRates, *ActionManageVariables, *ActionConvertToUnitExpression, *ActionStoreResult, *ActionClose; + KAction *ActionConvertNumberBases, *ActionManageFunctions, *ActionConvertToBaseUnits, *ActionConvertToBestUnit; + KAction *ActionManageUnits, *ActionManageDataSets, *ActionFactorize, *ActionSimplify, *ActionSetUnknowns, *ActionCopyResult; + KAction *ActionPreferences, *ActionSaveAsImage, *ActionImportCSVFile, *ActionExportCSVFile, *ActionPeriodicTable; + KAction *ActionPlotFunctionsData, *ActionSaveDefinitions, *ActionNewVariable, *ActionNewMatrix, *ActionNewVector; + KAction *ActionNewUnknownVariable, *ActionNewFunction, *ActionNewUnit, *ActionNewDataSet; + KAction *ActionInsertMatrix, *ActionInsertVector; + KAction *ActionClearHistory; + KAction *ActionHideSystemTrayIcon, *ActionHide; + KAction *ActionClearStack, *ActionDeleteRegister, *ActionEditRegister; + KAction *ActionConfigureGlobalShortcuts; + + KGlobalAccel *globalAccel; + + QValueVector::size_type current_history_index; + QValueVector mode_objects; + +public slots: + + void executeCommand2(); + void setResult2(); + void execute_expression2(); + + void showHide(); + void configureGlobalShortcuts(); + + void update_fmenu(); + void update_vmenu(); + void update_umenus(); + void insertVariable(Variable*); + void insertFunction(MathFunction*, QWidget *parent); + void applyFunction(MathFunction*, QWidget *parent); + void onExpressionChanged(); + void onErrorTimeout(); + bool fetch_exchange_rates(int); + void update_completion(); + void insert_text(QString); + void aboutToQuit(); + void onVariableMenuItemActivated(int); + void onFunctionMenuItemActivated(int); + void onUnitMenuItemActivated(int); + void onUnitsPrefixMenuItemActivated(int); + void precisionRecalculate(); + void setMaxDecimals(int); + void setMinDecimals(int); + void execute(); + void toggleHistory(bool); + void toggleStack(bool); + void toggleKeypad(bool); + void showEndingZeroes(bool); + void approximationTryExact(); + void approximationAlwaysExact(); + void approximationApproximate(); + void fractionalDisplayDecimal(); + void fractionalDisplayDecimalTryExact(); + void fractionalDisplayFraction(); + void fractionalDisplayCombined(); + void numericalDisplayNormal(); + void numericalDisplayEngineering(); + void numericalDisplayScientific(); + void numericalDisplayPurelyScientific(); + void numericalDisplaySimple(); + void indicateInfiniteSeries(bool); + void sortMinusLast(bool); + void negativeExponents(bool); + void roundHalfwayNumbersToEven(bool); + void abbreviateNames(bool); + void updateBaseOther(); + void numberBaseBinary(); + void numberBaseOctal(); + void numberBaseDecimal(); + void numberBaseOther(); + void numberBaseHexadecimal(); + void numberBaseSexagesimal(); + void numberBaseTimeFormat(); + void numberBaseRomanNumerals(); + void setBaseInResultFromDialogGroup(int); + void setBaseInResultFromDialogBox(int); + void setBaseInExpressionFromDialogGroup(int); + void setBaseInExpressionFromDialogBox(int); + void setBase(); + void nonZeroDenominators(bool); + void warnAboutDenominatorsAssumedNonZero(bool); + void algebraicModeSimplify(); + void algebraicModeFactorize(); + void algebraicModeNone(); + void readPrecision(bool); + void limitImplicitMultiplication(bool); + void setPrecision(int); + void precision(); + void decimals(); + void rpnMode(bool); + void rpnSyntax(bool); + void assumptionSignUnknown(); + void assumptionSignNonZero(); + void assumptionSignPositive(); + void assumptionSignNonNegative(); + void assumptionSignNegative(); + void assumptionSignNonPositive(); + void assumptionTypeUnknown(); + void assumptionTypeNonMatrix(); + void assumptionTypeNumber(); + void assumptionTypeComplex(); + void assumptionTypeReal(); + void assumptionTypeRational(); + void assumptionTypeInteger(); + void loadMode(int); + void onModesMenuItemActivated(int); + void saveModeAs(); + void deleteMode(); + void saveMode(); + void angleUnitDegrees(); + void angleUnitRadians(); + void angleUnitGradians(); + void angleUnitNone(); + void autoNoConversion(); + void autoConvertToBaseUnits(); + void autoConvertToBestUnit(); + void enablePrefixes(bool); + void enableUseOfAllPrefixes(bool); + void enableDenominatorPrefixes(bool); + void placeUnitsSeparately(bool); + void enableVariables(bool); + void enableFunctions(bool); + void enableUnits(bool); + void enableUnknowns(bool); + void calculateVariables(bool); + void allowComplexResult(bool); + void allowInfiniteResult(bool); + void updateExchangeRates(); + void insertKP1(); + void insertKP2(); + void insertKP3(); + void insertKP4(); + void insertKP5(); + void insertKP6(); + void insertKP7(); + void insertKP8(); + void insertKP9(); + void insertKP0(); + void insertDot(); + void insertExp(); + void insertAns(); + void insertMinus(); + void insertPlus(); + void insertTimes(); + void insertDivision(); + void insertCos(); + void insertSin(); + void insertTan(); + void insertSqrt(); + void insertLog(); + void insertLn(); + void insertRaise(); + void clearExpression(); + void expressionDel(); + void insertSquare(); + void setExactMode(bool); + void setFractionMode(bool); + void kpSetAngleUnit(int); + void kpSetBaseSelected(int); + void kpSetBase(int); + void kpSetNumericalMode(int); + void insertFactorial(); + void insertMod(); + void storeResult(); + void manageVariables(); + void convertToUnitConvertToDialogExpression(); + void convertToUnitExpression(); + void convertNumberBases(); + void insertManagedFunction(MathFunction*); + void applyManagedFunction(MathFunction*); + void manageFunctions(); + void manageUnits(); + void insertUnit(Unit *u); + void convertResult(Unit *u); + void factorize(); + void simplify(); + void manageDataSets(); + void setUnknownsApplyClicked(); + void setUnknowns(); + void convertToBaseUnits(); + void convertToBestUnit(); + void copyResult(); + void clearHistory(); + void preferences(); + void applyPreferences(); + void onConvertToUnitMenuItemActivated(int); + void onSetPrefixMenuItemActivated(int); + void periodicTable(); + void plotFunctionsData(); + void saveDefinitions(); + void saveAsImage(); + void importCSVFile(); + void exportCSVFile(); + void newVariable(); + void newMatrix(); + void newVector(); + void newUnknownVariable(); + void newFunction(); + void newDataSet(); + void newUnit(); + void insertMatrix(); + void insertVector(); + void showSystemTrayIcon(bool); + void hideSystemTrayIcon(); + void displayParseStatus(); + void registerUp(); + void registerDown(); + void clearStack(); + void deleteRegister(); + void editRegister(); + void updateRPNIndexes(); + QListViewItem *getRPNRegister(size_t index); + void stackRegisterMoved(); + void stackRegisterSet(QListViewItem*); + void popupStackMenu(KListView*, QListViewItem*, const QPoint&); + void registerSelected(); + void editHistoryExpression(); + void editHistoryParse(); + void editHistoryResult(); + void insertHistoryResultVariable(); + +protected: + + void updateButtonWidths(); + void applySetUnknowns(bool okclicked); + bool b_unknowns_changed; + QValueVector unknown_changed; + MathStructure *mstruct_before_unknowns, *unknowns_mstruct; + QValueVector unknowns_entries; + bool queryClose(); + QString parsed_expression; + void keyPressEvent(QKeyEvent *e); + void fontChange(const QFont &old_font); + void saveProperties(KConfig *cfg); + void readProperties(KConfig *cfg); + +private: + + bool close_to_systray_was; + bool display_expression_status_was; + int history_height; + +}; + +class QalculateHistoryBrowser : public KTextBrowser { + + Q_OBJECT + +public: + + QalculateHistoryBrowser(QWidget *parent, const char *name); + ~QalculateHistoryBrowser(); + +protected: + + QPopupMenu *createPopupMenu(const QPoint &pos); + +}; + +class QalculateParseLabel : public QLabel { + + Q_OBJECT + +public: + + QalculateParseLabel(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateParseLabel(); + + void setText(QString text, bool break_begin, bool error_color, bool warning_color); + +protected: + + QString parsetext; + bool bb, ec, wc; + void drawContents(QPainter *p); + +}; + +class QalculateButton : public QPushButton { + + Q_OBJECT + +public: + + QalculateButton(QWidget *parent = 0, const char *name = 0); + QalculateButton(const QString &text, QWidget *parent = 0, const char *name = 0); + QalculateButton(const QIconSet &icon, const QString &text, QWidget *parent = 0, const char *name = 0); + virtual ~QalculateButton(); + + void setUseMinThreeCharWidth(bool b); + void setMarkup(const QString &str); + QSize sizeHint() const; + +private: + + bool umtcw; + +}; + +class QalculateStyleSheet : public QStyleSheet { + + Q_OBJECT + +public: + + QalculateStyleSheet(QObject *parent = 0, const char *name = 0); + virtual ~QalculateStyleSheet(); + + void scaleFont(QFont &font, int logicalSize) const; + +}; + +class QalculateRPNStackListView : public KListView { + + Q_OBJECT + +public: + + QalculateRPNStackListView(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateRPNStackListView(); + +protected: + + void keyPressEvent(QKeyEvent *e); + +}; + +class QalculateModeDialog : public KDialogBase { + + Q_OBJECT + + protected: + + KKeyButton *keyButton; + KComboBox *modeCombo; + + public: + + QalculateModeDialog(QWidget *parent); + virtual ~QalculateModeDialog(); + + QString modeName(); + const KShortcut &modeShortcut(); + + public slots: + + void slotOk(); + void updateShortcut(const KShortcut&); + void modeSelected(int); + +}; + +#endif // QALCULATE_KWINDOW_H diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..157653f --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,306 @@ +/*************************************************************************** + * Copyright (C) 2005-2006 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "kqalculate.h" +#include "preferences.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "qalculateexpressionedit.h" +#include "qalculateresultdisplay.h" + +#include "qalculate_kde_utils.h" + +static const char description[] = I18N_NOOP("A powerful and easy to use desktop calculator"); + +static const char version[] = VERSION; + +static KCmdLineOptions options[] = { + {"c", 0, 0}, + {"clipboard", I18N_NOOP("Calculate X11-clipboard content (selected text)"), 0}, + {"+[Expression]", I18N_NOOP( "Initial expression to calculate" ), 0}, + KCmdLineLastOption +}; + +extern KnownVariable *vans[5]; +extern MathStructure *mstruct, *matrix_mstruct, *parsed_mstruct, *parsed_tostruct; +extern QString result_text, result_history_text, parsed_text; +extern QWidget *expressionWidget, *resultWidget, *statusWidget_l; +extern QWidget *topWidget; +extern KQalculate *mainWin; + +extern bool load_global_defs, fetch_exchange_rates_at_startup, first_time, first_qalculate_run; +extern bool b_busy; +extern bool canplot; +extern bool close_to_systray; + +extern FILE *view_pipe_r, *view_pipe_w, *command_pipe_r, *command_pipe_w; +extern pthread_t view_thread, command_thread; +extern pthread_attr_t view_thread_attr, command_thread_attr; +extern bool command_thread_started; + +extern QValueVector recent_functions_pre; +extern QValueVector recent_variables_pre; +extern QValueVector recent_units_pre; + +QTimer *error_timer; + +void create_qalculate_window(KUniqueApplication *parent) { + + QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf8")); + + b_busy = false; + + new Calculator(); + if(KGlobal::locale()->decimalSymbol() == ",") CALCULATOR->useDecimalComma(); + CALCULATOR->place_currency_code_before = KGlobal::locale()->positivePrefixCurrencySymbol(); + + //load application specific preferences + load_preferences(); + + mstruct = new MathStructure(); + parsed_mstruct = new MathStructure(); + parsed_tostruct = new MathStructure(); + parsed_tostruct->setUndefined(); + matrix_mstruct = new MathStructure(); + + canplot = CALCULATOR->canPlot(); + + mainWin = new KQalculate(parent); + topWidget = mainWin; + expressionWidget = (QWidget*) mainWin->expressionEdit; + resultWidget = (QWidget*) mainWin->resultLabel; + statusWidget_l = (QWidget*) mainWin->statusLabel_l; + +} + +QString parse_expression_arguments(KCmdLineArgs *args) { + QString calc_arg; + if(args->isSet("clipboard")) { + calc_arg = qApp->clipboard()->text(QClipboard::Selection); + if(calc_arg.isEmpty()) { + calc_arg = qApp->clipboard()->text(QClipboard::Clipboard); + } + } else { + for(int i = 0; i < args->count(); i++) { + if(i > 0) { + calc_arg += " "; + } + calc_arg += args->arg(i); + } + } + return calc_arg; +} + +void start_qalculate() { + + KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + QString calc_arg = parse_expression_arguments(args); + args->clear(); + if(!calc_arg.isEmpty()) { + mainWin->expressionEdit->setText(calc_arg); + } else if(first_time) { + mainWin->resultLabel->setText(i18n("Enter a mathematical expression above.
Ex. 5 + 2 / 3")); + } else { + mainWin->resultLabel->setText("
 
= 0
"); + } + + qApp->processEvents(); + + //exchange rates + if(first_qalculate_run) { + if(KMessageBox::questionYesNo(mainWin, i18n("You need to download exchange rates to be able to convert between different currencies. You can later get current exchange rates by selecting \"Update Exchange Rates\" under the File menu.\n\nDo you want to fetch exchange rates now from the Internet?"), i18n("Update exchange rates?")) == KMessageBox::Yes) { + qApp->processEvents(); + mainWin->fetch_exchange_rates(5); + } + qApp->processEvents(); + } else if(fetch_exchange_rates_at_startup) { + mainWin->fetch_exchange_rates(5); + qApp->processEvents(); + } + + CALCULATOR->loadExchangeRates(); + + string ans_str = i18n("ans").ascii(); + vans[0] = (KnownVariable*) CALCULATOR->addVariable(new KnownVariable(i18n("Temporary").ascii(), ans_str, m_undefined, i18n("Last Answer").ascii(), false)); + vans[0]->addName(i18n("answer").ascii()); + vans[0]->addName(ans_str + "1"); + vans[1] = (KnownVariable*) CALCULATOR->addVariable(new KnownVariable(i18n("Temporary").ascii(), ans_str + "2", m_undefined, i18n("Answer 2").ascii(), false)); + vans[2] = (KnownVariable*) CALCULATOR->addVariable(new KnownVariable(i18n("Temporary").ascii(), ans_str + "3", m_undefined, i18n("Answer 3").ascii(), false)); + vans[3] = (KnownVariable*) CALCULATOR->addVariable(new KnownVariable(i18n("Temporary").ascii(), ans_str + "4", m_undefined, i18n("Answer 4").ascii(), false)); + vans[4] = (KnownVariable*) CALCULATOR->addVariable(new KnownVariable(i18n("Temporary").ascii(), ans_str + "5", m_undefined, i18n("Answer 5").ascii(), false)); + + //load global definitions + if(load_global_defs && !CALCULATOR->loadGlobalDefinitions()) { + KMessageBox::error(mainWin, i18n("Failed to load global definitions!"), i18n("Error")); + qApp->processEvents(); + } + + //load local definitions + CALCULATOR->loadLocalDefinitions(); + + //check for calculation errros regularly + error_timer = new QTimer(mainWin); + QObject::connect(error_timer, SIGNAL(timeout()), mainWin, SLOT(onErrorTimeout())); + + generate_units_tree_struct(); + generate_functions_tree_struct(); + generate_variables_tree_struct(); + mainWin->create_fmenu(); + mainWin->create_vmenu(); + mainWin->create_umenu(); + mainWin->create_toumenu(); + mainWin->create_setpmenu(); + + for(int i = ((int) recent_functions_pre.size()) - 1; i >= 0; i--) { + mainWin->function_inserted(CALCULATOR->getActiveFunction(recent_functions_pre[i].ascii())); + } + for(int i = ((int) recent_variables_pre.size()) - 1; i >= 0; i--) { + mainWin->variable_inserted(CALCULATOR->getActiveVariable(recent_variables_pre[i].ascii())); + } + for(int i = ((int) recent_units_pre.size()) - 1; i >= 0; i--) { + Unit *u = CALCULATOR->getActiveUnit(recent_units_pre[i].ascii()); + if(!u) u = CALCULATOR->getCompositeUnit(recent_units_pre[i].ascii()); + mainWin->unit_inserted(u); + } + + mainWin->update_completion(); + + int pipe_wr[] = {0, 0}; + pipe(pipe_wr); + view_pipe_r = fdopen(pipe_wr[0], "r"); + view_pipe_w = fdopen(pipe_wr[1], "w"); + pthread_attr_init(&view_thread_attr); + pthread_create(&view_thread, &view_thread_attr, view_proc, view_pipe_r); + + int pipe_wr2[] = {0, 0}; + pipe(pipe_wr2); + command_pipe_r = fdopen(pipe_wr2[0], "r"); + command_pipe_w = fdopen(pipe_wr2[1], "w"); + pthread_attr_init(&command_thread_attr); + command_thread_started = false; + + QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit())); + QObject::connect(qApp, SIGNAL(aboutToQuit()), mainWin, SLOT(aboutToQuit())); + + error_timer->start(100); + + if(!calc_arg.isEmpty()) { + mainWin->execute_expression(); + } + +} + +class QalculateApp : public KUniqueApplication { + +public: + + bool started; + + QalculateApp() {started = false;} + virtual ~QalculateApp() {} + + int newInstance() { + if(mainWin && started) { + + KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + QString calc_arg = parse_expression_arguments(args); + args->clear(); + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + KWin::Info info = KWin::info(mainWin->winId()); + KWin::setOnDesktop(mainWin->winId(), KWin::currentDesktop()); + mainWin->move(info.geometry.topLeft()); +#else + KWin::WindowInfo info = KWin::windowInfo(mainWin->winId(), (unsigned long) NET::WMGeometry); + KWin::setOnDesktop(mainWin->winId(), KWin::currentDesktop()); + mainWin->move(info.geometry().topLeft()); +#endif + mainWin->setShown(true); + mainWin->show(); + mainWin->raise(); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + KWin::setActiveWindow(mainWin->winId()); +#else + KWin::activateWindow(mainWin->winId()); +#endif + + if(!calc_arg.isEmpty()) { + mainWin->expressionEdit->setText(calc_arg); + mainWin->execute_expression(); + } + + return 0; + } else { + if(isRestored() && KMainWindow::canBeRestored(1)) { + create_qalculate_window(this); + setMainWidget(mainWin); + mainWin->restore(1, false); + start_qalculate(); + } else { + create_qalculate_window(this); + setMainWidget(mainWin); + mainWin->show(); + start_qalculate(); + } + started = true; + return KUniqueApplication::newInstance(); + } + started = true; + return 0; + } + +}; + +int main(int argc, char **argv) { + + mainWin = NULL; + + KAboutData about(PACKAGE, I18N_NOOP("Qalculate!"), version, description, KAboutData::License_GPL, "(C) 2005-2006 Niklas Knutsson", 0, "http://qalculate.sourceforge.net/", "nique769@users.sourceforge.net"); + about.addAuthor("Niklas Knutsson", 0, "nq@altern.org"); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions(options); + KUniqueApplication::addCmdLineOptions(); + + if(!QalculateApp::start()) { + return 0; + } + + QalculateApp app; + + return app.exec(); + +} + + diff --git a/src/preferences.cpp b/src/preferences.cpp new file mode 100644 index 0000000..658e5ec --- /dev/null +++ b/src/preferences.cpp @@ -0,0 +1,865 @@ +/*************************************************************************** + * Copyright (C) 2005-2007 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "preferences.h" +#include "kqalculate.h" +#include "qalculate_kde_utils.h" +#include "qalculateexpressionedit.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +PrintOptions printops; +EvaluationOptions evalops; +bool rpn_mode; +bool rpn_keypad_only; +bool load_global_defs, fetch_exchange_rates_at_startup, first_time, first_qalculate_run, save_mode_on_exit, save_defs_on_exit; +bool use_custom_result_font, use_custom_expression_font, use_custom_status_font; +int use_icon_buttons; +QString custom_result_font, custom_expression_font, custom_status_font; +QColor status_warning_color, status_error_color; + +bool display_expression_status; +bool close_to_systray; +bool enable_expression_completion; + +PlotLegendPlacement default_plot_legend_placement; +bool default_plot_display_grid; +bool default_plot_full_border; +QString default_plot_min; +QString default_plot_max; +QString default_plot_step; +int default_plot_sampling_rate; +bool default_plot_use_sampling_rate; +bool default_plot_rows; +int default_plot_type; +PlotStyle default_plot_style; +PlotSmoothing default_plot_smoothing; +QString default_plot_variable; +bool default_plot_color; +bool enable_plot_expression_completion; + +bool canplot; + +QString initial_history; + +extern vector recent_functions; +extern vector recent_variables; +extern vector recent_units; +QValueVector recent_functions_pre; +QValueVector recent_variables_pre; +QValueVector recent_units_pre; + +extern QWidget *expressionWidget; +extern KQalculate *mainWin; +QStringList expression_history; + +bool show_keypad, show_history, show_stack; + +vector modes; + +QValueVector inhistory; +QValueVector inhistory_type; +QValueVector inhistory_id; +int inhistory_current_id; + +/* + save mode to file +*/ +void save_mode() { + return save_preferences(true); +} + +/* + remember current mode +*/ +void set_saved_mode() { + modes[1].precision = CALCULATOR->getPrecision(); + modes[1].po = printops; + modes[1].po.allow_factorization = (evalops.structuring == STRUCTURING_FACTORIZE); + modes[1].eo = evalops; + modes[1].at = CALCULATOR->defaultAssumptions()->type(); + modes[1].as = CALCULATOR->defaultAssumptions()->sign(); + modes[1].rpn_mode = rpn_mode; +} + +size_t save_mode_as(QString name, bool *new_mode) { + name = name.stripWhiteSpace(); + size_t index = 0; + for(; index < modes.size(); index++) { + if(modes[index].name == name) { + if(new_mode) *new_mode = false; + break; + } + } + if(index >= modes.size()) { + modes.resize(modes.size() + 1); + index = modes.size() - 1; + if(new_mode) *new_mode = true; + } + modes[index].po = printops; + modes[index].po.allow_factorization = (evalops.structuring == STRUCTURING_FACTORIZE); + modes[index].eo = evalops; + modes[index].precision = CALCULATOR->getPrecision(); + modes[index].at = CALCULATOR->defaultAssumptions()->type(); + modes[index].as = CALCULATOR->defaultAssumptions()->sign(); + modes[index].name = name; + modes[index].rpn_mode = rpn_mode; + return index; +} + +void load_preferences() { + + default_plot_legend_placement = PLOT_LEGEND_TOP_RIGHT; + default_plot_display_grid = true; + default_plot_full_border = false; + default_plot_min = "0"; + default_plot_max = "10"; + default_plot_step = "1"; + default_plot_sampling_rate = 100; + default_plot_rows = false; + default_plot_type = 0; + default_plot_style = PLOT_STYLE_LINES; + default_plot_smoothing = PLOT_SMOOTHING_NONE; + default_plot_variable = "x"; + default_plot_color = true; + default_plot_use_sampling_rate = true; + + printops.is_approximate = new bool(false); + printops.prefix = NULL; + printops.use_min_decimals = false; + printops.use_denominator_prefix = true; + printops.min_decimals = 0; + printops.use_max_decimals = false; + printops.max_decimals = 2; + printops.base = 10; + printops.min_exp = EXP_PRECISION; + printops.negative_exponents = false; + printops.sort_options.minus_last = true; + printops.indicate_infinite_series = false; + printops.show_ending_zeroes = false; + printops.round_halfway_to_even = false; + printops.number_fraction_format = FRACTION_DECIMAL; + printops.abbreviate_names = true; + printops.use_unicode_signs = true; + printops.use_unit_prefixes = true; + printops.spacious = true; + printops.short_multiplication = true; + printops.limit_implicit_multiplication = false; + printops.place_units_separately = true; + printops.use_all_prefixes = false; + printops.excessive_parenthesis = false; + printops.allow_non_usable = false; + printops.lower_case_numbers = false; + printops.lower_case_e = false; + printops.base_display = BASE_DISPLAY_NORMAL; + printops.division_sign = DIVISION_SIGN_DIVISION_SLASH; + printops.multiplication_sign = MULTIPLICATION_SIGN_DOT; + printops.can_display_unicode_string_function = &can_display_unicode_string_function; + printops.allow_factorization = false; + printops.spell_out_logical_operators = true; + + evalops.parse_options.limit_implicit_multiplication = false; + evalops.approximation = APPROXIMATION_TRY_EXACT; + evalops.sync_units = true; + evalops.structuring = STRUCTURING_SIMPLIFY; + evalops.parse_options.unknowns_enabled = false; + evalops.parse_options.read_precision = DONT_READ_PRECISION; + evalops.parse_options.base = BASE_DECIMAL; + evalops.allow_complex = true; + evalops.allow_infinite = true; + evalops.auto_post_conversion = POST_CONVERSION_NONE; + evalops.assume_denominators_nonzero = true; + evalops.warn_about_denominators_assumed_nonzero = true; + evalops.parse_options.angle_unit = ANGLE_UNIT_RADIANS; + evalops.parse_options.dot_as_separator = KGlobal::locale()->thousandsSeparator() == "."; + + rpn_mode = false; + rpn_keypad_only = true; + + save_mode_as(i18n("Preset")); + save_mode_as(i18n("Default")); + size_t mode_index = 1; + + inhistory_current_id = 0; + + status_warning_color.setNamedColor("blue"); + status_error_color.setNamedColor("red"); + use_icon_buttons = 1; + enable_expression_completion = true; + enable_plot_expression_completion = true; + close_to_systray = false; + show_keypad = true; + show_history = false; + show_stack = true; + display_expression_status = true; + save_mode_on_exit = true; + save_defs_on_exit = true; + use_custom_result_font = false; + use_custom_expression_font = false; + use_custom_status_font = false; + custom_result_font = ""; + custom_expression_font = ""; + custom_status_font = ""; + load_global_defs = true; + fetch_exchange_rates_at_startup = false; + first_time = false; + string filename = getLocalDir(); + DIR *dir = opendir(filename.c_str()); + if(!dir) { + first_qalculate_run = true; + first_time = true; + set_saved_mode(); + return; + } else { + first_qalculate_run = false; + closedir(dir); + } + + int version_numbers[] = {0, 9, 6}; + FILE *file = NULL; + filename += "qalculate-kde.cfg"; + file = fopen(filename.c_str(), "r"); + if(file) { + char line[10000]; + QString stmp, svalue, svar; + int i; + int v; + while(true) { + if(fgets(line, 10000, file) == NULL) + break; + stmp = line; + stmp = stmp.stripWhiteSpace(); + if((i = stmp.find("=")) >= 0) { + svar = stmp; + svar.truncate(i); + svar = svar.stripWhiteSpace(); + svalue = stmp; + svalue.remove(0, i + 1); + svalue = svalue.stripWhiteSpace(); + v = svalue.toInt(); + if(svar == "version") { + parse_qalculate_version(svalue.ascii(), version_numbers); + } else if(svar == "shortcut") { + if(mode_index != 1) modes[mode_index].shortcut.init(svalue); + } else if(svar == "save_mode_on_exit") { + save_mode_on_exit = v; + } else if(svar == "save_definitions_on_exit") { + save_defs_on_exit = v; + } else if(svar == "fetch_exchange_rates_at_startup") { + fetch_exchange_rates_at_startup = v; + } else if(svar == "min_deci") { + if(mode_index == 1) printops.min_decimals = v; + else modes[mode_index].po.min_decimals = v; + } else if(svar == "use_min_deci") { + if(mode_index == 1) printops.use_min_decimals = v; + else modes[mode_index].po.use_min_decimals = v; + } else if(svar == "max_deci") { + if(mode_index == 1) printops.max_decimals = v; + else modes[mode_index].po.max_decimals = v; + } else if(svar == "use_max_deci") { + if(mode_index == 1) printops.use_max_decimals = v; + else modes[mode_index].po.use_max_decimals = v; + } else if(svar == "precision") { + if(mode_index == 1) CALCULATOR->setPrecision(v); + else modes[mode_index].precision = v; + } else if(svar == "min_exp") { + if(mode_index == 1) printops.min_exp = v; + else modes[mode_index].po.min_exp = v; + } else if(svar == "negative_exponents") { + if(mode_index == 1) printops.negative_exponents = v; + else modes[mode_index].po.negative_exponents = v; + } else if(svar == "sort_minus_last") { + if(mode_index == 1) printops.sort_options.minus_last = v; + else modes[mode_index].po.sort_options.minus_last = v; + } else if(svar == "place_units_separately") { + if(mode_index == 1) printops.place_units_separately = v; + else modes[mode_index].po.place_units_separately = v; + } else if(svar == "use_prefixes") { + if(mode_index == 1) printops.use_unit_prefixes = v; + else modes[mode_index].po.use_unit_prefixes = v; + } else if(svar == "number_fraction_format") { + if(v >= FRACTION_DECIMAL && v <= FRACTION_COMBINED) { + if(mode_index == 1) printops.number_fraction_format = (NumberFractionFormat) v; + else modes[mode_index].po.number_fraction_format = (NumberFractionFormat) v; + } + } else if(svar == "number_base") { + if(mode_index == 1) printops.base = v; + else modes[mode_index].po.base = v; + } else if(svar == "number_base_expression") { + if(mode_index == 1) evalops.parse_options.base = v; + else modes[mode_index].eo.parse_options.base = v; + } else if(svar == "read_precision") { + if(v >= DONT_READ_PRECISION && v <= READ_PRECISION_WHEN_DECIMALS) { + if(mode_index == 1) evalops.parse_options.read_precision = (ReadPrecisionMode) v; + else modes[mode_index].eo.parse_options.read_precision = (ReadPrecisionMode) v; + } + } else if(svar == "assume_denominators_nonzero") { + if(version_numbers[0] == 0 && (version_numbers[1] < 9 || (version_numbers[1] == 9 && version_numbers[2] == 0))) { + v = true; + } + if(mode_index == 1) evalops.assume_denominators_nonzero = v; + else modes[mode_index].eo.assume_denominators_nonzero = v; + } else if(svar == "warn_about_denominators_assumed_nonzero") { + if(mode_index == 1) evalops.warn_about_denominators_assumed_nonzero = v; + else modes[mode_index].eo.warn_about_denominators_assumed_nonzero = v; + } else if(svar == "structuring") { + if(v >= STRUCTURING_NONE && v <= STRUCTURING_FACTORIZE) { + if(mode_index == 1) { + evalops.structuring = (StructuringMode) v; + printops.allow_factorization = (evalops.structuring == STRUCTURING_FACTORIZE); + } else { + modes[mode_index].eo.structuring = (StructuringMode) v; + modes[mode_index].po.allow_factorization = (modes[mode_index].eo.structuring == STRUCTURING_FACTORIZE); + } + } + } else if(svar == "angle_unit") { + if(v >= ANGLE_UNIT_NONE && v <= ANGLE_UNIT_GRADIANS) { + if(mode_index == 1) evalops.parse_options.angle_unit = (AngleUnit) v; + else modes[mode_index].eo.parse_options.angle_unit = (AngleUnit) v; + } + } else if(svar == "functions_enabled") { + if(mode_index == 1) evalops.parse_options.functions_enabled = v; + else modes[mode_index].eo.parse_options.functions_enabled = v; + } else if(svar == "variables_enabled") { + if(mode_index == 1) evalops.parse_options.variables_enabled = v; + else modes[mode_index].eo.parse_options.variables_enabled = v; + } else if(svar == "calculate_variables") { + if(mode_index == 1) evalops.calculate_variables = v; + else modes[mode_index].eo.calculate_variables = v; + } else if(svar == "calculate_functions") { + if(mode_index == 1) evalops.calculate_functions = v; + else modes[mode_index].eo.calculate_functions = v; + } else if(svar == "sync_units") { + if(mode_index == 1) evalops.sync_units = v; + else modes[mode_index].eo.sync_units = v; + } else if(svar == "unknownvariables_enabled") { + if(mode_index == 1) evalops.parse_options.unknowns_enabled = v; + else modes[mode_index].eo.parse_options.unknowns_enabled = v; + } else if(svar == "units_enabled") { + if(mode_index == 1) evalops.parse_options.units_enabled = v; + else modes[mode_index].eo.parse_options.units_enabled = v; + } else if(svar == "allow_complex") { + if(mode_index == 1) evalops.allow_complex = v; + else modes[mode_index].eo.allow_complex = v; + } else if(svar == "allow_infinite") { + if(mode_index == 1) evalops.allow_infinite = v; + else modes[mode_index].eo.allow_infinite = v; + } else if(svar == "use_short_units") { + if(mode_index == 1) printops.abbreviate_names = v; + else modes[mode_index].po.abbreviate_names = v; + } else if(svar == "abbreviate_names") { + if(mode_index == 1) printops.abbreviate_names = v; + else modes[mode_index].po.abbreviate_names = v; + } else if(svar == "all_prefixes_enabled") { + if(mode_index == 1) printops.use_all_prefixes = v; + else modes[mode_index].po.use_all_prefixes = v; + } else if(svar == "denominator_prefix_enabled") { + if(mode_index == 1) printops.use_denominator_prefix = v; + else modes[mode_index].po.use_denominator_prefix = v; + } else if(svar == "auto_post_conversion") { + if(v >= POST_CONVERSION_NONE && v <= POST_CONVERSION_BASE) { + if(mode_index == 1) evalops.auto_post_conversion = (AutoPostConversion) v; + else modes[mode_index].eo.auto_post_conversion = (AutoPostConversion) v; + } + } else if(svar == "indicate_infinite_series") { + if(mode_index == 1) printops.indicate_infinite_series = v; + else modes[mode_index].po.indicate_infinite_series = v; + } else if(svar == "show_ending_zeroes") { + if(mode_index == 1) printops.show_ending_zeroes = v; + else modes[mode_index].po.show_ending_zeroes = v; + } else if(svar == "round_halfway_to_even") { + if(mode_index == 1) printops.round_halfway_to_even = v; + else modes[mode_index].po.round_halfway_to_even = v; + } else if(svar == "approximation") { + if(v >= APPROXIMATION_EXACT && v <= APPROXIMATION_APPROXIMATE) { + if(mode_index == 1) evalops.approximation = (ApproximationMode) v; + else modes[mode_index].eo.approximation = (ApproximationMode) v; + } + } else if(svar == "in_rpn_mode") { + if(mode_index == 1) rpn_mode = v; + else modes[mode_index].rpn_mode = v; + } else if(svar == "rpn_keypad_only") { + rpn_keypad_only = v; + } else if(svar == "rpn_syntax") { + if(mode_index == 1) evalops.parse_options.rpn = v; + else modes[mode_index].eo.parse_options.rpn = v; + } else if(svar == "limit_implicit_multiplication") { + if(mode_index == 1) { + evalops.parse_options.limit_implicit_multiplication = v; + printops.limit_implicit_multiplication = v; + } else { + modes[mode_index].eo.parse_options.limit_implicit_multiplication = v; + modes[mode_index].po.limit_implicit_multiplication = v; + } + } else if(svar == "default_assumption_type") { + if(v >= ASSUMPTION_TYPE_NONE && v <= ASSUMPTION_TYPE_INTEGER) { + if(v == ASSUMPTION_TYPE_NONE && version_numbers[0] == 0 && (version_numbers[1] < 9 || (version_numbers[1] == 9 && version_numbers[2] == 0))) { + v = ASSUMPTION_TYPE_NONMATRIX; + } + if(mode_index == 1) CALCULATOR->defaultAssumptions()->setType((AssumptionType) v); + else modes[mode_index].at = (AssumptionType) v; + } + } else if(svar == "default_assumption_sign") { + if(v >= ASSUMPTION_SIGN_UNKNOWN && v <= ASSUMPTION_SIGN_NONZERO) { + if(v == ASSUMPTION_SIGN_NONZERO && version_numbers[0] == 0 && (version_numbers[1] < 9 || (version_numbers[1] == 9 && version_numbers[2] == 0))) { + v = ASSUMPTION_SIGN_UNKNOWN; + } + if(mode_index == 1) CALCULATOR->defaultAssumptions()->setSign((AssumptionSign) v); + else modes[mode_index].as = (AssumptionSign) v; + } + } else if(svar == "spacious") { + if(mode_index == 1) printops.spacious = v; + else modes[mode_index].po.spacious = v; + } else if(svar == "excessive_parenthesis") { + if(mode_index == 1) printops.excessive_parenthesis = v; + else modes[mode_index].po.excessive_parenthesis = v; + } else if(svar == "short_multiplication") { + if(mode_index == 1) printops.short_multiplication = v; + else modes[mode_index].po.short_multiplication = v; + } else if(svar == "use_unicode_signs") { + printops.use_unicode_signs = v; + } else if(svar == "lower_case_numbers") { + printops.lower_case_numbers = v; + } else if(svar == "lower_case_e") { + printops.lower_case_e = v; + } else if(svar == "base_display") { + if(v >= BASE_DISPLAY_NONE && v <= BASE_DISPLAY_ALTERNATIVE) printops.base_display = (BaseDisplay) v; + } else if(svar == "spell_out_logical_operators") { + printops.spell_out_logical_operators = v; + } else if(svar == "dot_as_separator") { + evalops.parse_options.dot_as_separator = v; + } else if(svar == "use_custom_result_font") { + use_custom_result_font = v; + } else if(svar == "use_custom_expression_font") { + use_custom_expression_font = v; + } else if(svar == "use_custom_status_font") { + use_custom_status_font = v; + } else if(svar == "custom_result_font") { + custom_result_font = svalue; + } else if(svar == "custom_expression_font") { + custom_expression_font = svalue; + } else if(svar == "custom_status_font") { + custom_status_font = svalue; + } else if(svar == "status_error_color") { + status_error_color.setNamedColor(svalue); + } else if(svar == "status_warning_color") { + status_warning_color.setNamedColor(svalue); + } else if(svar == "multiplication_sign") { + if(v >= MULTIPLICATION_SIGN_ASTERISK && v <= MULTIPLICATION_SIGN_X) printops.multiplication_sign = (MultiplicationSign) v; + } else if(svar == "division_sign") { + if(v >= DIVISION_SIGN_SLASH && v <= DIVISION_SIGN_DIVISION) printops.division_sign = (DivisionSign) v; + } else if(svar == "close_to_system_tray") { + close_to_systray = v; + } else if(svar == "show_keypad") { + show_keypad = v; + } else if(svar == "show_history") { + show_history = v; + } else if(svar == "show_stack") { + show_stack = v; + } else if(svar == "display_expression_status") { + display_expression_status = v; + } else if(svar == "enable_expression_completion") { + enable_expression_completion = v; + } else if(svar == "use_icon_buttons") { + use_icon_buttons = v; + } else if(svar == "plot_legend_placement") { + if(v >= PLOT_LEGEND_NONE && v <= PLOT_LEGEND_OUTSIDE) default_plot_legend_placement = (PlotLegendPlacement) v; + } else if(svar == "plot_style") { + if(v >= PLOT_STYLE_LINES && v <= PLOT_STYLE_DOTS) default_plot_style = (PlotStyle) v; + } else if(svar == "plot_smoothing") { + if(v >= PLOT_SMOOTHING_NONE && v <= PLOT_SMOOTHING_SBEZIER) default_plot_smoothing = (PlotSmoothing) v; + } else if(svar == "plot_display_grid") { + default_plot_display_grid = v; + } else if(svar == "plot_full_border") { + default_plot_full_border = v; + } else if(svar == "plot_min") { + default_plot_min = svalue; + } else if(svar == "plot_max") { + default_plot_max = svalue; + } else if(svar == "plot_step") { + default_plot_step = svalue; + } else if(svar == "plot_sampling_rate") { + default_plot_sampling_rate = v; + } else if(svar == "plot_use_sampling_rate") { + default_plot_use_sampling_rate = v; + } else if(svar == "plot_variable") { + default_plot_variable = svalue; + } else if(svar == "plot_rows") { + default_plot_rows = v; + } else if(svar == "plot_type") { + default_plot_type = v; + } else if(svar == "plot_color") { + default_plot_color = v; + } else if(svar == "enable_plot_expression_completion") { + enable_plot_expression_completion = v; + } else if(svar == "expression_history") { + expression_history.push_back(svalue); + } else if(svar == "history") { + initial_history = svalue; + if(version_numbers[1] < 9) { + initial_history.replace("

", "

"); + } + inhistory.push_back(initial_history); + inhistory_type.push_back(QALCULATE_HISTORY_OLD); + } else if(svar == "history_old") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_OLD); + } else if(svar == "history_expression") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_EXPRESSION); + } else if(svar == "history_transformation") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_TRANSFORMATION); + } else if(svar == "history_result") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_RESULT); + } else if(svar == "history_result_approximate") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_RESULT_APPROXIMATE); + } else if(svar == "history_parse") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_PARSE); + } else if(svar == "history_parse_approximate") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_PARSE_APPROXIMATE); + } else if(svar == "history_register_moved") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_REGISTER_MOVED); + } else if(svar == "history_warning") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_WARNING); + } else if(svar == "history_error") { + inhistory.push_back(svalue); + inhistory_type.push_back(QALCULATE_HISTORY_ERROR); + } else if(svar == "history_continued") { + if(inhistory.size() > 0) { + inhistory[inhistory.size() - 1] += "
"; + inhistory[inhistory.size() - 1] += svalue; + } + } else if(svar == "recent_functions") { + int v_i = 0; + while(true) { + v_i = svalue.find(','); + if(v_i < 0) { + svar = svalue.stripWhiteSpace(); + if(!svar.isEmpty()) { + recent_functions_pre.push_back(svar); + } + break; + } else { + svar = svalue; + svar.truncate(v_i); + svalue.remove(0, v_i + 1); + svar = svar.stripWhiteSpace(); + if(!svar.isEmpty()) { + recent_functions_pre.push_back(svar); + } + } + } + } else if(svar == "recent_variables") { + int v_i = 0; + while(true) { + v_i = svalue.find(','); + if(v_i < 0) { + svar = svalue.stripWhiteSpace(); + if(!svar.isEmpty()) { + recent_variables_pre.push_back(svar); + } + break; + } else { + svar = svalue; + svar.truncate(v_i); + svalue.remove(0, v_i + 1); + svar = svar.stripWhiteSpace(); + if(!svar.isEmpty()) { + recent_variables_pre.push_back(svar); + } + } + } + } else if(svar == "recent_units") { + int v_i = 0; + while(true) { + v_i = svalue.find(','); + if(v_i < 0) { + svar = svalue.stripWhiteSpace(); + if(!svar.isEmpty()) { + recent_units_pre.push_back(svar); + } + break; + } else { + svar = svalue; + svar.truncate(v_i); + svalue.remove(0, v_i + 1); + svar = svar.stripWhiteSpace(); + if(!svar.isEmpty()) { + recent_units_pre.push_back(svar); + } + } + } + } + } else if(stmp.length() > 2 && stmp[0] == '[' && stmp[stmp.length() - 1] == ']') { + stmp.truncate(stmp.length() - 1); + stmp.remove(0, 1); + stmp = stmp.stripWhiteSpace(); + if(stmp == "Mode") { + mode_index = 1; + } else if(stmp.length() > 5) { + QString svar = stmp; + svar.truncate(4); + if(svar == "Mode") { + stmp.remove(0, 5); + mode_index = save_mode_as(stmp); + } + } + } + } + inhistory_current_id = (int) inhistory.size(); + int id = inhistory_current_id; + id--; + for(QValueVector::size_type i = 0; i < inhistory.size(); i++) { + inhistory_id.push_back(id); + id--; + } + } else { + first_time = true; + } + if(show_keypad) show_history = false; + //remember start mode for when we save preferences + set_saved_mode(); + +} + +void save_preferences(bool mode) { + + FILE *file = NULL; + string filename = getLocalDir(); + mkdir(filename.c_str(), S_IRWXU); + filename += "qalculate-kde.cfg"; + file = fopen(filename.c_str(), "w+"); + if(file == NULL) { + fprintf(stderr, i18n("Couldn't write preferences to\n%s"), filename.c_str()); + return; + } + fprintf(file, "\n[General]\n"); + fprintf(file, "version=%s\n", VERSION); + fprintf(file, "save_mode_on_exit=%i\n", save_mode_on_exit); + fprintf(file, "save_definitions_on_exit=%i\n", save_defs_on_exit); + fprintf(file, "load_global_definitions=%i\n", load_global_defs); + fprintf(file, "fetch_exchange_rates_at_startup=%i\n", fetch_exchange_rates_at_startup); + fprintf(file, "close_to_system_tray=%i\n", close_to_systray); + fprintf(file, "show_keypad=%i\n", mainWin->keypadButton->isOn() || (rpn_mode && show_keypad && mainWin->stackButton->isOn())); + fprintf(file, "show_history=%i\n", mainWin->historyButton->isOn() || (rpn_mode && show_history && mainWin->stackButton->isOn())); + fprintf(file, "show_stack=%i\n", rpn_mode ? mainWin->stackButton->isOn() : show_stack); + fprintf(file, "rpn_keypad_only=%i\n", rpn_keypad_only); + fprintf(file, "display_expression_status=%i\n", display_expression_status); + fprintf(file, "enable_expression_completion=%i\n", ((QalculateExpressionEdit*) expressionWidget)->completionEnabled()); + if(use_icon_buttons >= 0) fprintf(file, "use_icon_buttons=%i\n", use_icon_buttons); + fprintf(file, "use_unicode_signs=%i\n", printops.use_unicode_signs); + fprintf(file, "lower_case_numbers=%i\n", printops.lower_case_numbers); + fprintf(file, "lower_case_e=%i\n", printops.lower_case_e); + fprintf(file, "base_display=%i\n", printops.base_display); + fprintf(file, "spell_out_logical_operators=%i\n", printops.spell_out_logical_operators); + fprintf(file, "dot_as_separator=%i\n", evalops.parse_options.dot_as_separator); + fprintf(file, "use_custom_result_font=%i\n", use_custom_result_font); + fprintf(file, "use_custom_expression_font=%i\n", use_custom_expression_font); + fprintf(file, "use_custom_status_font=%i\n", use_custom_status_font); + fprintf(file, "custom_result_font=%s\n", custom_result_font.ascii()); + fprintf(file, "custom_expression_font=%s\n", custom_expression_font.ascii()); + fprintf(file, "custom_status_font=%s\n", custom_status_font.ascii()); + if(status_error_color != QColor("red")) fprintf(file, "status_error_color=%s\n", status_error_color.name().ascii()); + if(status_warning_color != QColor("blue")) fprintf(file, "status_warning_color=%s\n", status_warning_color.name().ascii()); + fprintf(file, "multiplication_sign=%i\n", printops.multiplication_sign); + fprintf(file, "division_sign=%i\n", printops.division_sign); + for (QStringList::Iterator it = ((QalculateExpressionEdit*) expressionWidget)->expression_history.begin(); it != ((QalculateExpressionEdit*) expressionWidget)->expression_history.end(); ++it) { + fprintf(file, "expression_history=%s\n", (*it).ascii()); + } + int lines = 50; + bool end_after_result = false; + bool doend = false; + for(QValueVector::size_type i = 0; i < inhistory.size() && !doend; i++) { + switch(inhistory_type[i]) { + case QALCULATE_HISTORY_EXPRESSION: { + fprintf(file, "history_expression="); + break; + } + case QALCULATE_HISTORY_TRANSFORMATION: { + fprintf(file, "history_transformation="); + break; + } + case QALCULATE_HISTORY_RESULT: { + fprintf(file, "history_result="); + lines--; + if(end_after_result) doend = true; + break; + } + case QALCULATE_HISTORY_RESULT_APPROXIMATE: { + fprintf(file, "history_result_approximate="); + lines--; + if(end_after_result) doend = true; + break; + } + case QALCULATE_HISTORY_PARSE: { + fprintf(file, "history_parse="); + lines--; + if(lines < 0) end_after_result = true; + break; + } + case QALCULATE_HISTORY_PARSE_APPROXIMATE: { + fprintf(file, "history_parse_approximate="); + lines--; + if(lines < 0) end_after_result = true; + break; + } + case QALCULATE_HISTORY_REGISTER_MOVED: { + fprintf(file, "history_register_moved="); + break; + } + case QALCULATE_HISTORY_WARNING: { + fprintf(file, "history_warning="); + lines--; + break; + } + case QALCULATE_HISTORY_ERROR: { + fprintf(file, "history_error="); + lines--; + break; + } + case QALCULATE_HISTORY_OLD: { + fprintf(file, "history_old="); + lines--; + if(lines < 0) doend = true; + break; + } + } + if(inhistory[i].find("
") < 0) { + fprintf(file, "%s\n", inhistory[i].ascii()); + } else { + QStringList slist = QStringList::split("
", inhistory[i], true); + for(QStringList::size_type i2 = 0; i2 < slist.size(); i2++) { + if(i2 == 0) fprintf(file, "%s\n", slist[i2].ascii()); + else fprintf(file, "history_continued=%s\n", slist[i2].ascii()); + } + } + } + fprintf(file, "recent_functions="); + for(int i = (int) (recent_functions.size()) - 1; i >= 0; i--) { + fprintf(file, "%s", recent_functions[i]->referenceName().c_str()); + if(i != 0) fprintf(file, ","); + } + fprintf(file, "\n"); + fprintf(file, "recent_variables="); + for(int i = (int) (recent_variables.size()) - 1; i >= 0; i--) { + fprintf(file, "%s", recent_variables[i]->referenceName().c_str()); + if(i != 0) fprintf(file, ","); + } + fprintf(file, "\n"); + fprintf(file, "recent_units="); + for(int i = (int) (recent_units.size()) - 1; i >= 0; i--) { + fprintf(file, "%s", recent_units[i]->referenceName().c_str()); + if(i != 0) fprintf(file, ","); + } + fprintf(file, "\n"); + if(mode) + set_saved_mode(); + for(size_t i = 1; i < modes.size(); i++) { + if(i == 1) { + fprintf(file, "\n[Mode]\n"); + } else { + fprintf(file, "\n[Mode %s]\n", modes[i].name.ascii()); + if(!modes[i].shortcut.toString().isNull()) fprintf(file, "shortcut=%s\n", modes[i].shortcut.toString().ascii()); + } + fprintf(file, "min_deci=%i\n", modes[i].po.min_decimals); + fprintf(file, "use_min_deci=%i\n", modes[i].po.use_min_decimals); + fprintf(file, "max_deci=%i\n", modes[i].po.max_decimals); + fprintf(file, "use_max_deci=%i\n", modes[i].po.use_max_decimals); + fprintf(file, "precision=%i\n", modes[i].precision); + fprintf(file, "min_exp=%i\n", modes[i].po.min_exp); + fprintf(file, "negative_exponents=%i\n", modes[i].po.negative_exponents); + fprintf(file, "sort_minus_last=%i\n", modes[i].po.sort_options.minus_last); + fprintf(file, "number_fraction_format=%i\n", modes[i].po.number_fraction_format); + fprintf(file, "use_prefixes=%i\n", modes[i].po.use_unit_prefixes); + fprintf(file, "abbreviate_names=%i\n", modes[i].po.abbreviate_names); + fprintf(file, "all_prefixes_enabled=%i\n", modes[i].po.use_all_prefixes); + fprintf(file, "denominator_prefix_enabled=%i\n", modes[i].po.use_denominator_prefix); + fprintf(file, "place_units_separately=%i\n", modes[i].po.place_units_separately); + fprintf(file, "auto_post_conversion=%i\n", modes[i].eo.auto_post_conversion); + fprintf(file, "number_base=%i\n", modes[i].po.base); + fprintf(file, "number_base_expression=%i\n", modes[i].eo.parse_options.base); + fprintf(file, "read_precision=%i\n", modes[i].eo.parse_options.read_precision); + fprintf(file, "assume_denominators_nonzero=%i\n", modes[i].eo.assume_denominators_nonzero); + fprintf(file, "warn_about_denominators_assumed_nonzero=%i\n", modes[i].eo.warn_about_denominators_assumed_nonzero); + fprintf(file, "structuring=%i\n", modes[i].eo.structuring); + fprintf(file, "angle_unit=%i\n", modes[i].eo.parse_options.angle_unit); + fprintf(file, "functions_enabled=%i\n", modes[i].eo.parse_options.functions_enabled); + fprintf(file, "variables_enabled=%i\n", modes[i].eo.parse_options.variables_enabled); + fprintf(file, "calculate_functions=%i\n", modes[i].eo.calculate_functions); + fprintf(file, "calculate_variables=%i\n", modes[i].eo.calculate_variables); + fprintf(file, "sync_units=%i\n", modes[i].eo.sync_units); + fprintf(file, "unknownvariables_enabled=%i\n", modes[i].eo.parse_options.unknowns_enabled); + fprintf(file, "units_enabled=%i\n", modes[i].eo.parse_options.units_enabled); + fprintf(file, "allow_complex=%i\n", modes[i].eo.allow_complex); + fprintf(file, "allow_infinite=%i\n", modes[i].eo.allow_infinite); + fprintf(file, "indicate_infinite_series=%i\n", modes[i].po.indicate_infinite_series); + fprintf(file, "show_ending_zeroes=%i\n", modes[i].po.show_ending_zeroes); + fprintf(file, "round_halfway_to_even=%i\n", modes[i].po.round_halfway_to_even); + fprintf(file, "approximation=%i\n", modes[i].eo.approximation); + fprintf(file, "in_rpn_mode=%i\n", modes[i].rpn_mode); + fprintf(file, "rpn_syntax=%i\n", modes[i].eo.parse_options.rpn); + fprintf(file, "limit_implicit_multiplication=%i\n", modes[i].eo.parse_options.limit_implicit_multiplication); + fprintf(file, "spacious=%i\n", modes[i].po.spacious); + fprintf(file, "excessive_parenthesis=%i\n", modes[i].po.excessive_parenthesis); + fprintf(file, "short_multiplication=%i\n", modes[i].po.short_multiplication); + fprintf(file, "default_assumption_type=%i\n", modes[i].at); + fprintf(file, "default_assumption_sign=%i\n", modes[i].as); + } + + fprintf(file, "\n[Plotting]\n"); + fprintf(file, "plot_legend_placement=%i\n", default_plot_legend_placement); + fprintf(file, "plot_style=%i\n", default_plot_style); + fprintf(file, "plot_smoothing=%i\n", default_plot_smoothing); + fprintf(file, "plot_display_grid=%i\n", default_plot_display_grid); + fprintf(file, "plot_full_border=%i\n", default_plot_full_border); + fprintf(file, "plot_min=%s\n", default_plot_min.ascii()); + fprintf(file, "plot_max=%s\n", default_plot_max.ascii()); + fprintf(file, "plot_step=%s\n", default_plot_step.ascii()); + fprintf(file, "plot_sampling_rate=%i\n", default_plot_sampling_rate); + fprintf(file, "plot_use_sampling_rate=%i\n", default_plot_use_sampling_rate); + fprintf(file, "plot_variable=%s\n", default_plot_variable.ascii()); + fprintf(file, "plot_rows=%i\n", default_plot_rows); + fprintf(file, "plot_type=%i\n", default_plot_type); + fprintf(file, "plot_color=%i\n", default_plot_color); + fprintf(file, "enable_plot_expression_completion=%i\n", enable_plot_expression_completion); + + + fclose(file); + +} diff --git a/src/preferences.h b/src/preferences.h new file mode 100644 index 0000000..9547989 --- /dev/null +++ b/src/preferences.h @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ + +#ifndef PREFERENCES_H +#define PREFERENCES_H + +enum { + QALCULATE_HISTORY_EXPRESSION, + QALCULATE_HISTORY_TRANSFORMATION, + QALCULATE_HISTORY_RESULT, + QALCULATE_HISTORY_RESULT_APPROXIMATE, + QALCULATE_HISTORY_PARSE, + QALCULATE_HISTORY_PARSE_APPROXIMATE, + QALCULATE_HISTORY_WARNING, + QALCULATE_HISTORY_ERROR, + QALCULATE_HISTORY_OLD, + QALCULATE_HISTORY_REGISTER_MOVED +}; + +void save_mode(); + +void load_preferences(); +void save_preferences(bool mode = false); + +#endif diff --git a/src/qalculate_kde.desktop b/src/qalculate_kde.desktop new file mode 100644 index 0000000..c01c30b --- /dev/null +++ b/src/qalculate_kde.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Name=Qalculate! +GenericName=Scientific Calculator +Exec=qalculate-kde +Icon=qalculate_kde +Type=Application +DocPath=qalculate_kde/index.html +Categories=Qt;KDE;Utility;Science; +Terminal=false +X-DCOP-ServiceType=Unique +X-DCOP-ServiceName=qalculate_kde +X-KDE-StartupNotify=true +Comment=Powerful and easy to use desktop calculator diff --git a/src/qalculate_kde_utils.cpp b/src/qalculate_kde_utils.cpp new file mode 100644 index 0000000..5bcb8c5 --- /dev/null +++ b/src/qalculate_kde_utils.cpp @@ -0,0 +1,307 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ + +#include "qalculate_kde_utils.h" +#include +#include +#include +#include +#include +#include +#include "kqalculate.h" + +tree_struct function_cats, unit_cats, variable_cats; +vector ia_units, ia_variables, ia_functions; +vector recent_functions; +vector recent_variables; +vector recent_units; +extern PrintOptions printops; +extern KnownVariable *vans[5]; +extern QWidget *topWidget; +extern KQalculate *mainWin; + +void insert_text_in_expression(const QString &str) { + mainWin->insert_text(str); +} + +bool is_answer_variable(Variable *v) { + return v == vans[0] || v == vans[1] || v == vans[2] || v == vans[3] || v == vans[4]; +} + +QString get_value_string(const MathStructure &mstruct_, bool rlabel, Prefix *prefix) { + printops.allow_non_usable = rlabel; + printops.prefix = prefix; + QString str = CALCULATOR->printMathStructureTimeOut(mstruct_, 100, printops).c_str(); + printops.allow_non_usable = false; + printops.prefix = NULL; + return str; +} + +void set_name_label_and_entry(ExpressionItem *item, QLineEdit *entry, QLabel *label) { + const ExpressionName *ename = &item->getName(1); + entry->setText(ename->name.c_str()); + if(item->countNames() > 1) { + QString str = "+ "; + for(size_t i = 2; i <= item->countNames(); i++) { + if(i > 2) str += ", "; + str += item->getName(i).name.c_str(); + } + label->setText(str); + } +} + +bool can_display_unicode_string_function(const char *str, void *arg) { + if(!arg) arg = (void*) topWidget; + QFontMetrics fm(((QWidget*) arg)->fontMetrics()); + QString qstr(str); + const QChar *qchars = qstr.unicode(); + for(uint i = 0; i < qstr.length(); i++) { + if(!fm.inFont(qchars[i])) return false; + } + return true; +} + +void generate_units_tree_struct() { + size_t cat_i, cat_i_prev; + bool b; + string str, cat, cat_sub; + Unit *u = NULL; + unit_cats.items.clear(); + unit_cats.objects.clear(); + unit_cats.parent = NULL; + ia_units.clear(); + list::iterator it; + for(size_t i = 0; i < CALCULATOR->units.size(); i++) { + if(!CALCULATOR->units[i]->isActive()) { + b = false; + for(size_t i3 = 0; i3 < ia_units.size(); i3++) { + u = (Unit*) ia_units[i3]; + if(CALCULATOR->units[i]->title() < u->title()) { + b = true; + ia_units.insert(ia_units.begin() + i3, (void*) CALCULATOR->units[i]); + break; + } + } + if(!b) ia_units.push_back((void*) CALCULATOR->units[i]); + } else { + tree_struct *item = &unit_cats; + if(!CALCULATOR->units[i]->category().empty()) { + cat = CALCULATOR->units[i]->category(); + cat_i = cat.find("/"); cat_i_prev = 0; + b = false; + while(true) { + if(cat_i == string::npos) { + cat_sub = cat.substr(cat_i_prev, cat.length() - cat_i_prev); + } else { + cat_sub = cat.substr(cat_i_prev, cat_i - cat_i_prev); + } + b = false; + for(it = item->items.begin(); it != item->items.end(); ++it) { + if(cat_sub == it->item) { + item = &*it; + b = true; + break; + } + } + if(!b) { + tree_struct cat; + item->items.push_back(cat); + it = item->items.end(); + --it; + it->parent = item; + item = &*it; + item->item = cat_sub; + } + if(cat_i == string::npos) { + break; + } + cat_i_prev = cat_i + 1; + cat_i = cat.find("/", cat_i_prev); + } + } + b = false; + for(size_t i3 = 0; i3 < item->objects.size(); i3++) { + u = (Unit*) item->objects[i3]; + if(CALCULATOR->units[i]->title() < u->title()) { + b = true; + item->objects.insert(item->objects.begin() + i3, (void*) CALCULATOR->units[i]); + break; + } + } + if(!b) item->objects.push_back((void*) CALCULATOR->units[i]); + } + } + + unit_cats.sort(); + +} +void generate_variables_tree_struct() { + + size_t cat_i, cat_i_prev; + bool b; + string str, cat, cat_sub; + Variable *v = NULL; + variable_cats.items.clear(); + variable_cats.objects.clear(); + variable_cats.parent = NULL; + ia_variables.clear(); + list::iterator it; + for(size_t i = 0; i < CALCULATOR->variables.size(); i++) { + if(!CALCULATOR->variables[i]->isActive()) { + //deactivated variable + b = false; + for(size_t i3 = 0; i3 < ia_variables.size(); i3++) { + v = (Variable*) ia_variables[i3]; + if(CALCULATOR->variables[i]->title() < v->title()) { + b = true; + ia_variables.insert(ia_variables.begin() + i3, (void*) CALCULATOR->variables[i]); + break; + } + } + if(!b) ia_variables.push_back((void*) CALCULATOR->variables[i]); + } else { + tree_struct *item = &variable_cats; + if(!CALCULATOR->variables[i]->category().empty()) { + cat = CALCULATOR->variables[i]->category(); + cat_i = cat.find("/"); cat_i_prev = 0; + b = false; + while(true) { + if(cat_i == string::npos) { + cat_sub = cat.substr(cat_i_prev, cat.length() - cat_i_prev); + } else { + cat_sub = cat.substr(cat_i_prev, cat_i - cat_i_prev); + } + b = false; + for(it = item->items.begin(); it != item->items.end(); ++it) { + if(cat_sub == it->item) { + item = &*it; + b = true; + break; + } + } + if(!b) { + tree_struct cat; + item->items.push_back(cat); + it = item->items.end(); + --it; + it->parent = item; + item = &*it; + item->item = cat_sub; + } + if(cat_i == string::npos) { + break; + } + cat_i_prev = cat_i + 1; + cat_i = cat.find("/", cat_i_prev); + } + } + b = false; + for(size_t i3 = 0; i3 < item->objects.size(); i3++) { + v = (Variable*) item->objects[i3]; + if(CALCULATOR->variables[i]->title() < v->title()) { + b = true; + item->objects.insert(item->objects.begin() + i3, (void*) CALCULATOR->variables[i]); + break; + } + } + if(!b) item->objects.push_back((void*) CALCULATOR->variables[i]); + } + } + + variable_cats.sort(); + +} +void generate_functions_tree_struct() { + + size_t cat_i, cat_i_prev; + bool b; + string str, cat, cat_sub; + MathFunction *f = NULL; + function_cats.items.clear(); + function_cats.objects.clear(); + function_cats.parent = NULL; + ia_functions.clear(); + list::iterator it; + + for(size_t i = 0; i < CALCULATOR->functions.size(); i++) { + if(!CALCULATOR->functions[i]->isActive()) { + //deactivated function + b = false; + for(size_t i3 = 0; i3 < ia_functions.size(); i3++) { + f = (MathFunction*) ia_functions[i3]; + if(CALCULATOR->functions[i]->title() < f->title()) { + b = true; + ia_functions.insert(ia_functions.begin() + i3, (void*) CALCULATOR->functions[i]); + break; + } + } + if(!b) ia_functions.push_back((void*) CALCULATOR->functions[i]); + } else { + tree_struct *item = &function_cats; + if(!CALCULATOR->functions[i]->category().empty()) { + cat = CALCULATOR->functions[i]->category(); + cat_i = cat.find("/"); cat_i_prev = 0; + b = false; + while(true) { + if(cat_i == string::npos) { + cat_sub = cat.substr(cat_i_prev, cat.length() - cat_i_prev); + } else { + cat_sub = cat.substr(cat_i_prev, cat_i - cat_i_prev); + } + b = false; + for(it = item->items.begin(); it != item->items.end(); ++it) { + if(cat_sub == it->item) { + item = &*it; + b = true; + break; + } + } + if(!b) { + tree_struct cat; + item->items.push_back(cat); + it = item->items.end(); + --it; + it->parent = item; + item = &*it; + item->item = cat_sub; + } + if(cat_i == string::npos) { + break; + } + cat_i_prev = cat_i + 1; + cat_i = cat.find("/", cat_i_prev); + } + } + b = false; + for(size_t i3 = 0; i3 < item->objects.size(); i3++) { + f = (MathFunction*) item->objects[i3]; + if(CALCULATOR->functions[i]->title() < f->title()) { + b = true; + item->objects.insert(item->objects.begin() + i3, (void*) CALCULATOR->functions[i]); + break; + } + } + if(!b) item->objects.push_back((void*) CALCULATOR->functions[i]); + } + } + + function_cats.sort(); + +} diff --git a/src/qalculate_kde_utils.h b/src/qalculate_kde_utils.h new file mode 100644 index 0000000..2632739 --- /dev/null +++ b/src/qalculate_kde_utils.h @@ -0,0 +1,74 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ + +#ifndef QALCULATE_KDE_UTILS_H +#define QALCULATE_KDE_UTILS_H + +#include +#undef insertItem +#undef addItem +#undef setItem +#undef getItem + +#include +#include + +class QLabel; +class QLineEdit; + +struct tree_struct { + string item; + list items; + list::iterator it; + list::reverse_iterator rit; + vector objects; + tree_struct *parent; + void sort() { + items.sort(); + for(list::iterator it = items.begin(); it != items.end(); ++it) { + it->sort(); + } + } + bool operator < (tree_struct &s1) const { + return item < s1.item; + } +}; +struct mode_struct { + PrintOptions po; + EvaluationOptions eo; + AssumptionType at; + AssumptionSign as; + int precision; + QString name; + bool rpn_mode; + KShortcut shortcut; +}; + +void insert_text_in_expression(const QString &str); +bool is_answer_variable(Variable *v); +QString get_value_string(const MathStructure &mstruct_, bool rlabel = false, Prefix *prefix = NULL); +void set_name_label_and_entry(ExpressionItem *item, QLineEdit *entry, QLabel *label); +bool can_display_unicode_string_function(const char *str, void *arg); +void generate_units_tree_struct(); +void generate_functions_tree_struct(); +void generate_variables_tree_struct(); +size_t save_mode_as(QString name, bool *new_mode = NULL); + +#endif diff --git a/src/qalculate_kdeui.rc b/src/qalculate_kdeui.rc new file mode 100644 index 0000000..eae44d9 --- /dev/null +++ b/src/qalculate_kdeui.rc @@ -0,0 +1,168 @@ + + + + &File + &New + + + + + + + + + + + + + + + + + + + + + + + &Edit + + + + + + + + + &Set Prefix + + &Convert To Unit + + + + + + + + + + + + + + + &Mode + Number Base + + + + + + + + + + + + Numerical Display + + + + + + + + + + + + + Fractional Display + + + + + + Unit Display + + + + + + + + + + Angle Unit + + + + + + + + Enabled Objects + + + + + + + + + + + + Approximation + + + + + Assumptions + + + + + + + + + + + + + + + + Algebraic Mode + + + + + + + + + + + + + + + + + Meta Modes + + + + + + + Fu&nctions + + &Variables + + &Units + + + \ No newline at end of file diff --git a/src/qalculatebuttonwithdata.cpp b/src/qalculatebuttonwithdata.cpp new file mode 100644 index 0000000..0b4ced7 --- /dev/null +++ b/src/qalculatebuttonwithdata.cpp @@ -0,0 +1,37 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculatebuttonwithdata.h" + +QalculateButtonWithData::QalculateButtonWithData(void *data, const QString & text, QWidget *parent, const char *name) : QPushButton(text, parent, name) { + user_data = data; + QObject::connect(this, SIGNAL(clicked()), this, SLOT(emitClickedWithData())); +} +QalculateButtonWithData::QalculateButtonWithData(void *data, const QIconSet & icon, const QString & text, QWidget * parent, const char * name) : QPushButton(icon, text, parent, name) { + user_data = data; + QObject::connect(this, SIGNAL(clicked()), this, SLOT(emitClickedWithData())); +} +QalculateButtonWithData::~QalculateButtonWithData() {} +void QalculateButtonWithData::emitClickedWithData() { + emit clickedWithData(user_data); +} + + + +#include "qalculatebuttonwithdata.moc" diff --git a/src/qalculatebuttonwithdata.h b/src/qalculatebuttonwithdata.h new file mode 100644 index 0000000..b3281a3 --- /dev/null +++ b/src/qalculatebuttonwithdata.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEBUTTONWITHDATA_H +#define QALCULATEBUTTONWITHDATA_H + +#include + +/** +@author Niklas Knutsson +*/ +class QalculateButtonWithData : public QPushButton { + Q_OBJECT + +public: + + QalculateButtonWithData(void *data, const QString & text, QWidget *parent, const char *name = 0); + QalculateButtonWithData(void *data, const QIconSet & icon, const QString & text, QWidget * parent, const char * name = 0); + virtual ~QalculateButtonWithData(); + void *user_data; + +protected slots: + + void emitClickedWithData(); + +signals: + + void clickedWithData(void*); + +}; + +#endif diff --git a/src/qalculateconvertnumberbasesdialog.cpp b/src/qalculateconvertnumberbasesdialog.cpp new file mode 100644 index 0000000..79585c1 --- /dev/null +++ b/src/qalculateconvertnumberbasesdialog.cpp @@ -0,0 +1,122 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateconvertnumberbasesdialog.h" +#include "qalculate_kde_utils.h" +#include +#include +#include +#include +#include + +extern EvaluationOptions evalops; + +QalculateConvertNumberBasesDialog::QalculateConvertNumberBasesDialog(QWidget *parent, const char *name) + : KDialogBase(parent, name, false, i18n("Number Bases"), Close, Close) { + + actionButton(Close)->setAutoDefault(false); + actionButton(Close)->setDefault(false); + + QGrid *grid = makeGridMainWidget(2, Qt::Horizontal); + new QLabel(i18n("Decimal:"), grid); + decimalEdit = new KLineEdit(grid); + decimalEdit->setAlignment(Qt::AlignRight); + QObject::connect(decimalEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setDecimalValue(const QString&))); + new QLabel(i18n("Binary:"), grid); + binaryEdit = new KLineEdit(grid); + binaryEdit->setAlignment(Qt::AlignRight); + QObject::connect(binaryEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setBinaryValue(const QString&))); + new QLabel(i18n("Octal:"), grid); + octalEdit = new KLineEdit(grid); + octalEdit->setAlignment(Qt::AlignRight); + QObject::connect(octalEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setOctalValue(const QString&))); + new QLabel(i18n("Hexadecimal:"), grid); + hexadecimalEdit = new KLineEdit(grid); + hexadecimalEdit->setAlignment(Qt::AlignRight); + QObject::connect(hexadecimalEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setHexadecimalValue(const QString&))); + + decimalEdit->setFocus(); + +} + + +QalculateConvertNumberBasesDialog::~QalculateConvertNumberBasesDialog() {} + +void QalculateConvertNumberBasesDialog::setDecimalValue(const QString &qstr) { + string str = qstr.ascii(); + remove_blank_ends(str); + if(str.empty()) return; + if(is_in(OPERATORS EXP, str[str.length() - 1])) return; + EvaluationOptions eo; + eo.parse_options.angle_unit = evalops.parse_options.angle_unit; + MathStructure value = CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(str, evalops.parse_options), eo); + updateEntries(&value, 10); +} +void QalculateConvertNumberBasesDialog::setBinaryValue(const QString &qstr) { + string str = qstr.ascii(); + remove_blank_ends(str); + if(str.empty()) return; + if(is_in(OPERATORS EXP, str[str.length() - 1])) return; + EvaluationOptions eo; + eo.parse_options.base = BASE_BINARY; + eo.parse_options.angle_unit = evalops.parse_options.angle_unit; + MathStructure value = CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(str, evalops.parse_options), eo); + updateEntries(&value, 2); +} +void QalculateConvertNumberBasesDialog::setOctalValue(const QString &qstr) { + string str = qstr.ascii(); + remove_blank_ends(str); + if(str.empty()) return; + if(is_in(OPERATORS EXP, str[str.length() - 1])) return; + EvaluationOptions eo; + eo.parse_options.base = BASE_OCTAL; + eo.parse_options.angle_unit = evalops.parse_options.angle_unit; + MathStructure value = CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(str, evalops.parse_options), eo); + updateEntries(&value, 8); +} +void QalculateConvertNumberBasesDialog::setHexadecimalValue(const QString &qstr) { + string str = qstr.ascii(); + remove_blank_ends(str); + if(str.empty()) return; + if(is_in(OPERATORS EXP, str[str.length() - 1])) return; + EvaluationOptions eo; + eo.parse_options.angle_unit = evalops.parse_options.angle_unit; + eo.parse_options.base = BASE_HEXADECIMAL; + MathStructure value = CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(str, evalops.parse_options), eo); + updateEntries(&value, 16); +} + +void QalculateConvertNumberBasesDialog::updateEntries(const MathStructure *value, int base) { + decimalEdit->blockSignals(true); + binaryEdit->blockSignals(true); + octalEdit->blockSignals(true); + hexadecimalEdit->blockSignals(true); + PrintOptions po; + po.number_fraction_format = FRACTION_DECIMAL; + if(base != 10) {po.base = 10; decimalEdit->setText(value->print(po).c_str());} + if(base != 2) {po.base = 2; binaryEdit->setText(value->print(po).c_str());} + if(base != 8) {po.base = 8; octalEdit->setText(value->print(po).c_str());} + if(base != 16) {po.base = 16; hexadecimalEdit->setText(value->print(po).c_str());} + decimalEdit->blockSignals(false); + binaryEdit->blockSignals(false); + octalEdit->blockSignals(false); + hexadecimalEdit->blockSignals(false); +} + +#include "qalculateconvertnumberbasesdialog.moc" diff --git a/src/qalculateconvertnumberbasesdialog.h b/src/qalculateconvertnumberbasesdialog.h new file mode 100644 index 0000000..943fede --- /dev/null +++ b/src/qalculateconvertnumberbasesdialog.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATECONVERTNUMBERBASESDIALOG_H +#define QALCULATECONVERTNUMBERBASESDIALOG_H + +#include + +class KLineEdit; +class MathStructure; + +/** +@author Niklas Knutsson +*/ +class QalculateConvertNumberBasesDialog : public KDialogBase { + Q_OBJECT +public: + QalculateConvertNumberBasesDialog(QWidget *parent = 0, const char *name = 0); + + virtual ~QalculateConvertNumberBasesDialog(); + + KLineEdit *binaryEdit, *octalEdit, *decimalEdit, *hexadecimalEdit; + +public slots: + + void setDecimalValue(const QString&); + void setBinaryValue(const QString&); + void setOctalValue(const QString&); + void setHexadecimalValue(const QString&); + +protected: + + void updateEntries(const MathStructure *value, int base); + +}; + +#endif diff --git a/src/qalculateconvertunitsdialog.cpp b/src/qalculateconvertunitsdialog.cpp new file mode 100644 index 0000000..f3ebb61 --- /dev/null +++ b/src/qalculateconvertunitsdialog.cpp @@ -0,0 +1,205 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateconvertunitsdialog.h" +#include "qalculate_kde_utils.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern tree_struct unit_cats; +extern vector ia_units; +extern PrintOptions printops; +extern EvaluationOptions evalops; + + +QalculateConvertUnitsDialog::QalculateConvertUnitsDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, false, i18n("Convert"), Ok | Apply | Cancel | Details, Ok, true) { + + setButtonText(Details, i18n("Selector")); + + selected_category = ""; + block_unit_convert = true; + + QVBox *box = makeVBoxMainWidget(); + new QLabel(i18n("Unit expression:"), box); + unitExpressionEdit = new KLineEdit(box); + + QVBox *box_d = new QVBox(this); + box_d->setSpacing(spacingHint()); + new QWidget(box_d); + + QSplitter *splitter = new QSplitter(Qt::Vertical, box_d); + splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + setDetailsWidget(box_d); + + categoryView = new KListView(splitter); + categoryView->addColumn(i18n("Category")); + categoryView->setRootIsDecorated(false); + categoryView->setFullWidth(true); + + unitView = new KListView(splitter); + unitView->addColumn(i18n("Unit")); + unitView->setRootIsDecorated(false); + unitView->setFullWidth(true); + + unitExpressionEdit->setFocus(); + + connect(unitView, SIGNAL(selectionChanged()), this, SLOT(unitSelected())); + connect(categoryView, SIGNAL(selectionChanged()), this, SLOT(categorySelected())); + +} + +QalculateConvertUnitsDialog::~QalculateConvertUnitsDialog() {} + +void QalculateConvertUnitsDialog::updateUnitTree() { + unitItems.clear(); + categoryItems.clear(); + categoryView->clear(); + QListViewItem *i = new KListViewItem(categoryView, i18n("All")), *i2; + categoryItems[i] = i18n("All"); + i->setOpen(true); + QString str; + tree_struct *item, *item2; + unit_cats.it = unit_cats.items.begin(); + if(unit_cats.it != unit_cats.items.end()) { + item = &*unit_cats.it; + ++unit_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + str = ""; + i2 = i; + while(item) { + str += "/"; + str += item->item.c_str(); + i = new KListViewItem(i2, item->item.c_str()); + i->setOpen(false); + categoryItems[i] = str; + if(str == selected_category) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + while(item && item->it == item->items.end()) { + int str_i = str.findRev("/"); + if(str_i < 0) { + str = ""; + } else { + str.truncate(str_i); + } + item = item->parent; + i = i->parent(); + i2 = i; + } + if(item) { + item2 = &*item->it; + if(item->it == item->items.begin()) + i2 = i; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + if(!unit_cats.objects.empty()) { + //add "Uncategorized" category if there are units without category + i = new KListViewItem(categoryView, i18n("Uncategorized")); + categoryItems[i] = i18n("Uncategorized"); + if(selected_category == i18n("Uncategorized")) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + } + if(!categoryView->selectedItem()) { + //if no category has been selected (previously selected has been renamed/deleted), select "All" + selected_category = i18n("All"); + QListViewItemIterator it(categoryView); + if(it.current()) + categoryView->setSelected(it.current(), true); + } +} + +void QalculateConvertUnitsDialog::unitSelected() { + QListViewItem *selected = unitView->selectedItem(); + if(selected) { + Unit *u = unitItems[selected]; + if(!CALCULATOR->stillHasUnit(u)) { + KMessageBox::error(this, i18n("Unit does not exist anymore.")); + emit unitsChanged(); + return; + } + unitExpressionEdit->setText(u->print(false, printops.abbreviate_names, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) unitExpressionEdit).c_str()); + unitView->selectAll(false); + if(!block_unit_convert) actionButton(Apply)->animateClick(); + } +} + +void QalculateConvertUnitsDialog::addUnitTreeItem(Unit *u) { + QListViewItem *i = new KListViewItem(unitView, u->title(true).c_str()); + unitItems[i] = u; +} + + +void QalculateConvertUnitsDialog::categorySelected() { + block_unit_convert = true; + QListViewItem *selected = categoryView->selectedItem(); + bool no_cat = false, b_all = false; + unitView->clear(); + unitItems.clear(); + if(!selected) { + selected_category = ""; + return; + } + selected_category = categoryItems[selected]; + if(selected_category == i18n("All")) { + b_all = true; + } else if(selected_category == i18n("Uncategorized")) { + no_cat = true; + } + if(!b_all && !no_cat && selected_category[0] == '/') { + string str = selected_category.ascii(); + str.erase(str.begin()); + for(size_t i = 0; i < CALCULATOR->units.size(); i++) { + if(CALCULATOR->units[i]->isActive() && !CALCULATOR->units[i]->isHidden() && CALCULATOR->units[i]->category().substr(0, selected_category.length() - 1) == str) { + addUnitTreeItem(CALCULATOR->units[i]); + } + } + } else { + string str = selected_category.ascii(); + for(size_t i = 0; i < CALCULATOR->units.size(); i++) { + if(CALCULATOR->units[i]->isActive() && !CALCULATOR->units[i]->isHidden() && (b_all || (no_cat && CALCULATOR->units[i]->category().empty()) || CALCULATOR->units[i]->category() == str)) { + addUnitTreeItem(CALCULATOR->units[i]); + } + } + } + block_unit_convert = false; +} + + +#include "qalculateconvertunitsdialog.moc" diff --git a/src/qalculateconvertunitsdialog.h b/src/qalculateconvertunitsdialog.h new file mode 100644 index 0000000..7c6991c --- /dev/null +++ b/src/qalculateconvertunitsdialog.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATECONVERTUNITSDIALOG_H +#define QALCULATECONVERTUNITSDIALOG_H + +#include +#include + +class KLineEdit; +class Unit; +class KListView; +class QListViewItem; + +/** +@author Niklas Knutsson +*/ +class QalculateConvertUnitsDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateConvertUnitsDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateConvertUnitsDialog(); + + KLineEdit *unitExpressionEdit; + + void addUnitTreeItem(Unit *f); + QMap unitItems; + QMap categoryItems; + + KListView *categoryView; + KListView *unitView; + + QString selected_category; + bool block_unit_convert; + +public slots: + + void updateUnitTree(); + void unitSelected(); + void categorySelected(); + +signals: + + void unitsChanged(); + +}; + +#endif diff --git a/src/qalculatedatasetsdialog.cpp b/src/qalculatedatasetsdialog.cpp new file mode 100644 index 0000000..4468788 --- /dev/null +++ b/src/qalculatedatasetsdialog.cpp @@ -0,0 +1,506 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculatedatasetsdialog.h" + +#include "qalculateeditdatasetdialog.h" +#include "qalculateeditdataobjectdialog.h" +#include "qalculate_kde_utils.h" +#include "qalculatebuttonwithdata.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern PrintOptions printops; +extern QWidget *expressionWidget; + +QalculateDataSetsDialog::QalculateDataSetsDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, false, i18n("Data Sets"), Close, Close, false) { + + dataset_edit_dialog = NULL; + object_edit_dialog = NULL; + + QVBox *box = makeVBoxMainWidget(); + QSplitter *splitter = new QSplitter(Qt::Vertical, box); + + QVBox *group1 = new QVBox(splitter); + QVBox *group2 = new QVBox(splitter); + + splitter = new QSplitter(Qt::Horizontal, group1); + QWidget *widget = new QWidget(splitter); + widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); + QVBoxLayout *vbox = new QVBoxLayout(widget, spacingHint(), spacingHint()); + vbox->addWidget(new QLabel(i18n("Data Sets:"), widget)); + dataSetsView = new KListView(widget); + vbox->addWidget(dataSetsView); + dataSetsView->addColumn(i18n("Data Set")); + dataSetsView->setRootIsDecorated(false); + QHBoxLayout *hbox = new QHBoxLayout(vbox); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + newDataSetButton = new QPushButton(i18n("New"), widget); + hbox->addWidget(newDataSetButton); + editDataSetButton = new QPushButton(i18n("Edit"), widget); + hbox->addWidget(editDataSetButton); + deleteDataSetButton = new QPushButton(i18n("Delete"), widget); + hbox->addWidget(deleteDataSetButton); + QVBox *vbox2 = new QVBox(splitter); + vbox2->setMargin(spacingHint()); + vbox2->setSpacing(spacingHint()); + new QLabel(i18n("Description:"), vbox2); + descriptionBrowser = new KTextBrowser(vbox2); + + splitter = new QSplitter(Qt::Horizontal, group2); + widget = new QWidget(splitter); + widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); + vbox = new QVBoxLayout(widget, spacingHint(), spacingHint()); + vbox->addWidget(new QLabel(i18n("Objects:"), widget)); + objectsView = new KListView(widget); + vbox->addWidget(objectsView); + objectsView->addColumn(i18n("Object")); + objectsView->setRootIsDecorated(false); + hbox = new QHBoxLayout(vbox); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + newObjectButton = new QPushButton(i18n("New"), widget); + hbox->addWidget(newObjectButton); + editObjectButton = new QPushButton(i18n("Edit"), widget); + hbox->addWidget(editObjectButton); + deleteObjectButton = new QPushButton(i18n("Delete"), widget); + hbox->addWidget(deleteObjectButton); + vbox2 = new QVBox(splitter); + vbox2->setMargin(spacingHint()); + vbox2->setSpacing(spacingHint()); + new QLabel(i18n("Attributes:"), vbox2); + attributesView = new QScrollView(vbox2); + attributesView->setResizePolicy(QScrollView::AutoOneFit); + attributesView->setFrameStyle(QFrame::NoFrame); + attributesGrid = new QGrid(3, Qt::Horizontal, attributesView->viewport()); + attributesGrid->setSpacing(spacingHint()); + attributesView->addChild(attributesGrid); + + resize(QSize(675, 525).expandedTo(size())); + + connect(newDataSetButton, SIGNAL(clicked()), this, SLOT(newDataSet())); + connect(editDataSetButton, SIGNAL(clicked()), this, SLOT(editDataSet())); + connect(deleteDataSetButton, SIGNAL(clicked()), this, SLOT(deleteDataSet())); + connect(dataSetsView, SIGNAL(selectionChanged()), this, SLOT(dataSetSelected())); + connect(dataSetsView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(dataSetDoubleClicked(QListViewItem*))); + + connect(newObjectButton, SIGNAL(clicked()), this, SLOT(newObject())); + connect(editObjectButton, SIGNAL(clicked()), this, SLOT(editObject())); + connect(deleteObjectButton, SIGNAL(clicked()), this, SLOT(deleteObject())); + connect(objectsView, SIGNAL(selectionChanged()), this, SLOT(objectSelected())); + connect(objectsView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(objectDoubleClicked(QListViewItem*))); + +} + +QalculateDataSetsDialog::~QalculateDataSetsDialog() {} + +void QalculateDataSetsDialog::updateDataSetTree() { + + dataSetItems.clear(); + objectItems.clear(); + dataSetsView->clear(); + DataSet *ds; + QListViewItem *i; + bool b = false; + dataSetsView->blockSignals(true); + for(size_t index = 1; ; index++) { + ds = CALCULATOR->getDataSet(index); + if(!ds) break; + i = new KListViewItem(dataSetsView, ds->title().c_str()); + dataSetItems[i] = ds; + if(ds == selected_dataset) { + dataSetsView->blockSignals(false); + dataSetsView->setSelected(i, true); + dataSetsView->blockSignals(true); + b = true; + } + } + dataSetsView->blockSignals(false); + if(!b) { + dataSetsView->selectAll(false); + selected_dataset = NULL; + } + +} + +#define UPDATE_SELECTED_DATASET QListViewItem *i3 = dataSetsView->selectedItem(); if(!i3) return; selected_dataset = dataSetItems[i3]; if(!selected_dataset) return; +#define UPDATE_SELECTED_OBJECT QListViewItem *i2 = objectsView->selectedItem(); if(!i2) return; selected_object = objectItems[i2]; if(!selected_object) return; +#define CHECK_IF_DATASET_STILL_THERE if(!CALCULATOR->stillHasFunction(selected_dataset)) {KMessageBox::error(this, i18n("Data set does not exist anymore.")); emit dataSetsChanged(); return;} + +void QalculateDataSetsDialog::deleteDataSet() { + UPDATE_SELECTED_DATASET + CHECK_IF_DATASET_STILL_THERE + if(selected_dataset->isLocal()) { + selected_object = NULL; + //ensure that all references are removed in Calculator + selected_dataset->destroy(); + //update menus and trees + emit dataSetsChanged(); + } +} + + +void QalculateDataSetsDialog::editDataSet() { + UPDATE_SELECTED_DATASET + CHECK_IF_DATASET_STILL_THERE + if(!dataset_edit_dialog) { + dataset_edit_dialog = new QalculateEditDataSetDialog(this); + } + DataSet *ds = dataset_edit_dialog->editDataSet(selected_dataset); + if(ds) { + selected_dataset = ds; + emit dataSetsChanged(); + } +} + +void QalculateDataSetsDialog::newDataSet() { + if(!dataset_edit_dialog) { + dataset_edit_dialog = new QalculateEditDataSetDialog(this); + } + DataSet *ds = dataset_edit_dialog->editDataSet(); + if(ds) { + selected_dataset = ds; + emit dataSetsChanged(); + } +} + +void QalculateDataSetsDialog::dataSetDoubleClicked(QListViewItem*i) { + selected_dataset = dataSetItems[i]; + if(!selected_dataset) + return; + CHECK_IF_DATASET_STILL_THERE + if(!dataset_edit_dialog) { + dataset_edit_dialog = new QalculateEditDataSetDialog(this); + } + DataSet *ds = dataset_edit_dialog->editDataSet(selected_dataset); + if(ds) { + selected_dataset = ds; + emit dataSetsChanged(); + } +} + + +void QalculateDataSetsDialog::dataSetSelected() { + QListViewItem *selected = dataSetsView->selectedItem(); + objectsView->clear(); + if(selected) { + DataSet *ds = dataSetItems[selected]; + if(!CALCULATOR->stillHasFunction(ds)) { + KMessageBox::error(this, i18n("Data set does not exist anymore.")); + selected_dataset = NULL; + emit dataSetsChanged(); + return; + } + //remember selection + selected_dataset = ds; + + while(objectsView->columns() > 0) { + objectsView->removeColumn(0); + } + + DataObjectIter it; + DataPropertyIter pit; + DataProperty *dp; + DataObject *o = ds->getFirstObject(&it); + bool b = false, b2 = false; + QListViewItem *i; + while(o) { + i = new KListViewItem(objectsView); + objectItems[i] = o; + dp = ds->getFirstProperty(&pit); + int index = 0; + while(dp) { + if(!dp->isHidden() && dp->isKey()) { + if(!b2) { + objectsView->addColumn(dp->title().c_str()); + } + i->setText(index, o->getPropertyDisplayString(dp).c_str()); + index++; + if(index > 2) break; + } + dp = ds->getNextProperty(&pit); + } + b2 = true; + if(o == selected_object) { + objectsView->setSelected(i, true); + b = true; + } + o = ds->getNextObject(&it); + } + if(!b) { + QListViewItemIterator qit(objectsView); + if(qit.current()) { + objectsView->setSelected(qit.current(), true); + } + } + objectsView->sort(); + + editDataSetButton->setEnabled(true); + deleteDataSetButton->setEnabled(ds->isLocal()); + newObjectButton->setEnabled(true); + + QString str, str2; + + if(!ds->description().empty()) { + str2 = ds->description().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += "

"; + } + str += ""; + str += i18n("Properties"); + str += "
"; + dp = ds->getFirstProperty(&pit); + while(dp) { + if(!dp->isHidden()) { + if(!dp->title(false).empty()) { + str2 = dp->title().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += ": "; + } + for(size_t i = 1; i <= dp->countNames(); i++) { + if(i > 1) str += ", "; + str += dp->getName(i).c_str(); + } + if(dp->isKey()) { + str += " ("; + //indicating that the property is a data set key + str += i18n("key"); + str += ")"; + } + str += "
"; + if(!dp->description().empty()) { + str += ""; + str2 = dp->description().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += "
"; + } + } + dp = ds->getNextProperty(&pit); + } + str += "
"; + str += i18n("Data Retrieval Function"); + str += "
"; + Argument *arg; + Argument default_arg; + const ExpressionName *ename = &ds->preferredName(false, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) descriptionBrowser); + str += ""; + str += ename->name.c_str(); + str += ""; + int iargs = ds->maxargs(); + if(iargs < 0) { + iargs = ds->minargs() + 1; + } + str += "("; + if(iargs != 0) { + for(int i2 = 1; i2 <= iargs; i2++) { + if(i2 > ds->minargs()) { + str += "["; + } + if(i2 > 1) { + str += CALCULATOR->getComma().c_str(); + str += " "; + } + arg = ds->getArgumentDefinition(i2); + if(arg && !arg->name().empty()) { + str += arg->name().c_str(); + } else { + str += i18n("argument"); + str += " "; + str += QString::number(i2); + } + if(i2 > ds->minargs()) { + str += "]"; + } + } + if(ds->maxargs() < 0) { + str += CALCULATOR->getComma().c_str(); + str += " ..."; + } + } + str += ")"; + for(size_t i2 = 1; i2 <= ds->countNames(); i2++) { + if(&ds->getName(i2) != ename) { + str += "
"; + str += ds->getName(i2).name.c_str(); + } + } + str += "
"; + str += "
"; + + if(!ds->copyright().empty()) { + str += "
"; + str2 = ds->copyright().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += "
"; + } + str.replace("\n", "
"); + descriptionBrowser->setText(str); + + } else { + editDataSetButton->setEnabled(false); + deleteDataSetButton->setEnabled(false); + newObjectButton->setEnabled(false); + selected_dataset = NULL; + descriptionBrowser->clear(); + } + objectSelected(); +} + +void QalculateDataSetsDialog::insertObjectData(void *data) { + DataProperty *dp = (DataProperty*) data; + DataSet *ds = dp->parentSet(); + if(ds && selected_object) { + QString str = ds->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionWidget).name.c_str(); + str += "("; + str += selected_object->getProperty(ds->getPrimaryKeyProperty()).c_str(); + str += CALCULATOR->getComma().c_str(); + str += " "; + str += dp->getName().c_str(); + str += ")"; + insert_text_in_expression(str); + } +} + +void QalculateDataSetsDialog::objectSelected() { + + QListViewItem *selected = objectsView->selectedItem(); + DataObject *o = NULL; + if(selected) o = objectItems[selected]; + + if(o) { + selected_object = o; + editObjectButton->setEnabled(true); + deleteObjectButton->setEnabled(true); + DataSet *ds = o->parentSet(); + if(!ds) return; + DataPropertyIter it; + DataProperty *dp = ds->getFirstProperty(&it); + QString sval; + QString str; + delete attributesGrid; + attributesGrid = new QGrid(3, Qt::Horizontal, attributesView->viewport()); + attributesGrid->setSpacing(spacingHint()); + attributesView->addChild(attributesGrid); + while(dp) { + if(!dp->isHidden()) { + sval = o->getPropertyDisplayString(dp).c_str(); + if(!sval.isEmpty()) { + str = ""; str += dp->title().c_str(); str += ":"; str += ""; + new QLabel(str, attributesGrid); + KLineEdit *le = new KLineEdit(sval, attributesGrid); + le->setReadOnly(true); + le->setFrameStyle(QFrame::NoFrame | QFrame::Plain); + QalculateButtonWithData *button = new QalculateButtonWithData((void*) dp, QIconSet(SmallIcon("editpaste")), "", attributesGrid); + QObject::connect(button, SIGNAL(clickedWithData(void*)), SLOT(insertObjectData(void*))); + } + } + dp = ds->getNextProperty(&it); + } + QWidget *widget = new QWidget(attributesGrid); + widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); + attributesGrid->show(); + } else { + delete attributesGrid; + attributesGrid = new QGrid(3, Qt::Horizontal, attributesView->viewport()); + attributesGrid->setSpacing(spacingHint()); + attributesView->addChild(attributesGrid); + attributesGrid->show(); + selected_object = NULL; + editObjectButton->setEnabled(false); + deleteObjectButton->setEnabled(false); + } + +} + +void QalculateDataSetsDialog::deleteObject() { + UPDATE_SELECTED_DATASET + UPDATE_SELECTED_OBJECT + selected_dataset->delObject(selected_object); + selected_object = NULL; + updateObjects(); +} + +void QalculateDataSetsDialog::updateObjects() { + dataSetSelected(); +} + +void QalculateDataSetsDialog::editObject() { + UPDATE_SELECTED_DATASET + UPDATE_SELECTED_OBJECT + if(!object_edit_dialog) { + object_edit_dialog = new QalculateEditDataObjectDialog(this); + } + DataObject *o = object_edit_dialog->editDataObject(selected_dataset, selected_object); + if(o) { + selected_object = o; + updateObjects(); + } +} + +void QalculateDataSetsDialog::newObject() { + UPDATE_SELECTED_DATASET + if(!object_edit_dialog) { + object_edit_dialog = new QalculateEditDataObjectDialog(this); + } + DataObject *o = object_edit_dialog->editDataObject(selected_dataset); + if(o) { + selected_object = o; + updateObjects(); + } +} + +void QalculateDataSetsDialog::objectDoubleClicked(QListViewItem*i) { + UPDATE_SELECTED_DATASET + selected_object = objectItems[i]; + if(!selected_object) + return; + if(!object_edit_dialog) { + object_edit_dialog = new QalculateEditDataObjectDialog(this); + } + DataObject *o = object_edit_dialog->editDataObject(selected_dataset, selected_object); + if(o) { + selected_object = o; + updateObjects(); + } +} + + + +#include "qalculatedatasetsdialog.moc" diff --git a/src/qalculatedatasetsdialog.h b/src/qalculatedatasetsdialog.h new file mode 100644 index 0000000..1fa85b7 --- /dev/null +++ b/src/qalculatedatasetsdialog.h @@ -0,0 +1,85 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEDATASETSDIALOG_H +#define QALCULATEDATASETSDIALOG_H + +#include +#include + +class QPushButton; +class KListView; +class KTextBrowser; +class QScrollView; +class QGrid; +class DataSet; +class DataObject; +class QalculateEditDataSetDialog; +class QalculateEditDataObjectDialog; + +/** +@author Niklas Knutsson +*/ +class QalculateDataSetsDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateDataSetsDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateDataSetsDialog(); + + QPushButton *newObjectButton, *editObjectButton, *deleteObjectButton, *newDataSetButton, *editDataSetButton, *deleteDataSetButton; + KListView *objectsView, *dataSetsView; + KTextBrowser *descriptionBrowser; + QScrollView *attributesView; + QGrid *attributesGrid; + + QMap dataSetItems; + QMap objectItems; + + DataSet *selected_dataset; + DataObject *selected_object; + + QalculateEditDataSetDialog *dataset_edit_dialog; + QalculateEditDataObjectDialog *object_edit_dialog; + +public slots: + + void updateDataSetTree(); + void dataSetDoubleClicked(QListViewItem*); + void objectDoubleClicked(QListViewItem*); + void dataSetSelected(); + void objectSelected(); + void deleteDataSet(); + void editDataSet(); + void newDataSet(); + void deleteObject(); + void editObject(); + void newObject(); + void updateObjects(); + void insertObjectData(void*); + +signals: + + void dataSetsChanged(); + +}; + +#endif diff --git a/src/qalculatedecimalsdialog.cpp b/src/qalculatedecimalsdialog.cpp new file mode 100644 index 0000000..2039b93 --- /dev/null +++ b/src/qalculatedecimalsdialog.cpp @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculatedecimalsdialog.h" + +#include +#include +#include +#include + +QalculateDecimalsDialog::QalculateDecimalsDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, false, i18n("Decimals"), Close, Close, true) { + + QGrid *grid = makeGridMainWidget(2, Qt::Horizontal); + + new QLabel(i18n("Max decimals:"), grid); + + maxDecimalsBox = new QSpinBox(grid); + maxDecimalsBox->setButtonSymbols(QSpinBox::PlusMinus); + maxDecimalsBox->setMinValue(-1); + maxDecimalsBox->setValue(-1); + maxDecimalsBox->setSpecialValueText(i18n( "Off" )); + + new QLabel(i18n("Min decimals:"), grid); + + minDecimalsBox = new QSpinBox(grid); + minDecimalsBox->setButtonSymbols(QSpinBox::PlusMinus); + minDecimalsBox->setMinValue(0); + minDecimalsBox->setValue(0); + minDecimalsBox->setSpecialValueText(i18n( "Off" )); + + resize(QSize(300, minimumSizeHint().height()).expandedTo(minimumSizeHint())); + +} + + +QalculateDecimalsDialog::~QalculateDecimalsDialog() {} + + +#include "qalculatedecimalsdialog.moc" diff --git a/src/qalculatedecimalsdialog.h b/src/qalculatedecimalsdialog.h new file mode 100644 index 0000000..ae16d7c --- /dev/null +++ b/src/qalculatedecimalsdialog.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEDECIMALSDIALOG_H +#define QALCULATEDECIMALSDIALOG_H + +#include + +class QSpinBox; + +/** +@author Niklas Knutsson +*/ +class QalculateDecimalsDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateDecimalsDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateDecimalsDialog(); + + QSpinBox *maxDecimalsBox, *minDecimalsBox; + +}; + +#endif diff --git a/src/qalculateeditdataobjectdialog.cpp b/src/qalculateeditdataobjectdialog.cpp new file mode 100644 index 0000000..cf9e0cd --- /dev/null +++ b/src/qalculateeditdataobjectdialog.cpp @@ -0,0 +1,103 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateeditdataobjectdialog.h" +#include "qalculate_kde_utils.h" +#include +#include +#include +#include +#include +#include +#include + +QalculateEditDataObjectDialog::QalculateEditDataObjectDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Object"), Ok | Cancel, Ok, true) { + +} + +QalculateEditDataObjectDialog::~QalculateEditDataObjectDialog() {} + +DataObject *QalculateEditDataObjectDialog::editDataObject(DataSet *ds, DataObject *o) { + + if(!ds) return NULL; + if(o) { + setCaption(i18n("Edit Object")); + } else { + setCaption(i18n("New Object")); + } + + QGrid *grid = new QGrid(4, Qt::Horizontal, this); + grid->setSpacing(spacingHint()); + setMainWidget(grid); + new QLabel(i18n("Property"), grid); + new QLabel(i18n("Value"), grid); + new QLabel(grid); + new QLabel(i18n("Approximation"), grid); + DataPropertyIter it; + DataProperty *dp = ds->getFirstProperty(&it); + string sval; + QValueVector value_entries; + QValueVector approx_menus; + string str; + while(dp) { + new QLabel(dp->title().c_str(), grid); + KLineEdit *entry = new KLineEdit(grid); + value_entries.push_back(entry); + int iapprox = -1; + if(o) { + entry->setText(o->getProperty(dp, &iapprox).c_str()); + } + new QLabel(dp->getUnitString().c_str(), grid); + KComboBox *om = new KComboBox(grid); + om->setEditable(false); + om->insertItem(i18n("Default")); + om->insertItem(i18n("Approximate")); + om->insertItem(i18n("Exact")); + approx_menus.push_back(om); + om->setCurrentItem(iapprox + 1); + dp = ds->getNextProperty(&it); + } + if(exec() == QDialog::Accepted) { + bool new_object = (o == NULL); + if(new_object) { + o = new DataObject(ds); + ds->addObject(o); + } + dp = ds->getFirstProperty(&it); + size_t i = 0; + QString val; + while(dp) { + val = value_entries[i]->text().stripWhiteSpace(); + if(!val.isEmpty()) { + o->setProperty(dp, val.ascii(), approx_menus[i]->currentItem() - 1); + } else if(!new_object) { + o->eraseProperty(dp); + } + dp = ds->getNextProperty(&it); + i++; + } + o->setUserModified(); + delete grid; + return o; + } + delete grid; + return NULL; +} + +#include "qalculateeditdataobjectdialog.moc" diff --git a/src/qalculateeditdataobjectdialog.h b/src/qalculateeditdataobjectdialog.h new file mode 100644 index 0000000..9db334b --- /dev/null +++ b/src/qalculateeditdataobjectdialog.h @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEDITDATAOBJECTDIALOG_H +#define QALCULATEEDITDATAOBJECTDIALOG_H + +#include + +class DataObject; +class DataSet; + +/** +@author Niklas Knutsson +*/ +class QalculateEditDataObjectDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateEditDataObjectDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditDataObjectDialog(); + + DataObject *editDataObject(DataSet *ds, DataObject *o = NULL); + +}; + +#endif diff --git a/src/qalculateeditdatasetdialog.cpp b/src/qalculateeditdatasetdialog.cpp new file mode 100644 index 0000000..3341395 --- /dev/null +++ b/src/qalculateeditdatasetdialog.cpp @@ -0,0 +1,750 @@ +/*************************************************************************** + * Copyright (C) 2005-2006 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateeditdatasetdialog.h" +#include "qalculate_kde_utils.h" +#include "qalculateeditnamesdialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 1 +#include +#else +#include +#endif +#include +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 +#include +#else +#include +#endif +#include +#include + +extern PrintOptions printops; +extern tree_struct function_cats; + +QalculateEditDataSetDialog::QalculateEditDataSetDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Data Set"), Ok | Cancel, Ok, false) { + + names_edit_dialog = NULL; + edited_dataset = NULL; + property_edit_dialog = NULL; + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + tabs = new QTabWidget(this); +#else + tabs = new KTabWidget(this); +#endif + setMainWidget(tabs); + QWidget *page1 = new QWidget(this); + QWidget *page2 = new QWidget(this); + QWidget *page3 = new QWidget(this); + tabs->addTab(page1, i18n("General")); + tabs->addTab(page2, i18n("Properties")); + tabs->addTab(page3, i18n("Function")); + + QGridLayout *grid = new QGridLayout(page1, 1, 1, spacingHint()); + grid->addWidget(new QLabel(i18n("Title:"), page1), 0, 0); + titleEdit = new KLineEdit(page1); + grid->addWidget(titleEdit, 0, 1); + grid->addWidget(new QLabel(i18n("Data file:"), page1), 1, 0); + fileEdit = new KLineEdit(page1); + grid->addWidget(fileEdit, 1, 1); + grid->addWidget(new QLabel(i18n("Description:"), page1), 2, 0); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 1 + descriptionEdit = new QTextEdit(page1); +#else + descriptionEdit = new KTextEdit(page1); +#endif + descriptionEdit->setTextFormat(QTextEdit::PlainText); + grid->addMultiCellWidget(descriptionEdit, 3, 3, 0, 1); + grid->addWidget(new QLabel(i18n("Copyright:"), page1), 4, 0); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 1 + copyrightEdit = new QTextEdit(page1); +#else + copyrightEdit = new KTextEdit(page1); +#endif + copyrightEdit->setTextFormat(QTextEdit::PlainText); + grid->addMultiCellWidget(copyrightEdit, 5, 5, 0, 1); + + QVBoxLayout *vbox = new QVBoxLayout(page2, spacingHint()); + vbox->addWidget(new QLabel(i18n("Properties:"), page2)); + propertiesView = new KListView(page2); + propertiesView->addColumn(i18n("Title")); + propertiesView->addColumn(i18n("Name")); + propertiesView->addColumn(i18n("Type")); + propertiesView->setSorting(-1); + propertiesView->setRootIsDecorated(false); + vbox->addWidget(propertiesView); + QHBoxLayout *hbox = new QHBoxLayout(vbox, spacingHint()); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + newPropertyButton = new QPushButton(i18n("New"), page2); + hbox->addWidget(newPropertyButton); + editPropertyButton = new QPushButton(i18n("Edit"), page2); + hbox->addWidget(editPropertyButton); + deletePropertyButton = new QPushButton(i18n("Delete"), page2); + hbox->addWidget(deletePropertyButton); + + grid = new QGridLayout(page3, 1, 1, spacingHint()); + grid->addWidget(new QLabel(i18n("Name:"), page3), 0, 0); + nameEdit = new KLineEdit(page3); + grid->addWidget(nameEdit, 0, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 1, 1, 0, 1); + namesLabel = new QLabel(page3); + namesLabel->setAlignment(Qt::AlignRight); + namesLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hbox->addWidget(namesLabel); + namesButton = new QPushButton(i18n("Names Details"), page3); + hbox->addWidget(namesButton); + grid->addWidget(new QLabel(i18n("Object argument name:"), page3), 2, 0); + objectArgumentEdit = new KLineEdit(page3); + grid->addWidget(objectArgumentEdit, 2, 1); + grid->addWidget(new QLabel(i18n("Property argument name:"), page3), 3, 0); + propertyArgumentEdit = new KLineEdit(page3); + grid->addWidget(propertyArgumentEdit, 3, 1); + grid->addWidget(new QLabel(i18n("Default property:"), page3), 4, 0); + defaultPropertyEdit = new KLineEdit(page3); + grid->addWidget(defaultPropertyEdit, 4, 1); + grid->addItem(new QSpacerItem(5, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); + + + connect(namesButton, SIGNAL(clicked()), this, SLOT(editNames())); + connect(nameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + connect(newPropertyButton, SIGNAL(clicked()), this, SLOT(newProperty())); + connect(editPropertyButton, SIGNAL(clicked()), this, SLOT(editProperty())); + connect(deletePropertyButton, SIGNAL(clicked()), this, SLOT(deleteProperty())); + connect(propertiesView, SIGNAL(selectionChanged()), this, SLOT(propertySelectionChanged())); + +} + +QalculateEditDataSetDialog::~QalculateEditDataSetDialog() {} + + +void QalculateEditDataSetDialog::propertySelectionChanged() { + QListViewItem *i = propertiesView->selectedItem(); + if(i) { + editPropertyButton->setEnabled(propertiesItems[i]->isUserModified()); + deletePropertyButton->setEnabled(propertiesItems[i]->isUserModified()); + } else { + editPropertyButton->setEnabled(false); + deletePropertyButton->setEnabled(false); + } +} + +void QalculateEditDataSetDialog::updateDatasetPropertyList() { + propertiesView->clear(); + propertiesItems.clear(); + editPropertyButton->setEnabled(false); + deletePropertyButton->setEnabled(false); + QString str; + QListViewItem *i_prev = NULL; + for(size_t i = 0; i < tmp_props.size(); i++) { + if(tmp_props[i]) { + str = ""; + switch(tmp_props[i]->propertyType()) { + case PROPERTY_STRING: { + str += i18n("text"); + break; + } + case PROPERTY_NUMBER: { + if(tmp_props[i]->isApproximate()) { + str += i18n("approximate"); + str += " "; + } + str += i18n("number"); + break; + } + case PROPERTY_EXPRESSION: { + if(tmp_props[i]->isApproximate()) { + str += i18n("approximate"); + str += " "; + } + str += i18n("expression"); + break; + } + } + if(tmp_props[i]->isKey()) { + str += " ("; + str += i18n("key"); + str += ")"; + } + QListViewItem *item = new KListViewItem(propertiesView, i_prev, tmp_props[i]->title(false).c_str(), tmp_props[i]->getName().c_str(), str); + i_prev = item; + propertiesItems[item] = tmp_props[i]; + } + } +} + +void QalculateEditDataSetDialog::slotOk() { + + string str = nameEdit->text().ascii(); + remove_blank_ends(str); + if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { + //no name -- open dialog again + tabs->setCurrentPage(2); + nameEdit->setFocus(); + KMessageBox::error(this, i18n("Empty name field")); + return; + } + //function with the same name exists -- overwrite or open dialog again + if((!edited_dataset || !edited_dataset->hasName(str)) && (!names_edit_dialog || names_edit_dialog->isEmpty()) && CALCULATOR->functionNameTaken(str, edited_dataset) && KMessageBox::questionYesNo(this, i18n("A function with the same name already exists.\nDo you want to overwrite it?")) == KMessageBox::No) { + tabs->setCurrentPage(2); + nameEdit->setFocus(); + return; + } + + DataSet *ds = edited_dataset; + bool add_func = false; + if(ds) { + //edited an existing function + ds->setTitle(titleEdit->text().ascii()); + ds->setDescription(descriptionEdit->text().ascii()); + if(ds->isLocal()) ds->setDefaultDataFile(fileEdit->text().ascii()); + } else { + //new function + ds = new DataSet(i18n("Data Sets").ascii(), "", fileEdit->text().ascii(), titleEdit->text().ascii(), descriptionEdit->text().ascii(), true); + add_func = true; + } + QString str2 = objectArgumentEdit->text().stripWhiteSpace(); + if(str2.isEmpty()) str2 = i18n("Object"); + Argument *arg = ds->getArgumentDefinition(1); + if(arg) { + arg->setName(str2.ascii()); + } + str2 = propertyArgumentEdit->text().stripWhiteSpace(); + if(str2.isEmpty()) str2 = i18n("Property"); + arg = ds->getArgumentDefinition(2); + if(arg) { + arg->setName(str2.ascii()); + } + ds->setDefaultProperty(defaultPropertyEdit->text().ascii()); + ds->setCopyright(copyrightEdit->text().ascii()); + DataPropertyIter it; + for(size_t i = 0; i < tmp_props.size();) { + if(!tmp_props[i]) { + if(tmp_props_orig[i]) ds->delProperty(tmp_props_orig[i]); + i++; + } else if(tmp_props[i]->isUserModified()) { + if(tmp_props_orig[i]) { + tmp_props_orig[i]->set(*tmp_props[i]); + i++; + } else { + ds->addProperty(tmp_props[i]); + tmp_props.erase(tmp_props.begin() + i); + } + } else { + i++; + } + } + + if(names_edit_dialog) { + names_edit_dialog->saveNames(ds, str.c_str()); + } else { + if(ds->countNames() == 0) { + ExpressionName ename(str); + ename.reference = true; + ds->setName(ename, 1); + } else { + ds->setName(str, 1); + } + } + if(add_func) { + CALCULATOR->addDataSet(ds); + ds->loadObjects(); + ds->setObjectsLoaded(true); + } + + for(size_t i = 0; i < tmp_props.size(); i++) { + if(tmp_props[i]) delete tmp_props[i]; + } + tmp_props.clear(); + tmp_props_orig.clear(); + edited_dataset = ds; + + accept(); + +} + +DataSet *QalculateEditDataSetDialog::editDataSet(DataSet *ds) { + + titleEdit->setFocus(); + + tabs->setCurrentPage(0); + if(names_edit_dialog) { + delete names_edit_dialog; + names_edit_dialog = NULL; + } + edited_dataset = ds; + if(ds) { + if(ds->isLocal()) + setCaption(i18n("Edit Data Set")); + else + setCaption(i18n("Edit Data Set (global)")); + } else { + setCaption(i18n("New Data Set")); + } + + //clear entries + fileEdit->setReadOnly(ds && !ds->isLocal()); + copyrightEdit->setReadOnly(ds && !ds->isLocal()); + nameEdit->clear(); + titleEdit->clear(); + fileEdit->clear(); + objectArgumentEdit->clear(); + propertyArgumentEdit->clear(); + defaultPropertyEdit->setText(i18n("info")); + namesLabel->clear(); + descriptionEdit->clear(); + copyrightEdit->clear(); + nameEdit->setReadOnly(false); + actionButton(Ok)->setEnabled(true); + newPropertyButton->setEnabled(TRUE); + editPropertyButton->setEnabled(FALSE); + deletePropertyButton->setEnabled(FALSE); + if(ds) { + //fill in original paramaters + set_name_label_and_entry(ds, nameEdit, namesLabel); + fileEdit->setText(ds->defaultDataFile().c_str()); + defaultPropertyEdit->setText(ds->defaultProperty().c_str()); + titleEdit->setText(ds->title(false).c_str()); + Argument *arg = ds->getArgumentDefinition(1); + if(arg) { + objectArgumentEdit->setText(arg->name().c_str()); + } + arg = ds->getArgumentDefinition(2); + if(arg) { + propertyArgumentEdit->setText(arg->name().c_str()); + } + descriptionEdit->setText(ds->description().c_str()); + copyrightEdit->setText(ds->copyright().c_str()); + DataPropertyIter it; + DataProperty *dp = ds->getFirstProperty(&it); + while(dp) { + tmp_props.push_back(new DataProperty(*dp)); + tmp_props_orig.push_back(dp); + dp = ds->getNextProperty(&it); + } + } + updateDatasetPropertyList(); + + if(exec() == QDialog::Accepted) { + ds = edited_dataset; + edited_dataset = NULL; + return ds; + } + edited_dataset = NULL; + for(size_t i = 0; i < tmp_props.size(); i++) { + if(tmp_props[i]) delete tmp_props[i]; + } + tmp_props.clear(); + tmp_props_orig.clear(); + return NULL; +} + +void QalculateEditDataSetDialog::editNames() { + if(!names_edit_dialog) { + names_edit_dialog = new QalculateEditNamesDialog(TYPE_FUNCTION, this); + names_edit_dialog->setNames(edited_dataset, nameEdit->text(), false); + } else { + names_edit_dialog->setNames(edited_dataset, nameEdit->text(), true); + } + names_edit_dialog->exec(); + names_edit_dialog->setNamesLE(nameEdit, namesLabel); +} +void QalculateEditDataSetDialog::newProperty() { + if(!property_edit_dialog) { + property_edit_dialog = new QalculateEditDataPropertyDialog(this); + } + DataProperty *dp = new DataProperty(edited_dataset); + dp->setUserModified(true); + if(property_edit_dialog->editDataProperty(dp, true)) { + tmp_props.push_back(dp); + tmp_props_orig.push_back(NULL); + updateDatasetPropertyList(); + } else { + delete dp; + } +} + +void QalculateEditDataSetDialog::editProperty() { + QListViewItem *i = propertiesView->selectedItem(); + if(i == NULL) return; + if(!property_edit_dialog) { + property_edit_dialog = new QalculateEditDataPropertyDialog(this); + } + if(property_edit_dialog->editDataProperty(propertiesItems[i])) { + updateDatasetPropertyList(); + } +} +void QalculateEditDataSetDialog::deleteProperty() { + QListViewItem *i = propertiesView->selectedItem(); + if(i == NULL) return; + if(propertiesItems[i]->isUserModified()) { + for(size_t index = 0; index < tmp_props.size(); index++) { + if(tmp_props[index] == propertiesItems[i]) { + if(tmp_props_orig[index]) { + tmp_props[index] = NULL; + } else { + tmp_props.erase(tmp_props.begin() + index); + tmp_props_orig.erase(tmp_props_orig.begin() + index); + } + break; + } + } + updateDatasetPropertyList(); + } +} + +void QalculateEditDataSetDialog::nameChanged(const QString &name) { + if(name.isNull()) return; + if(!CALCULATOR->functionNameIsValid(name.ascii())) { + nameEdit->blockSignals(true); + nameEdit->setText(CALCULATOR->convertToValidFunctionName(name.ascii()).c_str()); + nameEdit->blockSignals(false); + } +} + + +QalculateEditDataPropertyDialog::QalculateEditDataPropertyDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Property"), Ok | Cancel, Ok, true) { + + names_edit_dialog = NULL; + edited_property = NULL; + + setMainWidget(new QWidget(this)); + QGridLayout *grid = new QGridLayout(mainWidget(), 1, 1, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("Name:"), mainWidget()), 0, 0); + nameEdit = new KLineEdit(mainWidget()); + grid->addWidget(nameEdit, 0, 1); + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 1, 1, 0, 1); + namesLabel = new QLabel(mainWidget()); + namesLabel->setAlignment(Qt::AlignRight); + namesLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hbox->addWidget(namesLabel); + namesButton = new QPushButton(i18n("Names Details"), mainWidget()); + hbox->addWidget(namesButton); + grid->addWidget(new QLabel(i18n("Descriptive name:"), mainWidget()), 2, 0); + titleEdit = new KLineEdit(mainWidget()); + grid->addWidget(titleEdit, 2, 1); + grid->addWidget(new QLabel(i18n("Description:"), mainWidget()), 3, 0); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 1 + descriptionEdit = new QTextEdit(mainWidget()); +#else + descriptionEdit = new KTextEdit(mainWidget()); +#endif + descriptionEdit->setTextFormat(QTextEdit::PlainText); + grid->addMultiCellWidget(descriptionEdit, 4, 4, 0, 1); + grid->addWidget(new QLabel(i18n("Value type:"), mainWidget()), 5, 0); + typeCombo = new KComboBox(mainWidget()); + typeCombo->setEditable(false); + typeCombo->insertItem(i18n("Text")); + typeCombo->insertItem(i18n("Number")); + typeCombo->insertItem(i18n("Expression")); + grid->addWidget(typeCombo, 5, 1); + hideButton = new QCheckBox(i18n("Hide"), mainWidget()); + grid->addWidget(hideButton, 6, 0); + //Use as a unique data set key + keyButton = new QCheckBox(i18n("Use as key"), mainWidget()); + grid->addWidget(keyButton, 6, 1); + approximateButton = new QCheckBox(i18n("Approximate value"), mainWidget()); + grid->addWidget(approximateButton, 7, 0); + caseButton = new QCheckBox(i18n("Case sensitive value"), mainWidget()); + grid->addWidget(caseButton, 7, 1); + bracketsButton = new QCheckBox(i18n("Value uses brackets"), mainWidget()); + grid->addWidget(bracketsButton, 8, 0); + grid->addWidget(new QLabel(i18n("Unit expression:"), mainWidget()), 9, 0); + unitEdit = new KLineEdit(mainWidget()); + grid->addWidget(unitEdit, 9, 1); + + connect(namesButton, SIGNAL(clicked()), this, SLOT(editNames())); + +} + +QalculateEditDataPropertyDialog::~QalculateEditDataPropertyDialog() {} + +void QalculateEditDataPropertyDialog::slotOk() { + + string str = nameEdit->text().ascii(); + remove_blank_ends(str); + if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { + //no name -- open dialog again + nameEdit->setFocus(); + KMessageBox::error(this, i18n("Empty name field")); + return; + } + DataProperty *dp = edited_property; + dp->setTitle(titleEdit->text().ascii()); + dp->setUnit(unitEdit->text().ascii()); + + dp->setHidden(hideButton->isChecked()); + dp->setKey(keyButton->isChecked()); + dp->setApproximate(approximateButton->isChecked()); + dp->setCaseSensitive(caseButton->isChecked()); + dp->setUsesBrackets(bracketsButton->isChecked()); + + dp->setDescription(descriptionEdit->text().ascii()); + + switch(typeCombo->currentItem()) { + case 0: { + dp->setPropertyType(PROPERTY_STRING); + break; + } + case 1: { + dp->setPropertyType(PROPERTY_NUMBER); + break; + } + case 2: { + dp->setPropertyType(PROPERTY_EXPRESSION); + break; + } + } + if(names_edit_dialog) { + names_edit_dialog->saveNames(dp, str.c_str()); + } else { + dp->setName(str, 1); + } + edited_property = dp; + accept(); + +} + +bool QalculateEditDataPropertyDialog::editDataProperty(DataProperty *dp, bool newdp) { + + nameEdit->setFocus(); + + if(names_edit_dialog) { + delete names_edit_dialog; + names_edit_dialog = NULL; + } + edited_property = dp; + if(!newdp) { + setCaption(i18n("Edit Property")); + } else { + setCaption(i18n("New Property")); + } + + actionButton(Ok)->setEnabled(true); + + nameEdit->setText(dp->getName().c_str()); + if(dp->countNames() > 1) { + QString str = "+ "; + for(size_t i = 2; i <= dp->countNames(); i++) { + if(i > 2) str += ", "; + str += dp->getName(i).c_str(); + } + namesLabel->setText(str); + } else { + namesLabel->clear(); + } + + titleEdit->setText(dp->title(false).c_str()); + unitEdit->setText(dp->getUnitString().c_str()); + + hideButton->setChecked(dp->isHidden()); + keyButton->setChecked(dp->isKey()); + approximateButton->setChecked(dp->isApproximate()); + caseButton->setChecked(dp->isCaseSensitive()); + bracketsButton->setChecked(dp->usesBrackets()); + + descriptionEdit->setText(dp->description().c_str()); + + switch(dp->propertyType()) { + case PROPERTY_STRING: { + typeCombo->setCurrentItem(0); + break; + } + case PROPERTY_NUMBER: { + typeCombo->setCurrentItem(1); + break; + } + case PROPERTY_EXPRESSION: { + typeCombo->setCurrentItem(2); + break; + } + } + + if(exec() == QDialog::Accepted) { + edited_property = NULL; + return true; + } + edited_property = NULL; + return false; +} + +void QalculateEditDataPropertyDialog::editNames() { + if(!names_edit_dialog) { + names_edit_dialog = new QalculateEditDataPropertyNamesDialog(this); + names_edit_dialog->setNames(edited_property, nameEdit->text(), false); + } else { + names_edit_dialog->setNames(edited_property, nameEdit->text(), true); + } + names_edit_dialog->exec(); + names_edit_dialog->setNamesLE(nameEdit, namesLabel); +} + + +QalculateEditDataPropertyNamesDialog::QalculateEditDataPropertyNamesDialog(QWidget *parent, const char *name) : KDialog(parent, name, true) { + + setCaption(i18n("Edit Names")); + + QVBoxLayout *layout = new QVBoxLayout(this, marginHint(), spacingHint()); + + namesView = new KListView(this); + namesView->addColumn(i18n("Name")); + namesView->addColumn(i18n("Reference")); + namesView->setColumnAlignment(1, Qt::AlignCenter); + namesView->setSorting(-1); + namesView->setItemsRenameable(true); + namesView->setItemsMovable(true); + layout->addWidget(namesView); + + QHBoxLayout *buttonLayout = new QHBoxLayout(layout, spacingHint()); + newButton = new QPushButton(i18n("New"), this); + buttonLayout->addWidget(newButton); + deleteButton = new QPushButton(i18n("Delete"), this); + deleteButton->setEnabled(false); + buttonLayout->addWidget(deleteButton); + buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + buttonClose = new KPushButton(KStdGuiItem::close(), this); + buttonClose->setAutoDefault(true); + buttonClose->setDefault(true); + buttonLayout->addWidget(buttonClose); + + connect(namesView, SIGNAL(selectionChanged()), this, SLOT(nameSelectionChanged())); + connect(buttonClose, SIGNAL(clicked()), this, SLOT(accept())); + connect(newButton, SIGNAL(clicked()), this, SLOT(newName())); + connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteName())); + connect(namesView, SIGNAL(clicked(QListViewItem*, const QPoint&, int)), this, SLOT(itemClicked(QListViewItem*, const QPoint&, int))); + +} + +QalculateEditDataPropertyNamesDialog::~QalculateEditDataPropertyNamesDialog() {} + +void QalculateEditDataPropertyNamesDialog::newName() { + ExpressionName name; + QListViewItem *i = new KListViewItem(namesView, namesView->lastChild(), "", i18n("No"), i18n("No"), i18n("No"), i18n("No"), i18n("No"), i18n("No"), i18n("No")); + namesView->setSelected(i, true); + qApp->processEvents(); + namesView->rename(i, 0); +} + +void QalculateEditDataPropertyNamesDialog::setNames(DataProperty *item, const QString &namestr, bool names_edited) { + + if(!names_edited) { + deleteButton->setEnabled(false); + namesView->clear(); + } + if(!names_edited && item && item->countNames() > 0) { + QListViewItem *i_prev = NULL; + for(size_t index = 1; index <= item->countNames(); index++) { + QListViewItem *i = new KListViewItem(namesView, i_prev); + i_prev = i; + if(item->nameIsReference(index)) + i->setText(1, i18n("Yes")); + else + i->setText(1, i18n("No")); + if(index == 1 && !namestr.isEmpty()) { + i->setText(0, namestr); + } else { + i->setText(0, item->getName(index).c_str()); + } + } + } else if(!namestr.isEmpty()) { + if(names_edited) { + QListViewItemIterator it(namesView); + if(it.current()) + it.current()->setText(0, namestr); + } else { + new KListViewItem(namesView, namestr, i18n("No")); + } + } +} +void QalculateEditDataPropertyNamesDialog::saveNames(DataProperty *item, const QString &str) { + item->clearNames(); + QListViewItemIterator it(namesView); + if(it.current()) { + bool b = false; + while(it.current()) { + bool ref = (it.current()->text(1) == i18n("Yes")); + if(b || str.isEmpty()) + item->addName(it.current()->text(0).ascii(), ref); + else + item->addName(str.ascii(), ref); + ++it; + b = true; + } + } else { + item->addName(str.ascii()); + } +} +void QalculateEditDataPropertyNamesDialog::setNamesLE(QLineEdit *entry, QLabel *label) { + int index = 0; + QString str; + QListViewItemIterator it(namesView); + while(it.current()) { + if(index == 0) { + entry->setText(it.current()->text(0)); + } else { + if(index == 1) { + str = "+ "; + } else { + str += ", "; + } + str += it.current()->text(0); + } + ++it; + index++; + } + label->setText(str); +} +bool QalculateEditDataPropertyNamesDialog::isEmpty() { + return namesView->childCount() <= 0; +} + +void QalculateEditDataPropertyNamesDialog::deleteName() { + namesView->removeItem(namesView->selectedItem()); +} + +void QalculateEditDataPropertyNamesDialog::itemClicked(QListViewItem *i, const QPoint &, int c) { + if(i && c > 0) { + if(i->text(c) == i18n("Yes")) + i->setText(c, i18n("No")); + else + i->setText(c, i18n("Yes")); + } +} + +void QalculateEditDataPropertyNamesDialog::nameSelectionChanged() { + deleteButton->setEnabled(namesView->selectedItem() != NULL); +} + + +#include "qalculateeditdatasetdialog.moc" + diff --git a/src/qalculateeditdatasetdialog.h b/src/qalculateeditdatasetdialog.h new file mode 100644 index 0000000..2c27b65 --- /dev/null +++ b/src/qalculateeditdatasetdialog.h @@ -0,0 +1,145 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEDITDATASETDIALOG_H +#define QALCULATEEDITDATASETDIALOG_H + +#include +#include +#include + +class KLineEdit; +class QCheckBox; +class KComboBox; +class QPushButton; +class MathStructure; +class QalculateEditNamesDialog; +class DataSet; +class KListView; +class QTextEdit; +class DataProperty; +class QTabWidget; +class UserFunction; +class QalculateEditDataPropertyDialog; +class QalculateEditDataPropertyNamesDialog; +class QLineEdit; + +/** +@author Niklas Knutsson +*/ +class QalculateEditDataSetDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateEditDataSetDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditDataSetDialog(); + + DataSet *editDataSet(DataSet *ds = NULL); + void updateDatasetPropertyList(); + + QalculateEditNamesDialog *names_edit_dialog; + QalculateEditDataPropertyDialog *property_edit_dialog; + DataSet *edited_dataset; + KLineEdit *objectArgumentEdit, *propertyArgumentEdit, *defaultPropertyEdit, *nameEdit, *titleEdit, *fileEdit; + QLabel *namesLabel; + KListView *propertiesView; + QTextEdit *descriptionEdit, *copyrightEdit; + QPushButton *namesButton, *newPropertyButton, *editPropertyButton, *deletePropertyButton; + QTabWidget *tabs; + QMap propertiesItems; + QValueVector tmp_props; + QValueVector tmp_props_orig; + +public slots: + + void propertySelectionChanged(); + void editNames(); + void newProperty(); + void editProperty(); + void deleteProperty(); + void nameChanged(const QString&); + +protected slots: + + void slotOk(); + +}; + +class QalculateEditDataPropertyDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateEditDataPropertyDialog(QWidget *parent = 0, const char *name = 0); + ~QalculateEditDataPropertyDialog(); + + bool editDataProperty(DataProperty *dp, bool newdp = false); + + QalculateEditDataPropertyNamesDialog *names_edit_dialog; + DataProperty *edited_property; + KComboBox *typeCombo; + KLineEdit *nameEdit, *titleEdit, *unitEdit; + QLabel *namesLabel; + QCheckBox *hideButton, *keyButton, *approximateButton, *caseButton, *bracketsButton; + QPushButton *namesButton; + QTextEdit *descriptionEdit; + +public slots: + + void editNames(); + +protected slots: + + void slotOk(); + +}; + +class QalculateEditDataPropertyNamesDialog : public KDialog { + + Q_OBJECT + +public: + + QalculateEditDataPropertyNamesDialog(QWidget *parent = 0, const char *name = 0); + ~QalculateEditDataPropertyNamesDialog(); + + void saveNames(DataProperty *item, const QString &str = QString::null); + void setNames(DataProperty *item = NULL, const QString &namestr = QString::null, bool names_edited = false); + bool isEmpty(); + void setNamesLE(QLineEdit *entry, QLabel *label); + + KListView* namesView; + QPushButton* newButton; + QPushButton* deleteButton; + QPushButton* buttonClose; + int i_type; + +public slots: + + void itemClicked(QListViewItem*, const QPoint&, int); + void newName(); + void deleteName(); + void nameSelectionChanged(); + +}; + +#endif diff --git a/src/qalculateeditfunctiondialog.cpp b/src/qalculateeditfunctiondialog.cpp new file mode 100644 index 0000000..f82b0cb --- /dev/null +++ b/src/qalculateeditfunctiondialog.cpp @@ -0,0 +1,799 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateeditfunctiondialog.h" +#include "qalculate_kde_utils.h" +#include "qalculateeditnamesdialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 1 +#include +#else +#include +#endif +#include +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 +#include +#else +#include +#endif +#include +#include +#include + +extern PrintOptions printops; +extern EvaluationOptions evalops; +extern tree_struct function_cats; + +QalculateEditFunctionDialog::QalculateEditFunctionDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Function"), Ok | Cancel | Help, Ok, false) { + + names_edit_dialog = NULL; + subfunctions_edit_dialog = NULL; + edited_function = NULL; + argument_edit_dialog = NULL; + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + tabs = new QTabWidget(this); +#else + tabs = new KTabWidget(this); +#endif + setMainWidget(tabs); + QWidget *page1 = new QWidget(this); + QWidget *page2 = new QWidget(this); + tabs->addTab(page1, i18n("General")); + tabs->addTab(page2, i18n("Function")); + QGridLayout *grid = new QGridLayout(page1, 1, 1, spacingHint()); + QVBoxLayout *vbox = new QVBoxLayout(page2, spacingHint()); + grid->addWidget(new QLabel(i18n("Name:"), page1), 0, 0); + nameEdit = new KLineEdit(page1); + grid->addWidget(nameEdit, 0, 1); + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 1, 1, 0, 1); + namesLabel = new QLabel(page1); + namesLabel->setAlignment(Qt::AlignRight); + namesLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hbox->addWidget(namesLabel); + namesButton = new QPushButton(i18n("Names Details"), page1); + hbox->addWidget(namesButton); + grid->addWidget(new QLabel(i18n("Category:"), page1), 2, 0); + categoryCombo = new KComboBox(page1); + categoryCombo->setMaximumWidth(250); + categoryCombo->setEditable(true); + grid->addWidget(categoryCombo, 2, 1); + grid->addWidget(new QLabel(i18n("Descriptive name:"), page1), 3, 0); + titleEdit = new KLineEdit(page1); + grid->addWidget(titleEdit, 3, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 4, 4, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + hideButton = new QCheckBox(i18n("Hide function"), page1); + hbox->addWidget(hideButton); + grid->addWidget(new QLabel(i18n("Description:"), page1), 5, 0); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 1 + descriptionEdit = new QTextEdit(page1); +#else + descriptionEdit = new KTextEdit(page1); +#endif + descriptionEdit->setTextFormat(QTextEdit::PlainText); + grid->addMultiCellWidget(descriptionEdit, 6, 6, 0, 1); + vbox->addWidget(new QLabel(i18n("Expression:"), page2)); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 1 + expressionEdit = new QTextEdit(page2); +#else + expressionEdit = new KTextEdit(page2); +#endif + expressionEdit->setTextFormat(QTextEdit::PlainText); + vbox->addWidget(expressionEdit); + hbox = new QHBoxLayout(vbox, spacingHint()); + hbox->addWidget(new QLabel(i18n("Condition:"), page2)); + conditionEdit = new KLineEdit(page2); + hbox->addWidget(conditionEdit); + hbox = new QHBoxLayout(vbox, spacingHint()); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + subFunctionsButton = new QPushButton(i18n("Sub-Functions"), page2); + hbox->addWidget(subFunctionsButton); + vbox->addWidget(new QLabel(i18n("Arguments:"), page2)); + argumentsView = new KListView(page2); + argumentsView->addColumn(i18n("Name")); + argumentsView->addColumn(i18n("Type")); + argumentsView->setSorting(-1); + argumentsView->setRootIsDecorated(false); + argumentsView->setItemsRenameable(true); + argumentsView->setItemsMovable(false); + vbox->addWidget(argumentsView); + hbox = new QHBoxLayout(vbox, spacingHint()); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + newArgumentButton = new QPushButton(i18n("New"), page2); + hbox->addWidget(newArgumentButton); + editArgumentButton = new QPushButton(i18n("Edit"), page2); + hbox->addWidget(editArgumentButton); + deleteArgumentButton = new QPushButton(i18n("Delete"), page2); + hbox->addWidget(deleteArgumentButton); + + connect(namesButton, SIGNAL(clicked()), this, SLOT(editNames())); + connect(subFunctionsButton, SIGNAL(clicked()), this, SLOT(editSubFunctions())); + connect(nameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + connect(newArgumentButton, SIGNAL(clicked()), this, SLOT(newArgument())); + connect(editArgumentButton, SIGNAL(clicked()), this, SLOT(editArgument())); + connect(deleteArgumentButton, SIGNAL(clicked()), this, SLOT(deleteArgument())); + connect(argumentsView, SIGNAL(itemRenamed(QListViewItem*, const QString&, int)), this, SLOT(argumentRenamed(QListViewItem*, const QString&, int))); + connect(argumentsView, SIGNAL(selectionChanged()), this, SLOT(argumentSelectionChanged())); + +} + +QalculateEditFunctionDialog::~QalculateEditFunctionDialog() {} + + +void QalculateEditFunctionDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-function-creation"); +} + +void QalculateEditFunctionDialog::argumentSelectionChanged() { + QListViewItem *i = argumentsView->selectedItem(); + if(i == NULL || (edited_function && edited_function->isBuiltin()) || argumentsItems[i]->type() > ARGUMENT_TYPE_ANGLE) { + editArgumentButton->setEnabled(false); + deleteArgumentButton->setEnabled(false); + } else { + editArgumentButton->setEnabled(true); + deleteArgumentButton->setEnabled(true); + } +} +void QalculateEditFunctionDialog::argumentRenamed(QListViewItem *i, const QString &str, int col) { + if(!i || col != 0) return; + if(col == 0) { + if(!argumentsItemsEdited[i]) { + argumentsItems[i] = argumentsItems[i]->copy(); + argumentsItemsEdited[i] = true; + } + argumentsItems[i]->setName(str.ascii()); + } +} + +void QalculateEditFunctionDialog::slotOk() { + + string str = nameEdit->text().ascii(); + remove_blank_ends(str); + string str2 = CALCULATOR->unlocalizeExpression(expressionEdit->text().ascii(), evalops.parse_options); + remove_blank_ends(str2); + gsub("\n", " ", str2); + if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { + //no name -- open dialog again + tabs->setCurrentPage(0); + nameEdit->setFocus(); + KMessageBox::error(this, i18n("Empty name field")); + return; + } + if(!(edited_function && edited_function->isBuiltin()) && str2.empty()) { + //no expression/relation -- open dialog again + tabs->setCurrentPage(1); + expressionEdit->setFocus(); + KMessageBox::error(this, i18n("Empty expression field")); + return; + } + //function with the same name exists -- overwrite or open dialog again + if((!edited_function || !edited_function->hasName(str)) && (!names_edit_dialog || names_edit_dialog->isEmpty()) && CALCULATOR->functionNameTaken(str, edited_function) && KMessageBox::questionYesNo(this, i18n("A function with the same name already exists.\nDo you want to overwrite it?")) == KMessageBox::No) { + tabs->setCurrentPage(0); + nameEdit->setFocus(); + return; + } + + MathFunction *f = edited_function; + + bool add_func = false; + if(f) { + f->setLocal(true); + //edited an existing function + f->setCategory(categoryCombo->lineEdit()->text().ascii()); + f->setTitle(titleEdit->text().ascii()); + f->setDescription(descriptionEdit->text().ascii()); + } else { + //new function + f = new UserFunction(categoryCombo->lineEdit()->text().ascii(), "", "", true, -1, titleEdit->text().ascii(), descriptionEdit->text().ascii()); + add_func = true; + } + f->setCondition(CALCULATOR->unlocalizeExpression(conditionEdit->text().ascii(), evalops.parse_options)); + size_t index = 1; + QListViewItemIterator it(argumentsView); + while(it.current()) { + if(argumentsItemsEdited[it.current()]) { + if(f->isBuiltin() && f->getArgumentDefinition(index)) { + f->getArgumentDefinition(index)->setName(argumentsItems[it.current()]->name()); + delete argumentsItems[it.current()]; + } else { + f->setArgumentDefinition(index, argumentsItems[it.current()]); + } + } + ++it; + index++; + } + if(!f->isBuiltin()) { + for(; index <= f->lastArgumentDefinitionIndex(); index++) { + f->setArgumentDefinition(index, NULL); + } + } + argumentsItemsEdited.clear(); + argumentsItems.clear(); + f->setHidden(hideButton->isChecked()); + if(!f->isBuiltin()) { + if(names_edit_dialog) { + names_edit_dialog->saveNames(f, str.c_str()); + } else { + if(f->countNames() == 0) { + ExpressionName ename(str); + ename.reference = true; + f->setName(ename, 1); + } else { + f->setName(str, 1); + } + } + if(subfunctions_edit_dialog) { + subfunctions_edit_dialog->saveSubFunctions((UserFunction*) f); + } + ((UserFunction*) f)->setFormula(str2); + } + if(add_func) { + CALCULATOR->addFunction(f); + } + edited_function = f; + + accept(); + +} + +MathFunction *QalculateEditFunctionDialog::editFunction(QString category, MathFunction *f) { + + nameEdit->setFocus(); + + tabs->setCurrentPage(0); + if(names_edit_dialog) { + delete names_edit_dialog; + names_edit_dialog = NULL; + } + if(subfunctions_edit_dialog) { + delete subfunctions_edit_dialog; + subfunctions_edit_dialog = NULL; + } + edited_function = f; + if(f) { + if(f->isLocal()) + setCaption(i18n("Edit Function")); + else + setCaption(i18n("Edit Function (global)")); + } else { + setCaption(i18n("New Function")); + } + + QString catstr; + categoryCombo->clear(); + tree_struct *item, *item2; + function_cats.it = function_cats.items.begin(); + if(function_cats.it != function_cats.items.end()) { + item = &*function_cats.it; + ++function_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + + catstr = ""; + while(item) { + if(!catstr.isEmpty()) catstr += "/"; + catstr += item->item.c_str(); + categoryCombo->insertItem(catstr); + while(item && item->it == item->items.end()) { + int str_i = catstr.findRev("/"); + if(str_i < 0) { + catstr = ""; + } else { + catstr.truncate(str_i); + } + item = item->parent; + } + if(item) { + item2 = &*item->it; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + + //clear entries + nameEdit->clear(); + namesLabel->clear(); + conditionEdit->clear(); + nameEdit->setReadOnly(f && f->isBuiltin()); + expressionEdit->setEnabled(!f || !f->isBuiltin()); + categoryCombo->lineEdit()->setText(category); + titleEdit->clear(); + descriptionEdit->clear(); + expressionEdit->clear(); + hideButton->setChecked(false); + actionButton(Ok)->setEnabled(true); + subFunctionsButton->setEnabled(!f || !f->isBuiltin()); + conditionEdit->setReadOnly(f && f->isBuiltin()); + newArgumentButton->setEnabled(!f || !f->isBuiltin()); + if(f) { + //fill in original paramaters + set_name_label_and_entry(f, nameEdit, namesLabel); + if(!f->isBuiltin()) { + expressionEdit->setText(CALCULATOR->localizeExpression(((UserFunction*) f)->formula()).c_str()); + } + categoryCombo->lineEdit()->setText(f->category().c_str()); + titleEdit->setText(f->title(false).c_str()); + conditionEdit->setText(CALCULATOR->localizeExpression(f->condition()).c_str()); + hideButton->setChecked(f->isHidden()); + descriptionEdit->setText(f->description().c_str()); + + } + argumentsView->clear(); + argumentsItems.clear(); + argumentsItemsEdited.clear(); + editArgumentButton->setEnabled(false); + deleteArgumentButton->setEnabled(false); + Argument defarg; + if(f) { + Argument *arg; + int args = f->maxargs(); + if(args < 0) { + args = f->minargs() + 1; + } + QString str, str2; + QListViewItem *i_prev = NULL; + for(int i = 1; i <= args; i++) { + arg = f->getArgumentDefinition(i); + if(arg) { + arg = arg->copy(); + str = arg->printlong().c_str(); + str2 = arg->name().c_str(); + } else { + arg = &defarg; + str = defarg.printlong().c_str(); + str2 = ""; + } + QListViewItem *i = new KListViewItem(argumentsView, i_prev, str2, str); + i_prev = i; + argumentsItems[i] = arg; + argumentsItemsEdited[i] = false; + } + } + argumentsView->setResizeMode(KListView::AllColumns); + + if(exec() == QDialog::Accepted) { + f = edited_function; + edited_function = NULL; + return f; + } + QListViewItemIterator it(argumentsView); + while(it.current()) { + if(argumentsItemsEdited[it.current()]) { + delete argumentsItems[it.current()]; + } + ++it; + } + argumentsItemsEdited.clear(); + argumentsItems.clear(); + edited_function = NULL; + return NULL; +} + +void QalculateEditFunctionDialog::editNames() { + if(!names_edit_dialog) { + names_edit_dialog = new QalculateEditNamesDialog(TYPE_FUNCTION, this); + names_edit_dialog->setNames(edited_function, nameEdit->text(), false); + } else { + names_edit_dialog->setNames(edited_function, nameEdit->text(), true); + } + names_edit_dialog->exec(); + names_edit_dialog->setNamesLE(nameEdit, namesLabel); +} +void QalculateEditFunctionDialog::newArgument() { + if(!argument_edit_dialog) { + argument_edit_dialog = new QalculateEditArgumentDialog(this); + } + Argument *arg = argument_edit_dialog->editArgument(); + if(arg) { + QListViewItem *i = new KListViewItem(argumentsView, argumentsView->lastChild(), arg->name().c_str(), arg->printlong().c_str()); + argumentsItems[i] = arg; + argumentsItemsEdited[i] = true; + } +} +void QalculateEditFunctionDialog::editArgument() { + QListViewItem *i = argumentsView->selectedItem(); + if(i == NULL) return; + if(!argument_edit_dialog) { + argument_edit_dialog = new QalculateEditArgumentDialog(this); + } + Argument *arg = argument_edit_dialog->editArgument(argumentsItems[i]); + if(arg) { + if(argumentsItemsEdited[i]) { + delete argumentsItems[i]; + } + argumentsItemsEdited[i] = true; + argumentsItems[i] = arg; + i->setText(0, arg->name().c_str()); + i->setText(1, arg->printlong().c_str()); + } +} +void QalculateEditFunctionDialog::deleteArgument() { + QListViewItem *i = argumentsView->selectedItem(); + if(i == NULL) return; + if(argumentsItemsEdited[i]) { + delete argumentsItems[i]; + } + argumentsItemsEdited.erase(i); + argumentsItems.erase(i); + argumentsView->removeItem(i); +} +void QalculateEditFunctionDialog::editSubFunctions() { + if(edited_function && edited_function->isBuiltin()) return; + if(!subfunctions_edit_dialog) { + subfunctions_edit_dialog = new QalculateEditSubFunctionsDialog(this); + subfunctions_edit_dialog->setSubFunctions((UserFunction*) edited_function, false); + } else { + subfunctions_edit_dialog->setSubFunctions((UserFunction*) edited_function, true); + } + subfunctions_edit_dialog->exec(); +} + +void QalculateEditFunctionDialog::nameChanged(const QString &name) { + if(name.isNull()) return; + if(!CALCULATOR->functionNameIsValid(name.ascii())) { + nameEdit->blockSignals(true); + nameEdit->setText(CALCULATOR->convertToValidFunctionName(name.ascii()).c_str()); + nameEdit->blockSignals(false); + } +} + +QalculateEditSubFunctionsDialog::QalculateEditSubFunctionsDialog(QWidget *parent, const char *name) : KDialog(parent, name, true) { + + setCaption(i18n("Sub-Functions")); + + QVBoxLayout *layout = new QVBoxLayout(this, marginHint(), spacingHint()); + + subFunctionsView = new KListView(this); + subFunctionsView->addColumn(i18n("Reference")); + subFunctionsView->addColumn(i18n("Expression")); + subFunctionsView->addColumn(i18n("Precalculate")); + subFunctionsView->setSorting(-1); + subFunctionsView->setItemsRenameable(true); + subFunctionsView->setRenameable(0, false); + subFunctionsView->setRenameable(1, true); + subFunctionsView->setItemsMovable(false); + layout->addWidget(subFunctionsView); + + QHBoxLayout *buttonLayout = new QHBoxLayout(layout, spacingHint()); + newButton = new QPushButton(i18n("New"), this); + buttonLayout->addWidget(newButton); + deleteButton = new QPushButton(i18n("Delete"), this); + deleteButton->setEnabled(false); + buttonLayout->addWidget(deleteButton); + buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + buttonClose = new KPushButton(KStdGuiItem::close(), this); + buttonClose->setAutoDefault(true); + buttonClose->setDefault(true); + buttonLayout->addWidget(buttonClose); + + connect(subFunctionsView, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); + connect(buttonClose, SIGNAL(clicked()), this, SLOT(accept())); + connect(newButton, SIGNAL(clicked()), this, SLOT(newSubFunction())); + connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteSubFunction())); + connect(subFunctionsView, SIGNAL(clicked(QListViewItem*, const QPoint&, int)), this, SLOT(itemClicked(QListViewItem*, const QPoint&, int))); +} + +QalculateEditSubFunctionsDialog::~QalculateEditSubFunctionsDialog() {} + +void QalculateEditSubFunctionsDialog::newSubFunction() { + ExpressionName name; + QString str = "\\"; + str += QString::number(subFunctionsView->childCount() + 1); + QListViewItem *i = new KListViewItem(subFunctionsView, subFunctionsView->lastChild(), str, "", i18n("Yes")); + subFunctionsView->setSelected(i, true); + qApp->processEvents(); + subFunctionsView->rename(i, 1); +} + +void QalculateEditSubFunctionsDialog::setSubFunctions(UserFunction *f, bool edited) { + if(!edited) { + deleteButton->setEnabled(false); + subFunctionsView->clear(); + } + if(!edited && f && f->countSubfunctions() > 0) { + QListViewItem *i_prev = NULL; + for(size_t index = 1; index <= f->countSubfunctions(); index++) { + QListViewItem *i = new KListViewItem(subFunctionsView, i_prev); + i_prev = i; + QString str = "\\"; + str += QString::number(index); + i->setText(0, str); + i->setText(1, f->getSubfunction(index).c_str()); + if(f->subfunctionPrecalculated(index)) i->setText(2, i18n("Yes")); + else i->setText(2, i18n("No")); + } + } +} +void QalculateEditSubFunctionsDialog::saveSubFunctions(UserFunction *f) { + f->clearSubfunctions(); + QListViewItemIterator it(subFunctionsView); + while(it.current()) { + f->addSubfunction(it.current()->text(1).ascii(), it.current()->text(2) == i18n("Yes")); + ++it; + } +} +bool QalculateEditSubFunctionsDialog::isEmpty() { + return subFunctionsView->childCount() <= 0; +} + +void QalculateEditSubFunctionsDialog::deleteSubFunction() { + subFunctionsView->removeItem(subFunctionsView->selectedItem()); + QListViewItemIterator it(subFunctionsView); + int index = 1; + while(it.current()) { + QString str = "\\"; + str += QString::number(index); + it.current()->setText(0, str); + ++it; + index++; + } +} + +void QalculateEditSubFunctionsDialog::itemClicked(QListViewItem *i, const QPoint &, int c) { + if(i && c == 2) { + if(i->text(c) == i18n("Yes")) + i->setText(c, i18n("No")); + else + i->setText(c, i18n("Yes")); + } +} + +void QalculateEditSubFunctionsDialog::selectionChanged() { + deleteButton->setEnabled(subFunctionsView->selectedItem() != NULL); +} + +QalculateEditArgumentDialog::QalculateEditArgumentDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Argument"), Ok | Cancel, Ok, true) { + + setMainWidget(new QWidget(this)); + QGridLayout *grid = new QGridLayout(mainWidget(), 1, 1, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("Name:"), mainWidget()), 0, 0); + nameEdit = new KLineEdit(mainWidget()); + grid->addWidget(nameEdit, 0, 1); + grid->addWidget(new QLabel(i18n("Type:"), mainWidget()), 1, 0); + typeCombo = new KComboBox(mainWidget()); + typeCombo->setEditable(false); + typeCombo->insertItem(i18n("Free")); + typeCombo->insertItem(i18n("Number")); + typeCombo->insertItem(i18n("Integer")); + typeCombo->insertItem(i18n("Symbol")); + typeCombo->insertItem(i18n("Text")); + typeCombo->insertItem(i18n("Date")); + typeCombo->insertItem(i18n("Vector")); + typeCombo->insertItem(i18n("Matrix")); + typeCombo->insertItem(i18n("Boolean")); + typeCombo->insertItem(i18n("Object")); + typeCombo->insertItem(i18n("Function")); + typeCombo->insertItem(i18n("Unit")); + typeCombo->insertItem(i18n("Variable")); + typeCombo->insertItem(i18n("File")); + typeCombo->insertItem(i18n("Angle")); + grid->addWidget(typeCombo, 1, 1); + testButton = new QCheckBox(i18n("Enable rules and type test"), mainWidget()); + grid->addMultiCellWidget(testButton, 2, 2, 0, 1); + conditionButton = new QCheckBox(i18n("Custom condition:"), mainWidget()); + grid->addWidget(conditionButton, 3, 0); + conditionEdit = new KLineEdit(mainWidget()); + grid->addWidget(conditionEdit, 3, 1); + matrixButton = new QCheckBox(i18n("Allow matrix"), mainWidget()); + grid->addMultiCellWidget(matrixButton, 4, 4, 0, 1); + zeroButton = new QCheckBox(i18n("Forbid zero"), mainWidget()); + grid->addMultiCellWidget(zeroButton, 5, 5, 0, 1); + complexButton = new QCheckBox(i18n("Allow complex"), mainWidget()); + grid->addMultiCellWidget(complexButton, 6, 6, 0, 1); + minButton = new QCheckBox(i18n("Min:"), mainWidget()); + grid->addWidget(minButton, 7, 0); + minEdit = new KLineEdit(mainWidget()); + grid->addWidget(minEdit, 7, 1); + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 8, 8, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + minIncludeEqualsButton = new QCheckBox(i18n("Include equals"), mainWidget()); + hbox->addWidget(minIncludeEqualsButton); + maxButton = new QCheckBox(i18n("Max:"), mainWidget()); + grid->addWidget(maxButton, 9, 0); + maxEdit = new KLineEdit(mainWidget()); + grid->addWidget(maxEdit, 9, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 10, 10, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + maxIncludeEqualsButton = new QCheckBox(i18n("Include equals"), mainWidget()); + hbox->addWidget(maxIncludeEqualsButton); + + connect(conditionButton, SIGNAL(toggled(bool)), conditionEdit, SLOT(setEnabled(bool))); + connect(minButton, SIGNAL(toggled(bool)), this, SLOT(minEnabled(bool))); + connect(maxButton, SIGNAL(toggled(bool)), this, SLOT(maxEnabled(bool))); + connect(typeCombo, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); + +} + +QalculateEditArgumentDialog::~QalculateEditArgumentDialog() {} + +void QalculateEditArgumentDialog::typeChanged(int i) { + maxButton->setEnabled(i == 1 || i == 2); + maxEdit->setEnabled(maxButton->isChecked() && (i == 1 || i == 2)); + maxIncludeEqualsButton->setEnabled(maxButton->isChecked() && i == 1); + maxIncludeEqualsButton->setChecked(i == 1 || i == 2); + minButton->setEnabled(i == 1 || i == 2); + minEdit->setEnabled(maxButton->isChecked() && (i == 1 || i == 2)); + minIncludeEqualsButton->setEnabled(minButton->isChecked() && i == 1); + minIncludeEqualsButton->setChecked(i == 1 || i == 2); + matrixButton->setEnabled(i != 7 && i != 0); + matrixButton->setChecked(i == 7 || i == 0); + complexButton->setEnabled(i == 1); + complexButton->setChecked(i == 1); +} +void QalculateEditArgumentDialog::maxEnabled(bool b) { + maxEdit->setEnabled(b); + if(typeCombo->currentItem() == 2) { + maxIncludeEqualsButton->setEnabled(b); + } +} +void QalculateEditArgumentDialog::minEnabled(bool b) { + minEdit->setEnabled(b); + if(typeCombo->currentItem() == 2) { + minIncludeEqualsButton->setEnabled(b); + } +} + +Argument *QalculateEditArgumentDialog::editArgument(Argument *arg) { + + if(arg) { + setCaption(i18n("Edit Argument")); + } else { + setCaption(i18n("New Argument")); + } + + nameEdit->setFocus(); + + typeCombo->setCurrentItem(0); + conditionEdit->clear(); + conditionButton->setChecked(false); + nameEdit->clear(); + maxEdit->setText("0"); + minEdit->setText("0"); + testButton->setChecked(true); + zeroButton->setChecked(false); + matrixButton->setChecked(false); + complexButton->setChecked(false); + PrintOptions po; + po.number_fraction_format = FRACTION_DECIMAL_EXACT; + if(arg) { + switch(arg->type()) { + case ARGUMENT_TYPE_NUMBER: { + typeCombo->setCurrentItem(1); + NumberArgument *farg = (NumberArgument*) arg; + minButton->setChecked(farg->min() != NULL); + minIncludeEqualsButton->setChecked(farg->includeEqualsMin()); + if(farg->min()) minEdit->setText(farg->min()->print(po).c_str()); + maxButton->setChecked(farg->max() != NULL); + maxIncludeEqualsButton->setChecked(farg->includeEqualsMax()); + if(farg->max()) maxEdit->setText(farg->max()->print(po).c_str()); + complexButton->setChecked(farg->complexAllowed()); + break; + } + case ARGUMENT_TYPE_INTEGER: { + typeCombo->setCurrentItem(2); + IntegerArgument *iarg = (IntegerArgument*) arg; + minButton->setChecked(iarg->min() != NULL); + if(iarg->min()) minEdit->setText(iarg->min()->print(po).c_str()); + maxButton->setChecked(iarg->max() != NULL); + if(iarg->max()) maxEdit->setText(iarg->max()->print(po).c_str()); + break; + } + case ARGUMENT_TYPE_TEXT: {typeCombo->setCurrentItem(4); break;} + case ARGUMENT_TYPE_SYMBOLIC: {typeCombo->setCurrentItem(3); break;} + case ARGUMENT_TYPE_DATE: {typeCombo->setCurrentItem(5); break;} + case ARGUMENT_TYPE_VECTOR: {typeCombo->setCurrentItem(6); break;} + case ARGUMENT_TYPE_MATRIX: {typeCombo->setCurrentItem(7); break;} + case ARGUMENT_TYPE_EXPRESSION_ITEM: {typeCombo->setCurrentItem(9); break;} + case ARGUMENT_TYPE_FUNCTION: {typeCombo->setCurrentItem(10); break;} + case ARGUMENT_TYPE_UNIT: {typeCombo->setCurrentItem(11); break;} + case ARGUMENT_TYPE_VARIABLE: {typeCombo->setCurrentItem(12); break;} + case ARGUMENT_TYPE_FILE: {typeCombo->setCurrentItem(13); break;} + case ARGUMENT_TYPE_BOOLEAN: {typeCombo->setCurrentItem(8); break;} + case ARGUMENT_TYPE_ANGLE: {typeCombo->setCurrentItem(14); break;} + } + nameEdit->setText(arg->name().c_str()); + matrixButton->setChecked(arg->matrixAllowed()); + zeroButton->setChecked(arg->zeroForbidden()); + testButton->setChecked(arg->tests()); + if(!arg->getCustomCondition().empty()) { + conditionButton->setChecked(true); + conditionEdit->setText(arg->getCustomCondition().c_str()); + } + } + typeChanged(typeCombo->currentItem()); + + if(exec() == QDialog::Accepted) { + switch(typeCombo->currentItem()) { + case 1: { + arg = new NumberArgument(); + if(minButton->isChecked()) { + Number nr(minEdit->text().ascii()); + ((NumberArgument*) arg)->setMin(&nr); + } + ((NumberArgument*) arg)->setIncludeEqualsMin(minIncludeEqualsButton->isChecked()); + if(maxButton->isChecked()) { + Number nr(maxEdit->text().ascii()); + ((NumberArgument*) arg)->setMax(&nr); + } + ((NumberArgument*) arg)->setIncludeEqualsMax(maxIncludeEqualsButton->isChecked()); + break; + } + case 2: { + arg = new IntegerArgument(); + if(minButton->isChecked()) { + Number nr(minEdit->text().ascii()); + ((IntegerArgument*) arg)->setMin(&nr); + } + if(maxButton->isChecked()) { + Number nr(maxEdit->text().ascii()); + ((IntegerArgument*) arg)->setMax(&nr); + } + break; + } + case 3: {arg = new SymbolicArgument(); break;} + case 4: {arg = new TextArgument(); break;} + case 5: {arg = new DateArgument(); break;} + case 6: {arg = new VectorArgument(); break;} + case 7: {arg = new MatrixArgument(); break;} + case 8: {arg = new BooleanArgument(); break;} + case 9: {arg = new ExpressionItemArgument(); break;} + case 10: {arg = new FunctionArgument(); break;} + case 11: {arg = new UnitArgument(); break;} + case 12: {arg = new VariableArgument(); break;} + case 13: {arg = new FileArgument(); break;} + case 14: {arg = new AngleArgument(); break;} + default: {arg = new Argument(); break;} + } + arg->setName(nameEdit->text().ascii()); + arg->setZeroForbidden(zeroButton->isChecked()); + arg->setTests(testButton->isChecked()); + if(conditionButton->isChecked()) { + arg->setCustomCondition(conditionEdit->text().ascii()); + } else { + arg->setCustomCondition(""); + } + if(arg->type() != ARGUMENT_TYPE_FREE && arg->type() != ARGUMENT_TYPE_MATRIX) arg->setMatrixAllowed(matrixButton->isChecked()); + return arg; + } + return NULL; + +} + +#include "qalculateeditfunctiondialog.moc" + diff --git a/src/qalculateeditfunctiondialog.h b/src/qalculateeditfunctiondialog.h new file mode 100644 index 0000000..ecd322d --- /dev/null +++ b/src/qalculateeditfunctiondialog.h @@ -0,0 +1,140 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEDITFUNCTIONDIALOG_H +#define QALCULATEEDITFUNCTIONDIALOG_H + +#include +#include + +class QLabel; +class KComboBox; +class KLineEdit; +class QCheckBox; +class QPushButton; +class MathStructure; +class QalculateEditNamesDialog; +class QalculateEditSubFunctionsDialog; +class QalculateEditArgumentDialog; +class MathFunction; +class KListView; +class QTextEdit; +class Argument; +class QTabWidget; +class UserFunction; + +/** +@author Niklas Knutsson +*/ +class QalculateEditFunctionDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateEditFunctionDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditFunctionDialog(); + + MathFunction *editFunction(QString category = QString::null, MathFunction *f = NULL); + + QalculateEditNamesDialog *names_edit_dialog; + QalculateEditSubFunctionsDialog *subfunctions_edit_dialog; + QalculateEditArgumentDialog *argument_edit_dialog; + MathFunction *edited_function; + KComboBox *categoryCombo; + KLineEdit *conditionEdit, *nameEdit, *titleEdit; + QLabel *namesLabel; + QCheckBox *hideButton; + KListView *argumentsView; + QTextEdit *descriptionEdit, *expressionEdit; + QPushButton *namesButton, *subFunctionsButton, *newArgumentButton, *editArgumentButton, *deleteArgumentButton; + QTabWidget *tabs; + QMap argumentsItems; + QMap argumentsItemsEdited; + +public slots: + + void argumentSelectionChanged(); + void argumentRenamed(QListViewItem*, const QString&, int); + void editNames(); + void newArgument(); + void editArgument(); + void deleteArgument(); + void editSubFunctions(); + void nameChanged(const QString&); + +protected slots: + + void slotHelp(); + void slotOk(); + +}; + +class QalculateEditSubFunctionsDialog : public KDialog { + + Q_OBJECT + +public: + + QalculateEditSubFunctionsDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditSubFunctionsDialog(); + + void saveSubFunctions(UserFunction *f); + void setSubFunctions(UserFunction *f = NULL, bool edited = false); + bool isEmpty(); + + KListView* subFunctionsView; + QPushButton* newButton; + QPushButton* deleteButton; + QPushButton* buttonClose; + +public slots: + + void itemClicked(QListViewItem*, const QPoint&, int); + void newSubFunction(); + void deleteSubFunction(); + void selectionChanged(); + +}; + +class QalculateEditArgumentDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateEditArgumentDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditArgumentDialog(); + + Argument *editArgument(Argument *arg = NULL); + + KComboBox *typeCombo; + KLineEdit *nameEdit, *conditionEdit, *maxEdit, *minEdit; + QCheckBox *conditionButton, *matrixButton, *zeroButton, *complexButton, *maxButton, *minButton, *maxIncludeEqualsButton, *minIncludeEqualsButton, *testButton; + +public slots: + + void maxEnabled(bool); + void minEnabled(bool); + void typeChanged(int); + +}; + + +#endif diff --git a/src/qalculateeditmatrixvectordialog.cpp b/src/qalculateeditmatrixvectordialog.cpp new file mode 100644 index 0000000..1dccb03 --- /dev/null +++ b/src/qalculateeditmatrixvectordialog.cpp @@ -0,0 +1,491 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateeditmatrixvectordialog.h" +#include "qalculate_kde_utils.h" +#include "qalculateeditnamesdialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern PrintOptions printops; +extern EvaluationOptions evalops; +extern tree_struct variable_cats; + +class QalculateEditMatrixVectorTableItem : public QTableItem { + + public: + + QalculateEditMatrixVectorTableItem(QTable *table); + QalculateEditMatrixVectorTableItem(QTable *table, const QString & text); + + int alignment() const; + +}; + +class QalculateEditMatrixTable : public QTable { + + public: + + QalculateEditMatrixTable(QWidget *parent = 0, const char *name = 0) : QTable(parent, name) {} + QalculateEditMatrixTable(int numRows, int numCols, QWidget *parent = 0, const char *name = 0) : QTable(numRows, numCols, parent, name) {} + + QWidget *beginEdit(int row, int col, bool replace) { + QWidget *w = QTable::beginEdit(row, col, replace); + ((QLineEdit*) w)->selectAll(); + return w; + } + +}; + +QalculateEditMatrixVectorDialog::QalculateEditMatrixVectorDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Variable"), Ok | Cancel | Help, Ok, true) { + + names_edit_dialog = NULL; + edited_variable = NULL; + + setMainWidget(new QWidget(this)); + QGridLayout *grid = new QGridLayout(mainWidget(), 1, 1, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("Name:"), mainWidget()), 0, 0); + nameEdit = new KLineEdit(mainWidget()); + grid->addWidget(nameEdit, 0, 1); + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 1, 1, 0, 1); + namesLabel = new QLabel(mainWidget()); + namesLabel->setAlignment(Qt::AlignRight); + namesLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hbox->addWidget(namesLabel); + namesButton = new QPushButton(i18n("Names Details"), mainWidget()); + hbox->addWidget(namesButton); + grid->addWidget(new QLabel(i18n("Category:"), mainWidget()), 2, 0); + categoryCombo = new KComboBox(mainWidget()); + categoryCombo->setEditable(true); + grid->addWidget(categoryCombo, 2, 1); + grid->addWidget(new QLabel(i18n("Descriptive name:"), mainWidget()), 3, 0); + titleEdit = new KLineEdit(mainWidget()); + grid->addWidget(titleEdit, 3, 1); + grid->addWidget(new QLabel(i18n("Rows:"), mainWidget()), 4, 0); + rowsBox = new QSpinBox(1, 1000, 1, mainWidget()); + grid->addWidget(rowsBox, 4, 1); + grid->addWidget(new QLabel(i18n("Columns:"), mainWidget()), 5, 0); + columnsBox = new QSpinBox(1, 1000, 1, mainWidget()); + grid->addWidget(columnsBox, 5, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 6, 6, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + QButtonGroup *group = new QButtonGroup(); + matrixButton = new QRadioButton(i18n("Matrix"), mainWidget()); + group->insert(matrixButton, 0); + hbox->addWidget(matrixButton); + vectorButton = new QRadioButton(i18n("Vector"), mainWidget()); + group->insert(vectorButton, 1); + hbox->addWidget(vectorButton); + elementsLabel = new QLabel(i18n("Elements:"), mainWidget()); + grid->addMultiCellWidget(elementsLabel, 7, 7, 0, 1); + elementsTable = new QalculateEditMatrixTable(0, 0, mainWidget()); + grid->addMultiCellWidget(elementsTable, 8, 8, 0, 1); + + connect(namesButton, SIGNAL(clicked()), this, SLOT(editNames())); + connect(nameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + connect(rowsBox, SIGNAL(valueChanged(int)), this, SLOT(rowsChanged(int))); + connect(columnsBox, SIGNAL(valueChanged(int)), this, SLOT(columnsChanged(int))); + connect(group, SIGNAL(clicked(int)), this, SLOT(typeChanged(int))); + +} + +QalculateEditMatrixVectorDialog::~QalculateEditMatrixVectorDialog() {} + +void QalculateEditMatrixVectorDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-vectors-matrices"); +} + +void QalculateEditMatrixVectorDialog::typeChanged(int i) { + if(i == 0) { + elementsLabel->setText(i18n("Elements:")); + bool b = true; + for(int index_r = elementsTable->numRows() - 1; index_r >= 0 && b; index_r--) { + for(int index_c = elementsTable->numCols() - 1; index_c >= 0; index_c--) { + if(elementsTable->text(index_r, index_c).isEmpty()) { + elementsTable->setText(index_r, index_c, "0"); + } else { + b = false; + break; + } + } + } + } else { + elementsLabel->setText(i18n("Elements (in horizontal order):")); + } +} +void QalculateEditMatrixVectorDialog::rowsChanged(int i) { + int r = elementsTable->numRows(); + elementsTable->setNumRows(i); + bool b = matrixButton->isChecked(); + for(int index_r = r; index_r < i; index_r++) { + for(int index_c = 0; index_c < elementsTable->numCols(); index_c++) { + if(b) elementsTable->setItem(index_r, index_c, new QalculateEditMatrixVectorTableItem(elementsTable, "0")); + else elementsTable->setItem(index_r, index_c, new QalculateEditMatrixVectorTableItem(elementsTable)); + } + } +} +void QalculateEditMatrixVectorDialog::columnsChanged(int i) { + int c = elementsTable->numCols(); + elementsTable->setNumCols(i); + bool b = matrixButton->isChecked(); + for(int index_r = 0; index_r < elementsTable->numRows(); index_r++) { + for(int index_c = c; index_c < i; index_c++) { + if(b) elementsTable->setItem(index_r, index_c, new QalculateEditMatrixVectorTableItem(elementsTable, "0")); + else elementsTable->setItem(index_r, index_c, new QalculateEditMatrixVectorTableItem(elementsTable)); + } + } +} + +KnownVariable *QalculateEditMatrixVectorDialog::newVector(QString category) { + return editVariable(category, NULL, NULL, false, true); +} +KnownVariable *QalculateEditMatrixVectorDialog::newMatrix(QString category) { + return editVariable(category, NULL, NULL, false, false); +} + +void QalculateEditMatrixVectorDialog::slotOk() { + string str = nameEdit->text().ascii(); + remove_blank_ends(str); + if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { + //no name -- open dialog again + nameEdit->setFocus(); + KMessageBox::error(this, i18n("Empty name field")); + return; + } + //variable with the same name exists -- overwrite or open dialog again + if((!edited_variable || !edited_variable->hasName(str)) && (!names_edit_dialog || names_edit_dialog->isEmpty()) && CALCULATOR->variableNameTaken(str, edited_variable) && KMessageBox::questionYesNo(this, i18n("An unit or variable with the same name already exists.\nDo you want to overwrite it?")) == KMessageBox::No) { + nameEdit->setFocus(); + return; + } + KnownVariable *v = edited_variable; + if(!v) { + //no need to create a new variable when a variable with the same name exists + Variable *var = CALCULATOR->getActiveVariable(str); + if(var && var->isLocal() && var->isKnown()) v = (KnownVariable*) var; + } + MathStructure mstruct_new; + if(!init_value) { + int r = rowsBox->value(); + int c = columnsBox->value(); + if(vectorButton->isChecked()) { + mstruct_new.clearVector(); + string str2; + for(int index_r = 0; index_r < r; index_r++) { + for(int index_c = 0; index_c < c; index_c++) { + if(!elementsTable->text(index_r, index_c).isEmpty()) { + str2 = elementsTable->text(index_r, index_c).ascii(); + remove_blank_ends(str2); + if(!str2.empty()) { + mstruct_new.addChild(CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(str2, evalops.parse_options))); + } + } + } + } + } else { + mstruct_new.clearMatrix(); + mstruct_new.resizeMatrix(r, c, m_undefined); + for(int index_r = 0; index_r < r; index_r++) { + for(int index_c = 0; index_c < c; index_c++) { + if(elementsTable->text(index_r, index_c).isEmpty()) mstruct_new.setElement(m_zero, index_r + 1, index_c + 1); + else mstruct_new.setElement(CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(elementsTable->text(index_r, index_c).ascii(), evalops.parse_options)), index_r + 1, index_c + 1); + } + } + } + } + bool add_var = false; + if(v) { + //update existing variable + v->setLocal(true); + if(!v->isBuiltin()) { + if(init_value) { + v->set(*init_value); + } else { + v->set(mstruct_new); + } + } + } else { + //new variable + if(force_init_value && init_value) { + //forced value + v = new KnownVariable("", "", *init_value, "", true); + } else { + v = new KnownVariable("", "", mstruct_new, "", true); + } + add_var = true; + } + v->setCategory(categoryCombo->lineEdit()->text().ascii()); + v->setTitle(titleEdit->text().ascii()); + if(!v->isBuiltin()) { + if(names_edit_dialog) { + names_edit_dialog->saveNames(v, str.c_str()); + } else { + if(v->countNames() == 0) { + ExpressionName ename(str); + ename.reference = true; + v->setName(ename, 1); + } else { + v->setName(str, 1); + } + } + } + if(add_var) { + CALCULATOR->addVariable(v); + } + edited_variable = v; + accept(); +} + +KnownVariable *QalculateEditMatrixVectorDialog::editVariable(QString category, KnownVariable *v, MathStructure *initial_value, bool force_value, bool create_vector) { + + nameEdit->setFocus(); + + if((v && !v->get().isVector()) || (initial_value && !initial_value->isVector())) { + return NULL; + } + + if(names_edit_dialog) { + delete names_edit_dialog; + names_edit_dialog = NULL; + } + edited_variable = v; + + if(initial_value) { + create_vector = !initial_value->isMatrix(); + } else if(v) { + create_vector = !v->get().isMatrix(); + } + if(create_vector) { + vectorButton->setChecked(true); + elementsLabel->setText(i18n("Elements (in horizontal order):")); + } else { + matrixButton->setChecked(true); + elementsLabel->setText(i18n("Elements:")); + } + + if(create_vector) { + if(v) { + if(v->isLocal()) + setCaption(i18n("Edit Vector")); + else + setCaption(i18n("Edit Vector (global)")); + } else { + setCaption(i18n("New Vector")); + } + } else { + if(v) { + if(v->isLocal()) + setCaption(i18n("Edit Matrix")); + else + setCaption(i18n("Edit Matrix (global)")); + } else { + setCaption(i18n("New Matrix")); + } + } + + actionButton(Ok)->setEnabled(true); + + namesLabel->setText(""); + + //QStringList cats; + QString catstr; + categoryCombo->clear(); + tree_struct *item, *item2; + variable_cats.it = variable_cats.items.begin(); + if(variable_cats.it != variable_cats.items.end()) { + item = &*variable_cats.it; + ++variable_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + + catstr = ""; + while(item) { + if(!catstr.isEmpty()) catstr += "/"; + catstr += item->item.c_str(); + categoryCombo->insertItem(catstr); + while(item && item->it == item->items.end()) { + int str_i = catstr.findRev("/"); + if(str_i < 0) { + catstr = ""; + } else { + catstr.truncate(str_i); + } + item = item->parent; + } + if(item) { + item2 = &*item->it; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + + int r = 4, c = 4; + const MathStructure *old_vctr = NULL; + if(v) { + if(create_vector) { + old_vctr = &v->get(); + } else { + c = v->get().columns(); + r = v->get().rows(); + } + set_name_label_and_entry(v, nameEdit, namesLabel); + nameEdit->setReadOnly(v->isBuiltin()); + rowsBox->setEnabled(!v->isBuiltin()); + columnsBox->setEnabled(!v->isBuiltin()); + matrixButton->setEnabled(!v->isBuiltin()); + vectorButton->setEnabled(!v->isBuiltin()); + elementsTable->setReadOnly(v->isBuiltin()); + categoryCombo->lineEdit()->setText(v->category().c_str()); + titleEdit->setText(v->title(false).c_str()); + } else { + nameEdit->setReadOnly(false); + rowsBox->setEnabled(true); + columnsBox->setEnabled(true); + matrixButton->setEnabled(true); + vectorButton->setEnabled(true); + elementsTable->setReadOnly(false); + + //fill in default values + nameEdit->setText(CALCULATOR->getName().c_str()); + namesLabel->setText(""); + categoryCombo->lineEdit()->setText(category); + titleEdit->setText(""); + if(force_value) { + if(create_vector) { + old_vctr = initial_value; + } else { + c = initial_value->columns(); + r = initial_value->rows(); + } + rowsBox->setEnabled(false); + columnsBox->setEnabled(false); + matrixButton->setEnabled(false); + vectorButton->setEnabled(false); + elementsTable->setReadOnly(true); + } + } + + if(create_vector) { + if(old_vctr) { + r = old_vctr->countChildren(); + c = (int) ::sqrt(r) + 4; + if(r % c > 0) { + r = r / c + 1; + } else { + r = r / c; + } + } else { + c = 4; + r = 4; + } + } + + rowsBox->setValue(r); + columnsBox->setValue(c); + elementsTable->setNumRows(r); + elementsTable->setNumCols(c); + + int timeout; + if(force_value) timeout = 3000 / (r * c); + else timeout = 3000; + PrintOptions po; + po.number_fraction_format = FRACTION_DECIMAL_EXACT; + for(int index_r = 0; index_r < r; index_r++) { + for(int index_c = 0; index_c < c; index_c++) { + if(create_vector) { + if(old_vctr && index_r * c + index_c < (int) old_vctr->countChildren()) { + elementsTable->setText(index_r, index_c, old_vctr->getChild(index_r * c + index_c + 1)->print(po).c_str()); + } else { + elementsTable->setText(index_r, index_c, ""); + } + } else { + if(v) { + elementsTable->setText(index_r, index_c, v->get().getElement(index_r + 1, index_c + 1)->print(po).c_str()); + } else if(initial_value) { + elementsTable->setText(index_r, index_c, initial_value->getElement(index_r + 1, index_c + 1)->print(po).c_str()); + } else { + elementsTable->setText(index_r, index_c, "0"); + } + } + } + } + + init_value = initial_value; + force_init_value = force_value; + + if(exec() == QDialog::Accepted) { + v = edited_variable; + edited_variable = NULL; + return v; + } + + edited_variable = NULL; + return NULL; +} + +void QalculateEditMatrixVectorDialog::editNames() { + if(!names_edit_dialog) { + names_edit_dialog = new QalculateEditNamesDialog(TYPE_VARIABLE, this); + names_edit_dialog->setNames(edited_variable, nameEdit->text(), false); + } else { + names_edit_dialog->setNames(edited_variable, nameEdit->text(), true); + } + names_edit_dialog->exec(); + names_edit_dialog->setNamesLE(nameEdit, namesLabel); +} + +void QalculateEditMatrixVectorDialog::nameChanged(const QString &name) { + if(name.isNull()) return; + if(!CALCULATOR->variableNameIsValid(name.ascii())) { + nameEdit->blockSignals(true); + nameEdit->setText(CALCULATOR->convertToValidVariableName(name.ascii()).c_str()); + nameEdit->blockSignals(false); + } +} + +#if QT_VERSION >= 0x030200 +QalculateEditMatrixVectorTableItem::QalculateEditMatrixVectorTableItem(QTable *table) : QTableItem(table, QTableItem::OnTyping) {} +#else +QalculateEditMatrixVectorTableItem::QalculateEditMatrixVectorTableItem(QTable *table) : QTableItem(table, QTableItem::OnTyping, QString::null) {} +#endif +QalculateEditMatrixVectorTableItem::QalculateEditMatrixVectorTableItem(QTable *table, const QString & text) : QTableItem(table, QTableItem::OnTyping, text) {} + +int QalculateEditMatrixVectorTableItem::alignment() const {return Qt::AlignRight;} + +#include "qalculateeditmatrixvectordialog.moc" + diff --git a/src/qalculateeditmatrixvectordialog.h b/src/qalculateeditmatrixvectordialog.h new file mode 100644 index 0000000..6ecd146 --- /dev/null +++ b/src/qalculateeditmatrixvectordialog.h @@ -0,0 +1,82 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEDITMATRIXVECTORDIALOG_H +#define QALCULATEEDITMATRIXVECTORDIALOG_H + +#include + +class QLabel; +class QSpinBox; +class QTable; +class QRadioButton; +class KComboBox; +class KLineEdit; +class QPushButton; +class MathStructure; +class QalculateEditNamesDialog; +class KnownVariable; + +/** +@author Niklas Knutsson +*/ +class QalculateEditMatrixVectorDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateEditMatrixVectorDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditMatrixVectorDialog(); + + KnownVariable *newMatrix(QString category = QString::null); + KnownVariable *newVector(QString category = QString::null); + KnownVariable *editVariable(QString category = QString::null, KnownVariable *v = NULL, MathStructure *initial_value = NULL, bool force_value = false, bool create_vector = false); + + QalculateEditNamesDialog *names_edit_dialog; + KnownVariable *edited_variable; + KComboBox *categoryCombo; + KLineEdit *nameEdit, *titleEdit; + QLabel *namesLabel, *elementsLabel; + QRadioButton *matrixButton, *vectorButton; + QTable *elementsTable; + QSpinBox *rowsBox, *columnsBox; + QPushButton *namesButton; + +private: + + MathStructure *init_value; + bool force_init_value; + +public slots: + + void typeChanged(int); + void rowsChanged(int); + void columnsChanged(int); + void editNames(); + void nameChanged(const QString&); + +protected slots: + + void slotHelp(); + void slotOk(); + +}; + +#endif diff --git a/src/qalculateeditnamesdialog.cpp b/src/qalculateeditnamesdialog.cpp new file mode 100644 index 0000000..1a79c51 --- /dev/null +++ b/src/qalculateeditnamesdialog.cpp @@ -0,0 +1,275 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateeditnamesdialog.h" +#include "qalculate_kde_utils.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +QalculateEditNamesDialog::QalculateEditNamesDialog(int item_type, QWidget *parent, const char *name) : KDialog(parent, name, true) { + + setCaption(i18n("Edit Names")); + + i_type = item_type; + + QVBoxLayout *layout = new QVBoxLayout(this, marginHint(), spacingHint()); + + namesView = new KListView(this); + namesView->addColumn(i18n("Name")); + namesView->addColumn(i18n("Abbreviation")); + namesView->setColumnAlignment(1, Qt::AlignCenter); + namesView->addColumn(i18n("Plural")); + namesView->setColumnAlignment(2, Qt::AlignCenter); + namesView->addColumn(i18n("Reference")); + namesView->setColumnAlignment(3, Qt::AlignCenter); + namesView->addColumn(i18n("Avoid Input")); + namesView->setColumnAlignment(4, Qt::AlignCenter); + namesView->addColumn(i18n("Unicode")); + namesView->setColumnAlignment(5, Qt::AlignCenter); + namesView->addColumn(i18n("Suffix")); + namesView->setColumnAlignment(6, Qt::AlignCenter); + namesView->addColumn(i18n("Case Sensitive")); + namesView->setColumnAlignment(7, Qt::AlignCenter); + namesView->setSorting(-1); + namesView->setItemsRenameable(true); + namesView->setItemsMovable(true); + namesView->setDragEnabled(true); + namesView->setAcceptDrops(true); + layout->addWidget(namesView); + + QHBoxLayout *buttonLayout = new QHBoxLayout(layout, spacingHint()); + newButton = new QPushButton(i18n("New"), this); + buttonLayout->addWidget(newButton); + deleteButton = new QPushButton(i18n("Delete"), this); + deleteButton->setEnabled(false); + buttonLayout->addWidget(deleteButton); + buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + buttonClose = new KPushButton(KStdGuiItem::close(), this); + buttonClose->setAutoDefault(true); + buttonClose->setDefault(true); + buttonLayout->addWidget(buttonClose); + + connect(namesView, SIGNAL(selectionChanged()), this, SLOT(nameSelectionChanged())); + connect(buttonClose, SIGNAL(clicked()), this, SLOT(accept())); + connect(newButton, SIGNAL(clicked()), this, SLOT(newName())); + connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteName())); + connect(namesView, SIGNAL(clicked(QListViewItem*, const QPoint&, int)), this, SLOT(itemClicked(QListViewItem*, const QPoint&, int))); + connect(namesView->renameLineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + +} + +QalculateEditNamesDialog::~QalculateEditNamesDialog() {} + +void QalculateEditNamesDialog::newName() { + ExpressionName name; + QListViewItem *i = new KListViewItem(namesView, namesView->lastChild(), "", i18n("No"), i18n("No"), i18n("No"), i18n("No"), i18n("No"), i18n("No"), i18n("No")); + namesView->setSelected(i, true); + qApp->processEvents(); + namesView->rename(i, 0); +} + +void QalculateEditNamesDialog::setNames(ExpressionItem *item, const QString &namestr, bool names_edited) { + + if(!names_edited) { + deleteButton->setEnabled(false); + namesView->clear(); + } + if(!names_edited && item && item->countNames() > 0) { + QListViewItem *i_prev = NULL; + for(size_t index = 1; index <= item->countNames(); index++) { + const ExpressionName *ename = &item->getName(index); + QListViewItem *i = new KListViewItem(namesView, i_prev); + i_prev = i; + if(ename->abbreviation) + i->setText(1, i18n("Yes")); + else + i->setText(1, i18n("No")); + if(ename->plural) + i->setText(2, i18n("Yes")); + else + i->setText(2, i18n("No")); + if(ename->reference) + i->setText(3, i18n("Yes")); + else + i->setText(3, i18n("No")); + if(ename->avoid_input) + i->setText(4, i18n("Yes")); + else + i->setText(4, i18n("No")); + if(ename->unicode) + i->setText(5, i18n("Yes")); + else + i->setText(5, i18n("No")); + if(ename->suffix) + i->setText(6, i18n("Yes")); + else + i->setText(6, i18n("No")); + if(ename->case_sensitive) + i->setText(7, i18n("Yes")); + else + i->setText(7, i18n("No")); + if(index == 1 && !namestr.isEmpty()) { + i->setText(0, namestr); + } else { + i->setText(0, ename->name.c_str()); + } + } + } else if(!namestr.isEmpty()) { + if(names_edited) { + QListViewItemIterator it(namesView); + if(it.current()) + it.current()->setText(0, namestr); + } else { + ExpressionName ename(namestr.ascii()); + QListViewItem *i = new KListViewItem(namesView, ename.name.c_str()); + if(ename.abbreviation) + i->setText(1, i18n("Yes")); + else + i->setText(1, i18n("No")); + if(ename.plural) + i->setText(2, i18n("Yes")); + else + i->setText(2, i18n("No")); + if(ename.reference) + i->setText(3, i18n("Yes")); + else + i->setText(3, i18n("No")); + if(ename.avoid_input) + i->setText(4, i18n("Yes")); + else + i->setText(4, i18n("No")); + if(ename.unicode) + i->setText(5, i18n("Yes")); + else + i->setText(5, i18n("No")); + if(ename.suffix) + i->setText(6, i18n("Yes")); + else + i->setText(6, i18n("No")); + if(ename.case_sensitive) + i->setText(7, i18n("Yes")); + else + i->setText(7, i18n("No")); + } + } +} +void QalculateEditNamesDialog::saveNames(ExpressionItem *item, const QString &str) { + item->clearNames(); + QListViewItemIterator it(namesView); + if(it.current()) { + bool b = false; + while(it.current()) { + ExpressionName ename; + if(b || str.isEmpty()) + ename.name = it.current()->text(0).ascii(); + else + ename.name = str.ascii(); + ename.abbreviation = (it.current()->text(1) == i18n("Yes")); + ename.plural = (it.current()->text(2) == i18n("Yes")); + ename.reference = (it.current()->text(3) == i18n("Yes")); + ename.avoid_input = (it.current()->text(4) == i18n("Yes")); + ename.unicode = (it.current()->text(5) == i18n("Yes")); + ename.suffix = (it.current()->text(6) == i18n("Yes")); + ename.case_sensitive = (it.current()->text(7) == i18n("Yes")); + item->addName(ename); + ++it; + b = true; + } + } else { + item->addName(str.ascii()); + } +} +void QalculateEditNamesDialog::setNamesLE(QLineEdit *entry, QLabel *label) { + int index = 0; + QString str; + QListViewItemIterator it(namesView); + while(it.current()) { + if(index == 0) { + entry->setText(it.current()->text(0)); + } else { + if(index == 1) { + str = "+ "; + } else { + str += ", "; + } + str += it.current()->text(0); + } + ++it; + index++; + } + label->setText(str); +} +bool QalculateEditNamesDialog::isEmpty() { + return namesView->childCount() <= 0; +} + +void QalculateEditNamesDialog::deleteName() { + namesView->removeItem(namesView->selectedItem()); +} + +void QalculateEditNamesDialog::itemClicked(QListViewItem *i, const QPoint &, int c) { + if(i && c > 0) { + if(i->text(c) == i18n("Yes")) + i->setText(c, i18n("No")); + else + i->setText(c, i18n("Yes")); + if(c == 1) + i->setText(7, i->text(c)); + } +} + +void QalculateEditNamesDialog::nameSelectionChanged() { + deleteButton->setEnabled(namesView->selectedItem() != NULL); +} + +void QalculateEditNamesDialog::nameChanged(const QString &name) { + if(name.isNull()) return; + namesView->renameLineEdit()->blockSignals(true); + switch(i_type) { + case TYPE_VARIABLE: { + if(!CALCULATOR->variableNameIsValid(name.ascii())) { + namesView->renameLineEdit()->setText(CALCULATOR->convertToValidVariableName(name.ascii()).c_str()); + } + break; + } + case TYPE_UNIT: { + if(!CALCULATOR->unitNameIsValid(name.ascii())) { + namesView->renameLineEdit()->setText(CALCULATOR->convertToValidUnitName(name.ascii()).c_str()); + } + break; + } + case TYPE_FUNCTION: { + if(!CALCULATOR->functionNameIsValid(name.ascii())) { + namesView->renameLineEdit()->setText(CALCULATOR->convertToValidFunctionName(name.ascii()).c_str()); + } + break; + } + } + namesView->renameLineEdit()->blockSignals(false); +} + + +#include "qalculateeditnamesdialog.moc" diff --git a/src/qalculateeditnamesdialog.h b/src/qalculateeditnamesdialog.h new file mode 100644 index 0000000..42f49af --- /dev/null +++ b/src/qalculateeditnamesdialog.h @@ -0,0 +1,65 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEDITNAMESDIALOG_H +#define QALCULATEEDITNAMESDIALOG_H + +#include + +class ExpressionItem; +class KListView; +class QPushButton; +class QLineEdit; +class QLabel; +class QListViewItem; + +/** +@author Niklas Knutsson +*/ +class QalculateEditNamesDialog : public KDialog { + + Q_OBJECT + +public: + + QalculateEditNamesDialog(int item_type, QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditNamesDialog(); + + void saveNames(ExpressionItem *item, const QString &str = QString::null); + void setNames(ExpressionItem *item = NULL, const QString &namestr = QString::null, bool names_edited = false); + bool isEmpty(); + void setNamesLE(QLineEdit *entry, QLabel *label); + + KListView* namesView; + QPushButton* newButton; + QPushButton* deleteButton; + QPushButton* buttonClose; + int i_type; + +public slots: + + virtual void itemClicked(QListViewItem*, const QPoint&, int); + virtual void newName(); + virtual void deleteName(); + virtual void nameChanged(const QString&); + virtual void nameSelectionChanged(); + +}; + +#endif diff --git a/src/qalculateeditunitdialog.cpp b/src/qalculateeditunitdialog.cpp new file mode 100644 index 0000000..3bf155f --- /dev/null +++ b/src/qalculateeditunitdialog.cpp @@ -0,0 +1,425 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateeditunitdialog.h" +#include "qalculate_kde_utils.h" +#include "qalculateeditnamesdialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern PrintOptions printops; +extern EvaluationOptions evalops; +extern tree_struct unit_cats; + +QalculateEditUnitDialog::QalculateEditUnitDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Unit"), Ok | Cancel | Help, Ok, true) { + + names_edit_dialog = NULL; + edited_unit = NULL; + + QVBox *box = makeVBoxMainWidget(); + + grid1 = new QGroupBox(1, Qt::Horizontal, i18n("Name"), box); + grid1->setInsideMargin(spacingHint()); + grid1->setInsideSpacing(spacingHint()); + QWidget *widget = new QWidget(grid1); + QGridLayout *grid = new QGridLayout(widget, 1, 1, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("Name:"), widget), 0, 0); + nameEdit = new KLineEdit(widget); + grid->addWidget(nameEdit, 0, 1); + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 1, 1, 0, 1); + namesLabel = new QLabel(widget); + namesLabel->setAlignment(Qt::AlignRight); + namesLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hbox->addWidget(namesLabel); + namesButton = new QPushButton(i18n("Names Details"), widget); + hbox->addWidget(namesButton); + grid->addWidget(new QLabel(i18n("Descriptive name:"), widget), 2, 0); + titleEdit = new KLineEdit(widget); + grid->addWidget(titleEdit, 2, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 3, 3, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + hideButton = new QCheckBox(i18n("Hide unit"), widget); + hbox->addWidget(hideButton); + + grid2 = new QGroupBox(1, Qt::Horizontal, i18n("Type"), box); + grid2->setInsideMargin(spacingHint()); + grid2->setInsideSpacing(spacingHint()); + widget = new QWidget(grid2); + grid = new QGridLayout(widget, 1, 1, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("Class:"), widget), 0, 0); + classCombo = new KComboBox(widget); + grid->addWidget(classCombo, 0, 1); + classCombo->insertItem(i18n("Base Unit")); + classCombo->insertItem(i18n("Alias")); + classCombo->insertItem(i18n("Composite Unit")); + classCombo->setMaximumWidth(250); + grid->addWidget(new QLabel(i18n("Category:"), widget), 1, 0); + categoryCombo = new KComboBox(widget); + grid->addWidget(categoryCombo, 1, 1); + categoryCombo->setMaximumWidth(250); + categoryCombo->setEditable(true); + grid->addWidget(new QLabel(i18n("System:"), widget), 2, 0); + systemCombo = new KComboBox(widget); + grid->addWidget(systemCombo, 2, 1); + systemCombo->insertItem(i18n("SI")); + systemCombo->insertItem(i18n("CGS")); + systemCombo->insertItem(i18n("Imperial")); + systemCombo->insertItem(i18n("US Survey")); + systemCombo->setMaximumWidth(250); + systemCombo->setEditable(true); + + grid3 = new QGroupBox(1, Qt::Horizontal, i18n("Relation"), box); + grid3->setInsideMargin(spacingHint()); + grid3->setInsideSpacing(spacingHint()); + widget = new QWidget(grid3); + grid = new QGridLayout(widget, 1, 1, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("Base unit:"), widget), 0, 0); + baseEdit = new KLineEdit(widget); + grid->addWidget(baseEdit, 0, 1); + exponentLabel = new QLabel(i18n("Exponent:"), widget); + grid->addWidget(exponentLabel, 1, 0); + exponentBox = new QSpinBox(-9, 9, 1, widget); + grid->addWidget(exponentBox, 1, 1); + relationLabel = new QLabel(i18n("Relation:"), widget); + grid->addWidget(relationLabel, 2, 0); + relationEdit = new KLineEdit(widget); + grid->addWidget(relationEdit, 2, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 3, 3, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + relationExactButton = new QCheckBox(i18n("Relation is exact"), widget); + hbox->addWidget(relationExactButton); + inverseRelationLabel = new QLabel(i18n("Inverse relation:"), widget); + grid->addWidget(inverseRelationLabel, 4, 0); + inverseRelationEdit = new KLineEdit(widget); + grid->addWidget(inverseRelationEdit, 4, 1); + + connect(namesButton, SIGNAL(clicked()), this, SLOT(editNames())); + connect(classCombo, SIGNAL(activated(int)), this, SLOT(classChanged(int))); + connect(nameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + +} + +QalculateEditUnitDialog::~QalculateEditUnitDialog() {} + +void QalculateEditUnitDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-unit-creation"); +} +void QalculateEditUnitDialog::slotOk() { + + string str = nameEdit->text().ascii(); + remove_blank_ends(str); + if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { + //no name -- open dialog again + nameEdit->setFocus(); + KMessageBox::error(this, i18n("Empty name field")); + return; + } + //unit with the same name exists -- overwrite or open dialog again + if((!edited_unit || !edited_unit->hasName(str)) && (!names_edit_dialog || names_edit_dialog->isEmpty()) && CALCULATOR->unitNameTaken(str, edited_unit) && KMessageBox::questionYesNo(this, i18n("A variable or unit with the same name already exists.\nDo you want to overwrite it?")) == KMessageBox::No) { + nameEdit->setFocus(); + return; + } + + Unit *u = edited_unit; + + bool add_unit = false; + if(u) { + //edited an existing unit -- update unit + u->setLocal(true); + int i1 = classCombo->currentItem(); + switch(u->subtype()) { + case SUBTYPE_ALIAS_UNIT: { + if(i1 != 1) { + u->destroy(); + u = NULL; + break; + } + if(!u->isBuiltin()) { + AliasUnit *au = (AliasUnit*) u; + Unit *bu = CALCULATOR->getUnit(baseEdit->text().ascii()); + if(!bu) bu = CALCULATOR->getCompositeUnit(baseEdit->text().ascii()); + if(!bu) { + baseEdit->setFocus(); + KMessageBox::error(this, i18n("Base unit does not exist")); + return; + } + au->setBaseUnit(bu); + au->setExpression(CALCULATOR->unlocalizeExpression(relationEdit->text().ascii(), evalops.parse_options)); + au->setInverseExpression(CALCULATOR->unlocalizeExpression(inverseRelationEdit->text().ascii(), evalops.parse_options)); + au->setExponent(exponentBox->value()); + au->setApproximate(!relationExactButton->isChecked()); + } + break; + } + case SUBTYPE_COMPOSITE_UNIT: { + if(i1 != 2) { + u->destroy(); + u = NULL; + break; + } + if(!u->isBuiltin()) { + ((CompositeUnit*) u)->setBaseExpression(baseEdit->text().ascii()); + } + break; + } + case SUBTYPE_BASE_UNIT: { + if(i1 != 0) { + u->destroy(); + u = NULL; + break; + } + break; + } + } + if(u) { + u->setTitle(titleEdit->text().ascii()); + u->setCategory(categoryCombo->lineEdit()->text().ascii()); + } + } + if(!u) { + //new unit + switch(classCombo->currentItem()) { + case 1: { + Unit *bu = CALCULATOR->getUnit(baseEdit->text().ascii()); + if(!bu) bu = CALCULATOR->getCompositeUnit(baseEdit->text().ascii()); + if(!bu) { + baseEdit->setFocus(); + KMessageBox::error(this, i18n("Base unit does not exist")); + return; + } + u = new AliasUnit(categoryCombo->lineEdit()->text().ascii(), "", "", "", titleEdit->text().ascii(), bu, CALCULATOR->unlocalizeExpression(relationEdit->text().ascii(), evalops.parse_options), exponentBox->value(), CALCULATOR->unlocalizeExpression(inverseRelationEdit->text().ascii(), evalops.parse_options), true); + ((AliasUnit*) u)->setApproximate(!relationExactButton->isChecked()); + break; + } + case 2: { + CompositeUnit *cu = new CompositeUnit(categoryCombo->lineEdit()->text().ascii(), "", titleEdit->text().ascii(), baseEdit->text().ascii(), true); + u = cu; + break; + } + default: { + u = new Unit(categoryCombo->lineEdit()->text().ascii(), "", "", "", titleEdit->text().ascii(), true); + break; + } + } + add_unit = true; + } + if(u) { + u->setHidden(hideButton->isChecked()); + if(!u->isBuiltin()) { + u->setSystem(systemCombo->lineEdit()->text().ascii()); + if(names_edit_dialog) { + names_edit_dialog->saveNames(u, str.c_str()); + } else { + if(u->countNames() == 0) { + ExpressionName ename(str); + ename.reference = true; + u->setName(ename, 1); + } else { + u->setName(str, 1); + } + } + } + if(add_unit) { + CALCULATOR->addUnit(u); + } + } + edited_unit = u; + + accept(); + +} + + +void QalculateEditUnitDialog::classChanged(int i) { + exponentBox->setEnabled(i == 1); + relationEdit->setEnabled(i == 1); + relationExactButton->setEnabled(i == 1); + inverseRelationEdit->setEnabled(i == 1); + exponentLabel->setEnabled(i == 1); + relationLabel->setEnabled(i == 1); + inverseRelationLabel->setEnabled(i == 1); + grid3->setEnabled(i != 0); +} + +Unit *QalculateEditUnitDialog::editUnit(QString category, Unit *u) { + + nameEdit->setFocus(); + + if(names_edit_dialog) { + delete names_edit_dialog; + names_edit_dialog = NULL; + } + edited_unit = u; + if(u) { + if(u->isLocal()) + setCaption(i18n("Edit Unit")); + else + setCaption(i18n("Edit Unit (global)")); + } else { + setCaption(i18n("New Unit")); + } + + //QStringList cats; + QString catstr; + categoryCombo->clear(); + tree_struct *item, *item2; + unit_cats.it = unit_cats.items.begin(); + if(unit_cats.it != unit_cats.items.end()) { + item = &*unit_cats.it; + ++unit_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + + catstr = ""; + while(item) { + if(!catstr.isEmpty()) catstr += "/"; + catstr += item->item.c_str(); + categoryCombo->insertItem(catstr); + while(item && item->it == item->items.end()) { + int str_i = catstr.findRev("/"); + if(str_i < 0) { + catstr = ""; + } else { + catstr.truncate(str_i); + } + item = item->parent; + } + if(item) { + item2 = &*item->it; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + + categoryCombo->lineEdit()->setText(category); + //clear entries + nameEdit->clear(); + titleEdit->clear(); + baseEdit->clear(); + relationEdit->clear(); + inverseRelationEdit->clear(); + systemCombo->lineEdit()->clear(); + exponentBox->setValue(1); + namesLabel->clear(); + actionButton(Ok)->setEnabled(true); + nameEdit->setReadOnly(u && u->isBuiltin()); + relationEdit->setReadOnly(u && u->isBuiltin()); + inverseRelationEdit->setReadOnly(u && u->isBuiltin()); + systemCombo->setEnabled(!u || !u->isBuiltin()); + classCombo->setEnabled(!u || !u->isBuiltin()); + baseEdit->setReadOnly(u && u->isBuiltin()); + if(u) { + //fill in original parameters + if(u->subtype() == SUBTYPE_BASE_UNIT) { + classCombo->setCurrentItem(0); + classChanged(0); + } else if(u->subtype() == SUBTYPE_ALIAS_UNIT) { + classCombo->setCurrentItem(1); + classChanged(1); + } else if(u->subtype() == SUBTYPE_COMPOSITE_UNIT) { + classCombo->setCurrentItem(2); + classChanged(2); + } + + set_name_label_and_entry(u, nameEdit, namesLabel); + systemCombo->lineEdit()->setText(u->system().c_str()); + hideButton->setChecked(u->isHidden()); + categoryCombo->lineEdit()->setText(u->category().c_str()); + titleEdit->setText(u->title(false).c_str()); + + switch(u->subtype()) { + case SUBTYPE_ALIAS_UNIT: { + AliasUnit *au = (AliasUnit*) u; + baseEdit->setText(((CompositeUnit*) (au->firstBaseUnit()))->preferredDisplayName(printops.abbreviate_names, true, false, false, &can_display_unicode_string_function, (void*) baseEdit).name.c_str()); + exponentBox->setValue(au->firstBaseExponent()); + relationEdit->setText(CALCULATOR->localizeExpression(au->expression()).c_str()); + inverseRelationEdit->setText(CALCULATOR->localizeExpression(au->inverseExpression()).c_str()); + relationExactButton->setChecked(!au->isApproximate()); + relationEdit->setEnabled(true); + inverseRelationEdit->setEnabled(true); + relationExactButton->setEnabled(!u->isBuiltin()); + exponentBox->setEnabled(!u->isBuiltin()); + baseEdit->setEnabled(true); + break; + } + case SUBTYPE_COMPOSITE_UNIT: { + baseEdit->setText(((CompositeUnit*) u)->print(false, printops.abbreviate_names, true, &can_display_unicode_string_function, (void*) baseEdit).c_str()); + baseEdit->setEnabled(true); + } + } + } else { + //default values + hideButton->setChecked(false); + relationExactButton->setChecked(true); + relationEdit->setText("1"); + classCombo->setCurrentItem(1); + classChanged(1); + } + + if(exec() == QDialog::Accepted) { + u = edited_unit; + edited_unit = NULL; + return u; + } + edited_unit = NULL; + return NULL; +} + +void QalculateEditUnitDialog::editNames() { + if(!names_edit_dialog) { + names_edit_dialog = new QalculateEditNamesDialog(TYPE_UNIT, this); + names_edit_dialog->setNames(edited_unit, nameEdit->text(), false); + } else { + names_edit_dialog->setNames(edited_unit, nameEdit->text(), true); + } + names_edit_dialog->exec(); + names_edit_dialog->setNamesLE(nameEdit, namesLabel); +} + +void QalculateEditUnitDialog::nameChanged(const QString &name) { + if(name.isNull()) return; + if(!CALCULATOR->unitNameIsValid(name.ascii())) { + nameEdit->blockSignals(true); + nameEdit->setText(CALCULATOR->convertToValidUnitName(name.ascii()).c_str()); + nameEdit->blockSignals(false); + } +} + + +#include "qalculateeditunitdialog.moc" + diff --git a/src/qalculateeditunitdialog.h b/src/qalculateeditunitdialog.h new file mode 100644 index 0000000..02655d8 --- /dev/null +++ b/src/qalculateeditunitdialog.h @@ -0,0 +1,73 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEDITUNITDIALOG_H +#define QALCULATEEDITUNITDIALOG_H + +#include + +class QLabel; +class KComboBox; +class KLineEdit; +class QCheckBox; +class QPushButton; +class QSpinBox; +class MathStructure; +class QalculateEditNamesDialog; +class Unit; +class QGroupBox; + +/** +@author Niklas Knutsson +*/ +class QalculateEditUnitDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateEditUnitDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditUnitDialog(); + + Unit *editUnit(QString category = QString::null, Unit *u = NULL); + + QalculateEditNamesDialog *names_edit_dialog; + Unit *edited_unit; + KComboBox *categoryCombo, *classCombo, *systemCombo; + KLineEdit *nameEdit, *titleEdit, *baseEdit, *relationEdit, *inverseRelationEdit; + QLabel *namesLabel, *exponentLabel, *relationLabel, *inverseRelationLabel; + QCheckBox *relationExactButton, *hideButton; + QPushButton *namesButton; + QSpinBox *exponentBox; + QGroupBox *grid1, *grid2, *grid3; + +public slots: + + void editNames(); + void classChanged(int); + void nameChanged(const QString&); + +protected slots: + + void slotHelp(); + void slotOk(); + +}; + +#endif diff --git a/src/qalculateeditunknownvariabledialog.cpp b/src/qalculateeditunknownvariabledialog.cpp new file mode 100644 index 0000000..4e7dc42 --- /dev/null +++ b/src/qalculateeditunknownvariabledialog.cpp @@ -0,0 +1,308 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateeditunknownvariabledialog.h" +#include "qalculate_kde_utils.h" +#include "qalculateeditnamesdialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern PrintOptions printops; +extern tree_struct variable_cats; + +QalculateEditUnknownVariableDialog::QalculateEditUnknownVariableDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Variable"), Ok | Cancel | Help, Ok, true) { + + names_edit_dialog = NULL; + edited_unknown = NULL; + + setMainWidget(new QWidget(this)); + QGridLayout *grid = new QGridLayout(mainWidget(), 1, 1, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("Name:"), mainWidget()), 0, 0); + nameEdit = new KLineEdit(mainWidget()); + grid->addWidget(nameEdit, 0, 1); + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 1, 1, 0, 1); + namesLabel = new QLabel(mainWidget()); + namesLabel->setAlignment(Qt::AlignRight); + namesLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hbox->addWidget(namesLabel); + namesButton = new QPushButton(i18n("Names Details"), mainWidget()); + hbox->addWidget(namesButton); + assumptionsBox = new QCheckBox(i18n("Custom assumptions:"), mainWidget()); + grid->addMultiCellWidget(assumptionsBox, 2, 2, 0, 1); + typeLabel = new QLabel(i18n("Type"), mainWidget()); + grid->addWidget(typeLabel, 3, 0); + typeCombo = new KComboBox(mainWidget()); + typeCombo->setMaximumWidth(250); + typeCombo->setEditable(false); + typeCombo->insertItem(i18n("Unknown")); + typeCombo->insertItem(i18n("Not Matrix")); + typeCombo->insertItem(i18n("Number")); + typeCombo->insertItem(i18n("Complex Number")); + typeCombo->insertItem(i18n("Real Number")); + typeCombo->insertItem(i18n("Rational Number")); + typeCombo->insertItem(i18n("Integer")); + grid->addWidget(typeCombo, 3, 1); + signLabel = new QLabel(i18n("Sign"), mainWidget()); + grid->addWidget(signLabel, 4, 0); + signCombo = new KComboBox(mainWidget()); + signCombo->setMaximumWidth(250); + signCombo->setEditable(false); + signCombo->insertItem(i18n("Unknown")); + signCombo->insertItem(i18n("Positive")); + signCombo->insertItem(i18n("Non-Negative")); + signCombo->insertItem(i18n("Negative")); + signCombo->insertItem(i18n("Non-Positive")); + signCombo->insertItem(i18n("Non-Zero")); + grid->addWidget(signCombo, 4, 1); + grid->addWidget(new QLabel(i18n("Category:"), mainWidget()), 5, 0); + categoryCombo = new KComboBox(mainWidget()); + categoryCombo->setMaximumWidth(250); + categoryCombo->setEditable(true); + grid->addWidget(categoryCombo, 5, 1); + grid->addWidget(new QLabel(i18n("Descriptive name:"), mainWidget()), 6, 0); + titleEdit = new KLineEdit(mainWidget()); + grid->addWidget(titleEdit, 6, 1); + + connect(assumptionsBox, SIGNAL(toggled(bool)), typeCombo, SLOT(setEnabled(bool))); + connect(assumptionsBox, SIGNAL(toggled(bool)), signCombo, SLOT(setEnabled(bool))); + connect(assumptionsBox, SIGNAL(toggled(bool)), typeLabel, SLOT(setEnabled(bool))); + connect(assumptionsBox, SIGNAL(toggled(bool)), signLabel, SLOT(setEnabled(bool))); + connect(typeCombo, SIGNAL(activated(int)), this, SLOT(typeComboActivated(int))); + connect(signCombo, SIGNAL(activated(int)), this, SLOT(signComboActivated(int))); + connect(namesButton, SIGNAL(clicked()), this, SLOT(editNames())); + connect(nameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + +} + +QalculateEditUnknownVariableDialog::~QalculateEditUnknownVariableDialog() {} + +void QalculateEditUnknownVariableDialog::typeComboActivated(int i) { + if((AssumptionType) i <= ASSUMPTION_TYPE_COMPLEX && (AssumptionSign) signCombo->currentItem() != ASSUMPTION_SIGN_NONZERO) { + signCombo->blockSignals(true); + signCombo->setCurrentItem(ASSUMPTION_SIGN_UNKNOWN); + signCombo->blockSignals(false); + } +} +void QalculateEditUnknownVariableDialog::signComboActivated(int i) { + if((AssumptionSign) i != ASSUMPTION_SIGN_NONZERO && (AssumptionSign) i != ASSUMPTION_SIGN_UNKNOWN && (AssumptionType) typeCombo->currentItem() <= ASSUMPTION_TYPE_COMPLEX) { + typeCombo->blockSignals(true); + typeCombo->setCurrentItem(ASSUMPTION_TYPE_REAL); + typeCombo->blockSignals(false); + } +} + +void QalculateEditUnknownVariableDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-variable-creation"); +} +void QalculateEditUnknownVariableDialog::slotOk() { + + string str = nameEdit->text().ascii(); + remove_blank_ends(str); + if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { + //no name -- open dialog again + nameEdit->setFocus(); + KMessageBox::error(this, i18n("Empty name field")); + return; + } + //variable with the same name exists -- overwrite or open dialog again + if((!edited_unknown || !edited_unknown->hasName(str)) && (!names_edit_dialog || names_edit_dialog->isEmpty()) && CALCULATOR->variableNameTaken(str, edited_unknown) && KMessageBox::questionYesNo(this, i18n("An unit or variable with the same name already exists.\nDo you want to overwrite it?")) == KMessageBox::No) { + nameEdit->setFocus(); + return; + } + + UnknownVariable *v = edited_unknown; + if(!v) { + //no need to create a new variable when a variable with the same name exists + Variable *var = CALCULATOR->getActiveVariable(str); + if(var && var->isLocal() && !var->isKnown()) v = (UnknownVariable*) var; + } + bool add_var = false; + if(v) { + //update existing variable + v->setLocal(true); + } else { + //new unknown variable + v = new UnknownVariable("", "", "", true); + add_var = true; + } + if(!v->isBuiltin()) { + if(assumptionsBox->isChecked()) { + if(!v->assumptions()) v->setAssumptions(new Assumptions()); + v->assumptions()->setType((AssumptionType) typeCombo->currentItem()); + v->assumptions()->setSign((AssumptionSign) signCombo->currentItem()); + } else { + v->setAssumptions(NULL); + } + } + v->setCategory(categoryCombo->lineEdit()->text().ascii()); + v->setTitle(titleEdit->text().ascii()); + if(!v->isBuiltin()) { + if(names_edit_dialog) { + names_edit_dialog->saveNames(v, str.c_str()); + } else { + if(v->countNames() == 0) { + ExpressionName ename(str); + ename.reference = true; + v->setName(ename, 1); + } else { + v->setName(str, 1); + } + } + } + if(add_var) { + CALCULATOR->addVariable(v); + } + edited_unknown = v; + accept(); +} + + +UnknownVariable *QalculateEditUnknownVariableDialog::editVariable(QString category, UnknownVariable *v) { + + nameEdit->setFocus(); + + if(names_edit_dialog) { + delete names_edit_dialog; + names_edit_dialog = NULL; + } + edited_unknown = v; + if(v) { + if(v->isLocal()) + setCaption(i18n("Edit Unknown Variable")); + else + setCaption(i18n("Edit Unknown Variable (global)")); + } else { + setCaption(i18n("New Unknown Variable")); + } + + actionButton(Ok)->setEnabled(true); + + namesLabel->setText(""); + + //QStringList cats; + QString catstr; + categoryCombo->clear(); + tree_struct *item, *item2; + variable_cats.it = variable_cats.items.begin(); + if(variable_cats.it != variable_cats.items.end()) { + item = &*variable_cats.it; + ++variable_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + + catstr = ""; + while(item) { + if(!catstr.isEmpty()) catstr += "/"; + catstr += item->item.c_str(); + categoryCombo->insertItem(catstr); + while(item && item->it == item->items.end()) { + int str_i = catstr.findRev("/"); + if(str_i < 0) { + catstr = ""; + } else { + catstr.truncate(str_i); + } + item = item->parent; + } + if(item) { + item2 = &*item->it; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + + if(v) { + //fill in original parameters + set_name_label_and_entry(v, nameEdit, namesLabel); + nameEdit->setReadOnly(v->isBuiltin()); + assumptionsBox->setEnabled(!v->isBuiltin()); + categoryCombo->lineEdit()->setText(v->category().c_str()); + titleEdit->setText(v->title(false).c_str()); + if(v->assumptions()) { + assumptionsBox->setChecked(true); + typeCombo->setCurrentItem(v->assumptions()->type()); + signCombo->setCurrentItem(v->assumptions()->sign()); + } else { + assumptionsBox->setChecked(false); + typeCombo->setCurrentItem(CALCULATOR->defaultAssumptions()->type()); + signCombo->setCurrentItem(CALCULATOR->defaultAssumptions()->sign()); + } + } else { + nameEdit->setReadOnly(false); + assumptionsBox->setChecked(true); + + //fill in default values + nameEdit->setText(CALCULATOR->getName().c_str()); + namesLabel->setText(""); + categoryCombo->lineEdit()->setText(category); + titleEdit->setText(""); + typeCombo->setCurrentItem(CALCULATOR->defaultAssumptions()->type()); + signCombo->setCurrentItem(CALCULATOR->defaultAssumptions()->sign()); + } + signLabel->setEnabled(!v || (!v->isBuiltin() && v->assumptions())); + typeLabel->setEnabled(!v || (!v->isBuiltin() && v->assumptions())); + signCombo->setEnabled(!v || (!v->isBuiltin() && v->assumptions())); + typeCombo->setEnabled(!v || (!v->isBuiltin() && v->assumptions())); + + if(exec() == QDialog::Accepted) { + v = edited_unknown; + edited_unknown = NULL; + return v; + } + edited_unknown = NULL; + return NULL; +} + +void QalculateEditUnknownVariableDialog::editNames() { + if(!names_edit_dialog) { + names_edit_dialog = new QalculateEditNamesDialog(TYPE_VARIABLE, this); + names_edit_dialog->setNames(edited_unknown, nameEdit->text(), false); + } else { + names_edit_dialog->setNames(edited_unknown, nameEdit->text(), true); + } + names_edit_dialog->exec(); + names_edit_dialog->setNamesLE(nameEdit, namesLabel); +} + +void QalculateEditUnknownVariableDialog::nameChanged(const QString &name) { + if(name.isNull()) return; + if(!CALCULATOR->variableNameIsValid(name.ascii())) { + nameEdit->blockSignals(true); + nameEdit->setText(CALCULATOR->convertToValidVariableName(name.ascii()).c_str()); + nameEdit->blockSignals(false); + } +} + +#include "qalculateeditunknownvariabledialog.moc" + diff --git a/src/qalculateeditunknownvariabledialog.h b/src/qalculateeditunknownvariabledialog.h new file mode 100644 index 0000000..cfa499e --- /dev/null +++ b/src/qalculateeditunknownvariabledialog.h @@ -0,0 +1,70 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEDITUNKNOWNVARIABLEDIALOG_H +#define QALCULATEEDITUNKNOWNVARIABLEDIALOG_H + +#include + +class QLabel; +class KComboBox; +class KLineEdit; +class QPushButton; +class MathStructure; +class QalculateEditNamesDialog; +class UnknownVariable; +class QCheckBox; + +/** +@author Niklas Knutsson +*/ +class QalculateEditUnknownVariableDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateEditUnknownVariableDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditUnknownVariableDialog(); + + UnknownVariable *editVariable(QString category = QString::null, UnknownVariable *v = NULL); + + QalculateEditNamesDialog *names_edit_dialog; + UnknownVariable *edited_unknown; + KComboBox *categoryCombo, *signCombo, *typeCombo; + KLineEdit *nameEdit, *titleEdit; + QLabel *namesLabel, *signLabel, *typeLabel; + QPushButton *namesButton; + QCheckBox *assumptionsBox; + +public slots: + + void editNames(); + void nameChanged(const QString&); + void signComboActivated(int); + void typeComboActivated(int); + +protected slots: + + void slotHelp(); + void slotOk(); + +}; + +#endif diff --git a/src/qalculateeditvariabledialog.cpp b/src/qalculateeditvariabledialog.cpp new file mode 100644 index 0000000..013dec0 --- /dev/null +++ b/src/qalculateeditvariabledialog.cpp @@ -0,0 +1,304 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateeditvariabledialog.h" +#include "qalculate_kde_utils.h" +#include "qalculateeditnamesdialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern PrintOptions printops; +extern EvaluationOptions evalops; +extern tree_struct variable_cats; + +QalculateEditVariableDialog::QalculateEditVariableDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Variable"), Ok | Cancel | Help, Ok, true) { + + names_edit_dialog = NULL; + edited_variable = NULL; + + setMainWidget(new QWidget(this)); + QGridLayout *grid = new QGridLayout(mainWidget(), 6, 2, 0, spacingHint()); + + nameLabel = new QLabel(i18n("Name:"), mainWidget()); + grid->addWidget(nameLabel, 0, 0); + nameEdit = new KLineEdit(mainWidget()); + grid->addWidget(nameEdit, 0, 1); + + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 1, 1, 0, 1); + namesLabel = new QLabel(mainWidget()); + namesLabel->setAlignment(Qt::AlignRight); + namesLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hbox->addWidget(namesLabel); + namesButton = new QPushButton(i18n("Names Details"), mainWidget()); + hbox->addWidget(namesButton); + + valueLabel = new QLabel(i18n("Value:"), mainWidget()); + grid->addWidget(valueLabel, 2, 0); + valueEdit = new KLineEdit(mainWidget()); + grid->addWidget(valueEdit, 2, 1); + + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 3, 3, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + valueExactButton = new QCheckBox(i18n("Value is exact"), mainWidget()); + hbox->addWidget(valueExactButton); + + grid->addWidget(new QLabel(i18n("Category:"), mainWidget()), 4, 0); + categoryCombo = new KComboBox(mainWidget()); + grid->addWidget(categoryCombo, 4, 1); + categoryCombo->setMaximumWidth(250); + categoryCombo->setEditable(true); + + titleLabel = new QLabel(i18n("Descriptive name:"), mainWidget()); + grid->addWidget(titleLabel, 5, 0); + titleEdit = new KLineEdit(mainWidget()); + grid->addWidget(titleEdit, 5, 1); + + connect(namesButton, SIGNAL(clicked()), this, SLOT(editNames())); + connect(nameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + +} + +QalculateEditVariableDialog::~QalculateEditVariableDialog() {} + +void QalculateEditVariableDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-variable-creation"); +} + +void QalculateEditVariableDialog::slotOk() { + string str = nameEdit->text().ascii(); + remove_blank_ends(str); + if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { + //no name -- open dialog again + nameEdit->setFocus(); + KMessageBox::error(this, i18n("Empty name field")); + return; + } + string str2 = valueEdit->text().ascii(); + remove_blank_ends(str2); + if(!(init_value && force_init_value) && str2.empty()) { + //no value -- open dialog again + valueEdit->setFocus(); + KMessageBox::error(this, i18n("Empty value field")); + return; + } + //variable with the same name exists -- overwrite or open dialog again + if((!edited_variable || !edited_variable->hasName(str)) && (!names_edit_dialog || names_edit_dialog->isEmpty()) && CALCULATOR->variableNameTaken(str, edited_variable) && KMessageBox::questionYesNo(this, i18n("An unit or variable with the same name already exists.\nDo you want to overwrite it?")) == KMessageBox::No) { + nameEdit->setFocus(); + return; + } + KnownVariable *v = edited_variable; + if(!v) { + //no need to create a new variable when a variable with the same name exists + Variable *var = CALCULATOR->getActiveVariable(str); + if(var && var->isLocal() && var->isKnown()) v = (KnownVariable*) var; + } + bool add_var = false; + if(v) { + //update existing variable + v->setLocal(true); + if(!v->isBuiltin()) { + if(force_init_value && init_value) { + v->set(*init_value); + } else { + v->set(CALCULATOR->unlocalizeExpression(valueEdit->text().ascii(), evalops.parse_options)); + v->setApproximate(!valueExactButton->isChecked()); + } + } + } else { + //new variable + if(force_init_value && init_value) { + //forced value + v = new KnownVariable("", "", *init_value, "", true); + } else { + v = new KnownVariable("", "", CALCULATOR->unlocalizeExpression(valueEdit->text().ascii(), evalops.parse_options), "", true); + v->setApproximate(!valueExactButton->isChecked()); + } + add_var = true; + } + v->setCategory(categoryCombo->lineEdit()->text().ascii()); + v->setTitle(titleEdit->text().ascii()); + if(!v->isBuiltin()) { + if(names_edit_dialog) { + names_edit_dialog->saveNames(v, str.c_str()); + } else { + if(v->countNames() == 0) { + ExpressionName ename(str); + ename.reference = true; + v->setName(ename, 1); + } else { + v->setName(str, 1); + } + } + } + if(add_var) { + CALCULATOR->addVariable(v); + } + edited_variable = v; + accept(); +} + +KnownVariable *QalculateEditVariableDialog::editVariable(QString category, KnownVariable *v, MathStructure *initial_value, bool force_value) { + + nameEdit->setFocus(); + + if(names_edit_dialog) { + delete names_edit_dialog; + names_edit_dialog = NULL; + } + edited_variable = v; + if(v) { + if(v->isLocal()) { + setCaption(i18n("Edit Variable")); + } else { + setCaption(i18n("Edit Variable (global)")); + } + } else { + setCaption(i18n("New Variable")); + } + + actionButton(Ok)->setEnabled(true); + + namesLabel->setText(""); + + //QStringList cats; + QString catstr; + categoryCombo->clear(); + tree_struct *item, *item2; + variable_cats.it = variable_cats.items.begin(); + if(variable_cats.it != variable_cats.items.end()) { + item = &*variable_cats.it; + ++variable_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + + catstr = ""; + while(item) { + if(!catstr.isEmpty()) catstr += "/"; + catstr += item->item.c_str(); + categoryCombo->insertItem(catstr); + while(item && item->it == item->items.end()) { + int str_i = catstr.findRev("/"); + if(str_i < 0) { + catstr = ""; + } else { + catstr.truncate(str_i); + } + item = item->parent; + } + if(item) { + item2 = &*item->it; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + + if(initial_value && force_value) { + valueEdit->hide(); + valueLabel->hide(); + namesButton->hide(); + namesLabel->hide(); + valueExactButton->hide(); + } else { + valueEdit->show(); + valueLabel->show(); + namesButton->show(); + namesLabel->show(); + valueExactButton->show(); + } + + if(v) { + //fill in original parameters + set_name_label_and_entry(v, nameEdit, namesLabel); + valueEdit->setText(get_value_string(v->get(), false, NULL)); + nameEdit->setReadOnly(v->isBuiltin()); + valueEdit->setReadOnly(v->isBuiltin()); + valueExactButton->setEnabled(!v->isBuiltin()); + categoryCombo->lineEdit()->setText(v->category().c_str()); + titleEdit->setText(v->title(false).c_str()); + valueExactButton->setChecked(!(*printops.is_approximate) && !v->isApproximate()); + } else { + nameEdit->setReadOnly(false); + valueEdit->setReadOnly(false); + valueExactButton->setEnabled(true); + + //fill in default values + nameEdit->setText(CALCULATOR->getName().c_str()); + namesLabel->setText(""); + if(initial_value && !force_value) valueEdit->setText(get_value_string(*initial_value)); + else valueEdit->setText(""); + categoryCombo->lineEdit()->setText(category); + titleEdit->setText(""); + if(initial_value) valueExactButton->setChecked(!initial_value->isApproximate()); + else valueExactButton->setChecked(true); + if(force_value) { + valueEdit->setReadOnly(true); + valueExactButton->setEnabled(false); + } + } + + init_value = initial_value; + force_init_value = force_value; + + if(exec() == QDialog::Accepted) { + v = edited_variable; + edited_variable = NULL; + return v; + } + edited_variable = NULL; + return NULL; +} + +void QalculateEditVariableDialog::editNames() { + if(!names_edit_dialog) { + names_edit_dialog = new QalculateEditNamesDialog(TYPE_VARIABLE, this); + names_edit_dialog->setNames(edited_variable, nameEdit->text(), false); + } else { + names_edit_dialog->setNames(edited_variable, nameEdit->text(), true); + } + names_edit_dialog->exec(); + names_edit_dialog->setNamesLE(nameEdit, namesLabel); +} + +void QalculateEditVariableDialog::nameChanged(const QString &name) { + if(name.isNull()) return; + if(!CALCULATOR->variableNameIsValid(name.ascii())) { + nameEdit->blockSignals(true); + nameEdit->setText(CALCULATOR->convertToValidVariableName(name.ascii()).c_str()); + nameEdit->blockSignals(false); + } +} + +#include "qalculateeditvariabledialog.moc" + diff --git a/src/qalculateeditvariabledialog.h b/src/qalculateeditvariabledialog.h new file mode 100644 index 0000000..14ccd4d --- /dev/null +++ b/src/qalculateeditvariabledialog.h @@ -0,0 +1,74 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEDITVARIABLEDIALOG_H +#define QALCULATEEDITVARIABLEDIALOG_H + +#include + +class QLabel; +class KComboBox; +class KLineEdit; +class QCheckBox; +class QPushButton; +class MathStructure; +class QalculateEditNamesDialog; +class KnownVariable; +class QGridLayout; + +/** +@author Niklas Knutsson +*/ +class QalculateEditVariableDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateEditVariableDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateEditVariableDialog(); + + KnownVariable *editVariable(QString category = QString::null, KnownVariable *v = NULL, MathStructure *initial_value = NULL, bool force_value = false); + + QalculateEditNamesDialog *names_edit_dialog; + KnownVariable *edited_variable; + KComboBox *categoryCombo; + KLineEdit *valueEdit, *nameEdit, *titleEdit; + QLabel *namesLabel, *titleLabel, *nameLabel, *valueLabel; + QCheckBox *valueExactButton; + QPushButton *namesButton; + +private: + + MathStructure *init_value; + bool force_init_value; + +public slots: + + void editNames(); + void nameChanged(const QString&); + +protected slots: + + void slotHelp(); + void slotOk(); + +}; + +#endif diff --git a/src/qalculateexportcsvdialog.cpp b/src/qalculateexportcsvdialog.cpp new file mode 100644 index 0000000..93022f5 --- /dev/null +++ b/src/qalculateexportcsvdialog.cpp @@ -0,0 +1,186 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateexportcsvdialog.h" +#include "qalculate_kde_utils.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern MathStructure *mstruct; + +QalculateExportCSVDialog::QalculateExportCSVDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Export CSV File"), Ok | Cancel | Help, Ok, true) { + + setMainWidget(new QWidget(this)); + QGridLayout *grid = new QGridLayout(mainWidget(), 1, 1, 0, spacingHint()); + QButtonGroup *group = new QButtonGroup(); + currentResultButton = new QRadioButton(i18n("Current result"), mainWidget()); + group->insert(currentResultButton, 0); + grid->addWidget(currentResultButton, 0, 0); + currentResultButton->setChecked(true); + matrixVectorButton = new QRadioButton(i18n("Matrix/vector variable"), mainWidget()); + group->insert(matrixVectorButton, 1); + grid->addWidget(matrixVectorButton, 1, 0); + matrixVectorEdit = new KLineEdit(mainWidget()); + grid->addWidget(matrixVectorEdit, 1, 1); + grid->addWidget(new QLabel(i18n("File:"), mainWidget()), 2, 0); + fileEdit = new KURLRequester(mainWidget()); + fileEdit->setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly); + fileEdit->setCaption(i18n("Export CSV File")); + grid->addWidget(fileEdit, 2, 1); + grid->addWidget(new QLabel(i18n("Delimiter:"), mainWidget()), 3, 0); + delimiterCombo = new KComboBox(mainWidget()); + delimiterCombo->setMaximumWidth(250); + delimiterCombo->insertItem(i18n("Comma")); + delimiterCombo->insertItem(i18n("Tabulator")); + delimiterCombo->insertItem(i18n("Semicolon")); + delimiterCombo->insertItem(i18n("Space")); + delimiterCombo->insertItem(i18n("Other")); + delimiterCombo->setEditable(false); + grid->addWidget(delimiterCombo, 3, 1); + otherDelimiterEdit = new KLineEdit(mainWidget()); + grid->addWidget(otherDelimiterEdit, 4, 1); + otherDelimiterEdit->setEnabled(false); + + connect(group, SIGNAL(clicked(int)), this, SLOT(exportSourceChanged(int))); + connect(delimiterCombo, SIGNAL(activated(int)), this, SLOT(delimiterChanged(int))); + +} + +QalculateExportCSVDialog::~QalculateExportCSVDialog() {} + +void QalculateExportCSVDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-import-export-csv"); +} + +void QalculateExportCSVDialog::exportSourceChanged(int i) { + matrixVectorEdit->setEnabled(i == 1); +} +void QalculateExportCSVDialog::delimiterChanged(int i) { + otherDelimiterEdit->setEnabled(i == 4); +} +void QalculateExportCSVDialog::slotOk() { + + QString str = fileEdit->url().stripWhiteSpace(); + if(str.isEmpty()) { + //no name -- open dialog again + fileEdit->setFocus(); + KMessageBox::error(this, i18n("No file name entered.")); + return; + } + string delimiter = ""; + switch(delimiterCombo->currentItem()) { + case 0: { + delimiter = ","; + break; + } + case 1: { + delimiter = "\t"; + break; + } + case 2: { + delimiter = ";"; + break; + } + case 3: { + delimiter = " "; + break; + } + case 4: { + delimiter = otherDelimiterEdit->text().ascii(); + break; + } + } + if(delimiter.empty()) { + //no delimiter -- open dialog again + otherDelimiterEdit->setFocus(); + KMessageBox::error(this, i18n("No delimiter selected.")); + return; + } + MathStructure *matrix_struct; + if(export_variable) { + matrix_struct = (MathStructure*) &export_variable->get(); + } else if(currentResultButton->isChecked()) { + matrix_struct = mstruct; + } else { + string str2 = matrixVectorEdit->text().ascii(); + remove_blank_ends(str2); + if(str2.empty()) { + matrixVectorEdit->setFocus(); + KMessageBox::error(this, i18n("No variable name entered.")); + return; + } + Variable *var = CALCULATOR->getActiveVariable(str2); + if(!var || !var->isKnown()) { + var = CALCULATOR->getVariable(str2); + while(var && !var->isKnown()) { + var = CALCULATOR->getVariable(str2); + } + } + if(!var || !var->isKnown()) { + matrixVectorEdit->setFocus(); + KMessageBox::error(this, i18n("No known variable with entered name found.")); + return; + } + matrix_struct = (MathStructure*) &((KnownVariable*) var)->get(); + } + if(!CALCULATOR->exportCSV(*matrix_struct, str.ascii(), delimiter)) { + QString error_str; + error_str.sprintf(i18n("Could not export to file \n%s"), str.ascii()); + KMessageBox::error(this, error_str); + reject(); + } + accept(); + +} + +void QalculateExportCSVDialog::exportCSVFile(KnownVariable *v) { + + fileEdit->setFocus(); + + export_variable = v; + + if(v) { + fileEdit->setURL(v->preferredDisplayName(false, false, false, false, &can_display_unicode_string_function, (void*) fileEdit->lineEdit()).name.c_str()); + matrixVectorEdit->setText(v->preferredDisplayName(false, false, false, false, &can_display_unicode_string_function, (void*) matrixVectorEdit).name.c_str()); + matrixVectorButton->setChecked(true); + } else { + fileEdit->clear(); + matrixVectorEdit->clear(); + currentResultButton->setChecked(true); + } + currentResultButton->setEnabled(v == NULL); + matrixVectorButton->setEnabled(v == NULL); + matrixVectorEdit->setEnabled(false); + + exec(); + +} + + +#include "qalculateexportcsvdialog.moc" diff --git a/src/qalculateexportcsvdialog.h b/src/qalculateexportcsvdialog.h new file mode 100644 index 0000000..57e45f4 --- /dev/null +++ b/src/qalculateexportcsvdialog.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEXPORTCSVDIALOG_H +#define QALCULATEEXPORTCSVDIALOG_H + +#include + +class KLineEdit; +class KComboBox; +class QRadioButton; +class KURLRequester; +class KnownVariable; + +/** +@author Niklas Knutsson +*/ +class QalculateExportCSVDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateExportCSVDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateExportCSVDialog(); + + KLineEdit *otherDelimiterEdit, *matrixVectorEdit; + KComboBox *delimiterCombo; + QRadioButton *currentResultButton, *matrixVectorButton; + KURLRequester *fileEdit; + + void exportCSVFile(KnownVariable *v = NULL); + +private: + + KnownVariable *export_variable; + +public slots: + + void exportSourceChanged(int); + void delimiterChanged(int); + +protected slots: + + void slotHelp(); + void slotOk(); + +}; + +#endif diff --git a/src/qalculateexpressionedit.cpp b/src/qalculateexpressionedit.cpp new file mode 100644 index 0000000..6ef9328 --- /dev/null +++ b/src/qalculateexpressionedit.cpp @@ -0,0 +1,1018 @@ +/*************************************************************************** + * Copyright (C) 2005. 2007 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateexpressionedit.h" + +#include "qalculate_kde_utils.h" +#include "kqalculate.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern vector modes; + +extern KQalculate *mainWin; +extern PrintOptions printops; +extern EvaluationOptions evalops; +extern bool rpn_mode, rpn_keypad_only; +extern tree_struct function_cats, unit_cats, variable_cats; +extern vector ia_units, ia_variables, ia_functions; + +class QalculateExpressionEditListBoxItem : public QListBoxItem { + +public: + + QalculateExpressionEditListBoxItem(ExpressionItem *eitem); + virtual ~QalculateExpressionEditListBoxItem(); + + int height(const QListBox*) const; + int width(const QListBox*) const; + + bool reuse(ExpressionItem *newItem); + + ExpressionItem *item; + +protected: + + void paint(QPainter*); + +private: + + QString title; + int italic_index; + bool rich_text; + +}; + +QalculateExpressionEdit::QalculateExpressionEdit(bool connected_to_main_win, QWidget *parent, const char *name) : KLineEdit(parent, name) { + + qalculateCompletionBox = new QalculateExpressionEditCompletionBox(this); + qalculateCompletion = new KCompletion(); + setCompletionObject(qalculateCompletion); + + pos_before_completion = 0; + + b_main = connected_to_main_win; + + dont_change_index = false; + expression_history_index = -1; + + setCompletionMode(KGlobalSettings::CompletionPopup); + + setKeyCompression(false); + + //check for position changes regularly + prev_position = 0; + pos_timer = startTimer(50); + + connect(qalculateCompletionBox, SIGNAL(highlighted(QListBoxItem*)), this, SLOT(insertCompletion(QListBoxItem*))); + connect(qalculateCompletionBox, SIGNAL(userCancelled(const QString&)), this, SLOT(cancelCompletion(const QString&))); + connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&))); + +} + +QalculateExpressionEdit::~QalculateExpressionEdit() {} + +void QalculateExpressionEdit::timerEvent(QTimerEvent *event) { + if(event->timerId() == pos_timer) { + if(cursorPosition() != prev_position) { + prev_position = cursorPosition(); + emit cursorMoved(); + } + } else { + KLineEdit::timerEvent(event); + } +} + +void QalculateExpressionEdit::onTextChanged(const QString &str) { + if(str.isEmpty()) { + if(qalculateCompletionBox) { + qalculateCompletionBox->hide(); + qalculateCompletionBox->clear(); + } + return; + } + prev_position = cursorPosition(); +} + +void QalculateExpressionEdit::cancelCompletion(const QString &str) { + int new_pos = pos_before_completion; + setText(str); + setCursorPosition(new_pos); +} + +void QalculateExpressionEdit::enableCompletion() { + setCompletionMode(KGlobalSettings::CompletionPopup); +} +void QalculateExpressionEdit::disableCompletion() { + setCompletionMode(KGlobalSettings::CompletionNone); +} +bool QalculateExpressionEdit::completionEnabled() const { + return completionMode() == KGlobalSettings::CompletionPopup; +} + +QPopupMenu *QalculateExpressionEdit::createPopupMenu() { + + setCompletionObject(NULL); + QPopupMenu *menu = KLineEdit::createPopupMenu(); + setCompletionObject(qalculateCompletion); + menu->insertSeparator(); + if(completionMode() == KGlobalSettings::CompletionPopup) menu->insertItem(i18n("Disable Completion"), this, SLOT(disableCompletion())); + else menu->insertItem(i18n("Enable Completion"), this, SLOT(enableCompletion())); + if(b_main) { + menu->insertSeparator(); + mainWin->ActionReadPrecision->plug(menu); + mainWin->ActionLimitImplicitMultiplication->plug(menu); + mainWin->ActionRPNMode->plug(menu); + QPopupMenu *modes_menu = new QPopupMenu(menu); + QObject::connect(modes_menu, SIGNAL(activated(int)), mainWin, SLOT(loadMode(int))); + for(size_t i = 0; i < modes.size(); i++) { + modes_menu->insertItem(modes[i].name, i, i); + } + modes_menu->insertSeparator(); + mainWin->ActionSaveModeAs->plug(modes_menu); + mainWin->ActionDeleteMode->plug(modes_menu); + menu->insertItem(i18n("Meta Modes"), modes_menu); + menu->insertSeparator(); + mainWin->ActionInsertMatrix->plug(menu); + mainWin->ActionInsertVector->plug(menu); + } + return menu; + +} + +#if QT_VERSION >= 0x030200 +#define GET_SELECTION int start = selectionStart(), end = -1; if(start >= 0) end = start + selectedText().length(); +#else +#define GET_SELECTION int start = -1, end = -1; getSelection(&start, &end); +#endif +#define RESTORE_SELECTION if(start > 0) setSelection(start, end - start); + +void QalculateExpressionEdit::addToHistory(const QString &str) { + for(QStringList::Iterator it = expression_history.begin(); it != expression_history.end(); ++it) { + if(*it == str) { + expression_history.erase(it); + break; + } + } + if(expression_history.size() >= 25) { + expression_history.pop_back(); + } + expression_history.insert(expression_history.begin(), str); + expression_history_index = 0; +} + + +void QalculateExpressionEdit::setAfterCompletionPosition() { + setCursorPosition(cpos_ac); +} + +void QalculateExpressionEdit::insertCompletion(QListBoxItem *li) { + + ExpressionItem *item = ((QalculateExpressionEditListBoxItem*) li)->item; + + setSelection(cstart, cend - cstart + 1); + + QString str = completed_text; + const ExpressionName *ename = NULL, *ename_r = NULL; + ename_r = &item->preferredInputName(false, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) this); + for(size_t name_i = 0; name_i <= item->countNames() && !ename; name_i++) { + if(name_i == 0) { + ename = ename_r; + } else { + ename = &item->getName(name_i); + if(!ename || ename == ename_r || ename->plural || (ename->unicode && (!printops.use_unicode_signs || !can_display_unicode_string_function(ename->name.c_str(), (void*) this)))) { + ename = NULL; + } + } + if(ename) { + if(str.length() <= ename->name.length()) { + for(size_t i = 0; i < str.length(); i++) { + if(ename->name[i] != str[i]) { + ename = NULL; + break; + } + } + } else { + ename = NULL; + } + } + } + for(size_t name_i = 1; name_i <= item->countNames() && !ename; name_i++) { + ename = &item->getName(name_i); + if(!ename || ename == ename_r || (!ename->plural && !(ename->unicode && (!printops.use_unicode_signs || !can_display_unicode_string_function(ename->name.c_str(), (void*) this))))) { + ename = NULL; + } + if(ename) { + if(str.length() <= ename->name.length()) { + for(size_t i = 0; i < str.length(); i++) { + if(ename->name[i] != str[i]) { + ename = NULL; + break; + } + } + } else { + ename = NULL; + } + } + } + if(!ename) ename = ename_r; + if(!ename) return; + if(item->type() == TYPE_FUNCTION) { + if(text()[cend + 1] == '(') { + insert(ename->name.c_str()); + cend = cstart + ename->name.length() - 1; + cpos_ac = cend + 2; + } else { + str = ename->name.c_str(); + str += "()"; + insert(str); + cend = cstart + str.length() - 1; + cpos_ac = cend; + } + } else { + insert(ename->name.c_str()); + cend = cstart + ename->name.length() - 1; + cpos_ac = cend + 1; + } + setCursorPosition(cpos_ac); + +} + +bool matchesExpressionItem(const QString &str, ExpressionItem *item) { + bool b_match = false; + for(size_t name_i = 1; !b_match && name_i <= item->countNames(); name_i++) { + const ExpressionName *ename = &item->getName(name_i); + if(ename && str.length() <= ename->name.length()) { + b_match = true; + for(size_t i = 0; i < str.length(); i++) { + if(ename->name[i] != str[i]) { + b_match = false; + break; + } + } + } + } + return b_match; +} + +void QalculateExpressionEdit::makeCompletion(const QString &str) { + if(cursorPosition() <= 0 || str.isEmpty()) { + if(qalculateCompletionBox) { + qalculateCompletionBox->hide(); + qalculateCompletionBox->clear(); + } + return; + } + uint start = (uint) cursorPosition(); + cend = (int) start - 1; + QString str2 = str; + str2.truncate(start); + const char *cstr = str2.ascii(); + bool non_number_before = false; + size_t cpos = strlen(cstr) - 1; + start--; + while(true) { + while(cpos > 0 && (unsigned char) cstr[cpos] >= 0x80 && (unsigned char) cstr[cpos] <= 0xBF) { + cpos--; + } + if(!CALCULATOR->utf8_pos_is_valid_in_name((char*) &cstr[cpos])) { + start++; + break; + } else if(is_in(NUMBERS, cstr[cpos])) { + if(non_number_before) { + start++; + break; + } + } else { + non_number_before = true; + } + if(start == 0 || cpos == 0) break; + start--; + cpos--; + } + if(start >= (uint) cursorPosition()) { + if(qalculateCompletionBox) { + qalculateCompletionBox->hide(); + qalculateCompletionBox->clear(); + } + return; + } + cstart = (int) start; + str2.remove(0, start); + + completed_text = str2; + pos_before_completion = cursorPosition(); + qalculateCompletionBox->setCancelledText(text()); + + matched_items.clear(); + if(evalops.parse_options.functions_enabled) { + for(size_t i = 0; i < CALCULATOR->functions.size(); i++) { + if(CALCULATOR->functions[i]->isActive()) { + if(matchesExpressionItem(str2, CALCULATOR->functions[i])) { + matched_items.push_back(CALCULATOR->functions[i]); + } + } + } + } + if(evalops.parse_options.variables_enabled) { + for(size_t i = 0; i < CALCULATOR->variables.size(); i++) { + if(CALCULATOR->variables[i]->isActive()) { + if(matchesExpressionItem(str2, CALCULATOR->variables[i])) { + matched_items.push_back(CALCULATOR->variables[i]); + } + } + } + } + if(evalops.parse_options.units_enabled) { + for(size_t i = 0; i < CALCULATOR->units.size(); i++) { + if(CALCULATOR->units[i]->isActive() && CALCULATOR->units[i]->subtype() != SUBTYPE_COMPOSITE_UNIT) { + if(matchesExpressionItem(str2, CALCULATOR->units[i])) { + matched_items.push_back(CALCULATOR->units[i]); + } + } + } + } + + if(matched_items.isEmpty()) { + if(qalculateCompletionBox) { + qalculateCompletionBox->hide(); + qalculateCompletionBox->clear(); + } + } else { + setCompletedItems(); + } +} + +void QalculateExpressionEdit::updateCompletion() { +} + +void QalculateExpressionEdit::wrapSelection() { + GET_SELECTION + if(start >= 0) { + deselect(); + setCursorPosition(start); + insert("("); + setCursorPosition(end + 1); + insert(")"); + setSelection(start, end - start + 2); + } +} + +void QalculateExpressionEdit::keyPressEvent(QKeyEvent *e) { + if(e->key() == Key_Enter || e->key() == Key_Return) { + if(b_main) { + mainWin->execute(); + e->accept(); + return; + } else { + return KLineEdit::keyPressEvent(e); + } + } + if(e->state() & ControlButton && e->key() == Key_Asterisk) { + if(rpn_mode && b_main && (!rpn_keypad_only || e->state() & Keypad)) { + mainWin->calculateRPN(OPERATION_RAISE); + return; + } + insert("^"); + e->accept(); + return; + } + if(e->state() != 0 && e->state() != ShiftButton && e->state() != Keypad) { + KLineEdit::keyPressEvent(e); + return; + } + switch(e->key()) { + case Key_Period: { + if(e->state() == Keypad) { + insert(CALCULATOR->getDecimalPoint()); + e->accept(); + return; + } + break; + } + case Key_Comma: { + if(e->state() == Keypad) { + insert(CALCULATOR->getDecimalPoint()); + e->accept(); + return; + } + break; + } + case Key_AsciiCircum: { + if(rpn_mode && b_main && (!rpn_keypad_only || e->state() & Keypad)) { + mainWin->calculateRPN(OPERATION_RAISE); + return; + } + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^"); + e->accept(); + return; + } + case Key_Slash: { + if(rpn_mode && b_main && (!rpn_keypad_only || e->state() & Keypad)) { + mainWin->calculateRPN(OPERATION_DIVIDE); + return; + } + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + if(printops.use_unicode_signs && printops.division_sign == DIVISION_SIGN_DIVISION && can_display_unicode_string_function(SIGN_DIVISION, (void*) this)) { + insert(SIGN_DIVISION); + e->accept(); + return; + } + break; + } + case Key_Asterisk: { + if(rpn_mode && b_main && (!rpn_keypad_only || e->state() & Keypad)) { + mainWin->calculateRPN(OPERATION_MULTIPLY); + return; + } + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + if(printops.use_unicode_signs && printops.multiplication_sign == MULTIPLICATION_SIGN_DOT && can_display_unicode_string_function(SIGN_MULTIDOT, (void*) this)) { + insert(SIGN_MULTIDOT); + } else if(printops.use_unicode_signs && printops.multiplication_sign == MULTIPLICATION_SIGN_DOT && can_display_unicode_string_function(SIGN_SMALLCIRCLE, (void*) this)) { + insert(SIGN_SMALLCIRCLE); + } else if(printops.use_unicode_signs && printops.multiplication_sign == MULTIPLICATION_SIGN_X && can_display_unicode_string_function(SIGN_MULTIPLICATION, (void*) this)) { + insert(SIGN_MULTIPLICATION); + } else { + insert("*"); + } + e->accept(); + return; + } + case Key_Plus: { + if(rpn_mode && b_main && (!rpn_keypad_only || e->state() & Keypad)) { + mainWin->calculateRPN(OPERATION_ADD); + return; + } + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + e->accept(); + break; + } + case Key_Minus: { + if(rpn_mode && b_main && (!rpn_keypad_only || e->state() & Keypad)) { + mainWin->calculateRPN(OPERATION_SUBTRACT); + return; + } + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + if(printops.use_unicode_signs && can_display_unicode_string_function(SIGN_MINUS, (void*) this)) { + insert(SIGN_MINUS); + e->accept(); + return; + } + break; + } + case Key_Up: {} + case Key_PageUp: { + if(expression_history_index + 1 < (int) expression_history.size()) { + expression_history_index++; + dont_change_index = true; + setText(expression_history[expression_history_index]); + dont_change_index = false; + } + e->accept(); + return; + } + case Key_Down: {} + case Key_PageDown: { + if(expression_history_index > -1) { + expression_history_index--; + dont_change_index = true; + if(expression_history_index < 0) { + clear(); + } else { + setText(expression_history[expression_history_index]); + } + dont_change_index = false; + } + e->accept(); + return; + } + case Key_BraceLeft: {} + case Key_BraceRight: { + return; + } + case 0xffff: { + if(e->text().utf8() == "⁰") { + insert("°"); + e->accept(); + return; + } + if(e->text().utf8() == "¹") { + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^1"); + e->accept(); + return; + } + if(e->text().utf8() == "²") { + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^2"); + e->accept(); + return; + } + if(e->text().utf8() == "³") { + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^3"); + e->accept(); + return; + } + if(e->text().utf8() == "⁴") { + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^4"); + e->accept(); + return; + } + if(e->text().utf8() == "⁵") { + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^5"); + e->accept(); + return; + } + if(e->text().utf8() == "⁶") { + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^6"); + e->accept(); + return; + } + if(e->text().utf8() == "⁷") { + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^7"); + e->accept(); + return; + } + if(e->text().utf8() == "⁸") { + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^8"); + e->accept(); + return; + } + if(e->text().utf8() == "⁹") { + if(!evalops.parse_options.rpn) { + wrapSelection(); + deselect(); + } + insert("^9"); + e->accept(); + return; + } + break; + } + } + KLineEdit::keyPressEvent(e); +} + +bool QalculateExpressionEdit::eventFilter(QObject *o, QEvent *ev) { + if(o == this && ev->type() == QEvent::KeyPress) { + QKeyEvent *e = static_cast(ev); + if((e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && qalculateCompletionBox && qalculateCompletionBox->isVisible()) { + if(qalculateCompletionBox->selectedItem()) { + KCursor::autoHideEventFilter(this, ev); + e->accept(); + qalculateCompletionBox->hide(); + deselect(); + return true; + } else { + qalculateCompletionBox->hide(); + return false; + } + } + } + return KLineEdit::eventFilter(o, ev); +} + + +void set_title(ExpressionItem *item, QString &title) { + if(item->type() != TYPE_VARIABLE || !item->title(false).empty()) { + title = item->title().c_str(); + } else { + Variable *v = (Variable*) item; + if(is_answer_variable(v)) { + title = i18n("a previous result"); + } else if(v->isKnown()) { + if(((KnownVariable*) v)->isExpression()) { + title = CALCULATOR->localizeExpression(((KnownVariable*) v)->expression()).c_str(); + } else { + if(((KnownVariable*) v)->get().isMatrix()) { + title = i18n("matrix"); + } else if(((KnownVariable*) v)->get().isVector()) { + title = i18n("vector"); + } else { + title = CALCULATOR->printMathStructureTimeOut(((KnownVariable*) v)->get(), 30).c_str(); + } + } + } else { + if(((UnknownVariable*) v)->assumptions()) { + switch(((UnknownVariable*) v)->assumptions()->sign()) { + case ASSUMPTION_SIGN_POSITIVE: { + title = i18n("positive"); + break; + } + case ASSUMPTION_SIGN_NONPOSITIVE: { + title = i18n("non-positive"); + break; + } + case ASSUMPTION_SIGN_NEGATIVE: { + title = i18n("negative"); + break; + } + case ASSUMPTION_SIGN_NONNEGATIVE: { + title = i18n("non-negative"); + break; + } + case ASSUMPTION_SIGN_NONZERO: { + title = i18n("non-zero"); + break; + } + default: {} + } + if(!title.isEmpty() && !((UnknownVariable*) v)->assumptions()->type() == ASSUMPTION_TYPE_NONE) title += " "; + switch(((UnknownVariable*) v)->assumptions()->type()) { + case ASSUMPTION_TYPE_INTEGER: { + title += i18n("integer"); + break; + } + case ASSUMPTION_TYPE_RATIONAL: { + title += i18n("rational"); + break; + } + case ASSUMPTION_TYPE_REAL: { + title += i18n("real"); + break; + } + case ASSUMPTION_TYPE_COMPLEX: { + title += i18n("complex"); + break; + } + case ASSUMPTION_TYPE_NUMBER: { + title += i18n("number"); + break; + } + case ASSUMPTION_TYPE_NONMATRIX: { + title += i18n("(not matrix)"); + break; + } + default: {} + } + if(title.isEmpty()) title = i18n("unknown"); + } else { + title = i18n("default assumptions"); + } + } + } +} + +string sub_suffix(const ExpressionName *ename) { + size_t i = ename->name.rfind('_'); + bool b = i == string::npos || i == ename->name.length() - 1 || i == 0; + size_t i2 = 1; + string str; + if(b) { + if(is_in(NUMBERS, ename->name[ename->name.length() - 1])) { + while(ename->name.length() > i2 + 1 && is_in(NUMBERS, ename->name[ename->name.length() - 1 - i2])) { + i2++; + } + } + str += ename->name.substr(0, ename->name.length() - i2); + } else { + str += ename->name.substr(0, i); + } + str += ""; + if(b) str += ename->name.substr(ename->name.length() - i2, i2); + else str += ename->name.substr(i + 1, ename->name.length() - (i + 1)); + str += ""; + return str; +} + +QString makeListName(ExpressionItem *item, QWidget *w, int *italic_index, bool *rich_text) { + string str; + const ExpressionName *ename, *ename_r; + *rich_text = false; + bool b = false; + ename_r = &item->preferredInputName(false, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) w); + if(ename_r->suffix && ename_r->name.length() > 1) { + str = sub_suffix(ename_r); + *rich_text = true; + } else { + str = ename_r->name; + } + if(item->type() == TYPE_FUNCTION) str += "()"; + for(size_t name_i = 1; name_i <= item->countNames(); name_i++) { + ename = &item->getName(name_i); + if(ename && ename != ename_r && !ename->plural && (!ename->unicode || can_display_unicode_string_function(ename->name.c_str(), (void*) w))) { + str += " "; + if(!b) { + *italic_index = str.length(); + *rich_text = true; + str += ""; + b = true; + } + if(ename->suffix && ename->name.length() > 1) { + str += sub_suffix(ename); + } else { + str += ename->name; + } + if(item->type() == TYPE_FUNCTION) str += "()"; + } + } + if(b) str += ""; + return str.c_str(); +} + +QalculateExpressionEditListBoxItem::QalculateExpressionEditListBoxItem(ExpressionItem *eitem) : QListBoxItem() { + item = eitem; + italic_index = -1; + setText(makeListName(item, listBox(), &italic_index, &rich_text)); + set_title(item, title); +} +QalculateExpressionEditListBoxItem::~QalculateExpressionEditListBoxItem() { +} + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 +QString rPixelSqueeze(const QString& name, const QFontMetrics& fontMetrics, uint maxPixels) +{ + uint nameWidth = fontMetrics.width(name); + + if (maxPixels < nameWidth) + { + QString tmp = name; + const uint em = fontMetrics.maxWidth(); + maxPixels -= fontMetrics.width("..."); + + while (maxPixels < nameWidth && !tmp.isEmpty()) + { + int length = tmp.length(); + int delta = em ? (nameWidth - maxPixels) / em : length; + + if(delta < 1) delta = 1; + else if(length < delta) delta = length; + + tmp.remove(length - delta, delta); + nameWidth = fontMetrics.width(tmp); + } + + return (tmp + "..."); + } + + return name; +} +#endif + +void QalculateExpressionEditListBoxItem::paint(QPainter *painter) { + + int itemHeight = height(listBox()); + + int entryWidth = listBox()->width() - listBox()->style().pixelMetric(QStyle::PM_ScrollBarExtent) - 2 * listBox()->style().pixelMetric(QStyle::PM_DefaultFrameWidth); + int titleWidth = (entryWidth / 2) - 1; + int nameWidth = entryWidth - titleWidth - 2; + + if(!text().isEmpty()) { + QString squeezedText; + if(rich_text) { + QSimpleRichText rt(text(), painter->font()); + rt.setWidth(entryWidth); + if(rt.widthUsed() > nameWidth - 1) { + squeezedText = text(); + if(italic_index > 0) squeezedText.truncate(italic_index); +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + squeezedText = rPixelSqueeze(squeezedText, listBox()->fontMetrics(), nameWidth); +#else + squeezedText = KStringHandler::rPixelSqueeze(squeezedText, listBox()->fontMetrics(), nameWidth); +#endif + painter->drawText(0, 0, nameWidth, itemHeight, Qt::AlignLeft | Qt::AlignVCenter, squeezedText); + } else { + QColorGroup cg = listBox()->colorGroup(); + cg.setColor(QColorGroup::Text, painter->pen().color()); + rt.draw(painter, 1, 0, QRect(0, 0, nameWidth - 1, itemHeight), cg, &painter->brush()); + } + } else { +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + squeezedText = rPixelSqueeze(text(), listBox()->fontMetrics(), nameWidth); +#else + squeezedText = KStringHandler::rPixelSqueeze(text(), listBox()->fontMetrics(), nameWidth); +#endif + painter->drawText(0, 0, nameWidth, itemHeight, Qt::AlignLeft | Qt::AlignVCenter, squeezedText); + } +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + squeezedText = rPixelSqueeze(title, listBox()->fontMetrics(), titleWidth); +#else + squeezedText = KStringHandler::rPixelSqueeze(title, listBox()->fontMetrics(), titleWidth); +#endif + QFont font = painter->font(); + font.setItalic(true); + painter->setFont(font); + painter->drawText(entryWidth - titleWidth, 0, titleWidth, itemHeight, Qt::AlignLeft | Qt::AlignVCenter, squeezedText); + } + +} + +int QalculateExpressionEditListBoxItem::height(const QListBox *lb) const { + int h; + h = lb->fontMetrics().lineSpacing() + 4; + return QMAX(h, QApplication::globalStrut().height()); +} + +int QalculateExpressionEditListBoxItem::width(const QListBox *lb) const { + return QMAX(lb->fontMetrics().width(text()) + 6, QApplication::globalStrut().width()); +} +bool QalculateExpressionEditListBoxItem::reuse(ExpressionItem *newItem) { + if(item == newItem) return false; + item = newItem; + italic_index = -1; + setText(makeListName(item, listBox(), &italic_index, &rich_text)); + set_title(item, title); + return true; +} + +QalculateExpressionEditCompletionBox::QalculateExpressionEditCompletionBox(QWidget *parent, const char *name) : KCompletionBox(parent, name) { +} +QalculateExpressionEditCompletionBox::~QalculateExpressionEditCompletionBox() { +} + +void QalculateExpressionEditCompletionBox::setItems(const QValueVector& items) { + + bool block = signalsBlocked(); + blockSignals(true); + + QListBoxItem* item = firstItem(); + if(!item) { + insertItemList(items); + } else { + //Keep track of whether we need to change anything, + //so we can avoid a repaint for identical updates, + //to reduce flicker + bool dirty = false; + +#if QT_VERSION >= 0x030200 + QValueVector::ConstIterator it = items.constBegin(); + const QValueVector::ConstIterator itEnd = items.constEnd(); +#else + QValueVector::ConstIterator it = items.begin(); + const QValueVector::ConstIterator itEnd = items.end(); +#endif + + for (; it != itEnd; ++it) { + if(item) { + const bool changed = ((QalculateExpressionEditListBoxItem*) item)->reuse(*it); + dirty = dirty || changed; + item = item->next(); + } else { + dirty = true; + //Inserting an item is a way of making this dirty + insertItem(new QalculateExpressionEditListBoxItem(*it)); + } + } + + //If there is an unused item, mark as dirty -> less items now + if(item) dirty = true; + + QListBoxItem* tmp = item; + while((item = tmp)) { + tmp = item->next(); + delete item; + } + + if(dirty) triggerUpdate(false); + } + sort(); + + if(isVisible() && size().height() != sizeHint().height()) { +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + hide(); + popup(); +#else + sizeAndPosition(); +#endif + } + + blockSignals(block); + + // Trigger d->down_workaround = true within KCompletionBox + QStringList dummy; + KCompletionBox::insertItems(dummy, 1); + +} + +void QalculateExpressionEditCompletionBox::insertItemList(const QValueVector & list, int index) { + if(index < 0) index = count(); + for(QValueVector::ConstIterator it = list.begin(); it != list.end(); ++it) { + insertItem(new QalculateExpressionEditListBoxItem(*it), index++); + } +} + +void QalculateExpressionEdit::setCompletedItems() { + + QString txt; + if(qalculateCompletionBox && qalculateCompletionBox->isVisible()) { + // The popup is visible already - do the matching on the initial string, + // not on the currently selected one. + txt = qalculateCompletionBox->cancelledText(); + } else { + txt = text(); + } + + if(!matched_items.isEmpty() && !(matched_items.size() == 1 && matched_items[0]->hasName(txt.ascii()))) { + + if(qalculateCompletionBox->isVisible()) { + bool wasSelected = qalculateCompletionBox->isSelected(qalculateCompletionBox->currentItem()); + const QString currentSelection = qalculateCompletionBox->currentText(); + qalculateCompletionBox->setItems(matched_items); + QListBoxItem* item = qalculateCompletionBox->findItem(currentSelection, Qt::ExactMatch); + // If no item is selected, that means the listbox hasn't been manipulated by the user yet, + // because it's not possible otherwise to have no selected item. In such case make + // always the first item current and unselected, so that the current item doesn't jump. + if(!item || !wasSelected) { + wasSelected = false; + item = qalculateCompletionBox->item(0); + } + if(item) { + qalculateCompletionBox->blockSignals(true); + qalculateCompletionBox->setCurrentItem(item); + qalculateCompletionBox->setSelected(item, wasSelected); + qalculateCompletionBox->blockSignals(false); + } + } else { // completion box not visible yet -> show it + if(!txt.isEmpty()) qalculateCompletionBox->setCancelledText(txt); + ((QalculateExpressionEditCompletionBox*) qalculateCompletionBox)->setItems(matched_items); + qalculateCompletionBox->popup(); + } + + } else { + + if(qalculateCompletionBox && qalculateCompletionBox->isVisible()) { + qalculateCompletionBox->hide(); + } + + } + +} + +void QalculateExpressionEditCompletionBox::hideEvent(QHideEvent*) { + emit hidden(); +} + +#include "qalculateexpressionedit.moc" diff --git a/src/qalculateexpressionedit.h b/src/qalculateexpressionedit.h new file mode 100644 index 0000000..7434489 --- /dev/null +++ b/src/qalculateexpressionedit.h @@ -0,0 +1,109 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEEXPRESSIONEDIT_H +#define QALCULATEEXPRESSIONEDIT_H + +#include +#include +#include +#include + +class QStringList; +class QPopupMenu; +class QalculateExpressionEditCompletionBox; +class ExpressionItem; +class QListBoxItem; + +class QalculateExpressionEdit : public KLineEdit { + + Q_OBJECT + +public: + + QalculateExpressionEdit(bool connected_to_main_win, QWidget *parent = 0, const char *name = 0); + virtual ~QalculateExpressionEdit(); + + QValueVector matched_items; + + bool b_main; + QStringList expression_history; + int expression_history_index; + bool dont_change_index; + QalculateExpressionEditCompletionBox *qalculateCompletionBox; + KCompletion *qalculateCompletion; + + virtual bool eventFilter(QObject *o, QEvent *ev); + void keyPressEvent(QKeyEvent *e); + +public slots: + + void onTextChanged(const QString&); + void addToHistory(const QString&); + void wrapSelection(); + void makeCompletion(const QString&); + void insertCompletion(QListBoxItem *li); + void updateCompletion(); + void setAfterCompletionPosition(); + void cancelCompletion(const QString &str); + void setCompletedItems(); + void enableCompletion(); + void disableCompletion(); + bool completionEnabled() const; + +signals: + + void cursorMoved(); + +protected: + + virtual QPopupMenu *createPopupMenu(); + virtual void timerEvent(QTimerEvent*); + int cstart, cend, cpos_ac, prev_position, pos_timer; + QString completed_text; + int pos_before_completion; + +}; + +class QalculateExpressionEditCompletionBox : public KCompletionBox { + + Q_OBJECT + +public: + + QalculateExpressionEditCompletionBox(QWidget *parent, const char *name = 0); + virtual ~QalculateExpressionEditCompletionBox(); + void insertItemList(const QValueVector& list, int index = -1); + +public slots: + + void setItems(const QValueVector& items); + +protected: + + void hideEvent(QHideEvent*); + +signals: + + void hidden(); + +}; + + +#endif diff --git a/src/qalculatefunctionsdialog.cpp b/src/qalculatefunctionsdialog.cpp new file mode 100644 index 0000000..80b452d --- /dev/null +++ b/src/qalculatefunctionsdialog.cpp @@ -0,0 +1,537 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculatefunctionsdialog.h" +#include "qalculate_kde_utils.h" +#include "qalculateeditfunctiondialog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern tree_struct function_cats; +extern vector ia_functions; +extern PrintOptions printops; + +QalculateFunctionsDialog::QalculateFunctionsDialog(QWidget *parent, const char *name) : KDialog(parent, name, false) { + + function_edit_dialog = NULL; + selected_category = ""; + selected_function = NULL; + + QHBoxLayout *layout = new QHBoxLayout(this, marginHint(), spacingHint()); + + setCaption(i18n("Functions")); + + QVBoxLayout *leftLayout = new QVBoxLayout(layout, spacingHint()); + + QSplitter *splitter = new QSplitter(Qt::Horizontal, this); + leftLayout->addWidget(splitter); + + categoryView = new KListView(splitter); + categoryView->addColumn(i18n("Category")); + categoryView->setRootIsDecorated(false); + + functionView = new KListView(splitter); + functionView->addColumn(i18n("Function Name")); + functionView->setRootIsDecorated(false); + + descriptionBrowser = new KTextBrowser(this); + leftLayout->addWidget(descriptionBrowser); + + QVBoxLayout *buttonLayout = new QVBoxLayout(layout, spacingHint()); + + newButton = new QPushButton(i18n("New"), this); + buttonLayout->addWidget(newButton); + editButton = new QPushButton(i18n("Edit"), this); + editButton->setEnabled(false); + buttonLayout->addWidget(editButton); + deleteButton = new QPushButton(i18n("Delete"), this); + deleteButton->setEnabled(false); + buttonLayout->addWidget(deleteButton); + deactivateButton = new QPushButton(i18n("Deactivate"), this); + deactivateButton->setEnabled(false); + buttonLayout->addWidget(deactivateButton); + insertButton = new QPushButton(i18n("Insert"), this); + insertButton->setEnabled(false); + buttonLayout->addWidget(insertButton); + applyButton = new QPushButton(i18n("Apply"), this); + applyButton->setEnabled(false); + buttonLayout->addWidget(applyButton); + buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); + helpButton = new KPushButton(KStdGuiItem::help(), this); + buttonLayout->addWidget(helpButton); + buttonClose = new KPushButton(KStdGuiItem::close(), this); + buttonClose->setFocus(); + buttonLayout->addWidget(buttonClose); + + resize(QSize(675, 475).expandedTo(size())); + + connect(buttonClose, SIGNAL(clicked()), this, SLOT(close())); + connect(newButton, SIGNAL(clicked()), this, SLOT(newFunction())); + connect(editButton, SIGNAL(clicked()), this, SLOT(editFunction())); + connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteFunction())); + connect(deactivateButton, SIGNAL(clicked()), this, SLOT(deactivateFunction())); + connect(insertButton, SIGNAL(clicked()), this, SLOT(insertFunction())); + connect(applyButton, SIGNAL(clicked()), this, SLOT(applyFunction())); + connect(functionView, SIGNAL(selectionChanged()), this, SLOT(functionSelected())); + connect(functionView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(functionDoubleClicked(QListViewItem*))); + connect(categoryView, SIGNAL(selectionChanged()), this, SLOT(categorySelected())); + connect(helpButton, SIGNAL(clicked()), this, SLOT(slotHelp())); + +} + +QalculateFunctionsDialog::~QalculateFunctionsDialog() { +} + +void QalculateFunctionsDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-managers"); +} + +void QalculateFunctionsDialog::updateFunctionTree() { + functionItems.clear(); + categoryItems.clear(); + categoryView->clear(); + QListViewItem *i = new KListViewItem(categoryView, i18n("All")), *i2; + categoryItems[i] = i18n("All"); + i->setOpen(true); + QString str; + tree_struct *item, *item2; + function_cats.it = function_cats.items.begin(); + if(function_cats.it != function_cats.items.end()) { + item = &*function_cats.it; + ++function_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + str = ""; + i2 = i; + while(item) { + str += "/"; + str += item->item.c_str(); + i = new KListViewItem(i2, item->item.c_str()); + i->setOpen(false); + categoryItems[i] = str; + if(str == selected_category) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + while(item && item->it == item->items.end()) { + int str_i = str.findRev("/"); + if(str_i < 0) { + str = ""; + } else { + str.truncate(str_i); + } + item = item->parent; + i = i->parent(); + i2 = i; + } + if(item) { + item2 = &*item->it; + if(item->it == item->items.begin()) + i2 = i; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + if(!function_cats.objects.empty()) { + //add "Uncategorized" category if there are functions without category + i = new KListViewItem(categoryView, i18n("Uncategorized")); + categoryItems[i] = i18n("Uncategorized"); + if(selected_category == i18n("Uncategorized")) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + } + if(!ia_functions.empty()) { + //add "Inactive" category if there are inactive functions + i = new KListViewItem(categoryView, i18n("Inactive")); + categoryItems[i] = i18n("Inactive"); + if(selected_category == i18n("Inactive")) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + } + if(!categoryView->selectedItem()) { + //if no category has been selected (previously selected has been renamed/deleted), select "All" + selected_category = i18n("All"); + QListViewItemIterator it(categoryView); + if(it.current()) + categoryView->setSelected(it.current(), true); + } +} + +#define UPDATE_SELECTED_FUNCTION QListViewItem *i = functionView->selectedItem(); if(!i) return; selected_function = functionItems[i]; if(!selected_function) return; +#define CHECK_IF_FUNCTION_STILL_THERE if(!CALCULATOR->stillHasFunction(selected_function)) {KMessageBox::error(this, i18n("Function does not exist anymore.")); emit functionsChanged(); return;} + +void QalculateFunctionsDialog::insertFunction() { + UPDATE_SELECTED_FUNCTION + CHECK_IF_FUNCTION_STILL_THERE + emit insertRequest(selected_function); +} + +void QalculateFunctionsDialog::applyFunction() { + UPDATE_SELECTED_FUNCTION + CHECK_IF_FUNCTION_STILL_THERE + emit applyRequest(selected_function); +} + +void QalculateFunctionsDialog::deactivateFunction() { + UPDATE_SELECTED_FUNCTION + CHECK_IF_FUNCTION_STILL_THERE + selected_function->setActive(!selected_function->isActive()); + emit functionsChanged(); +} + +void QalculateFunctionsDialog::deleteFunction() { + UPDATE_SELECTED_FUNCTION + CHECK_IF_FUNCTION_STILL_THERE + if(selected_function->isLocal()) { + //ensure that all references are removed in Calculator + selected_function->destroy(); + //update menus and trees + emit functionsChanged(); + } +} + + +void QalculateFunctionsDialog::editFunction() { + UPDATE_SELECTED_FUNCTION + CHECK_IF_FUNCTION_STILL_THERE + if(!function_edit_dialog) { + function_edit_dialog = new QalculateEditFunctionDialog(this); + } + MathFunction *f = function_edit_dialog->editFunction(QString::null, selected_function); + if(f) { + selected_function = f; + if(!f->isActive()) { + selected_category = i18n("Inactive"); + } else if(f->category().empty()) { + selected_category = i18n("Uncategorized"); + } else { + selected_category = "/"; + selected_category += f->category().c_str(); + } + emit functionsChanged(); + } +} + +void QalculateFunctionsDialog::newFunction() { + if(!function_edit_dialog) { + function_edit_dialog = new QalculateEditFunctionDialog(this); + } + MathFunction *f = NULL; + if(selected_category.isEmpty() || selected_category[0] != '/') { + f = function_edit_dialog->editFunction(); + } else { + QString str = selected_category; + str.remove(0, 1); + f = function_edit_dialog->editFunction(str); + } + if(f) { + selected_function = f; + if(!f->isActive()) { + selected_category = i18n("Inactive"); + } else if(f->category().empty()) { + selected_category = i18n("Uncategorized"); + } else { + selected_category = "/"; + selected_category += f->category().c_str(); + } + emit functionsChanged(); + } +} + +void QalculateFunctionsDialog::functionDoubleClicked(QListViewItem*i) { + selected_function = functionItems[i]; + if(!selected_function) + return; + CHECK_IF_FUNCTION_STILL_THERE + if(!function_edit_dialog) { + function_edit_dialog = new QalculateEditFunctionDialog(this); + } + MathFunction *f = function_edit_dialog->editFunction(QString::null, selected_function); + if(f) { + selected_function = f; + if(!f->isActive()) { + selected_category = i18n("Inactive"); + } else if(f->category().empty()) { + selected_category = i18n("Uncategorized"); + } else { + selected_category = "/"; + selected_category += f->category().c_str(); + } + emit functionsChanged(); + } +} + + +void QalculateFunctionsDialog::functionSelected() { + QListViewItem *selected = functionView->selectedItem(); + if(selected) { + MathFunction *f = functionItems[selected]; + if(!CALCULATOR->stillHasFunction(f)) { + KMessageBox::error(this, i18n("Function does not exist anymore.")); + selected_function = NULL; + emit functionsChanged(); + return; + } + //remember selection + selected_function = f; + editButton->setEnabled(true); + insertButton->setEnabled(f->isActive()); + applyButton->setEnabled(f->isActive() && f->minargs() <= 1); + deleteButton->setEnabled(f->isLocal()); + deactivateButton->setEnabled(true); + if(f->isActive()) { + deactivateButton->setText(i18n("Deactivate")); + } else { + deactivateButton->setText(i18n("Activate")); + } + + Argument *arg; + Argument default_arg; + QString str, str2; + const ExpressionName *ename = &f->preferredName(false, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) descriptionBrowser); + str += ""; + str += ename->name.c_str(); + str += ""; + int iargs = f->maxargs(); + if(iargs < 0) { + iargs = f->minargs() + 1; + } + str += "("; + if(iargs != 0) { + for(int i2 = 1; i2 <= iargs; i2++) { + if(i2 > f->minargs()) { + str += "["; + } + if(i2 > 1) { + str += CALCULATOR->getComma().c_str(); + str += " "; + } + arg = f->getArgumentDefinition(i2); + if(arg && !arg->name().empty()) { + str += arg->name().c_str(); + } else { + str += i18n("argument"); + str += " "; + str += QString::number(i2); + } + if(i2 > f->minargs()) { + str += "]"; + } + } + if(f->maxargs() < 0) { + str += CALCULATOR->getComma().c_str(); + str += " ..."; + } + } + str += ")"; + for(size_t i2 = 1; i2 <= f->countNames(); i2++) { + if(&f->getName(i2) != ename) { + str += "
"; + str += f->getName(i2).name.c_str(); + } + } + str += "
"; + str += "
"; + if(f->subtype() == SUBTYPE_DATA_SET) { + str += "
"; + str2.sprintf(i18n("Retrieves data from the %s data set for a given object and property. If \"info\" is typed as property, a dialog window will pop up with all properties of the object."), f->title().c_str()); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += "
"; + } + if(!f->description().empty()) { + str += "
"; + str2 = f->description().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += "
"; + } + if(f->subtype() == SUBTYPE_DATA_SET && !((DataSet*) f)->copyright().empty()) { + str += "
"; + str2 = ((DataSet*) f)->copyright().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += "
"; + } + if(iargs) { + str += "
"; + str += i18n("Arguments"); + str += "
"; + for(int i2 = 1; i2 <= iargs; i2++) { + arg = f->getArgumentDefinition(i2); + if(arg && !arg->name().empty()) { + str += arg->name().c_str(); + } else { + str += QString::number(i2); + } + str += ": "; + if(arg) { + str2= arg->printlong().c_str(); + } else { + str2= default_arg.printlong().c_str(); + } + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + if(i2 > f->minargs()) { + str += " ("; + //optional argument + str += i18n("optional"); + if(!f->getDefaultValue(i2).empty()) { + str += ", "; + //argument default, in description + str += i18n("default: "); + str += f->getDefaultValue(i2).c_str(); + } + str += ")"; + } + str += "
"; + } + } + if(!f->condition().empty()) { + str += "
"; + str += i18n("Requirement"); + str += ": "; + str2 = f->printCondition().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += "
"; + } + if(f->subtype() == SUBTYPE_DATA_SET) { + DataSet *ds = (DataSet*) f; + str += "
"; + str += i18n("Properties"); + str += "
"; + DataPropertyIter it; + DataProperty *dp = ds->getFirstProperty(&it); + while(dp) { + if(!dp->isHidden()) { + if(!dp->title(false).empty()) { + str2 = dp->title().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += ": "; + } + for(size_t i = 1; i <= dp->countNames(); i++) { + if(i > 1) str += ", "; + str += dp->getName(i).c_str(); + } + if(dp->isKey()) { + str += " ("; + str += i18n("key"); + str += ")"; + } + str += "
"; + if(!dp->description().empty()) { + str += ""; + str2 = dp->description().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + str += "
"; + } + } + dp = ds->getNextProperty(&it); + } + } + str.replace("\n", "
"); + descriptionBrowser->setText(str); + } else { + editButton->setEnabled(false); + insertButton->setEnabled(false); + applyButton->setEnabled(false); + deleteButton->setEnabled(false); + deactivateButton->setEnabled(false); + selected_function = NULL; + descriptionBrowser->clear(); + } +} + +void QalculateFunctionsDialog::addFunctionTreeItem(MathFunction *f) { + QListViewItem *i = new KListViewItem(functionView, f->title(true).c_str()); + functionItems[i] = f; + if(f == selected_function) { + functionView->setSelected(i, true); + } +} + + +void QalculateFunctionsDialog::categorySelected() { + QListViewItem *selected = categoryView->selectedItem(); + bool no_cat = false, b_all = false, b_inactive = false; + functionView->clear(); + functionItems.clear(); + if(!selected) { + selected_category = ""; + functionSelected(); + return; + } + selected_category = categoryItems[selected]; + if(selected_category == i18n("All")) { + b_all = true; + } else if(selected_category == i18n("Uncategorized")) { + no_cat = true; + } else if(selected_category == i18n("Inactive")) { + b_inactive = true; + } + if(!b_all && !no_cat && !b_inactive && selected_category[0] == '/') { + string str = selected_category.ascii(); + str.erase(str.begin()); + for(size_t i = 0; i < CALCULATOR->functions.size(); i++) { + if(CALCULATOR->functions[i]->isActive() && CALCULATOR->functions[i]->category().substr(0, selected_category.length() - 1) == str) { + addFunctionTreeItem(CALCULATOR->functions[i]); + } + } + } else { + string str = selected_category.ascii(); + for(size_t i = 0; i < CALCULATOR->functions.size(); i++) { + if((b_inactive && !CALCULATOR->functions[i]->isActive()) || (CALCULATOR->functions[i]->isActive() && (b_all || (no_cat && CALCULATOR->functions[i]->category().empty()) || (!b_inactive && CALCULATOR->functions[i]->category() == str)))) { + addFunctionTreeItem(CALCULATOR->functions[i]); + } + } + } + if(!selected_function || !functionView->selectedItem()) { + QListViewItemIterator it(functionView); + if(it.current()) + functionView->setSelected(it.current(), true); + } + +} + + +#include "qalculatefunctionsdialog.moc" diff --git a/src/qalculatefunctionsdialog.h b/src/qalculatefunctionsdialog.h new file mode 100644 index 0000000..7a0104f --- /dev/null +++ b/src/qalculatefunctionsdialog.h @@ -0,0 +1,89 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEFUNCTIONSDIALOG_H +#define QALCULATEFUNCTIONSDIALOG_H + +#include +#include + +class MathFunction; +class QalculateEditFunctionDialog; +class KListView; +class QListViewItem; +class QPushButton; +class KTextBrowser; + +/** +@author Niklas Knutsson +*/ +class QalculateFunctionsDialog : public KDialog { + + Q_OBJECT + +public: + + QalculateFunctionsDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateFunctionsDialog(); + + QalculateEditFunctionDialog *function_edit_dialog; + QString selected_category; + MathFunction *selected_function; + void addFunctionTreeItem(MathFunction *f); + QMap functionItems; + QMap categoryItems; + + KListView *categoryView; + KListView *functionView; + QPushButton *newButton; + QPushButton *editButton; + QPushButton *deleteButton; + QPushButton *deactivateButton; + QPushButton *insertButton; + QPushButton *applyButton; + QPushButton *helpButton; + QPushButton *buttonClose; + KTextBrowser *descriptionBrowser; + +public slots: + + void updateFunctionTree(); + void functionDoubleClicked(QListViewItem*); + void functionSelected(); + void categorySelected(); + void insertFunction(); + void applyFunction(); + void deactivateFunction(); + void deleteFunction(); + void editFunction(); + void newFunction(); + +protected slots: + + void slotHelp(); + +signals: + + void functionsChanged(); + void insertRequest(MathFunction*); + void applyRequest(MathFunction*); + +}; + +#endif diff --git a/src/qalculateimportcsvdialog.cpp b/src/qalculateimportcsvdialog.cpp new file mode 100644 index 0000000..88f8044 --- /dev/null +++ b/src/qalculateimportcsvdialog.cpp @@ -0,0 +1,216 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateimportcsvdialog.h" +#include "qalculate_kde_utils.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern tree_struct variable_cats; + +QalculateImportCSVDialog::QalculateImportCSVDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Import CSV File"), Ok | Cancel | Help, Ok, true) { + + setMainWidget(new QWidget(this)); + QGridLayout *grid = new QGridLayout(mainWidget(), 1, 1, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("File:"), mainWidget()), 0, 0); + fileEdit = new KURLRequester(mainWidget()); + fileEdit->setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly); + fileEdit->setCaption(i18n("Import CSV File")); + grid->addWidget(fileEdit, 0, 1); + grid->addWidget(new QLabel(i18n("Import as:"), mainWidget()), 1, 0); + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addLayout(hbox, 1, 1); + QButtonGroup *group = new QButtonGroup(); + matrixButton = new QRadioButton(i18n("Matrix"), mainWidget()); + group->insert(matrixButton, 0); + hbox->addWidget(matrixButton); + matrixButton->setChecked(true); + vectorsButton = new QRadioButton(i18n("Vectors"), mainWidget()); + group->insert(vectorsButton, 1); + hbox->addWidget(vectorsButton); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + grid->addWidget(new QLabel(i18n("Name:"), mainWidget()), 2, 0); + nameEdit = new KLineEdit(mainWidget()); + grid->addWidget(nameEdit, 2, 1); + grid->addWidget(new QLabel(i18n("Descriptive name:"), mainWidget()), 3, 0); + titleEdit = new KLineEdit(mainWidget()); + grid->addWidget(titleEdit, 3, 1); + grid->addWidget(new QLabel(i18n("Category:"), mainWidget()), 4, 0); + categoryCombo = new KComboBox(mainWidget()); + categoryCombo->setMaximumWidth(250); + categoryCombo->setEditable(true); + grid->addWidget(categoryCombo, 4, 1); + grid->addWidget(new QLabel(i18n("First row:"), mainWidget()), 5, 0); + firstRowBox = new QSpinBox(1, 1000, 1, mainWidget()); + grid->addWidget(firstRowBox, 5, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 6, 6, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + includesHeadingsButton = new QCheckBox(i18n("Includes headings"), mainWidget()); + includesHeadingsButton->setChecked(true); + hbox->addWidget(includesHeadingsButton); + grid->addWidget(new QLabel(i18n("Delimiter:"), mainWidget()), 7, 0); + delimiterCombo = new KComboBox(mainWidget()); + delimiterCombo->setMaximumWidth(250); + delimiterCombo->insertItem(i18n("Comma")); + delimiterCombo->insertItem(i18n("Tabulator")); + delimiterCombo->insertItem(i18n("Semicolon")); + delimiterCombo->insertItem(i18n("Space")); + delimiterCombo->insertItem(i18n("Other")); + delimiterCombo->setEditable(false); + grid->addWidget(delimiterCombo, 7, 1); + otherDelimiterEdit = new KLineEdit(mainWidget()); + grid->addWidget(otherDelimiterEdit, 8, 1); + otherDelimiterEdit->setEnabled(false); + + connect(delimiterCombo, SIGNAL(activated(int)), this, SLOT(delimiterChanged(int))); + connect(nameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); + +} + +QalculateImportCSVDialog::~QalculateImportCSVDialog() { +} + +void QalculateImportCSVDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-import-export-csv"); +} + +void QalculateImportCSVDialog::delimiterChanged(int i) { + otherDelimiterEdit->setEnabled(i == 4); +} + +void QalculateImportCSVDialog::slotOk() { + + QString str = fileEdit->url().stripWhiteSpace(); + if(str.isEmpty()) { + //no name -- open dialog again + fileEdit->setFocus(); + KMessageBox::error(this, i18n("No file name entered.")); + return; + } + string delimiter = ""; + switch(delimiterCombo->currentItem()) { + case 0: { + delimiter = ","; + break; + } + case 1: { + delimiter = "\t"; + break; + } + case 2: { + delimiter = ";"; + break; + } + case 3: { + delimiter = " "; + break; + } + case 4: { + delimiter = otherDelimiterEdit->text().ascii(); + break; + } + } + if(delimiter.empty()) { + //no delimiter -- open dialog again + otherDelimiterEdit->setFocus(); + KMessageBox::error(this, i18n("No delimiter selected.")); + return; + } + if(!CALCULATOR->importCSV(str.ascii(), firstRowBox->value(), includesHeadingsButton->isChecked(), delimiter, matrixButton->isChecked(), nameEdit->text().ascii(), titleEdit->text().ascii(), categoryCombo->lineEdit()->text().ascii())) { + KMessageBox::error(this, i18n("An error occured when importing the CSV file.")); + reject(); + } + accept(); + +} + +bool QalculateImportCSVDialog::importCSVFile() { + + fileEdit->setFocus(); + + nameEdit->clear(); + fileEdit->clear(); + titleEdit->clear(); + + //QStringList cats; + QString catstr; + categoryCombo->clear(); + tree_struct *item, *item2; + variable_cats.it = variable_cats.items.begin(); + if(variable_cats.it != variable_cats.items.end()) { + item = &*variable_cats.it; + ++variable_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + + catstr = ""; + while(item) { + if(!catstr.isEmpty()) catstr += "/"; + catstr += item->item.c_str(); + categoryCombo->insertItem(catstr); + while(item && item->it == item->items.end()) { + int str_i = catstr.findRev("/"); + if(str_i < 0) { + catstr = ""; + } else { + catstr.truncate(str_i); + } + item = item->parent; + } + if(item) { + item2 = &*item->it; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + + categoryCombo->lineEdit()->clear(); + + if(exec() == QDialog::Accepted) { + return true; + } + return false; +} + +void QalculateImportCSVDialog::nameChanged(const QString &name) { + if(name.isNull()) return; + if(!CALCULATOR->variableNameIsValid(name.ascii())) { + nameEdit->blockSignals(true); + nameEdit->setText(CALCULATOR->convertToValidVariableName(name.ascii()).c_str()); + nameEdit->blockSignals(false); + } +} + +#include "qalculateimportcsvdialog.moc" diff --git a/src/qalculateimportcsvdialog.h b/src/qalculateimportcsvdialog.h new file mode 100644 index 0000000..8b6e96e --- /dev/null +++ b/src/qalculateimportcsvdialog.h @@ -0,0 +1,65 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEIMPORTCSVDIALOG_H +#define QALCULATEIMPORTCSVDIALOG_H + +#include + +class KLineEdit; +class KComboBox; +class QSpinBox; +class QCheckBox; +class QRadioButton; +class KURLRequester; + +/** +@author Niklas Knutsson +*/ +class QalculateImportCSVDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateImportCSVDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateImportCSVDialog(); + + KLineEdit *nameEdit, *titleEdit, *otherDelimiterEdit; + KComboBox *categoryCombo, *delimiterCombo; + QSpinBox *firstRowBox; + QCheckBox *includesHeadingsButton; + QRadioButton *matrixButton, *vectorsButton; + KURLRequester *fileEdit; + + bool importCSVFile(); + +public slots: + + void delimiterChanged(int); + void nameChanged(const QString&); + +protected slots: + + void slotHelp(); + void slotOk(); + +}; + +#endif diff --git a/src/qalculateinsertfunctiondialog.cpp b/src/qalculateinsertfunctiondialog.cpp new file mode 100644 index 0000000..c0fc808 --- /dev/null +++ b/src/qalculateinsertfunctiondialog.cpp @@ -0,0 +1,404 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateinsertfunctiondialog.h" +#include "qalculate_kde_utils.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "buttonwithindexsignal.h" +#include "qalculateinsertmatrixvectordialog.h" + +extern QWidget *expressionWidget; +extern PrintOptions printops; +extern EvaluationOptions evalops; + +QalculateInsertFunctionDialog::QalculateInsertFunctionDialog(MathFunction *f, QWidget *parent, const QString &selected_text, const char *name) : KDialogBase(parent, name, true, f->title(true).c_str(), Ok|Apply|Cancel, Ok) { + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + setButtonOKText(i18n("Insert")); + setButtonApplyText(i18n("Execute")); +#else +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 3 + setButtonOK(KGuiItem(i18n("Insert"))); +#else + setButtonOK(KStdGuiItem::insert()); +#endif + setButtonApply(KGuiItem(i18n("Execute"))); +#endif + mathFunction = f; + QVBox *box = makeVBoxMainWidget(); + box->setSpacing(12); + QString titlestr = ""; + titlestr += mathFunction->title(true).c_str(); + titlestr += ""; + new QLabel(titlestr, box); + int args = 0; + bool has_vector = false; + if(mathFunction->args() > 0) { + args = mathFunction->args(); + } else if(mathFunction->minargs() > 0) { + args = mathFunction->minargs() + 1; + has_vector = true; + } else { + args = 1; + has_vector = true; + } + QGrid *table = new QGrid(3, box); + table->setSpacing(6); + table->setMargin(12); + table->setFrameStyle(QFrame::Sunken | QFrame::GroupBoxPanel); + label.resize(args); + entry.resize(args); + type_label.resize(args); + QString argstr, typestr, defstr, argtype; + //create argument entries + Argument *arg; + for(int i = 0; i < args; i++) { + arg = mathFunction->getArgumentDefinition(i + 1); + if(!arg || arg->name().empty()) { + if(args == 1) { + argstr = i18n("Value:"); + } else { + argstr = i18n("Argument"); + argstr += " "; + argstr += QString::number(i + 1); + argstr += ":"; + } + } else { + argstr = arg->name().c_str(); + argstr += ":"; + } + typestr = ""; + argtype = ""; + defstr = mathFunction->getDefaultValue(i + 1).c_str(); + if(arg && (arg->suggestsQuotes() || arg->type() == ARGUMENT_TYPE_TEXT) && defstr.length() >= 2 && defstr[0] == '\"' && defstr[defstr.length() - 1] == '\"') { + defstr.remove(0, 1); + defstr.truncate(defstr.length() - 1); + } + label[i] = new QLabel(argstr, table); + if(arg) { + switch(arg->type()) { + case ARGUMENT_TYPE_INTEGER: { + IntegerArgument *iarg = (IntegerArgument*) arg; + int min = -1000000, max = 1000000; + if(iarg->min()) { + min = iarg->min()->intValue(); + } + if(iarg->max()) { + max = iarg->max()->intValue(); + } + QSpinBox *qsp = new QSpinBox(min, max, 1, table); + entry[i] = qsp; + qsp->setButtonSymbols(QSpinBox::PlusMinus); + int selected_value = 0; + bool convok = false; + if(i == 0 && !selected_text.isEmpty()) { + selected_value = selected_text.toInt(&convok); + } + if(convok && selected_value >= min && selected_value <= max) { + qsp->setValue(selected_value); + } else if(!mathFunction->getDefaultValue(i + 1).empty()) { + qsp->setValue(QString(mathFunction->getDefaultValue(i + 1).c_str()).toInt()); + } else if(!arg->zeroForbidden() && min <= 0 && max >= 0) { + qsp->setValue(0); + } else { + if(max < 0) { + qsp->setValue(max); + } else if(min <= 1) { + qsp->setValue(1); + } else { + qsp->setValue(min); + } + } + break; + } + case ARGUMENT_TYPE_BOOLEAN: { + QHButtonGroup *bg = new QHButtonGroup(table); + entry[i] = bg; + bg->setFrameStyle(QFrame::Plain | QFrame::NoFrame); + bg->setMargin(0); + bg->setRadioButtonExclusive(TRUE); + bg->insert(new QRadioButton(i18n("True"), bg), 1); + bg->insert(new QRadioButton(i18n("False"), bg), 0); + QString str = selected_text.stripWhiteSpace(); + if(i == 0 && str == "1") { + bg->setButton(1); + } else if(i == 0 && str == "0") { + bg->setButton(0); + } else if(defstr == "1") { + bg->setButton(1); + } else { + bg->setButton(0); + } + break; + } + case ARGUMENT_TYPE_DATA_PROPERTY: { + if(mathFunction->subtype() == SUBTYPE_DATA_SET) { + KComboBox *cb = new KComboBox(table); + entry[i] = cb; + DataPropertyIter it; + DataSet *ds = (DataSet*) mathFunction; + DataProperty *dp = ds->getFirstProperty(&it); + bool active_set = false; + while(dp) { + if(!dp->isHidden()) { + cb->insertItem(dp->title().c_str()); + if(!active_set && defstr == dp->getName().c_str()) { + cb->setCurrentItem(cb->count() - 1); + active_set = true; + } + } + dp = ds->getNextProperty(&it); + } + cb->insertItem(i18n("Info")); + if(!active_set) { + cb->setCurrentItem(cb->count() - 1); + } + break; + } + } + default: { + if(i >= mathFunction->minargs() && !has_vector) { + typestr = "("; + typestr += i18n("optional"); + } + argtype = arg->print().c_str(); + if(typestr.isEmpty()) { + typestr = "("; + } else if(!argtype.isEmpty()) { + typestr += " "; + } + if(!argtype.isEmpty()) { + typestr += argtype; + } + typestr += ")"; + if(typestr.length() == 2) { + typestr = ""; + } + entry[i] = new KLineEdit(table); + if(i == 0 && !selected_text.isEmpty()) { + ((KLineEdit*) entry[i])->setText(selected_text); + } else { + ((KLineEdit*) entry[i])->setText(defstr); + } + } + } + } else { + entry[i] = new KLineEdit(table); + if(i == 0 && !selected_text.isEmpty()) { + ((KLineEdit*) entry[i])->setText(selected_text); + } else { + ((KLineEdit*) entry[i])->setText(defstr); + } + } + if(typestr.isEmpty() && i >= mathFunction->minargs() && !has_vector) { + typestr = "("; + typestr += i18n("optional"); + typestr += ")"; + } + if(arg) { + switch(arg->type()) { + case ARGUMENT_TYPE_DATE: { + typestr.remove(0, 1); + typestr.remove(typestr.length() - 1, 1); + type_label[i] = new ButtonWithIndexSignal(typestr, i, table); + QObject::connect(type_label[i], SIGNAL(clickedWithIndex(int)), this, SLOT(selectDate(int))); + break; + } + case ARGUMENT_TYPE_MATRIX: { + typestr.remove(0, 1); + typestr.remove(typestr.length() - 1, 1); + type_label[i] = new ButtonWithIndexSignal(typestr, i, table); + QObject::connect(type_label[i], SIGNAL(clickedWithIndex(int)), this, SLOT(insertMatrix(int))); + break; + } + case ARGUMENT_TYPE_VECTOR: { + typestr.remove(0, 1); + typestr.remove(typestr.length() - 1, 1); + type_label[i] = new ButtonWithIndexSignal(typestr, i, table); + QObject::connect(type_label[i], SIGNAL(clickedWithIndex(int)), this, SLOT(insertVector(int))); + break; + } + case ARGUMENT_TYPE_FILE: { + typestr.remove(0, 1); + typestr.remove(typestr.length() - 1, 1); + type_label[i] = new ButtonWithIndexSignal(typestr, i, table); + QObject::connect(type_label[i], SIGNAL(clickedWithIndex(int)), this, SLOT(selectFile(int))); + break; + } + default: { + type_label[i] = new QLabel(typestr, table); + } + } + } else { + type_label[i] = new QLabel(typestr, table); + } + if(i == 0) entry[0]->setFocus(); + } + //display function description + if(!mathFunction->description().empty()) { + QString str = mathFunction->description().c_str(); + str.replace("<", "<"); + str.replace(">", ">"); + str.replace("\n", "
"); + KActiveLabel *descrLabel = new KActiveLabel(str, box); + descrLabel->setAlignment(Qt::AlignJustify); + enableButtonSeparator(true); + } +} + +QalculateInsertFunctionDialog::~QalculateInsertFunctionDialog() { +} + +QString QalculateInsertFunctionDialog::functionExpression() { + QString str = mathFunction->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionWidget).name.c_str(), str2; + str += "("; + int args = 0; + if(mathFunction->args() > 0) { + args = mathFunction->args(); + } else if(mathFunction->minargs() > 0) { + args = mathFunction->minargs() + 1; + } else { + args = 1; + } + for(int i = 0; i < args; i++) { + if(mathFunction->getArgumentDefinition(i + 1) && mathFunction->getArgumentDefinition(i + 1)->type() == ARGUMENT_TYPE_BOOLEAN) { + if(((QButtonGroup*) entry[i])->id(((QButtonGroup*) entry[i])->selected()) == 1) { + str2 = "1"; + } else { + str2 = "0"; + } + } else if(mathFunction->getArgumentDefinition(i + 1) && mathFunction->getArgumentDefinition(i + 1)->type() == ARGUMENT_TYPE_INTEGER) { + str2 = ((QSpinBox*) entry[i])->text(); + } else if(mathFunction->subtype() == SUBTYPE_DATA_SET && mathFunction->getArgumentDefinition(i + 1) && mathFunction->getArgumentDefinition(i + 1)->type() == ARGUMENT_TYPE_DATA_PROPERTY) { + int index = ((KComboBox*) entry[i])->currentItem(); + DataPropertyIter it; + DataSet *ds = (DataSet*) mathFunction; + DataProperty *dp = ds->getFirstProperty(&it); + while(dp) { + if(!dp->isHidden()) { + if(index <= 0) break; + index--; + } + dp = ds->getNextProperty(&it); + } + if(dp) { + str2 = dp->getName().c_str(); + } else { + str2 = "info"; + } + } else { + str2 = ((KLineEdit*) entry[i])->text(); + } + //if the minimum number of function arguments have been filled, do not add anymore if entry is empty + if(i >= mathFunction->minargs()) { + str2 = str2.stripWhiteSpace(); + } + if((i < mathFunction->minargs() || !str2.isEmpty()) && mathFunction->getArgumentDefinition(i + 1) && (mathFunction->getArgumentDefinition(i + 1)->suggestsQuotes() || (mathFunction->getArgumentDefinition(i + 1)->type() == ARGUMENT_TYPE_TEXT && str2.find(CALCULATOR->getComma().c_str()) >= 0))) { + if(str2.length() < 1 || (str2[0] != '\"' && str[0] != '\'')) { + str2.insert(0, "\""); + str2 += "\""; + } + } + if(i > 0) { + str += CALCULATOR->getComma().c_str(); + str += " "; + } + str += str2; + } + str += ")"; + return str; +} + +void QalculateInsertFunctionDialog::slotOk() { + accept(); +} + +void QalculateInsertFunctionDialog::slotApply() { + done(100); +} + +void QalculateInsertFunctionDialog::selectDate(int index) { + KDialogBase *dialog = new KDialogBase(this, 0, true, i18n("Date"), Ok|Cancel); + KDatePicker *datePicker; + QDate date(QDate::fromString(((KLineEdit*) entry[index])->text(), Qt::ISODate)); + if(date.isValid()) datePicker = new KDatePicker(dialog->makeVBoxMainWidget(), date); + else datePicker = new KDatePicker(dialog->makeVBoxMainWidget()); + if(dialog->exec() == QDialog::Accepted) { + ((KLineEdit*) entry[index])->setText(datePicker->date().toString(Qt::ISODate)); + } + dialog->deleteLater(); +} +void QalculateInsertFunctionDialog::selectFile(int index) { + QString filename = KFileDialog::getSaveFileName(((KLineEdit*) entry[index])->text(), QString::null, this, i18n("File")); + if(!filename.isEmpty()) { + ((KLineEdit*) entry[index])->setText(filename); + } +} +void QalculateInsertFunctionDialog::insertMatrix(int index) { + QalculateInsertMatrixVectorDialog *d = new QalculateInsertMatrixVectorDialog(this); + QString str = ((KLineEdit*) entry[index])->text(); + MathStructure mstruct; + if(!str.isEmpty()) { + CALCULATOR->parse(&mstruct, CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options)); + } + if(mstruct.isVector()) { + str = d->editMatrixVector(&mstruct, false); + } else { + str = d->editMatrixVector(NULL, false); + } + if(!str.isEmpty()) { + ((KLineEdit*) entry[index])->setText(str); + } + d->deleteLater(); +} +void QalculateInsertFunctionDialog::insertVector(int index) { + QalculateInsertMatrixVectorDialog *d = new QalculateInsertMatrixVectorDialog(this); + QString str = ((KLineEdit*) entry[index])->text(); + MathStructure mstruct; + if(!str.isEmpty()) { + CALCULATOR->parse(&mstruct, CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options)); + } + if(mstruct.isVector()) { + str = d->editMatrixVector(&mstruct, true); + } else { + str = d->editMatrixVector(NULL, true); + } + if(!str.isEmpty()) { + ((KLineEdit*) entry[index])->setText(str); + } + d->deleteLater(); +} + +#include "qalculateinsertfunctiondialog.moc" diff --git a/src/qalculateinsertfunctiondialog.h b/src/qalculateinsertfunctiondialog.h new file mode 100644 index 0000000..5954196 --- /dev/null +++ b/src/qalculateinsertfunctiondialog.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEINSERTFUNCTIONDIALOG_H +#define QALCULATEINSERTFUNCTIONDIALOG_H + +#include +#include + +class MathFunction; + +class QalculateInsertFunctionDialog : public KDialogBase { + Q_OBJECT + +public: + + QalculateInsertFunctionDialog(MathFunction *f, QWidget *parent = 0, const QString &selected_text = QString::null, const char *name = 0); + virtual ~QalculateInsertFunctionDialog(); + + QString functionExpression(); + + MathFunction *mathFunction; + + QValueVector label; + QValueVector entry; + QValueVector type_label; + +protected slots: + + void slotOk(); + void slotApply(); + + void selectDate(int); + void selectFile(int); + void insertMatrix(int); + void insertVector(int); + +}; + +#endif diff --git a/src/qalculateinsertmatrixvectordialog.cpp b/src/qalculateinsertmatrixvectordialog.cpp new file mode 100644 index 0000000..6e6f994 --- /dev/null +++ b/src/qalculateinsertmatrixvectordialog.cpp @@ -0,0 +1,381 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateinsertmatrixvectordialog.h" +#include "qalculate_kde_utils.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern PrintOptions printops; + +class QalculateInsertMatrixTableItem : public QTableItem { + +public: + + QalculateInsertMatrixTableItem(QTable *table); + QalculateInsertMatrixTableItem(QTable *table, const QString & text); + + int alignment() const; + +}; + +class QalculateInsertMatrixTable : public QTable { + + public: + + QalculateInsertMatrixTable(QWidget *parent = 0, const char *name = 0) : QTable(parent, name) {} + QalculateInsertMatrixTable(int numRows, int numCols, QWidget *parent = 0, const char *name = 0) : QTable(numRows, numCols, parent, name) {} + + QWidget *beginEdit(int row, int col, bool replace) { + QWidget *w = QTable::beginEdit(row, col, replace); + ((QLineEdit*) w)->selectAll(); + return w; + } + +}; + + +QalculateInsertMatrixVectorDialog::QalculateInsertMatrixVectorDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Variable"), Ok | Cancel | User1, Ok, true, KGuiItem(i18n("Insert Selection"))) { + + setMainWidget(new QWidget(this)); + QGridLayout *grid = new QGridLayout(mainWidget(), 1, 1, 0, spacingHint()); + grid->addWidget(new QLabel(i18n("Rows:"), mainWidget()), 0, 0); + rowsBox = new QSpinBox(1, 1000, 1, mainWidget()); + grid->addWidget(rowsBox, 0, 1); + grid->addWidget(new QLabel(i18n("Columns:"), mainWidget()), 1, 0); + columnsBox = new QSpinBox(1, 1000, 1, mainWidget()); + grid->addWidget(columnsBox, 1, 1); + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 2, 2, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + QButtonGroup *group = new QButtonGroup(); + matrixButton = new QRadioButton(i18n("Matrix"), mainWidget()); + group->insert(matrixButton, 0); + hbox->addWidget(matrixButton); + vectorButton = new QRadioButton(i18n("Vector"), mainWidget()); + group->insert(vectorButton, 1); + hbox->addWidget(vectorButton); + elementsLabel = new QLabel(i18n("Elements:"), mainWidget()); + grid->addMultiCellWidget(elementsLabel, 3, 3, 0, 1); + elementsTable = new QalculateInsertMatrixTable(0, 0, mainWidget()); + grid->addMultiCellWidget(elementsTable, 4, 4, 0, 1); + elementsTable->setSelectionMode(QTable::Single); + + insertSelectionButton = actionButton(User1); + onSelectionChanged(); + + connect(insertSelectionButton, SIGNAL(clicked()), this, SLOT(insertSelection())); + connect(elementsTable, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); + connect(rowsBox, SIGNAL(valueChanged(int)), this, SLOT(rowsChanged(int))); + connect(columnsBox, SIGNAL(valueChanged(int)), this, SLOT(columnsChanged(int))); + connect(group, SIGNAL(clicked(int)), this, SLOT(typeChanged(int))); + +} + +QalculateInsertMatrixVectorDialog::~QalculateInsertMatrixVectorDialog() {} + +void QalculateInsertMatrixVectorDialog::onSelectionChanged() { + insertSelectionButton->setEnabled(elementsTable->currentSelection() >= 0); +} +void QalculateInsertMatrixVectorDialog::typeChanged(int i) { + if(i == 0) { + elementsLabel->setText(i18n("Elements:")); + bool b = true; + for(int index_r = elementsTable->numRows() - 1; index_r >= 0 && b; index_r--) { + for(int index_c = elementsTable->numCols() - 1; index_c >= 0; index_c--) { + if(elementsTable->text(index_r, index_c).isEmpty()) { + elementsTable->setText(index_r, index_c, "0"); + } else { + b = false; + break; + } + } + } + } else { + elementsLabel->setText(i18n("Elements (in horizontal order):")); + } +} +void QalculateInsertMatrixVectorDialog::rowsChanged(int i) { + int r = elementsTable->numRows(); + elementsTable->setNumRows(i); + bool b = matrixButton->isChecked(); + for(int index_r = r; index_r < i; index_r++) { + for(int index_c = 0; index_c < elementsTable->numCols(); index_c++) { + if(b) elementsTable->setItem(index_r, index_c, new QalculateInsertMatrixTableItem(elementsTable, "0")); + else elementsTable->setItem(index_r, index_c, new QalculateInsertMatrixTableItem(elementsTable)); + } + } +} +void QalculateInsertMatrixVectorDialog::columnsChanged(int i) { + int c = elementsTable->numCols(); + elementsTable->setNumCols(i); + bool b = matrixButton->isChecked(); + for(int index_r = 0; index_r < elementsTable->numRows(); index_r++) { + for(int index_c = c; index_c < i; index_c++) { + if(b) elementsTable->setItem(index_r, index_c, new QalculateInsertMatrixTableItem(elementsTable, "0")); + else elementsTable->setItem(index_r, index_c, new QalculateInsertMatrixTableItem(elementsTable)); + } + } +} + +QString QalculateInsertMatrixVectorDialog::newVector() { + return editMatrixVector(NULL, true); +} +QString QalculateInsertMatrixVectorDialog::newMatrix() { + return editMatrixVector(NULL, false); +} + +void QalculateInsertMatrixVectorDialog::slotOk() { + int r = rowsBox->value(); + int c = columnsBox->value(); + if(vectorButton->isChecked()) { + bool b = false; + matrixstr = "["; + for(int index_r = 0; index_r < r; index_r++) { + for(int index_c = 0; index_c < c; index_c++) { + if(!elementsTable->text(index_r, index_c).isEmpty()) { + QString str2 = elementsTable->text(index_r, index_c).stripWhiteSpace(); + if(!str2.isEmpty()) { + if(b) { + matrixstr += CALCULATOR->getComma(); + matrixstr += " "; + } else { + b = true; + } + matrixstr += str2; + } + } + } + } + matrixstr += "]"; + } else { + matrixstr = "["; + bool b1 = false; + for(int index_r = 0; index_r < r; index_r++) { + if(b1) { + matrixstr += CALCULATOR->getComma(); + matrixstr += " "; + } else { + b1 = true; + } + matrixstr += "["; + bool b2 = false; + for(int index_c = 0; index_c < c; index_c++) { + if(b2) { + matrixstr += CALCULATOR->getComma(); + matrixstr += " "; + } else { + b2 = true; + } + matrixstr += elementsTable->text(index_r, index_c).stripWhiteSpace(); + } + matrixstr += "]"; + } + matrixstr += "]"; + } + accept(); +} +void QalculateInsertMatrixVectorDialog::insertSelection() { + QTableSelection sel = elementsTable->selection(elementsTable->currentSelection()); + if(vectorButton->isChecked()) { + bool b = false; + matrixstr = "["; + for(int index_r = sel.topRow(); index_r <= sel.bottomRow(); index_r++) { + for(int index_c = sel.leftCol(); index_c <= sel.rightCol(); index_c++) { + if(!elementsTable->text(index_r, index_c).isEmpty()) { + QString str2 = elementsTable->text(index_r, index_c).stripWhiteSpace(); + if(!str2.isEmpty()) { + if(b) { + matrixstr += CALCULATOR->getComma(); + matrixstr += " "; + } else { + b = true; + } + matrixstr += str2; + } + } + } + } + matrixstr += "]"; + } else { + matrixstr = "["; + bool b1 = false; + for(int index_r = sel.topRow(); index_r <= sel.bottomRow(); index_r++) { + if(b1) { + matrixstr += CALCULATOR->getComma(); + matrixstr += " "; + } else { + b1 = true; + } + matrixstr += "["; + bool b2 = false; + for(int index_c = sel.leftCol(); index_c <= sel.rightCol(); index_c++) { + if(b2) { + matrixstr += CALCULATOR->getComma(); + matrixstr += " "; + } else { + b2 = true; + } + matrixstr += elementsTable->text(index_r, index_c).stripWhiteSpace(); + } + matrixstr += "]"; + } + matrixstr += "]"; + } + accept(); +} + +QString QalculateInsertMatrixVectorDialog::editMatrixVector(const MathStructure *initial_value, bool create_vector, bool is_text_struct, bool is_result) { + + if(initial_value && !initial_value->isVector()) { + return NULL; + } + + if(initial_value) { + create_vector = !initial_value->isMatrix(); + } + if(create_vector) { + vectorButton->setChecked(true); + elementsLabel->setText(i18n("Elements (in horizontal order):")); + } else { + matrixButton->setChecked(true); + elementsLabel->setText(i18n("Elements:")); + } + + if(is_result) { +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + setButtonOKText(i18n("Insert")); + setButtonCancelText(KStdGuiItem::close().text()); +#else +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 3 + setButtonOK(KGuiItem(i18n("Insert"))); +#else + setButtonOK(KStdGuiItem::insert()); +#endif + setButtonCancel(KStdGuiItem::close()); +#endif + actionButton(Cancel)->setDefault(true); + actionButton(Cancel)->setFocus(); + if(create_vector) { + setCaption(i18n("Vector Result")); + } else { + setCaption(i18n("Matrix Result")); + } + } else { +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + setButtonOKText(KStdGuiItem::ok().text()); + setButtonCancelText(KStdGuiItem::cancel().text()); +#else + setButtonOK(KStdGuiItem::ok()); + setButtonCancel(KStdGuiItem::cancel()); +#endif + actionButton(Ok)->setDefault(true); + elementsTable->setFocus(); + if(create_vector) { + setCaption(i18n("Vector")); + } else { + setCaption(i18n("Matrix")); + } + } + + int r = 4, c = 4; + if(create_vector) { + if(initial_value) { + r = initial_value->countChildren(); + c = (int) ::sqrt(r) + 4; + if(r % c > 0) { + r = r / c + 1; + } else { + r = r / c; + } + } else { + c = 4; + r = 4; + } + } else if(initial_value) { + c = initial_value->columns(); + r = initial_value->rows(); + } + + rowsBox->setValue(r); + columnsBox->setValue(c); + elementsTable->setNumRows(r); + elementsTable->setNumCols(c); + + int timeout; + if(initial_value) timeout = 3000 / (r * c); + else timeout = 3000; + printops.can_display_unicode_string_arg = (void*) elementsTable; + for(int index_r = 0; index_r < r; index_r++) { + for(int index_c = 0; index_c < c; index_c++) { + if(create_vector) { + if(initial_value && index_r * c + index_c < (int) initial_value->countChildren()) { + if(is_text_struct) elementsTable->setText(index_r, index_c, initial_value->getChild(index_r * c + index_c + 1)->symbol().c_str()); + else elementsTable->setText(index_r, index_c, initial_value->getChild(index_r * c + index_c + 1)->print(printops).c_str()); + } else { + elementsTable->setText(index_r, index_c, ""); + } + } else { + if(initial_value) { + if(is_text_struct) elementsTable->setText(index_r, index_c, initial_value->getElement(index_r + 1, index_c + 1)->symbol().c_str()); + else elementsTable->setText(index_r, index_c, initial_value->getElement(index_r + 1, index_c + 1)->print(printops).c_str()); + } else { + elementsTable->setText(index_r, index_c, "0"); + } + } + } + } + printops.can_display_unicode_string_arg = NULL; + matrixstr = ""; + + onSelectionChanged(); + + exec(); + + return matrixstr; +} + +#if QT_VERSION >= 0x030200 +QalculateInsertMatrixTableItem::QalculateInsertMatrixTableItem(QTable *table) : QTableItem(table, QTableItem::OnTyping) {} +#else +QalculateInsertMatrixTableItem::QalculateInsertMatrixTableItem(QTable *table) : QTableItem(table, QTableItem::OnTyping, QString::null) {} +#endif +QalculateInsertMatrixTableItem::QalculateInsertMatrixTableItem(QTable *table, const QString & text) : QTableItem(table, QTableItem::OnTyping, text) {} + +int QalculateInsertMatrixTableItem::alignment() const {return Qt::AlignRight;} + +#include "qalculateinsertmatrixvectordialog.moc" + diff --git a/src/qalculateinsertmatrixvectordialog.h b/src/qalculateinsertmatrixvectordialog.h new file mode 100644 index 0000000..32ba4ea --- /dev/null +++ b/src/qalculateinsertmatrixvectordialog.h @@ -0,0 +1,73 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEINSERTMATRIXVECTORDIALOG_H +#define QALCULATEINSERTMATRIXVECTORDIALOG_H + +#include + +class QTable; +class QLabel; +class QSpinBox; +class QRadioButton; +class KComboBox; +class KLineEdit; +class QPushButton; +class MathStructure; +class QalculateEditNamesDialog; +class KnownVariable; + +/** +@author Niklas Knutsson +*/ +class QalculateInsertMatrixVectorDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateInsertMatrixVectorDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateInsertMatrixVectorDialog(); + + QString newMatrix(); + QString newVector(); + QString editMatrixVector(const MathStructure *initial_value = NULL, bool create_vector = false, bool is_text_struct = false, bool is_result = false); + + QLabel *elementsLabel; + QRadioButton *matrixButton, *vectorButton; + QTable *elementsTable; + QSpinBox *rowsBox, *columnsBox; + QString matrixstr; + QPushButton *insertSelectionButton; + +public slots: + + void typeChanged(int); + void rowsChanged(int); + void columnsChanged(int); + void onSelectionChanged(); + +protected slots: + + void slotOk(); + void insertSelection(); + +}; + +#endif diff --git a/src/qalculateperiodictabledialog.cpp b/src/qalculateperiodictabledialog.cpp new file mode 100644 index 0000000..1eb07be --- /dev/null +++ b/src/qalculateperiodictabledialog.cpp @@ -0,0 +1,276 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateperiodictabledialog.h" +#include "qalculate_kde_utils.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "qalculatebuttonwithdata.h" +#include +#include +#include +#include + +extern PrintOptions printops; +extern QWidget *expressionWidget; + +QalculatePeriodicTableDialog::QalculatePeriodicTableDialog(QWidget *parent, const char *name) + : KDialogBase(parent, name, false, i18n("Periodic Table"), Close, Close, true) { + + actionButton(Close)->setAutoDefault(false); + actionButton(Close)->setDefault(false); + + grid = new QGridLayout(makeMainWidget(), 11, 20, 0, 1); + + grid->addWidget(new QLabel("1", mainWidget()), 0, 1, Qt::AlignHCenter); + grid->addWidget(new QLabel("2", mainWidget()), 0, 2, Qt::AlignHCenter); + grid->addWidget(new QLabel("3", mainWidget()), 0, 4, Qt::AlignHCenter); + grid->addWidget(new QLabel("4", mainWidget()), 0, 5, Qt::AlignHCenter); + grid->addWidget(new QLabel("5", mainWidget()), 0, 6, Qt::AlignHCenter); + grid->addWidget(new QLabel("6", mainWidget()), 0, 7, Qt::AlignHCenter); + grid->addWidget(new QLabel("7", mainWidget()), 0, 8, Qt::AlignHCenter); + grid->addWidget(new QLabel("8", mainWidget()), 0, 9, Qt::AlignHCenter); + grid->addWidget(new QLabel("9", mainWidget()), 0, 10, Qt::AlignHCenter); + grid->addWidget(new QLabel("10", mainWidget()), 0, 11, Qt::AlignHCenter); + grid->addWidget(new QLabel("11", mainWidget()), 0, 12, Qt::AlignHCenter); + grid->addWidget(new QLabel("12", mainWidget()), 0, 13, Qt::AlignHCenter); + grid->addWidget(new QLabel("13", mainWidget()), 0, 14, Qt::AlignHCenter); + grid->addWidget(new QLabel("14", mainWidget()), 0, 15, Qt::AlignHCenter); + grid->addWidget(new QLabel("15", mainWidget()), 0, 16, Qt::AlignHCenter); + grid->addWidget(new QLabel("16", mainWidget()), 0, 17, Qt::AlignHCenter); + grid->addWidget(new QLabel("17", mainWidget()), 0, 18, Qt::AlignHCenter); + grid->addWidget(new QLabel("18", mainWidget()), 0, 19, Qt::AlignHCenter); + + grid->addWidget(new QLabel("1 ", mainWidget()), 1, 0, Qt::AlignRight); + grid->addWidget(new QLabel("2 ", mainWidget()), 2, 0, Qt::AlignRight); + grid->addWidget(new QLabel("3 ", mainWidget()), 3, 0, Qt::AlignRight); + grid->addWidget(new QLabel("4 ", mainWidget()), 4, 0, Qt::AlignRight); + grid->addWidget(new QLabel("5 ", mainWidget()), 5, 0, Qt::AlignRight); + grid->addWidget(new QLabel("6 ", mainWidget()), 6, 0, Qt::AlignRight); + grid->addWidget(new QLabel("7 ", mainWidget()), 7, 0, Qt::AlignRight); + + grid->addWidget(new QLabel("*", mainWidget()), 6, 3, Qt::AlignRight); + grid->addWidget(new QLabel("**", mainWidget()), 7, 3, Qt::AlignRight); + grid->addWidget(new QLabel("*", mainWidget()), 9, 3, Qt::AlignRight); + grid->addWidget(new QLabel("**", mainWidget()), 10, 3, Qt::AlignRight); + grid->addWidget(new QLabel(" ", mainWidget()), 8, 0); + + DataSet *dc = CALCULATOR->getDataSet("atom"); + if(!dc) { + return; + } + DataObject *e; + QalculateButtonWithData *e_button; + QString tip; + DataProperty *p_xpos = dc->getProperty("x_pos"); + DataProperty *p_ypos = dc->getProperty("y_pos"); + DataProperty *p_weight = dc->getProperty("weight"); + DataProperty *p_number = dc->getProperty("number"); + DataProperty *p_symbol = dc->getProperty("symbol"); + DataProperty *p_class = dc->getProperty("class"); + DataProperty *p_name = dc->getProperty("name"); + int x_pos = 0, y_pos = 0, group = 0; + QString weight; + int w = -1; + for(size_t i = 1; i < 120; i++) { + e = dc->getObject(i2s(i)); + if(e) { + x_pos = s2i(e->getProperty(p_xpos)); + y_pos = s2i(e->getProperty(p_ypos)); + } + if(e && x_pos > 0 && x_pos <= 18 && y_pos > 0 && y_pos <= 10) { + e_button = new QalculateButtonWithData((void*) e, e->getProperty(p_symbol).c_str(), mainWidget()); + e_button->setFlat(true); + group = s2i(e->getProperty(p_class)); + switch(group) { + case 1: { + e_button->setPaletteBackgroundColor(QColor(0xee, 0xcc, 0xee)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 2: { + e_button->setPaletteBackgroundColor(QColor(0xdd, 0xcc, 0xee)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 3: { + e_button->setPaletteBackgroundColor(QColor(0xdd, 0xdd, 0xff)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 4: { + e_button->setPaletteBackgroundColor(QColor(0xdd, 0xee, 0xff)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 5: { + e_button->setPaletteBackgroundColor(QColor(0xcc, 0xee, 0xee)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 6: { + e_button->setPaletteBackgroundColor(QColor(0xbb, 0xff, 0xbb)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 7: { + e_button->setPaletteBackgroundColor(QColor(0xee, 0xff, 0xdd)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 8: { + e_button->setPaletteBackgroundColor(QColor(0xff, 0xff, 0xaa)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 9: { + e_button->setPaletteBackgroundColor(QColor(0xff, 0xdd, 0xaa)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 10: { + e_button->setPaletteBackgroundColor(QColor(0xff, 0xcc, 0xdd)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + case 11: { + e_button->setPaletteBackgroundColor(QColor(0xaa, 0xee, 0xdd)); + e_button->setPaletteForegroundColor(QColor(0, 0, 0)); + break; + } + } + if(w < 0) { + w = e_button->fontMetrics().width("Uuo") + 12; + } + e_button->setFixedWidth(w); + e_button->setFixedHeight(w); + if(x_pos > 2) { + grid->addWidget(e_button, y_pos, x_pos + 1); + } else { + grid->addWidget(e_button, y_pos, x_pos); + } + tip = e->getProperty(p_number).c_str(); + tip += " "; + tip += e->getProperty(p_name).c_str(); + weight = e->getPropertyDisplayString(p_weight).c_str(); + if(!weight.isEmpty() && weight != "-") { + tip += "\n"; + tip += weight; + } + QToolTip::add(e_button, tip); + QObject::connect(e_button, SIGNAL(clickedWithData(void*)), this, SLOT(showElementInfo(void*))); + } + } + +} +QalculatePeriodicTableDialog::~QalculatePeriodicTableDialog() {} +void QalculatePeriodicTableDialog::showElementInfo(void *e) { + DataObject *o = (DataObject*) e; + QalculateElementInfoDialog *dialog = new QalculateElementInfoDialog(o, this); + dialog->show(); +} + +QalculateElementInfoDialog::QalculateElementInfoDialog(DataObject *element, QWidget *parent, const char *name) : KDialogBase(parent, name, false, i18n("Element Data"), Close, Close, true) { + + setWFlags(getWFlags() | Qt::WDestructiveClose); + e = element; + DataSet *ds = e->parentSet(); + if(!ds) { + close(); + return; + } + QVBox *vbox = makeVBoxMainWidget(); + QVBox *vbox2 = new QVBox(vbox); + DataProperty *p_number = ds->getProperty("number"); + DataProperty *p_symbol = ds->getProperty("symbol"); + DataProperty *p_class = ds->getProperty("class"); + DataProperty *p_name = ds->getProperty("name"); + QString str = "
"; str += e->getProperty(p_number).c_str(); str += "
"; + new KActiveLabel(str, vbox2); + str = ""; str += e->getProperty(p_symbol).c_str(); str += ""; + new KActiveLabel(str, vbox2); + str = ""; str += e->getProperty(p_name).c_str(); str += " "; + new KActiveLabel(str, vbox2); + + QalculateButtonWithData *button; + QGrid *grid = new QGrid(3, Qt::Horizontal, vbox); + int group = s2i(e->getProperty(p_class)); + if(group > 0) { + str = ""; str += i18n("Classification"); str += ":"; str += ""; + new QLabel(str, grid); + switch(group) { + case ALKALI_METALS: {str = i18n("Alkali Metal"); break;} + case ALKALI_EARTH_METALS: {str = i18n("Alkaline-Earth Metal"); break;} + case LANTHANIDES: {str = i18n("Lanthanide"); break;} + case ACTINIDES: {str = i18n("Actinide"); break;} + case TRANSITION_METALS: {str = i18n("Transition Metal"); break;} + case METALS: {str = i18n("Metal"); break;} + case METALLOIDS: {str = i18n("Metalloid"); break;} + case NONMETALS: {str = i18n("Non-Metal"); break;} + case HALOGENS: {str = i18n("Halogen"); break;} + case NOBLE_GASES: {str = i18n("Noble Gas"); break;} + case TRANSACTINIDES: {str = i18n("Transactinide"); break;} + default: {str = i18n("Unknown"); break;} + } + new KActiveLabel(str, grid); + new QFrame(grid); + } + + DataPropertyIter it; + DataProperty *dp = ds->getFirstProperty(&it); + QString sval; + while(dp) { + if(!dp->isHidden() && dp != p_number && dp != p_class && dp != p_symbol && dp != p_name) { + sval = e->getPropertyDisplayString(dp).c_str(); + if(!sval.isEmpty()) { + str = ""; str += dp->title().c_str(); str += ":"; str += ""; + new QLabel(str, grid); + new KActiveLabel(sval, grid); + button = new QalculateButtonWithData((void*) dp, QIconSet(SmallIcon("editpaste")), "", grid); + QObject::connect(button, SIGNAL(clickedWithData(void*)), SLOT(insertElementData(void*))); + } + } + dp = ds->getNextProperty(&it); + } +} +QalculateElementInfoDialog::~QalculateElementInfoDialog() {} + +void QalculateElementInfoDialog::insertElementData(void *data) { + DataProperty *dp = (DataProperty*) data; + DataSet *ds = dp->parentSet(); + if(ds) { + QString str = ds->preferredInputName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) expressionWidget).name.c_str(); + str += "("; + str += e->getProperty(ds->getPrimaryKeyProperty()).c_str(); + str += CALCULATOR->getComma().c_str(); + str += " "; + str += dp->getName().c_str(); + str += ")"; + insert_text_in_expression(str); + } +} + + +#include "qalculateperiodictabledialog.moc" diff --git a/src/qalculateperiodictabledialog.h b/src/qalculateperiodictabledialog.h new file mode 100644 index 0000000..5d52767 --- /dev/null +++ b/src/qalculateperiodictabledialog.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEPERIODICTABLEDIALOG_H +#define QALCULATEPERIODICTABLEDIALOG_H + +#include +#include + +class QGridLayout; +class DataObject; + +/** +@author Niklas Knutsson +*/ +class QalculatePeriodicTableDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculatePeriodicTableDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculatePeriodicTableDialog(); + + QGridLayout *grid; + +public slots: + + void showElementInfo(void*); + +}; + +class QalculateElementInfoDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateElementInfoDialog(DataObject *element, QWidget *parent = 0, const char *name = 0); + virtual ~QalculateElementInfoDialog(); + + DataObject *e; + +public slots: + + void insertElementData(void*); + +}; + +#endif diff --git a/src/qalculateplotdialog.cpp b/src/qalculateplotdialog.cpp new file mode 100644 index 0000000..e1adbae --- /dev/null +++ b/src/qalculateplotdialog.cpp @@ -0,0 +1,789 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateplotdialog.h" +#include "qalculateexpressionedit.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 +#include +#else +#include +#endif +#include +#include +#include + +extern PlotLegendPlacement default_plot_legend_placement; +extern bool default_plot_display_grid; +extern bool default_plot_full_border; +extern QString default_plot_min; +extern QString default_plot_max; +extern QString default_plot_step; +extern int default_plot_sampling_rate; +extern bool default_plot_use_sampling_rate; +extern bool default_plot_rows; +extern int default_plot_type; +extern PlotStyle default_plot_style; +extern PlotSmoothing default_plot_smoothing; +extern QString default_plot_variable; +extern bool default_plot_color; +extern bool enable_plot_expression_completion; + +extern EvaluationOptions evalops; + +QalculatePlotDialog::QalculatePlotDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, false, i18n("Plot"), User1 | Close | Help, Close, false, KStdGuiItem::save()) { + + actionButton(Close)->setAutoDefault(false); + actionButton(Close)->setDefault(false); + actionButton(User1)->setAutoDefault(false); + actionButton(User1)->setDefault(false); + + actionButton(User1)->setEnabled(false); + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + tabs = new QTabWidget(this); +#else + tabs = new KTabWidget(this); +#endif + setMainWidget(tabs); + QWidget *page1 = new QWidget(this); + QWidget *page2 = new QWidget(this); + QWidget *page3 = new QWidget(this); + tabs->addTab(page1, i18n("Data")); + tabs->addTab(page2, i18n("Function Range")); + tabs->addTab(page3, i18n("Appearance")); + QGridLayout *grid = new QGridLayout(page1, 1, 1, spacingHint()); + grid->addWidget(new QLabel(i18n("Title:"), page1), 0, 0); + seriesTitleEdit = new KLineEdit(page1); + grid->addWidget(seriesTitleEdit, 0, 1); + grid->addWidget(new QLabel(i18n("Expression:"), page1), 1, 0); + expressionEdit = new QalculateExpressionEdit(false, page1); + if(!enable_plot_expression_completion) expressionEdit->disableCompletion(); + expressionEdit->updateCompletion(); + grid->addWidget(expressionEdit, 1, 1); + QHBoxLayout *hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 2, 2, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + typeGroup = new QButtonGroup(); + functionButton = new QRadioButton(i18n("Function"), page1); + typeGroup->insert(functionButton, 0); + hbox->addWidget(functionButton); + vectorMatrixButton = new QRadioButton(i18n("Vector/matrix"), page1); + typeGroup->insert(vectorMatrixButton, 1); + hbox->addWidget(vectorMatrixButton); + pairedMatrixButton = new QRadioButton(i18n("Paired matrix"), page1); + typeGroup->insert(pairedMatrixButton, 2); + hbox->addWidget(pairedMatrixButton); + rowsButton = new QCheckBox(i18n("Rows"), page1); + hbox->addWidget(rowsButton); + xVariableLabel = new QLabel(i18n("X variable:"), page1); + grid->addWidget(xVariableLabel, 3, 0); + xVariableEdit = new KLineEdit(page1); + grid->addWidget(xVariableEdit, 3, 1); + grid->addWidget(new QLabel(i18n("Style:"), page1), 4, 0); + styleCombo = new KComboBox(page1); + styleCombo->insertItem(i18n("Line")); + styleCombo->insertItem(i18n("Points")); + styleCombo->insertItem(i18n("Line with points")); + styleCombo->insertItem(i18n("Boxes/bars")); + styleCombo->insertItem(i18n("Histogram")); + styleCombo->insertItem(i18n("Steps")); + styleCombo->insertItem(i18n("Candlesticks")); + styleCombo->insertItem(i18n("Dots")); + grid->addWidget(styleCombo, 4, 1); + grid->addWidget(new QLabel(i18n("Smoothing:"), page1), 5, 0); + smoothingCombo = new KComboBox(page1); + smoothingCombo->insertItem(i18n("None")); + smoothingCombo->insertItem(i18n("Monotonic")); + smoothingCombo->insertItem(i18n("Natural cubic splines")); + smoothingCombo->insertItem(i18n("Bezier")); + smoothingCombo->insertItem(i18n("Bezier (monotonic)")); + grid->addWidget(smoothingCombo, 5, 1); + grid->addWidget(new QLabel(i18n("Y-axis:"), page1), 6, 0); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addLayout(hbox, 6, 1); + QButtonGroup *group = new QButtonGroup(); + primaryButton = new QRadioButton(i18n("Primary"), page1); + group->insert(primaryButton, 0); + hbox->addWidget(primaryButton); + secondaryButton = new QRadioButton(i18n("Secondary"), page1); + group->insert(secondaryButton, 1); + hbox->addWidget(secondaryButton); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 7, 7, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + addButton = new QPushButton(i18n("Add"), page1); + hbox->addWidget(addButton); + modifyButton = new QPushButton(i18n("Modify"), page1); + hbox->addWidget(modifyButton); + removeButton = new QPushButton(i18n("Remove"), page1); + hbox->addWidget(removeButton); + seriesView = new KListView(page1); + seriesView->addColumn(i18n("Title")); + seriesView->addColumn(i18n("Expression")); + seriesView->setRootIsDecorated(false); + seriesView->setItemsRenameable(true); + seriesView->setRenameable(0, true); + seriesView->setRenameable(1, true); + seriesView->setItemsMovable(true); + seriesView->setSorting(-1); + grid->addMultiCellWidget(seriesView, 8, 8, 0, 1); + + grid = new QGridLayout(page2, 1, 1, spacingHint()); + grid->addWidget(new QLabel(i18n("Min:"), page2), 0, 0); + minEdit = new KLineEdit(page2); + grid->addWidget(minEdit, 0, 1); + grid->addWidget(new QLabel(i18n("Max:"), page2), 1, 0); + maxEdit = new KLineEdit(page2); + grid->addWidget(maxEdit, 1, 1); + rangeGroup = new QButtonGroup(); + samplingRateButton = new QRadioButton(i18n("Sampling rate:"), page2); + rangeGroup->insert(samplingRateButton, 0); + grid->addWidget(samplingRateButton, 2, 0); + samplingRateBox = new QSpinBox(1, 10000, 10, page2); + grid->addWidget(samplingRateBox, 2, 1); + stepSizeButton = new QRadioButton(i18n("Step size:"), page2); + rangeGroup->insert(stepSizeButton, 1); + grid->addWidget(stepSizeButton, 3, 0); + stepSizeEdit = new KLineEdit(page2); + grid->addWidget(stepSizeEdit, 3, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 4, 4, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + applyRangeButton = new KPushButton(KStdGuiItem::apply(), page2); + hbox->addWidget(applyRangeButton); + grid->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 5, 0); + + grid = new QGridLayout(page3, 1, 1, spacingHint()); + grid->addWidget(new QLabel(i18n("Title:"), page3), 0, 0); + titleEdit = new KLineEdit(page3); + grid->addWidget(titleEdit, 0, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 1, 1, 0, 1); + gridButton = new QCheckBox(i18n("Display grid"), page3); + hbox->addWidget(gridButton); + fullBorderButton = new QCheckBox(i18n("Display full border"), page3); + hbox->addWidget(fullBorderButton); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + logXButton = new QCheckBox(i18n("Logarithmic x scale:"), page3); + grid->addWidget(logXButton, 2, 0); + logXBox = new QSpinBox(2, 100, 1, page3); + grid->addWidget(logXBox, 2, 1); + logYButton = new QCheckBox(i18n("Logarithmic y scale:"), page3); + grid->addWidget(logYButton, 3, 0); + logYBox = new QSpinBox(2, 100, 1, page3); + grid->addWidget(logYBox, 3, 1); + grid->addWidget(new QLabel(i18n("X-axis label:"), page3), 4, 0); + xLabelEdit = new KLineEdit(page3); + grid->addWidget(xLabelEdit, 4, 1); + grid->addWidget(new QLabel(i18n("Y-axis label:"), page3), 5, 0); + yLabelEdit = new KLineEdit(page3); + grid->addWidget(yLabelEdit, 5, 1); + grid->addWidget(new QLabel(i18n("Color display:"), page3), 6, 0); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addLayout(hbox, 6, 1); + group = new QButtonGroup(); + colorButton = new QRadioButton(i18n("Color"), page3); + group->insert(colorButton, 0); + hbox->addWidget(colorButton); + monochromeButton = new QRadioButton(i18n("Monochrome"), page3); + group->insert(monochromeButton, 1); + hbox->addWidget(monochromeButton); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + grid->addWidget(new QLabel(i18n("Legend placement:"), page3), 7, 0); + legendPlacementCombo = new KComboBox(page3); + legendPlacementCombo->insertItem(i18n("Hide")); + legendPlacementCombo->insertItem(i18n("Top-left")); + legendPlacementCombo->insertItem(i18n("Top-right")); + legendPlacementCombo->insertItem(i18n("Bottom-left")); + legendPlacementCombo->insertItem(i18n("Bottom-right")); + legendPlacementCombo->insertItem(i18n("Below")); + legendPlacementCombo->insertItem(i18n("Outside")); + grid->addWidget(legendPlacementCombo, 7, 1); + hbox = new QHBoxLayout(0, 0, spacingHint()); + grid->addMultiCellLayout(hbox, 8, 8, 0, 1); + hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); + applyAppearanceButton = new KPushButton(KStdGuiItem::apply(), page3); + hbox->addWidget(applyAppearanceButton); + grid->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 9, 0); + + primaryButton->setChecked(true); + modifyButton->setEnabled(false); + removeButton->setEnabled(false); + gridButton->setChecked(default_plot_display_grid); + fullBorderButton->setChecked(default_plot_full_border); + rowsButton->setChecked(default_plot_rows); + colorButton->setChecked(default_plot_color); + monochromeButton->setChecked(!default_plot_color); + minEdit->setText(default_plot_min); + maxEdit->setText(default_plot_max); + stepSizeEdit->setText(default_plot_step); + xVariableEdit->setText(default_plot_variable); + samplingRateButton->setChecked(default_plot_use_sampling_rate); + samplingRateBox->setEnabled(default_plot_use_sampling_rate); + stepSizeButton->setChecked(!default_plot_use_sampling_rate); + stepSizeEdit->setEnabled(!default_plot_use_sampling_rate); + logXBox->setEnabled(false); + logYBox->setEnabled(false); + switch(default_plot_type) { + case 1: {vectorMatrixButton->setChecked(true); break;} + case 2: {pairedMatrixButton->setChecked(true); break;} + default: {functionButton->setChecked(true);} + } + rowsButton->setEnabled(default_plot_type == 1 || default_plot_type == 2); + xVariableEdit->setEnabled(default_plot_type != 1 && default_plot_type != 2); + xVariableLabel->setEnabled(default_plot_type != 1 && default_plot_type != 2); + switch(default_plot_legend_placement) { + case PLOT_LEGEND_NONE: {legendPlacementCombo->setCurrentItem(0); break;} + case PLOT_LEGEND_TOP_LEFT: {legendPlacementCombo->setCurrentItem(1); break;} + case PLOT_LEGEND_TOP_RIGHT: {legendPlacementCombo->setCurrentItem(2); break;} + case PLOT_LEGEND_BOTTOM_LEFT: {legendPlacementCombo->setCurrentItem(3); break;} + case PLOT_LEGEND_BOTTOM_RIGHT: {legendPlacementCombo->setCurrentItem(4); break;} + case PLOT_LEGEND_BELOW: {legendPlacementCombo->setCurrentItem(5); break;} + case PLOT_LEGEND_OUTSIDE: {legendPlacementCombo->setCurrentItem(6); break;} + } + switch(default_plot_smoothing) { + case PLOT_SMOOTHING_NONE: {smoothingCombo->setCurrentItem(0); break;} + case PLOT_SMOOTHING_UNIQUE: {smoothingCombo->setCurrentItem(1); break;} + case PLOT_SMOOTHING_CSPLINES: {smoothingCombo->setCurrentItem(2); break;} + case PLOT_SMOOTHING_BEZIER: {smoothingCombo->setCurrentItem(3); break;} + case PLOT_SMOOTHING_SBEZIER: {smoothingCombo->setCurrentItem(4); break;} + } + switch(default_plot_style) { + case PLOT_STYLE_LINES: {styleCombo->setCurrentItem(0); break;} + case PLOT_STYLE_POINTS: {styleCombo->setCurrentItem(1); break;} + case PLOT_STYLE_POINTS_LINES: {styleCombo->setCurrentItem(2); break;} + case PLOT_STYLE_BOXES: {styleCombo->setCurrentItem(3); break;} + case PLOT_STYLE_HISTOGRAM: {styleCombo->setCurrentItem(4); break;} + case PLOT_STYLE_STEPS: {styleCombo->setCurrentItem(5); break;} + case PLOT_STYLE_CANDLESTICKS: {styleCombo->setCurrentItem(6); break;} + case PLOT_STYLE_DOTS: {styleCombo->setCurrentItem(7); break;} + } + samplingRateBox->setValue(default_plot_sampling_rate); + + seriesTitleEdit->setFocus(); + + connect(seriesTitleEdit, SIGNAL(returnPressed()), expressionEdit, SLOT(setFocus())); + connect(expressionEdit, SIGNAL(returnPressed()), this, SLOT(expressionActivated())); + connect(typeGroup, SIGNAL(clicked(int)), this, SLOT(typeChanged(int))); + connect(rangeGroup, SIGNAL(clicked(int)), this, SLOT(rangeTypeChanged(int))); + connect(logXButton, SIGNAL(toggled(bool)), logXBox, SLOT(setEnabled(bool))); + connect(logYButton, SIGNAL(toggled(bool)), logYBox, SLOT(setEnabled(bool))); + connect(applyRangeButton, SIGNAL(clicked()), this, SLOT(applyRange())); + connect(applyAppearanceButton, SIGNAL(clicked()), this, SLOT(applyAppearance())); + connect(seriesView, SIGNAL(selectionChanged()), this, SLOT(seriesSelected())); + connect(seriesView, SIGNAL(itemRenamed(QListViewItem*, const QString&, int)), this, SLOT(seriesItemRenamed(QListViewItem*, const QString&, int))); + connect(addButton, SIGNAL(clicked()), this, SLOT(addSeries())); + connect(modifyButton, SIGNAL(clicked()), this, SLOT(modifySeries())); + connect(removeButton, SIGNAL(clicked()), this, SLOT(removeSeries())); + connect(this, SIGNAL(user1Clicked()), this, SLOT(savePlot())); + connect(this, SIGNAL(finished()), this, SLOT(onClosing())); + +} + +QalculatePlotDialog::~QalculatePlotDialog() {} + +void QalculatePlotDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-plotting"); +} + +void QalculatePlotDialog::saveMode() { + + enable_plot_expression_completion = expressionEdit->completionEnabled(); + default_plot_display_grid = gridButton->isChecked(); + default_plot_full_border = fullBorderButton->isChecked(); + default_plot_rows = rowsButton->isChecked(); + default_plot_color = colorButton->isChecked(); + default_plot_min = minEdit->text().ascii(); + default_plot_max = maxEdit->text().ascii(); + default_plot_step = stepSizeEdit->text().ascii(); + default_plot_variable = xVariableEdit->text().ascii(); + default_plot_use_sampling_rate = samplingRateButton->isChecked(); + if(vectorMatrixButton->isChecked()) { + default_plot_type = 1; + } else if(pairedMatrixButton->isChecked()) { + default_plot_type = 2; + } else { + default_plot_type = 0; + } + switch(legendPlacementCombo->currentItem()) { + case 0: {default_plot_legend_placement = PLOT_LEGEND_NONE; break;} + case 1: {default_plot_legend_placement = PLOT_LEGEND_TOP_LEFT; break;} + case 2: {default_plot_legend_placement = PLOT_LEGEND_TOP_RIGHT; break;} + case 3: {default_plot_legend_placement = PLOT_LEGEND_BOTTOM_LEFT; break;} + case 4: {default_plot_legend_placement = PLOT_LEGEND_BOTTOM_RIGHT; break;} + case 5: {default_plot_legend_placement = PLOT_LEGEND_BELOW; break;} + case 6: {default_plot_legend_placement = PLOT_LEGEND_OUTSIDE; break;} + } + switch(smoothingCombo->currentItem()) { + case 0: {default_plot_smoothing = PLOT_SMOOTHING_NONE; break;} + case 1: {default_plot_smoothing = PLOT_SMOOTHING_UNIQUE; break;} + case 2: {default_plot_smoothing = PLOT_SMOOTHING_CSPLINES; break;} + case 3: {default_plot_smoothing = PLOT_SMOOTHING_BEZIER; break;} + case 4: {default_plot_smoothing = PLOT_SMOOTHING_SBEZIER; break;} + } + switch(styleCombo->currentItem()) { + case 0: {default_plot_style = PLOT_STYLE_LINES; break;} + case 1: {default_plot_style = PLOT_STYLE_POINTS; break;} + case 2: {default_plot_style = PLOT_STYLE_POINTS_LINES; break;} + case 3: {default_plot_style = PLOT_STYLE_BOXES; break;} + case 4: {default_plot_style = PLOT_STYLE_HISTOGRAM; break;} + case 5: {default_plot_style = PLOT_STYLE_STEPS; break;} + case 6: {default_plot_style = PLOT_STYLE_CANDLESTICKS; break;} + case 7: {default_plot_style = PLOT_STYLE_DOTS; break;} + } + default_plot_sampling_rate = samplingRateBox->value(); +} +void QalculatePlotDialog::onClosing() { + + tabs->setCurrentPage(0); + modifyButton->setEnabled(false); + removeButton->setEnabled(false); + actionButton(User1)->setEnabled(false); + + QListViewItemIterator it(seriesView); + while(it.current()) { + MathStructure *y_vector = itemYVector[it.current()], *x_vector = itemXVector[it.current()]; + if(y_vector) delete y_vector; + if(x_vector) delete x_vector; + ++it; + } + itemStyle.clear(); + itemType.clear(); + itemAxis.clear(); + itemSmoothing.clear(); + itemRows.clear(); + itemXVector.clear(); + itemYVector.clear(); + itemXVariable.clear(); + seriesView->clear(); + expressionEdit->clear(); + seriesTitleEdit->clear(); + + CALCULATOR->closeGnuplot(); + +} +void QalculatePlotDialog::seriesItemRenamed(QListViewItem *i, const QString &str, int col) { + if(!i) return; + if(col == 0) { + updatePlot(); + } else if(col == 1) { + if(str.isEmpty()) { + KMessageBox::error(this, i18n("Empty expression.")); + } + MathStructure *x_vector = itemXVector[i], *y_vector = itemYVector[i]; + if(x_vector) delete x_vector; + if(y_vector) delete y_vector; + x_vector = NULL; + y_vector = NULL; + generatePlotSeries(&x_vector, &y_vector, itemType[i], str.ascii(), itemXVariable[i].ascii()); + itemXVector[i] = x_vector; + itemYVector[i] = y_vector; + updatePlot(); + } + seriesSelected(); +} +void QalculatePlotDialog::seriesSelected() { + QListViewItem *i = seriesView->selectedItem(); + if(i) { + modifyButton->setEnabled(true); + removeButton->setEnabled(true); + expressionEdit->setText(i->text(1)); + seriesTitleEdit->setText(i->text(0)); + xVariableEdit->setText(itemXVariable[i]); + styleCombo->setCurrentItem(itemStyle[i]); + smoothingCombo->setCurrentItem(itemSmoothing[i]); + typeGroup->setButton(itemType[i]); + secondaryButton->setChecked(itemAxis[i] == 2); + primaryButton->setChecked(itemAxis[i] != 2); + rowsButton->setChecked(itemRows[i]); + } else { + modifyButton->setEnabled(false); + removeButton->setEnabled(false); + } +} +void QalculatePlotDialog::rangeTypeChanged(int i) { + stepSizeEdit->setEnabled(i == 1); + samplingRateBox->setEnabled(i == 0); +} + +void QalculatePlotDialog::typeChanged(int i) { + rowsButton->setEnabled(i == 1 || i == 2); + xVariableEdit->setEnabled(i != 1 && i != 2); + xVariableLabel->setEnabled(i != 1 && i != 2); +} +void QalculatePlotDialog::expressionActivated() { + QListViewItem *i = seriesView->selectedItem(); + if(i) { + modifySeries(); + } else { + addSeries(); + } +} +void QalculatePlotDialog::addSeries() { + QString expression = expressionEdit->text(); + if(expression.stripWhiteSpace().isEmpty()) { + expressionEdit->setFocus(); + KMessageBox::error(this, i18n("Empty expression.")); + return; + } + int type = 0, axis = 1; + bool rows = false; + QString title = seriesTitleEdit->text(); + if(vectorMatrixButton->isChecked()) { + type = 1; + } else if(pairedMatrixButton->isChecked()) { + type = 2; + } + QString str_x = xVariableEdit->text().stripWhiteSpace(); + if(str_x.isEmpty() && type == 0) { + xVariableEdit->setFocus(); + KMessageBox::error(this, i18n("Empty x variable.")); + return; + } + expressionEdit->addToHistory(expression); + if(secondaryButton->isChecked()) { + axis = 2; + } + if((type == 1 || type == 2) && title.isEmpty()) { + Variable *v = CALCULATOR->getActiveVariable(expression.ascii()); + if(v) { + title = v->title(false).c_str(); + } + } + MathStructure *x_vector, *y_vector; + generatePlotSeries(&x_vector, &y_vector, type, expression.ascii(), str_x.ascii()); + rows = rowsButton->isChecked(); + QListViewItem *i = new KListViewItem(seriesView, seriesView->lastChild(), title, expression); + itemStyle[i] = styleCombo->currentItem(); + itemSmoothing[i] = smoothingCombo->currentItem(); + itemType[i] = type; + itemAxis[i] = axis; + itemRows[i] = rows; + itemXVector[i] = x_vector; + itemYVector[i] = y_vector; + itemXVariable[i] = str_x; + seriesView->setSelected(i, true); + updatePlot(); +} +void QalculatePlotDialog::modifySeries() { + QListViewItem *i = seriesView->selectedItem(); + if(i) { + QString expression = expressionEdit->text(); + if(expression.stripWhiteSpace().isEmpty()) { + expressionEdit->setFocus(); + KMessageBox::error(this, i18n("Empty expression.")); + return; + } + int type = 0, axis = 1; + QString title = seriesTitleEdit->text(); + if(vectorMatrixButton->isChecked()) { + type = 1; + } else if(pairedMatrixButton->isChecked()) { + type = 2; + } + QString str_x = xVariableEdit->text().stripWhiteSpace(); + if(str_x.isEmpty() && type == 0) { + xVariableEdit->setFocus(); + KMessageBox::error(this, i18n("Empty x variable.")); + return; + } + expressionEdit->addToHistory(expression); + if(secondaryButton->isChecked()) { + axis = 2; + } + if((type == 1 || type == 2) && title.isEmpty()) { + Variable *v = CALCULATOR->getActiveVariable(expression.ascii()); + if(v) { + title = v->title(false).c_str(); + } + } + MathStructure *x_vector = itemXVector[i], *y_vector = itemYVector[i]; + if(x_vector) delete x_vector; + if(y_vector) delete y_vector; + x_vector = NULL; + y_vector = NULL; + generatePlotSeries(&x_vector, &y_vector, type, expression.ascii(), str_x.ascii()); + i->setText(0, title); + i->setText(1, expression); + itemStyle[i] = styleCombo->currentItem(); + itemSmoothing[i] = smoothingCombo->currentItem(); + itemType[i] = type; + itemAxis[i] = axis; + itemRows[i] = rowsButton->isChecked(); + itemXVector[i] = x_vector; + itemYVector[i] = y_vector; + itemXVariable[i] = str_x; + updatePlot(); + } +} +void QalculatePlotDialog::removeSeries() { + QListViewItem *i = seriesView->selectedItem(); + if(i) { + MathStructure *x_vector = itemXVector[i], *y_vector = itemYVector[i]; + if(x_vector) delete x_vector; + if(y_vector) delete y_vector; + itemStyle.erase(i); + itemSmoothing.erase(i); + itemType.erase(i); + itemAxis.erase(i); + itemRows.erase(i); + itemXVector.erase(i); + itemYVector.erase(i); + itemXVariable.erase(i); + delete i; + expressionEdit->clear(); + seriesTitleEdit->clear(); + updatePlot(); + } +} +void QalculatePlotDialog::applyRange() { + QListViewItemIterator it(seriesView); + while(it.current()) { + MathStructure *x_vector = itemXVector[it.current()], *y_vector = itemYVector[it.current()]; + if(y_vector) delete y_vector; + if(x_vector) delete x_vector; + x_vector = NULL; + y_vector = NULL; + generatePlotSeries(&x_vector, &y_vector, itemType[it.current()], it.current()->text(1).ascii(), itemXVariable[it.current()].ascii()); + itemXVector[it.current()] = x_vector; + itemYVector[it.current()] = y_vector; + ++it; + } + updatePlot(); +} +void QalculatePlotDialog::applyAppearance() { + updatePlot(); +} + +bool QalculatePlotDialog::generatePlot(PlotParameters &pp, vector &y_vectors, vector &x_vectors, vector &pdps) { + QListViewItemIterator it(seriesView); + if(!it.current()) { + return false; + } + while(it.current()) { + int count = 1; + QString title = it.current()->text(0), expression = it.current()->text(1); + int style = itemStyle[it.current()]; + int smoothing = itemSmoothing[it.current()]; + int type = itemType[it.current()]; + int axis = itemAxis[it.current()]; + bool rows = itemRows[it.current()]; + MathStructure *x_vector = itemXVector[it.current()]; + MathStructure *y_vector = itemYVector[it.current()]; + if(type == 1) { + if(y_vector->isMatrix()) { + count = 0; + if(rows) { + for(size_t i = 1; i <= y_vector->rows(); i++) { + y_vectors.push_back(m_undefined); + y_vector->rowToVector(i, y_vectors[y_vectors.size() - 1]); + x_vectors.push_back(m_undefined); + count++; + } + } else { + for(size_t i = 1; i <= y_vector->columns(); i++) { + y_vectors.push_back(m_undefined); + y_vector->columnToVector(i, y_vectors[y_vectors.size() - 1]); + x_vectors.push_back(m_undefined); + count++; + } + } + } else if(y_vector->isVector()) { + y_vectors.push_back(*y_vector); + x_vectors.push_back(m_undefined); + } else { + y_vectors.push_back(*y_vector); + y_vectors[y_vectors.size() - 1].transform(STRUCT_VECTOR); + x_vectors.push_back(m_undefined); + } + } else if(type == 2) { + if(y_vector->isMatrix()) { + count = 0; + if(rows) { + for(size_t i = 1; i <= y_vector->rows(); i += 2) { + y_vectors.push_back(m_undefined); + y_vector->rowToVector(i, y_vectors[y_vectors.size() - 1]); + x_vectors.push_back(m_undefined); + y_vector->rowToVector(i + 1, x_vectors[x_vectors.size() - 1]); + count++; + } + } else { + for(size_t i = 1; i <= y_vector->columns(); i += 2) { + y_vectors.push_back(m_undefined); + y_vector->columnToVector(i, y_vectors[y_vectors.size() - 1]); + x_vectors.push_back(m_undefined); + y_vector->columnToVector(i + 1, x_vectors[x_vectors.size() - 1]); + count++; + } + } + } else if(y_vector->isVector()) { + y_vectors.push_back(*y_vector); + x_vectors.push_back(m_undefined); + } else { + y_vectors.push_back(*y_vector); + y_vectors[y_vectors.size() - 1].transform(STRUCT_VECTOR); + x_vectors.push_back(m_undefined); + } + } else { + y_vectors.push_back(*y_vector); + x_vectors.push_back(*x_vector); + } + for(int i = 0; i < count; i++) { + PlotDataParameters *pdp = new PlotDataParameters(); + pdp->title = title.ascii(); + if(count > 1) { + pdp->title += " :"; + pdp->title += i2s(i + 1); + } + remove_blank_ends(pdp->title); + if(pdp->title.empty()) { + pdp->title = expression.ascii(); + } + switch(smoothing) { + case 0: {pdp->smoothing = PLOT_SMOOTHING_NONE; break;} + case 1: {pdp->smoothing = PLOT_SMOOTHING_UNIQUE; break;} + case 2: {pdp->smoothing = PLOT_SMOOTHING_CSPLINES; break;} + case 3: {pdp->smoothing = PLOT_SMOOTHING_BEZIER; break;} + case 4: {pdp->smoothing = PLOT_SMOOTHING_SBEZIER; break;} + } + switch(style) { + case 0: {pdp->style = PLOT_STYLE_LINES; break;} + case 1: {pdp->style = PLOT_STYLE_POINTS; break;} + case 2: {pdp->style = PLOT_STYLE_POINTS_LINES; break;} + case 3: {pdp->style = PLOT_STYLE_DOTS; break;} + case 4: {pdp->style = PLOT_STYLE_BOXES; break;} + case 5: {pdp->style = PLOT_STYLE_HISTOGRAM; break;} + case 6:{pdp->style = PLOT_STYLE_STEPS; break;} + case 7: {pdp->style = PLOT_STYLE_CANDLESTICKS; break;} + } + pdp->yaxis2 = (axis == 2); + pdps.push_back(pdp); + } + ++it; + } + switch(legendPlacementCombo->currentItem()) { + case 0: {pp.legend_placement = PLOT_LEGEND_NONE; break;} + case 1: {pp.legend_placement = PLOT_LEGEND_TOP_LEFT; break;} + case 2: {pp.legend_placement = PLOT_LEGEND_TOP_RIGHT; break;} + case 3: {pp.legend_placement = PLOT_LEGEND_BOTTOM_LEFT; break;} + case 4: {pp.legend_placement = PLOT_LEGEND_BOTTOM_RIGHT; break;} + case 5: {pp.legend_placement = PLOT_LEGEND_BELOW; break;} + case 6: {pp.legend_placement = PLOT_LEGEND_OUTSIDE; break;} + } + pp.title = titleEdit->text().ascii(); + pp.x_label = xLabelEdit->text().ascii(); + pp.y_label = yLabelEdit->text().ascii(); + pp.grid = gridButton->isChecked(); + pp.x_log = logXButton->isChecked(); + pp.y_log = logYButton->isChecked(); + pp.x_log_base = logXBox->value(); + pp.y_log_base = logYBox->value(); + pp.color = colorButton->isChecked(); + pp.show_all_borders = fullBorderButton->isChecked(); + return true; +} +void QalculatePlotDialog::savePlot() { + QString title = titleEdit->text().ascii(); + if(title.isEmpty()) { + title = "plot.png"; + } else { + title += ".png"; + } + QString filename; + while(true) { + filename = KFileDialog::getSaveFileName(title, "image/png image/svg application/postscript image/x-eps /text/x-tex image/x-xfig", this, i18n("Save Image")); + if(filename.isEmpty()) { + return; + } else { + if(QFile::exists(filename)) { + if(KMessageBox::warningContinueCancel(this, i18n("A file named \"%1\" already exists. Are you sure you want to overwrite it?" ).arg(filename), i18n("Overwrite File?"), i18n( "&Overwrite" )) != KMessageBox::Cancel) { + break; + } + } else { + break; + } + } + } + vector y_vectors; + vector x_vectors; + vector pdps; + PlotParameters pp; + if(generatePlot(pp, y_vectors, x_vectors, pdps)) { + pp.filename = filename.ascii(); + pp.filetype = PLOT_FILETYPE_AUTO; + CALCULATOR->plotVectors(&pp, y_vectors, x_vectors, pdps); + for(size_t i = 0; i < pdps.size(); i++) { + if(pdps[i]) delete pdps[i]; + } + } +} +void QalculatePlotDialog::updatePlot() { + vector y_vectors; + vector x_vectors; + vector pdps; + PlotParameters pp; + if(!generatePlot(pp, y_vectors, x_vectors, pdps)) { + CALCULATOR->closeGnuplot(); + actionButton(User1)->setEnabled(false); + return; + } + CALCULATOR->plotVectors(&pp, y_vectors, x_vectors, pdps); + actionButton(User1)->setEnabled(true); + for(size_t i = 0; i < pdps.size(); i++) { + if(pdps[i]) delete pdps[i]; + } +} +void QalculatePlotDialog::generatePlotSeries(MathStructure **x_vector, MathStructure **y_vector, int type, string str, string str_x) { + EvaluationOptions eo; + eo.approximation = APPROXIMATION_APPROXIMATE; + eo.parse_options = evalops.parse_options; + eo.parse_options.read_precision = DONT_READ_PRECISION; + if(type == 1 || type == 2) { + *y_vector = new MathStructure(CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(str, evalops.parse_options), eo)); + *x_vector = NULL; + } else { + MathStructure min(CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(minEdit->text().ascii(), evalops.parse_options), eo)); + MathStructure max(CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(maxEdit->text().ascii(), evalops.parse_options), eo)); + *x_vector = new MathStructure(); + (*x_vector)->clearVector(); + if(stepSizeButton->isChecked()) { + *y_vector = new MathStructure(CALCULATOR->expressionToPlotVector(str, min, max, CALCULATOR->calculate(CALCULATOR->unlocalizeExpression(stepSizeEdit->text().ascii(), evalops.parse_options), eo), *x_vector, str_x, evalops.parse_options)); + } else { + *y_vector = new MathStructure(CALCULATOR->expressionToPlotVector(str, min, max, samplingRateBox->value(), *x_vector, str_x, evalops.parse_options)); + } + } +} + +#include "qalculateplotdialog.moc" diff --git a/src/qalculateplotdialog.h b/src/qalculateplotdialog.h new file mode 100644 index 0000000..984dad6 --- /dev/null +++ b/src/qalculateplotdialog.h @@ -0,0 +1,101 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEPLOTDIALOG_H +#define QALCULATEPLOTDIALOG_H + +#include +#include +#include + +class KLineEdit; +class QCheckBox; +class QRadioButton; +class QSpinBox; +class QButtonGroup; +class KComboBox; +class QPushButton; +class QTabWidget; +class KListView; +class QLabel; +class QListViewItem; +class QalculateExpressionEdit; + +#include "qalculate_kde_utils.h" + +/** +@author Niklas Knutsson +*/ +class QalculatePlotDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculatePlotDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculatePlotDialog(); + + QLabel *xVariableLabel; + KLineEdit *seriesTitleEdit, *xVariableEdit, *minEdit, *maxEdit, *stepSizeEdit, *titleEdit, *xLabelEdit, *yLabelEdit; + QalculateExpressionEdit *expressionEdit; + QCheckBox *rowsButton, *gridButton, *fullBorderButton, *logXButton, *logYButton; + QRadioButton *functionButton, *vectorMatrixButton, *pairedMatrixButton, *primaryButton, *secondaryButton, *samplingRateButton, *stepSizeButton, *colorButton, *monochromeButton; + QSpinBox *samplingRateBox, *logXBox, *logYBox; + QButtonGroup *typeGroup, *rangeGroup; + KComboBox *styleCombo, *smoothingCombo, *legendPlacementCombo; + QPushButton *addButton, *modifyButton, *removeButton, *applyRangeButton, *applyAppearanceButton; + QTabWidget *tabs; + KListView *seriesView; + + bool generatePlot(PlotParameters &pp, vector &y_vectors, vector &x_vectors, vector &pdps); + void generatePlotSeries(MathStructure **x_vector, MathStructure **y_vector, int type, string str, string str_x); + + QMap itemStyle; + QMap itemSmoothing; + QMap itemType; + QMap itemAxis; + QMap itemRows; + QMap itemXVector; + QMap itemYVector; + QMap itemXVariable; + +protected slots: + + void slotHelp(); + +public slots: + + void onClosing(); + void seriesItemRenamed(QListViewItem*, const QString&, int); + void seriesSelected(); + void rangeTypeChanged(int); + void typeChanged(int); + void savePlot(); + void expressionActivated(); + void addSeries(); + void modifySeries(); + void removeSeries(); + void applyRange(); + void applyAppearance(); + void updatePlot(); + void saveMode(); + +}; + +#endif diff --git a/src/qalculateprecisiondialog.cpp b/src/qalculateprecisiondialog.cpp new file mode 100644 index 0000000..d1f6741 --- /dev/null +++ b/src/qalculateprecisiondialog.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateprecisiondialog.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +QalculatePrecisionDialog::QalculatePrecisionDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, false, i18n("Precision"), Apply | Close, Close, true) { + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + setButtonApplyText(i18n("Recalculate")); +#else + setButtonApply(KGuiItem(i18n("Recalculate"))); +#endif + setMainWidget(new QWidget(this)); + QHBoxLayout *box = new QHBoxLayout(mainWidget()); + box->setSpacing(spacingHint()); + box->addWidget(new QLabel(i18n("Precision:"), mainWidget())); + precisionBox = new QSpinBox(1, 100000, 1, mainWidget()); + precisionBox->setButtonSymbols(QSpinBox::PlusMinus); + box->addWidget(precisionBox); + + resize(QSize(300, minimumSizeHint().height()).expandedTo(minimumSizeHint())); + +} + + +QalculatePrecisionDialog::~QalculatePrecisionDialog() {} + + +#include "qalculateprecisiondialog.moc" diff --git a/src/qalculateprecisiondialog.h b/src/qalculateprecisiondialog.h new file mode 100644 index 0000000..9abc99c --- /dev/null +++ b/src/qalculateprecisiondialog.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEPRECISIONDIALOG_H +#define QALCULATEPRECISIONDIALOG_H + +#include + +class QSpinBox; + +/** +@author Niklas Knutsson +*/ +class QalculatePrecisionDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculatePrecisionDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculatePrecisionDialog(); + + QSpinBox *precisionBox; + +}; + +#endif diff --git a/src/qalculatepreferencesdialog.cpp b/src/qalculatepreferencesdialog.cpp new file mode 100644 index 0000000..a0faeff --- /dev/null +++ b/src/qalculatepreferencesdialog.cpp @@ -0,0 +1,414 @@ +/*************************************************************************** + * Copyright (C) 2005-2006 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculatepreferencesdialog.h" +#include "qalculate_kde_utils.h" + +#include +#include +#include +#include +#include +#include +#include +#if KDE_VERSION_MAJOR > 3 || KDE_VERSION_MINOR > 1 +#include +#endif +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 +#include +#else +#include +#endif +#include +#include +#include +#include +#include +#include "kqalculate.h" + +extern KQalculate *mainWin; +extern PrintOptions printops; +extern EvaluationOptions evalops; +extern bool fetch_exchange_rates_at_startup, save_mode_on_exit, save_defs_on_exit; +extern bool use_custom_result_font, use_custom_expression_font, use_custom_status_font; +extern QString custom_result_font, custom_expression_font, custom_status_font; +extern QWidget *expressionWidget, *resultWidget, *statusWidget_l; +extern bool close_to_systray; +extern bool display_expression_status; +extern QColor status_error_color; +extern QColor status_warning_color; +extern int use_icon_buttons; +extern bool rpn_keypad_only; + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 +#include + +class KFontRequester : public QWidget +{ + Q_OBJECT + + public: + + KFontRequester( QWidget *parent=0L, const char *name=0L, + bool onlyFixed=false ); + + QFont font() const { return m_selFont; } + virtual void setFont( const QFont &font, bool onlyFixed=false ); + + protected: + + void displaySampleText(); + + protected slots: + + virtual void buttonClicked(); + + protected: + + bool m_onlyFixed; + QString m_sampleText, m_title; + QLabel *m_sampleLabel; + QPushButton *m_button; + QFont m_selFont; + +}; + + +KFontRequester::KFontRequester( QWidget *parent, const char *name, + bool onlyFixed ) : QWidget( parent, name ), + m_onlyFixed( onlyFixed ) +{ + QHBoxLayout *layout = new QHBoxLayout( this, 0, KDialog::spacingHint() ); + + m_sampleLabel = new QLabel( this, "m_sampleLabel" ); + m_button = new QPushButton( i18n( "Choose..." ), this, "m_button" ); + + m_sampleLabel->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + setFocusProxy( m_button ); + + layout->addWidget( m_sampleLabel, 1 ); + layout->addWidget( m_button ); + + connect( m_button, SIGNAL( clicked() ), SLOT( buttonClicked() ) ); + + displaySampleText(); + +} + +void KFontRequester::setFont( const QFont &font, bool onlyFixed ) +{ + m_selFont = font; + m_onlyFixed = onlyFixed; + + displaySampleText(); +} +void KFontRequester::buttonClicked() +{ + int result = KFontDialog::getFont( m_selFont, m_onlyFixed, parentWidget() ); + + if ( result == KDialog::Accepted ) + { + displaySampleText(); + } +} + +void KFontRequester::displaySampleText() +{ + m_sampleLabel->setFont( m_selFont ); + + int size = m_selFont.pointSize(); + if(size == -1) + size = m_selFont.pixelSize(); + + if ( m_sampleText.isEmpty() ) + m_sampleLabel->setText( QString( "%1 %2" ).arg( m_selFont.family() ) + .arg( size ) ); + else + m_sampleLabel->setText( m_sampleText ); +} +#endif + +QalculatePreferencesDialog::QalculatePreferencesDialog(QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Preferences"), Ok | Apply | Cancel, Ok, false) { + +#if KDE_VERSION_MAJOR < 4 && KDE_VERSION_MINOR < 2 + QTabWidget *tabs = new QTabWidget(this); +#else + QTabWidget *tabs = new KTabWidget(this); +#endif + setMainWidget(tabs); + QWidget *page1 = new QWidget(this); + QWidget *page2 = new QWidget(this); + tabs->addTab(page1, i18n("General")); + tabs->addTab(page2, i18n("Fonts")); + + QVBoxLayout *vbox = new QVBoxLayout(page1, spacingHint()); + systrayButton = new QCheckBox(i18n("Close to system tray"), page1); + QToolTip::add(systrayButton, i18n("If the application will reside in the system tray when the window is closed")); + vbox->addWidget(systrayButton); + statusButton = new QCheckBox(i18n("Display expression status"), page1); + QToolTip::add(statusButton, i18n("If as-you-type expression status shall be displayed below the expression entry")); + vbox->addWidget(statusButton); + iconsButton = new QCheckBox(i18n("Use icon buttons"), page1); + QToolTip::add(iconsButton, i18n("Use icons instead of text on the top-right buttons. The third state uses the style setting for icons on buttons.")); + iconsButton->setTristate(true); + vbox->addWidget(iconsButton); + fetchExchangeRatesButton = new QCheckBox(i18n("Update exchange rates on start"), page1); + QToolTip::add(fetchExchangeRatesButton, i18n("If current exchange rates shall be downloaded from the internet at program start")); + vbox->addWidget(fetchExchangeRatesButton); + saveModeButton = new QCheckBox(i18n("Save mode on exit"), page1); + QToolTip::add(saveModeButton, i18n("If the mode of the calculator shall be restored")); + vbox->addWidget(saveModeButton); + saveDefsButton = new QCheckBox(i18n("Save definitions on exit"), page1); + QToolTip::add(saveDefsButton, i18n("If changes to functions, units and variables shall be saved automatically")); + vbox->addWidget(saveDefsButton); + rpnKeypadOnlyButton = new QCheckBox(i18n("Use only keypad keys for RPN"), page1); + QToolTip::add(rpnKeypadOnlyButton, i18n("Use only keypad keys for RPN operations (+-*/^) and use the rest of the keyboard for expression entry")); + vbox->addWidget(rpnKeypadOnlyButton); + dotAsSeparatorButton = new QCheckBox(i18n("Ignores dots in numbers"), page1); + QToolTip::add(dotAsSeparatorButton, i18n("Allow dots, '.', to be used as thousands separator instead of as an alternative to decimal sign")); + if(CALCULATOR->getDecimalPoint() == ".") dotAsSeparatorButton->hide(); + vbox->addWidget(dotAsSeparatorButton); + unicodeButton = new QCheckBox(i18n("Enable unicode signs"), page1); + QToolTip::add(unicodeButton, i18n("Disable this if you have problems with some fancy characters")); + vbox->addWidget(unicodeButton); + lowerCaseButton = new QCheckBox(i18n("Use lower case in numbers"), page1); + QToolTip::add(lowerCaseButton, i18n("If lower case letters should be used in numbers with non-decimal base")); + vbox->addWidget(lowerCaseButton); + lowerCaseEButton = new QCheckBox(i18n("Use lower case \"e\""), page1); + QToolTip::add(lowerCaseEButton, i18n("If \"e\"; shall be used instead of \"E\" in numbers")); + vbox->addWidget(lowerCaseEButton); + alternativeBasePrefixButton = new QCheckBox(i18n("Alternative base prefixes"), page1); + QToolTip::add(alternativeBasePrefixButton, i18n("If hexadecimal numbers shall be displayed with \"0x0\" and binary numbers with \"0b00\" as prefixes")); + vbox->addWidget(alternativeBasePrefixButton); + spellOutLogicalOperatorsButton = new QCheckBox(i18n("Spell out logical operators"), page1); + QToolTip::add(spellOutLogicalOperatorsButton, i18n("If logical and/or shall be displayed as \"&&\"/\"||\" or \"and\"/\"or\"")); + vbox->addWidget(spellOutLogicalOperatorsButton); + QGridLayout *grid = new QGridLayout(vbox); + multiplicationLabel = new QLabel(i18n("Multiplication sign:"), page1); + grid->addWidget(multiplicationLabel, 0, 0); + QButtonGroup *group = new QButtonGroup(); + dotButton = new QRadioButton(SIGN_MULTIDOT, page1); + group->insert(dotButton, 0); + grid->addWidget(dotButton, 0, 1); + exButton = new QRadioButton(SIGN_MULTIPLICATION, page1); + group->insert(exButton, 1); + grid->addWidget(exButton, 0, 2); + asteriskButton = new QRadioButton("*", page1); + group->insert(asteriskButton, 2); + grid->addWidget(asteriskButton, 0, 3); + divisionLabel = new QLabel(i18n("Division sign:"), page1); + grid->addWidget(divisionLabel, 1, 0); + group = new QButtonGroup(); + divisionSlashButton = new QRadioButton(" " SIGN_DIVISION_SLASH " ", page1); + group->insert(divisionSlashButton, 0); + grid->addWidget(divisionSlashButton, 1, 1); + divisionButton = new QRadioButton(SIGN_DIVISION, page1); + group->insert(divisionButton, 1); + grid->addWidget(divisionButton, 1, 2); + slashButton = new QRadioButton("/", page1); + group->insert(slashButton, 2); + grid->addWidget(slashButton, 1, 3); + vbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); + + vbox = new QVBoxLayout(page2, spacingHint()); + useCustomResultFontButton = new QCheckBox(i18n("Custom result font"), page2); + vbox->addWidget(useCustomResultFontButton); + resultFontEdit = new KFontRequester(page2); + vbox->addWidget(resultFontEdit); + useCustomExpressionFontButton = new QCheckBox(i18n("Custom expression font"), page2); + vbox->addWidget(useCustomExpressionFontButton); + expressionFontEdit = new KFontRequester(page2); + vbox->addWidget(expressionFontEdit); + useCustomStatusFontButton = new QCheckBox(i18n("Custom status font"), page2); + vbox->addWidget(useCustomStatusFontButton); + statusFontEdit = new KFontRequester(page2); + vbox->addWidget(statusFontEdit); + grid = new QGridLayout(vbox); + grid->addWidget(new QLabel(i18n("Status error color:"), page2), 0, 0); +#if KDE_VERSION_MAJOR == 3 && KDE_VERSION_MINOR < 1 + statusErrorColorButton = new KColorButton(page2); +#else + statusErrorColorButton = new KColorButton("red", "red", page2); +#endif + grid->addWidget(statusErrorColorButton, 0, 1); + grid->addWidget(new QLabel(i18n("Status warning color:"), page2), 1, 0); +#if KDE_VERSION_MAJOR == 3 && KDE_VERSION_MINOR < 1 + statusWarningColorButton = new KColorButton(page2); +#else + statusWarningColorButton = new KColorButton("blue", "blue", page2); +#endif + grid->addWidget(statusWarningColorButton, 1, 1); + vbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); + + + connect(useCustomResultFontButton, SIGNAL(toggled(bool)), resultFontEdit, SLOT(setEnabled(bool))); + connect(useCustomExpressionFontButton, SIGNAL(toggled(bool)), expressionFontEdit, SLOT(setEnabled(bool))); + connect(useCustomStatusFontButton, SIGNAL(toggled(bool)), statusFontEdit, SLOT(setEnabled(bool))); + connect(unicodeButton, SIGNAL(toggled(bool)), multiplicationLabel, SLOT(setEnabled(bool))); + connect(unicodeButton, SIGNAL(toggled(bool)), dotButton, SLOT(setEnabled(bool))); + connect(unicodeButton, SIGNAL(toggled(bool)), exButton, SLOT(setEnabled(bool))); + connect(unicodeButton, SIGNAL(toggled(bool)), asteriskButton, SLOT(setEnabled(bool))); + connect(unicodeButton, SIGNAL(toggled(bool)), divisionLabel, SLOT(setEnabled(bool))); + connect(unicodeButton, SIGNAL(toggled(bool)), divisionSlashButton, SLOT(setEnabled(bool))); + connect(unicodeButton, SIGNAL(toggled(bool)), divisionButton, SLOT(setEnabled(bool))); + connect(unicodeButton, SIGNAL(toggled(bool)), slashButton, SLOT(setEnabled(bool))); + +} + +QalculatePreferencesDialog::~QalculatePreferencesDialog() {} + +void QalculatePreferencesDialog::slotApply() { + rpn_keypad_only = rpnKeypadOnlyButton->isChecked(); + evalops.parse_options.dot_as_separator = dotAsSeparatorButton->isChecked(); + close_to_systray = systrayButton->isChecked(); + display_expression_status = statusButton->isChecked(); + switch(iconsButton->state()) { + case QButton::Off: { + use_icon_buttons = 0; + break; + } + case QButton::On: { + use_icon_buttons = 1; + break; + } + case QButton::NoChange: { + use_icon_buttons = -1; + break; + } + } + fetch_exchange_rates_at_startup = fetchExchangeRatesButton->isChecked(); + save_mode_on_exit = saveModeButton->isChecked(); + printops.use_unicode_signs = unicodeButton->isChecked(); + printops.lower_case_numbers = lowerCaseButton->isChecked(); + printops.lower_case_e = lowerCaseEButton->isChecked(); + if(alternativeBasePrefixButton->isChecked()) printops.base_display = BASE_DISPLAY_ALTERNATIVE; + else printops.base_display = BASE_DISPLAY_NORMAL; + printops.spell_out_logical_operators = spellOutLogicalOperatorsButton->isChecked(); + save_defs_on_exit = saveDefsButton->isChecked(); + use_custom_result_font = useCustomResultFontButton->isChecked(); + use_custom_expression_font = useCustomExpressionFontButton->isChecked(); + use_custom_status_font = useCustomStatusFontButton->isChecked(); + custom_result_font = resultFontEdit->font().toString(); + custom_expression_font = expressionFontEdit->font().toString(); + custom_status_font = statusFontEdit->font().toString(); + status_error_color = statusErrorColorButton->color(); + if(!status_error_color.isValid()) status_error_color.setNamedColor("red"); + status_warning_color = statusWarningColorButton->color(); + if(!status_warning_color.isValid()) status_warning_color.setNamedColor("blue"); + if(dotButton->isChecked()) { + printops.multiplication_sign = MULTIPLICATION_SIGN_DOT; + } else if(exButton->isChecked()) { + printops.multiplication_sign = MULTIPLICATION_SIGN_X; + } else { + printops.multiplication_sign = MULTIPLICATION_SIGN_ASTERISK; + } + if(divisionSlashButton->isChecked()) { + printops.division_sign = DIVISION_SIGN_DIVISION_SLASH; + } else if(divisionButton->isChecked()) { + printops.division_sign = DIVISION_SIGN_DIVISION; + } else { + printops.division_sign = DIVISION_SIGN_SLASH; + } + mainWin->applyPreferences(); +} +bool QalculatePreferencesDialog::editPreferences() { + + rpnKeypadOnlyButton->setChecked(rpn_keypad_only); + dotAsSeparatorButton->setChecked(evalops.parse_options.dot_as_separator); + systrayButton->setChecked(close_to_systray); + statusButton->setChecked(display_expression_status); + if(use_icon_buttons < 0) { + iconsButton->setNoChange(); + } else { + iconsButton->setChecked(use_icon_buttons > 0); + } + fetchExchangeRatesButton->setChecked(fetch_exchange_rates_at_startup); + saveModeButton->setChecked(save_mode_on_exit); + unicodeButton->setChecked(printops.use_unicode_signs); + lowerCaseButton->setChecked(printops.lower_case_numbers); + lowerCaseEButton->setChecked(printops.lower_case_e); + alternativeBasePrefixButton->setChecked(printops.base_display == BASE_DISPLAY_ALTERNATIVE); + spellOutLogicalOperatorsButton->setChecked(printops.spell_out_logical_operators); + saveDefsButton->setChecked(save_defs_on_exit); + useCustomResultFontButton->setChecked(use_custom_result_font); + useCustomExpressionFontButton->setChecked(use_custom_expression_font); + useCustomStatusFontButton->setChecked(use_custom_status_font); + QFont font1(resultWidget->font()); + font1.fromString(custom_result_font); + resultFontEdit->setFont(font1); + resultFontEdit->setEnabled(use_custom_result_font); + QFont font2(expressionWidget->font()); + font2.fromString(custom_expression_font); + expressionFontEdit->setFont(font2); + expressionFontEdit->setEnabled(use_custom_expression_font); + QFont font3(statusWidget_l->font()); + font3.fromString(custom_status_font); + statusFontEdit->setFont(font3); + statusFontEdit->setEnabled(use_custom_status_font); + statusErrorColorButton->setColor(status_error_color); + statusWarningColorButton->setColor(status_warning_color); + if(can_display_unicode_string_function(SIGN_MULTIDOT, (void*) dotButton)) dotButton->setText(SIGN_MULTIDOT); + else dotButton->setText(SIGN_SMALLCIRCLE); + switch(printops.multiplication_sign) { + case MULTIPLICATION_SIGN_DOT: { + dotButton->setChecked(true); + break; + } + case MULTIPLICATION_SIGN_X: { + exButton->setChecked(true); + break; + } + default: { + asteriskButton->setChecked(true); + break; + } + } + asteriskButton->setEnabled(printops.use_unicode_signs); + exButton->setEnabled(printops.use_unicode_signs); + dotButton->setEnabled(printops.use_unicode_signs); + multiplicationLabel->setEnabled(printops.use_unicode_signs); + switch(printops.division_sign) { + case DIVISION_SIGN_DIVISION_SLASH: { + divisionSlashButton->setChecked(true); + break; + } + case DIVISION_SIGN_DIVISION: { + divisionButton->setChecked(true); + break; + } + default: { + slashButton->setChecked(true); + break; + } + } + slashButton->setEnabled(printops.use_unicode_signs); + divisionSlashButton->setEnabled(printops.use_unicode_signs); + divisionButton->setEnabled(printops.use_unicode_signs); + divisionLabel->setEnabled(printops.use_unicode_signs); + + if(exec() == Accepted) { + slotApply(); + return true; + } + return false; + +} + + +#include "qalculatepreferencesdialog.moc" diff --git a/src/qalculatepreferencesdialog.h b/src/qalculatepreferencesdialog.h new file mode 100644 index 0000000..feb42d3 --- /dev/null +++ b/src/qalculatepreferencesdialog.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (C) 2005-2006 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEPREFERENCESDIALOG_H +#define QALCULATEPREFERENCESDIALOG_H + +#include + +class QCheckBox; +class QRadioButton; +class QLabel; +class KFontRequester; +class KColorButton; + +/** +@author Niklas Knutsson +*/ +class QalculatePreferencesDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculatePreferencesDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculatePreferencesDialog(); + + bool editPreferences(); + + QCheckBox *rpnKeypadOnlyButton, *systrayButton, *statusButton, *iconsButton, *fetchExchangeRatesButton, *saveModeButton, *saveDefsButton, *dotAsSeparatorButton, *unicodeButton, *lowerCaseButton, *lowerCaseEButton, *alternativeBasePrefixButton, *spellOutLogicalOperatorsButton, *useCustomResultFontButton, *useCustomExpressionFontButton, *useCustomStatusFontButton; + QRadioButton *dotButton, *exButton, *asteriskButton, *divisionSlashButton, *divisionButton, *slashButton; + QLabel *multiplicationLabel, *divisionLabel; + KFontRequester *resultFontEdit, *expressionFontEdit, *statusFontEdit; + KColorButton *statusErrorColorButton, *statusWarningColorButton; + +protected slots: + + void slotApply(); + +}; + +#endif diff --git a/src/qalculateresultdisplay.cpp b/src/qalculateresultdisplay.cpp new file mode 100644 index 0000000..91f5667 --- /dev/null +++ b/src/qalculateresultdisplay.cpp @@ -0,0 +1,495 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateresultdisplay.h" + +#include "qalculate_kde_utils.h" +#include "kqalculate.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern vector modes; + +extern QString parsed_text; +extern KQalculate *mainWin; +extern MathStructure *mstruct; +extern PrintOptions printops; +extern EvaluationOptions evalops; + +QString linkInfo(const MathStructure *m, QWidget *w, bool full_length = false) { + QString str; + if(m) { + if(m->isSymbolic()) { + str = "\""; + str += m->symbol().c_str(); + str += "\""; + } else if(m->isVector()) { + if(m->isMatrix()) { + str = i18n("a matrix"); + } else { + str = i18n("a vector"); + } + str += "\n"; + str += i18n("double-click to view/edit"); + } else if(m->isVariable()) { + if(m->variable()->subtype() == SUBTYPE_UNKNOWN_VARIABLE) { + str = i18n("Unknown variable"); + } else { + str = i18n("Variable"); + } + str += ": "; + str += m->variable()->title(true).c_str(); + } else if(m->isUnit()) { + str = i18n("Unit"); + str += ": "; + str += m->unit()->title(true).c_str(); + if(m->prefix() && m->prefix() != CALCULATOR->decimal_null_prefix && m->prefix() != CALCULATOR->binary_null_prefix) { + str += "\n"; + str += i18n("Prefix"); + str += ": "; + QString pstr; + switch(m->prefix()->type()) { + case PREFIX_DECIMAL: { + QTextOStream(&pstr) << m->prefix()->name(false, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) w).c_str() << " (10e" << ((DecimalPrefix*) m->prefix())->exponent() << ")"; + break; + } + case PREFIX_BINARY: { + QTextOStream(&pstr) << m->prefix()->name(false, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) w).c_str() << " (2e" << ((BinaryPrefix*) m->prefix())->exponent() << ")"; + break; + } + case PREFIX_NUMBER: { + QTextOStream(&pstr) << m->prefix()->name(false, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) w).c_str(); + break; + } + } + str += pstr; + } + } else if(m->isFunction()) { + str = i18n("Function"); + str += ": "; + str += m->function()->title(true).c_str(); + Argument default_arg; + MathFunction *f = m->function(); + str += "
"; + const ExpressionName *ename = &f->preferredName(false, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) w); + str += ""; + str += ename->name.c_str(); + str += ""; + int iargs = f->maxargs(); + if(iargs < 0) { + iargs = f->minargs() + 1; + } + str += "("; + if(iargs != 0) { + for(int i2 = 1; i2 <= iargs; i2++) { + if(i2 > f->minargs()) { + str += "["; + } + if(i2 > 1) { + str += CALCULATOR->getComma().c_str(); + str += " "; + } + Argument *arg = f->getArgumentDefinition(i2); + if(arg && !arg->name().empty()) { + str += arg->name().c_str(); + } else { + str += i18n("argument"); + str += " "; + str += QString::number(i2); + } + if(i2 > f->minargs()) { + str += "]"; + } + } + if(f->maxargs() < 0) { + str += CALCULATOR->getComma().c_str(); + str += " ..."; + } + } + str += ")"; + str += ""; + if(full_length) { + str += ""; + for(size_t i2 = 1; i2 <= f->countNames(); i2++) { + if(&f->getName(i2) != ename) { + str += "
"; + str += f->getName(i2).name.c_str(); + } + } + str += "
"; + if(f->subtype() == SUBTYPE_DATA_SET) { + str += "
"; + str += "
"; + QString str2; + str2.sprintf(i18n("Retrieves data from the %s data set for a given object and property. If \"info\" is typed as property, a dialog window will pop up with all properties of the object."), f->title().c_str()); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + } + if(!f->description().empty()) { + str += "
"; + str += "
"; + QString str2 = f->description().c_str(); + str2.replace("<", "<"); + str2.replace(">", ">"); + str += str2; + } + } + } + } + return str; +} + + +QString linkInfo(const QString &link, QWidget *w, bool full_length = false) { + if(!link.isEmpty() && link[0] == '+') { + QString str = link; + str.remove(0, 1); + return str; + } else { + return linkInfo(mainWin->getResultPart(link.toInt()), w, full_length); + } +} + +class QalculateExpressionToolTip : public QToolTip { + +public: + + QalculateResultDisplay *qrd; + + QalculateExpressionToolTip(QalculateResultDisplay *parent, QToolTipGroup *group = 0) : QToolTip(parent->viewport(), group) { + qrd = parent; + } + virtual ~QalculateExpressionToolTip() {} + +protected: + + void maybeTip(const QPoint &p) { + int cx = qrd->contentsX(); + int cy = qrd->contentsY(); + QString str = qrd->anchorAt(qrd->viewportToContents(p), Qt::AnchorName); + if(str.isEmpty()) return; + int w = 5; + while(p.x() + w < qrd->visibleWidth() && qrd->anchorAt(QPoint(p.x() + cx + w, p.y() + cy), Qt::AnchorName) == str) { + w += 5; + } + int x = p.x() - 5; + w += 5; + while(x > 0 && qrd->anchorAt(QPoint(x + cx, p.y() + cy), Qt::AnchorName) == str) { + x -= 5; + w += 5; + } + if(x < 0) x = 0; + if(w + x > qrd->visibleWidth()) w = qrd->visibleWidth() - x; + int h = 5; + while(p.y() + h < qrd->visibleHeight() && qrd->anchorAt(QPoint(p.x() + cx, p.y() + cy + h), Qt::AnchorName) == str) { + h += 5; + } + int y = p.y() - 5; + h += 5; + while(y > 0 && qrd->anchorAt(QPoint(p.x() + cx, y + cy), Qt::AnchorName) == str) { + y -= 5; + h += 5; + } + if(y < 0) y = 0; + if(h + y > qrd->visibleHeight()) h = qrd->visibleHeight() - y; + tip(QRect(x, y, w, h), linkInfo(str, qrd, true)); + } + +}; + +QalculateResultDisplay::QalculateResultDisplay(QWidget *parent, const char *name): QTextBrowser(parent, name) { + + setResizePolicy(AutoOneFit); + setVScrollBarMode(Auto); + setHScrollBarMode(Auto); + setTextFormat(Qt::RichText); + setFrameStyle(QFrame::NoFrame); + //setFocusPolicy(QWidget::TabFocus); + paletteChanged(); + m_under_pointer = NULL; + + QToolTipGroup *tgroup = new QToolTipGroup(viewport()); + tooltip = new QalculateExpressionToolTip(this, tgroup); + + //connect(this, SIGNAL(anchorClicked(const QString&, const QString&)), this, SLOT(onAnchorClicked(const QString&, const QString&))); + connect(this, SIGNAL(doubleClicked(int, int)), this, SLOT(onDoubleClicked(int, int))); + if(kapp) { + connect(kapp, SIGNAL(kdisplayPaletteChanged()), this, SLOT(paletteChanged())); + } + +} + +QalculateResultDisplay::~QalculateResultDisplay() {} + +void QalculateResultDisplay::setRightMargin(int i_margin) { + setMargins(0, 0, i_margin, 0); +} + +void QalculateResultDisplay::onAnchorClicked(const QString&, const QString&) { + /*if(name.isEmpty()) return; + QWhatsThis::display(linkInfo(name, this, true));*/ +} + +QPopupMenu *QalculateResultDisplay::createPopupMenu(const QPoint &pos) { + + m_under_pointer = NULL; + + QPopupMenu *menu = QTextBrowser::createPopupMenu(pos); + menu->insertSeparator(); + mainWin->ActionStoreResult->plug(menu); + mainWin->ActionSaveAsImage->plug(menu); + menu->insertSeparator(); + if(mstruct && mstruct->containsType(STRUCT_ADDITION)) { + if(evalops.structuring != STRUCTURING_FACTORIZE) { + mainWin->ActionFactorize->plug(menu); + } + if(evalops.structuring != STRUCTURING_SIMPLIFY) { + mainWin->ActionSimplify->plug(menu); + } + } else if(mstruct && mstruct->isNumber() && mstruct->number().isInteger() && !mstruct->number().isZero()) { + mainWin->ActionFactorize->plug(menu); + menu->insertSeparator(); + } + if(mstruct && mstruct->containsUnknowns()) { + mainWin->ActionSetUnknowns->plug(menu); + } + if(mstruct && (mstruct->containsType(STRUCT_ADDITION) || mstruct->containsUnknowns())) { + menu->insertSeparator(); + } + if(mstruct && mstruct->containsDivision()) { + mainWin->ActionNonZeroDenominators->plug(menu); + menu->insertSeparator(); + } + int id = menu->insertItem(i18n("Normal")); + if(printops.min_exp == EXP_PRECISION) menu->setItemChecked(id, true); + else menu->connectItem(id, this, SLOT(displayNormal())); + id = menu->insertItem(i18n("Engineering")); + if(printops.min_exp == EXP_BASE_3) menu->setItemChecked(id, true); + else menu->connectItem(id, this, SLOT(displayEngineering())); + id = menu->insertItem(i18n("Scientific")); + if(printops.min_exp == EXP_SCIENTIFIC) menu->setItemChecked(id, true); + else menu->connectItem(id, this, SLOT(displayScientific())); + /*mainWin->ActionNumericalDisplayNormal->plug(menu); + mainWin->ActionNumericalDisplayEngineering->plug(menu); + mainWin->ActionNumericalDisplayScientific->plug(menu);*/ + if(!mstruct || !mstruct->containsType(STRUCT_UNIT)) { + menu->insertSeparator(); + mainWin->ActionNumberBaseBinary->plug(menu); + mainWin->ActionNumberBaseOctal->plug(menu); + mainWin->ActionNumberBaseDecimal->plug(menu); + mainWin->ActionNumberBaseHexadecimal->plug(menu); + menu->insertSeparator(); + mainWin->ActionFractionalDisplayDecimal->plug(menu); + mainWin->ActionFractionalDisplayDecimalTryExact->plug(menu); + mainWin->ActionFractionalDisplayFraction->plug(menu); + mainWin->ActionFractionalDisplayCombined->plug(menu); + } + menu->insertSeparator(); + mainWin->ActionAbbreviateNames->plug(menu); + if(mstruct && mstruct->containsType(STRUCT_UNIT)) { + menu->insertSeparator(); + mainWin->ActionConvertToUnitExpression->plug(menu); + mainWin->ActionConvertToBaseUnits->plug(menu); + mainWin->ActionConvertToBestUnit->plug(menu); + menu->insertSeparator(); + mainWin->ActionEnablePrefixes->plug(menu); + mainWin->ActionEnableUseOfAllPrefixes->plug(menu); + mainWin->ActionEnableDenominatorPrefixes->plug(menu); + } + menu->insertSeparator(); + QPopupMenu *modes_menu = new QPopupMenu(menu); + QObject::connect(modes_menu, SIGNAL(activated(int)), mainWin, SLOT(loadMode(int))); + for(size_t i = 0; i < modes.size(); i++) { + modes_menu->insertItem(modes[i].name, i, i); + } + modes_menu->insertSeparator(); + mainWin->ActionSaveModeAs->plug(modes_menu); + mainWin->ActionDeleteMode->plug(modes_menu); + menu->insertItem(i18n("Meta Modes"), modes_menu); + if(parsed_text.isEmpty()) return menu; + menu->insertSeparator(); + menu->insertItem(i18n("Show Parsed Expression"), this, SLOT(showParsedExpression())); + QString str = anchorAt(pos, Qt::AnchorName); + if(!str.isEmpty()) { + if(str[0] == '+') { + name_under_pointer = str; + name_under_pointer.remove(0, 1); + menu->insertItem(i18n("Show Object Info"), this, SLOT(showInfo())); + } else { + m_under_pointer = mainWin->getResultPart(str.toInt()); + if(m_under_pointer) { + if(m_under_pointer->isVector()) { + if(m_under_pointer->isMatrix()) { + menu->insertItem(i18n("View/Edit Matrix"), this, SLOT(editMatrix())); + } else { + menu->insertItem(i18n("View/Edit Vector"), this, SLOT(editVector())); + } + } else { + menu->insertItem(i18n("Show Object Info"), this, SLOT(showInfo())); + } + } + } + } + curpos = viewport()->mapToGlobal(pos); + return menu; + +} + +void QalculateResultDisplay::displayNormal() { + printops.negative_exponents = false; + printops.sort_options.minus_last = true; + mainWin->ActionNumericalDisplayNormal->activate(); + mainWin->ActionNegativeExponents->setChecked(false); + mainWin->ActionSortMinusLast->setChecked(true); +} +void QalculateResultDisplay::displayEngineering() { + mainWin->ActionNumericalDisplayEngineering->activate(); +} +void QalculateResultDisplay::displayScientific() { + printops.negative_exponents = true; + printops.sort_options.minus_last = false; + mainWin->ActionNumericalDisplayScientific->activate(); + mainWin->ActionNegativeExponents->setChecked(true); + mainWin->ActionSortMinusLast->setChecked(false); +} + +void QalculateResultDisplay::showParsedExpression() { + QString str = i18n("Parsed expression:"); + str += "\n"; + str += parsed_text; + QWhatsThis::display(str, curpos); +} +void QalculateResultDisplay::showInfo() { + if(m_under_pointer) { + QWhatsThis::display(linkInfo(m_under_pointer, this, true), curpos); + } else { + QWhatsThis::display(linkInfo(name_under_pointer, this, true), curpos); + } +} +void QalculateResultDisplay::editVector() { + mainWin->insertMatrixVector(m_under_pointer, true, false, true); +} +void QalculateResultDisplay::editMatrix() { + mainWin->insertMatrixVector(m_under_pointer, false, false, true); +} + +void QalculateResultDisplay::paletteChanged() { + QPalette p = kapp ? kapp->palette() : palette(); + p.setBrush(QColorGroup::Base, p.brush(QPalette::Normal, QColorGroup::Background)); + p.setColor(QColorGroup::Text, p.color(QPalette::Normal, QColorGroup::Foreground)); + setPalette(p); +} + +void QalculateResultDisplay::virtual_hook(int, void*) { +} + +void QalculateResultDisplay::focusInEvent(QFocusEvent* fe) { + QTextBrowser::focusInEvent(fe); + if(fe->reason() == QFocusEvent::Tab || fe->reason() == QFocusEvent::Backtab) + selectAll(true); +} + +void QalculateResultDisplay::focusOutEvent(QFocusEvent* fe) { + QTextBrowser::focusOutEvent(fe); + if(fe->reason() == QFocusEvent::Tab || fe->reason() == QFocusEvent::Backtab) + selectAll(false); +} + +void QalculateResultDisplay::onDoubleClicked(int, int) { + curpos = QCursor::pos(); + QString str = anchorAt(viewportToContents(viewport()->mapFromGlobal(curpos)), Qt::AnchorName); + if(!str.isEmpty()) { + if(str[0] == '+') { + selectAll(false); + name_under_pointer = str; + name_under_pointer.remove(0, 1); + showInfo(); + } else { + m_under_pointer = mainWin->getResultPart(str.toInt()); + if(m_under_pointer) { + selectAll(false); + if(m_under_pointer->isVector()) { + if(m_under_pointer->isMatrix()) { + editMatrix(); + } else { + editVector(); + } + } else { + showInfo(); + } + } + } + } +} + +void QalculateResultDisplay::keyPressEvent(QKeyEvent *e) { + + switch (e->key()) { + case Key_Down: + case Key_Up: + case Key_Left: + case Key_Right: + // jump over QTextEdit's key navigation breakage. + // we're not interested in keyboard navigation within the text + QWidget::keyPressEvent(e); + break; + default: + QTextBrowser::keyPressEvent(e); + } + +} + +QSize QalculateResultDisplay::minimumSizeHint() const { + + QSize ms = minimumSize(); + if((ms.width() > 0) && (ms.height() > 0)) + return ms; + + int w = 100; + if(ms.width() > 0) + w = ms.width(); + + QSimpleRichText rt("X", font()); + rt.setWidth(100); + QSimpleRichText rt2("X", font()); + rt2.setWidth(100); + int h2 = (int) (rt2.height() / 1.5); + h2 += h2 % 2; + int h = rt.height() * 2 + h2 + 2 * frameWidth(); + if(h < ms.height()) + h = ms.height(); + + return QSize(w, h); +} + +QSize QalculateResultDisplay::sizeHint() const { + return minimumSizeHint(); +} + + +#include "qalculateresultdisplay.moc" diff --git a/src/qalculateresultdisplay.h b/src/qalculateresultdisplay.h new file mode 100644 index 0000000..c5c2af1 --- /dev/null +++ b/src/qalculateresultdisplay.h @@ -0,0 +1,79 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATERESULTDISPLAY_H +#define QALCULATERESULTDISPLAY_H + +#include + +class QPopupMenu; +class QToolTip; +class MathStructure; + +/** +@author Niklas Knutsson +*/ +class QalculateResultDisplay : public QTextBrowser { + + Q_OBJECT + +public: + + QalculateResultDisplay(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateResultDisplay(); + + QPopupMenu *createPopupMenu(const QPoint & pos); + + QToolTip *tooltip; + const MathStructure *m_under_pointer; + QString name_under_pointer; + QPoint curpos; + + QSize minimumSizeHint() const; + QSize sizeHint() const; + + void setRightMargin(int); + +public slots: + + void onAnchorClicked(const QString&, const QString&); + void showParsedExpression(); + +private slots: + + void paletteChanged(); + void setSource(const QString &) {} + void showInfo(); + void editVector(); + void editMatrix(); + void onDoubleClicked(int, int); + void displayEngineering(); + void displayScientific(); + void displayNormal(); + +protected: + + void virtual_hook(int id, void* data); + void focusInEvent(QFocusEvent *fe); + void focusOutEvent(QFocusEvent *fe); + void keyPressEvent(QKeyEvent *e); + +}; + +#endif diff --git a/src/qalculatesetbasedialog.cpp b/src/qalculatesetbasedialog.cpp new file mode 100644 index 0000000..b95b205 --- /dev/null +++ b/src/qalculatesetbasedialog.cpp @@ -0,0 +1,63 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculatesetbasedialog.h" + +#include +#include +#include +#include +#include + +QalculateSetBaseDialog::QalculateSetBaseDialog(QWidget *parent, const char *name) + : KDialogBase(parent, name, false, i18n("Number Bases"), Close, Close) { + + QHBox *box = makeHBoxMainWidget(); + + radiogroup_output = new QVButtonGroup(i18n("Result Base"), box); + radiogroup_output->setRadioButtonExclusive(true); + new QRadioButton(i18n("Binary"), radiogroup_output); + new QRadioButton(i18n("Octal"), radiogroup_output); + new QRadioButton(i18n("Decimal"), radiogroup_output); + new QRadioButton(i18n("Hexadecimal"), radiogroup_output); + new QRadioButton(i18n("Other:"), radiogroup_output); + outputBaseBox = new QSpinBox(2, 36, 1, radiogroup_output); + outputBaseBox->setValue(10); + new QRadioButton(i18n("Sexagesimal"), radiogroup_output); + new QRadioButton(i18n("Time format"), radiogroup_output); + new QRadioButton(i18n("Roman numerals"), radiogroup_output); + + radiogroup_input = new QVButtonGroup(i18n("Expression Base"), box); + radiogroup_input->setRadioButtonExclusive(true); + new QRadioButton(i18n("Binary"), radiogroup_input); + new QRadioButton(i18n("Octal"), radiogroup_input); + new QRadioButton(i18n("Decimal"), radiogroup_input); + new QRadioButton(i18n("Hexadecimal"), radiogroup_input); + new QRadioButton(i18n("Other:"), radiogroup_input); + inputBaseBox = new QSpinBox(2, 36, 1, radiogroup_input); + inputBaseBox->setValue(10); + new QRadioButton(i18n("Roman numerals"), radiogroup_input); + +} + + +QalculateSetBaseDialog::~QalculateSetBaseDialog() {} + + +#include "qalculatesetbasedialog.moc" diff --git a/src/qalculatesetbasedialog.h b/src/qalculatesetbasedialog.h new file mode 100644 index 0000000..21955ba --- /dev/null +++ b/src/qalculatesetbasedialog.h @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATESETBASEDIALOG_H +#define QALCULATESETBASEDIALOG_H + +#include + +class QVButtonGroup; +class QSpinBox; + +/** +@author Niklas Knutsson +*/ +class QalculateSetBaseDialog : public KDialogBase { + + Q_OBJECT + +public: + + QalculateSetBaseDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateSetBaseDialog(); + + QVButtonGroup *radiogroup_input, *radiogroup_output; + QSpinBox *inputBaseBox, *outputBaseBox; + +}; + +#endif diff --git a/src/qalculateunitsdialog.cpp b/src/qalculateunitsdialog.cpp new file mode 100644 index 0000000..1918130 --- /dev/null +++ b/src/qalculateunitsdialog.cpp @@ -0,0 +1,560 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculateunitsdialog.h" +#include "qalculate_kde_utils.h" +#include "qalculateeditunitdialog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern tree_struct unit_cats; +extern vector ia_units; +extern PrintOptions printops; +extern EvaluationOptions evalops; + +QalculateUnitsDialog::QalculateUnitsDialog(QWidget *parent, const char *name) : KDialog(parent, name, false) { + + unit_edit_dialog = NULL; + selected_category = ""; + selected_unit = NULL; + selected_to_unit = NULL; + block_unit_convert = true; + + QHBoxLayout *layout = new QHBoxLayout(this, marginHint(), spacingHint()); + + setCaption(i18n("Units")); + + QVBoxLayout *leftLayout = new QVBoxLayout(layout, spacingHint()); + + QSplitter *splitter = new QSplitter(Qt::Horizontal, this); + splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + leftLayout->addWidget(splitter); + + categoryView = new KListView(splitter); + categoryView->addColumn(i18n("Category")); + categoryView->setRootIsDecorated(false); + + unitView = new KListView(splitter); + unitView->addColumn(i18n("Unit")); + unitView->addColumn(i18n("Names")); + unitView->addColumn(i18n("Base")); + unitView->setRootIsDecorated(false); + + convertGroup = new QGroupBox(3, Qt::Horizontal, i18n("Conversion"), this); + convertGroup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); + convertGroup->setInsideSpacing(spacingHint()); + convertGroup->setInsideMargin(spacingHint()); + convertButton = new KPushButton(QIconSet(SmallIcon("reload")), "", convertGroup); + fromEdit = new KLineEdit("1", convertGroup); + fromEdit->setAlignment(Qt::AlignRight); + fromEdit->setMinimumWidth(100); + fromLabel = new QLabel(convertGroup); + equalsLabel = new QLabel("=", convertGroup); + equalsLabel->setAlignment(Qt::AlignRight); + toEdit = new KLineEdit("1", convertGroup); + toEdit->setAlignment(Qt::AlignRight); + toEdit->setMinimumWidth(100); + toCombo = new KComboBox(convertGroup); + leftLayout->addWidget(convertGroup); + + QVBoxLayout *buttonLayout = new QVBoxLayout(layout, spacingHint()); + + newButton = new QPushButton(i18n("New"), this); + buttonLayout->addWidget(newButton); + editButton = new QPushButton(i18n("Edit"), this); + editButton->setEnabled(false); + buttonLayout->addWidget(editButton); + deleteButton = new QPushButton(i18n("Delete"), this); + deleteButton->setEnabled(false); + buttonLayout->addWidget(deleteButton); + deactivateButton = new QPushButton(i18n("Deactivate"), this); + deactivateButton->setEnabled(false); + buttonLayout->addWidget(deactivateButton); + insertButton = new QPushButton(i18n("Insert"), this); + insertButton->setEnabled(false); + buttonLayout->addWidget(insertButton); + convertResultButton = new QPushButton(i18n("Convert Result"), this); + convertResultButton->setEnabled(false); + buttonLayout->addWidget(convertResultButton); + buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); + helpButton = new KPushButton(KStdGuiItem::help(), this); + buttonLayout->addWidget(helpButton); + buttonClose = new KPushButton(KStdGuiItem::close(), this); + buttonLayout->addWidget(buttonClose); + + fromEdit->setFocus(); + + resize(QSize(675, 425).expandedTo(size())); + + connect(buttonClose, SIGNAL(clicked()), this, SLOT(close())); + connect(newButton, SIGNAL(clicked()), this, SLOT(newUnit())); + connect(editButton, SIGNAL(clicked()), this, SLOT(editUnit())); + connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteUnit())); + connect(deactivateButton, SIGNAL(clicked()), this, SLOT(deactivateUnit())); + connect(insertButton, SIGNAL(clicked()), this, SLOT(insertUnit())); + connect(convertResultButton, SIGNAL(clicked()), this, SLOT(convertResult())); + connect(unitView, SIGNAL(selectionChanged()), this, SLOT(unitSelected())); + connect(unitView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(unitDoubleClicked(QListViewItem*))); + connect(categoryView, SIGNAL(selectionChanged()), this, SLOT(categorySelected())); + connect(toCombo, SIGNAL(activated(int)), this, SLOT(toUnitSelected(int))); + connect(convertButton, SIGNAL(clicked()), this, SLOT(convertClicked())); + connect(fromEdit, SIGNAL(returnPressed()), this, SLOT(convert())); + connect(toEdit, SIGNAL(returnPressed()), this, SLOT(convertReversed())); + connect(fromEdit, SIGNAL(lostFocus()), this, SLOT(convert())); + connect(toEdit, SIGNAL(lostFocus()), this, SLOT(convertReversed())); + connect(helpButton, SIGNAL(clicked()), this, SLOT(slotHelp())); + +} + +QalculateUnitsDialog::~QalculateUnitsDialog() { +} + +void QalculateUnitsDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-managers"); +} + +void QalculateUnitsDialog::updateUnitTree() { + unitItems.clear(); + comboItems.clear(); + categoryItems.clear(); + categoryView->clear(); + QListViewItem *i = new KListViewItem(categoryView, i18n("All")), *i2; + categoryItems[i] = i18n("All"); + i->setOpen(true); + QString str; + tree_struct *item, *item2; + unit_cats.it = unit_cats.items.begin(); + if(unit_cats.it != unit_cats.items.end()) { + item = &*unit_cats.it; + ++unit_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + str = ""; + i2 = i; + while(item) { + str += "/"; + str += item->item.c_str(); + i = new KListViewItem(i2, item->item.c_str()); + i->setOpen(false); + categoryItems[i] = str; + if(str == selected_category) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + while(item && item->it == item->items.end()) { + int str_i = str.findRev("/"); + if(str_i < 0) { + str = ""; + } else { + str.truncate(str_i); + } + item = item->parent; + i = i->parent(); + i2 = i; + } + if(item) { + item2 = &*item->it; + if(item->it == item->items.begin()) + i2 = i; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + if(!unit_cats.objects.empty()) { + //add "Uncategorized" category if there are units without category + i = new KListViewItem(categoryView, i18n("Uncategorized")); + categoryItems[i] = i18n("Uncategorized"); + if(selected_category == i18n("Uncategorized")) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + } + if(!ia_units.empty()) { + //add "Inactive" category if there are inactive units + i = new KListViewItem(categoryView, i18n("Inactive")); + categoryItems[i] = i18n("Inactive"); + if(selected_category == i18n("Inactive")) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + } + if(!categoryView->selectedItem()) { + //if no category has been selected (previously selected has been renamed/deleted), select "All" + selected_category = i18n("All"); + QListViewItemIterator it(categoryView); + if(it.current()) + categoryView->setSelected(it.current(), true); + } +} + +#define UPDATE_SELECTED_UNIT QListViewItem *i = unitView->selectedItem(); if(!i) return; selected_unit = unitItems[i]; if(!selected_unit) return; +#define CHECK_IF_UNIT_STILL_THERE if(!CALCULATOR->stillHasUnit(selected_unit)) {KMessageBox::error(this, i18n("Unit does not exist anymore.")); emit unitsChanged(); return;} + +void QalculateUnitsDialog::insertUnit() { + UPDATE_SELECTED_UNIT + CHECK_IF_UNIT_STILL_THERE + emit insertRequest(selected_unit); +} + +void QalculateUnitsDialog::convertResult() { + UPDATE_SELECTED_UNIT + CHECK_IF_UNIT_STILL_THERE + emit convertRequest(selected_unit); +} + +void QalculateUnitsDialog::deactivateUnit() { + UPDATE_SELECTED_UNIT + CHECK_IF_UNIT_STILL_THERE + selected_unit->setActive(!selected_unit->isActive()); + emit unitsChanged(); +} + +void QalculateUnitsDialog::deleteUnit() { + UPDATE_SELECTED_UNIT + CHECK_IF_UNIT_STILL_THERE + if(selected_unit->isLocal()) { + if(selected_unit->isUsedByOtherUnits()) { + //do not delete units that are used by other units + KMessageBox::error(this, i18n("Cannot delete unit as it is needed by other units.")); + return; + } + //ensure that all references are removed in Calculator + selected_unit->destroy(); + //update menus and trees + emit unitsChanged(); + } +} + + +void QalculateUnitsDialog::editUnit() { + UPDATE_SELECTED_UNIT + CHECK_IF_UNIT_STILL_THERE + if(!unit_edit_dialog) { + unit_edit_dialog = new QalculateEditUnitDialog(this); + } + Unit *u = unit_edit_dialog->editUnit(QString::null, selected_unit); + if(u) { + selected_unit = u; + if(!u->isActive()) { + selected_category = i18n("Inactive"); + } else if(u->category().empty()) { + selected_category = i18n("Uncategorized"); + } else { + selected_category = "/"; + selected_category += u->category().c_str(); + } + emit unitsChanged(); + } +} + +void QalculateUnitsDialog::newUnit() { + if(!unit_edit_dialog) { + unit_edit_dialog = new QalculateEditUnitDialog(this); + } + Unit *u = NULL; + if(selected_category.isEmpty() || selected_category[0] != '/') { + u = unit_edit_dialog->editUnit(); + } else { + QString str = selected_category; + str.remove(0, 1); + u = unit_edit_dialog->editUnit(str); + } + if(u) { + selected_unit = u; + if(!u->isActive()) { + selected_category = i18n("Inactive"); + } else if(u->category().empty()) { + selected_category = i18n("Uncategorized"); + } else { + selected_category = "/"; + selected_category += u->category().c_str(); + } + emit unitsChanged(); + } +} + +void QalculateUnitsDialog::unitDoubleClicked(QListViewItem*i) { + selected_unit = unitItems[i]; + if(!selected_unit) + return; + CHECK_IF_UNIT_STILL_THERE + if(!unit_edit_dialog) { + unit_edit_dialog = new QalculateEditUnitDialog(this); + } + Unit *u = unit_edit_dialog->editUnit(QString::null, selected_unit); + if(u) { + selected_unit = u; + if(!u->isActive()) { + selected_category = i18n("Inactive"); + } else if(u->category().empty()) { + selected_category = i18n("Uncategorized"); + } else { + selected_category = "/"; + selected_category += u->category().c_str(); + } + emit unitsChanged(); + } +} + + +void QalculateUnitsDialog::unitSelected() { + QListViewItem *selected = unitView->selectedItem(); + if(selected) { + Unit *u = unitItems[selected]; + if(!CALCULATOR->stillHasUnit(u)) { + KMessageBox::error(this, i18n("Unit does not exist anymore.")); + selected_unit = NULL; + emit unitsChanged(); + return; + } + //remember selection + selected_unit = u; + editButton->setEnabled(true); + insertButton->setEnabled(u->isActive()); + convertResultButton->setEnabled(true); + deleteButton->setEnabled(u->isLocal()); + deactivateButton->setEnabled(true); + convertGroup->setEnabled(true); + fromLabel->setText(u->print(true, printops.abbreviate_names, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) fromLabel).c_str()); + if(u->isActive()) + deactivateButton->setText(i18n("Deactivate")); + else + deactivateButton->setText(i18n("Activate")); + } else { + editButton->setEnabled(false); + insertButton->setEnabled(false); + deleteButton->setEnabled(false); + deactivateButton->setEnabled(false); + convertResultButton->setEnabled(false); + convertGroup->setEnabled(false); + selected_unit = NULL; + } + if(!block_unit_convert) convert(); +} + +void QalculateUnitsDialog::addUnitTreeItem(Unit *u) { + QString snames, sbase; + //display name, plural name and short name in the second column + AliasUnit *au; + for(size_t i = 1; i <= u->countNames(); i++) { + if(i > 1) snames += " / "; + snames += u->getName(i).name.c_str(); + } + //depending on unit type display relation to base unit(s) + switch(u->subtype()) { + case SUBTYPE_COMPOSITE_UNIT: { + snames = ""; + sbase = ((CompositeUnit*) u)->print(false, true, printops.use_unicode_signs, &can_display_unicode_string_function, (void*) unitView).c_str(); + break; + } + case SUBTYPE_ALIAS_UNIT: { + au = (AliasUnit*) u; + sbase = au->firstBaseUnit()->preferredDisplayName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) unitView).name.c_str(); + if(au->firstBaseExponent() != 1) { + sbase += POWER; + sbase += QString::number(au->firstBaseExponent()); + } + break; + } + case SUBTYPE_BASE_UNIT: { + sbase = ""; + break; + } + } + QListViewItem *i = new KListViewItem(unitView, u->title(true).c_str(), snames, sbase); + unitItems[i] = u; + if(u == selected_unit) { + unitView->setSelected(i, true); + } +} + + +void QalculateUnitsDialog::categorySelected() { + block_unit_convert = true; + QListViewItem *selected = categoryView->selectedItem(); + bool no_cat = false, b_all = false, b_inactive = false; + unitView->clear(); + unitItems.clear(); + if(!selected) { + selected_category = ""; + unitSelected(); + return; + } + selected_category = categoryItems[selected]; + if(selected_category == i18n("All")) { + b_all = true; + } else if(selected_category == i18n("Uncategorized")) { + no_cat = true; + } else if(selected_category == i18n("Inactive")) { + b_inactive = true; + } + if(!b_all && !no_cat && !b_inactive && selected_category[0] == '/') { + string str = selected_category.ascii(); + str.erase(str.begin()); + for(size_t i = 0; i < CALCULATOR->units.size(); i++) { + if(CALCULATOR->units[i]->isActive() && CALCULATOR->units[i]->category().substr(0, selected_category.length() - 1) == str) { + addUnitTreeItem(CALCULATOR->units[i]); + } + } + } else { + string str = selected_category.ascii(); + for(size_t i = 0; i < CALCULATOR->units.size(); i++) { + if((b_inactive && !CALCULATOR->units[i]->isActive()) || (CALCULATOR->units[i]->isActive() && (b_all || (no_cat && CALCULATOR->units[i]->category().empty()) || (!b_inactive && CALCULATOR->units[i]->category() == str)))) { + addUnitTreeItem(CALCULATOR->units[i]); + } + } + } + if(!selected_unit || !unitView->selectedItem()) { + QListViewItemIterator it(unitView); + if(it.current()) + unitView->setSelected(it.current(), true); + } + //generate convert to menu + toCombo->blockSignals(true); + toCombo->clear(); + comboItems.clear(); + int i = 0, h = -1; + //add all units in units tree to menu + QListViewItemIterator it(unitView); + Unit *u; + while(it.current()) { + u = unitItems[it.current()]; + if(!selected_to_unit) { + selected_to_unit = u; + } + if(u) { + toCombo->insertItem(it.current()->text(0)); + comboItems.push_back(u); + if(selected_to_unit == u) + h = i; + } + i++; + ++it; + } + + //if no items were added to the menu, reset selected unit + if(i == 0) { + selected_to_unit = NULL; + } else { + //if no menu item was selected, select the first + if(h < 0) { + h = 0; + QListViewItemIterator it2(unitView); + if(it2.current()) { + selected_to_unit = unitItems[it2.current()]; + } else { + selected_to_unit = NULL; + } + } + toCombo->setCurrentItem(h); + } + toCombo->blockSignals(false); + block_unit_convert = false; + //update conversion display + convert(); +} + +void QalculateUnitsDialog::toUnitSelected(int index) { + if(index < (int) comboItems.size()) { + selected_to_unit = comboItems[index]; + convert(); + } +} +void QalculateUnitsDialog::convertClicked() { + if(toEdit->hasFocus()) { + convertReversed(); + } else { + convert(); + } +} +void QalculateUnitsDialog::convert() { + if(selected_unit && selected_to_unit) { + //determine conversion direction + bool b = false; + if(selected_unit == selected_to_unit) { + toEdit->setText(fromEdit->text()); + } else { + EvaluationOptions eo; + eo.approximation = APPROXIMATION_APPROXIMATE; + eo.parse_options.angle_unit = evalops.parse_options.angle_unit; + PrintOptions po; + po.is_approximate = &b; + po.number_fraction_format = FRACTION_DECIMAL; + MathStructure v_mstruct = CALCULATOR->convert(CALCULATOR->unlocalizeExpression(fromEdit->text().ascii(), evalops.parse_options), selected_unit, selected_to_unit, eo); + toEdit->setText(v_mstruct.print(po).c_str()); + b = b || v_mstruct.isApproximate(); + } + if(b && printops.use_unicode_signs && can_display_unicode_string_function(SIGN_ALMOST_EQUAL, (void*) equalsLabel)) { + equalsLabel->setText(SIGN_ALMOST_EQUAL); + } else { + equalsLabel->setText("="); + } + } +} +void QalculateUnitsDialog::convertReversed() { + if(selected_unit && selected_to_unit) { + bool b = false; + if(selected_unit == selected_to_unit) { + fromEdit->setText(toEdit->text()); + } else { + EvaluationOptions eo; + eo.approximation = APPROXIMATION_APPROXIMATE; + eo.parse_options.angle_unit = evalops.parse_options.angle_unit; + PrintOptions po; + po.is_approximate = &b; + po.number_fraction_format = FRACTION_DECIMAL; + MathStructure v_mstruct = CALCULATOR->convert(CALCULATOR->unlocalizeExpression(toEdit->text().ascii(), evalops.parse_options), selected_to_unit, selected_unit, eo); + fromEdit->setText(v_mstruct.print(po).c_str()); + b = b || v_mstruct.isApproximate(); + } + if(b && printops.use_unicode_signs && can_display_unicode_string_function(SIGN_ALMOST_EQUAL, (void*) equalsLabel)) { + equalsLabel->setText(SIGN_ALMOST_EQUAL); + } else { + equalsLabel->setText("="); + } + } +} + +void QalculateUnitsDialog::keyPressEvent(QKeyEvent *e) { + if(e->key() == Key_Return) { + convertClicked(); + e->accept(); + return; + } + KDialog::keyPressEvent(e); +} + + +#include "qalculateunitsdialog.moc" diff --git a/src/qalculateunitsdialog.h b/src/qalculateunitsdialog.h new file mode 100644 index 0000000..dfe9132 --- /dev/null +++ b/src/qalculateunitsdialog.h @@ -0,0 +1,108 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEUNITSDIALOG_H +#define QALCULATEUNITSDIALOG_H + +#include +#include +#include + +class Unit; +class QalculateEditUnitDialog; +class KListView; +class QListViewItem; +class QPushButton; +class KLineEdit; +class QLabel; +class KComboBox; +class QGroupBox; + +/** +@author Niklas Knutsson +*/ +class QalculateUnitsDialog : public KDialog { + + Q_OBJECT + +public: + + QalculateUnitsDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateUnitsDialog(); + + QalculateEditUnitDialog *unit_edit_dialog; + QString selected_category; + Unit *selected_unit, *selected_to_unit; + void addUnitTreeItem(Unit *f); + QMap unitItems; + QMap categoryItems; + QValueVector comboItems; + + QGroupBox *convertGroup; + KListView *categoryView; + KListView *unitView; + QPushButton *newButton; + QPushButton *editButton; + QPushButton *deleteButton; + QPushButton *deactivateButton; + QPushButton *insertButton; + QPushButton *helpButton; + QPushButton *buttonClose; + QPushButton *convertResultButton; + QPushButton *convertButton; + QLabel *fromLabel, *equalsLabel; + KLineEdit *toEdit, *fromEdit; + KComboBox *toCombo; + + bool block_unit_convert; + +public slots: + + void updateUnitTree(); + void unitDoubleClicked(QListViewItem*); + void unitSelected(); + void categorySelected(); + void insertUnit(); + void deactivateUnit(); + void deleteUnit(); + void editUnit(); + void newUnit(); + void convertResult(); + void convertClicked(); + void convert(); + void convertReversed(); + void toUnitSelected(int); + +protected slots: + + void slotHelp(); + +signals: + + void unitsChanged(); + void insertRequest(Unit*); + void convertRequest(Unit*); + +protected: + + void keyPressEvent(QKeyEvent *e); + +}; + +#endif diff --git a/src/qalculatevariablesdialog.cpp b/src/qalculatevariablesdialog.cpp new file mode 100644 index 0000000..af6d024 --- /dev/null +++ b/src/qalculatevariablesdialog.cpp @@ -0,0 +1,493 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#include "qalculatevariablesdialog.h" +#include "qalculate_kde_utils.h" +#include "qalculateeditvariabledialog.h" +#include "qalculateeditmatrixvectordialog.h" +#include "qalculateeditunknownvariabledialog.h" +#include "qalculateexportcsvdialog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern tree_struct variable_cats; +extern vector ia_variables; + +QalculateVariablesDialog::QalculateVariablesDialog(QWidget *parent, const char *name) : KDialog(parent, name, false) { + + export_csv_dialog = NULL; + variable_edit_dialog = NULL; + matrix_edit_dialog = NULL; + unknown_edit_dialog = NULL; + selected_category = ""; + selected_variable = NULL; + + QHBoxLayout *layout = new QHBoxLayout(this, marginHint(), spacingHint()); + + setCaption(i18n("Variables")); + + QSplitter *splitter = new QSplitter(Qt::Horizontal, this); + layout->addWidget(splitter); + + categoryView = new KListView(splitter); + categoryView->addColumn(i18n("Category")); + + variableView = new KListView(splitter); + variableView->addColumn(i18n("Variable Name")); + variableView->addColumn(i18n("Value")); + variableView->setRootIsDecorated(false); + + QVBoxLayout *buttonLayout = new QVBoxLayout(layout, spacingHint()); + + newButton = new QPushButton(i18n("New"), this); + buttonLayout->addWidget(newButton); + editButton = new QPushButton(i18n("Edit"), this); + editButton->setEnabled(false); + buttonLayout->addWidget(editButton); + deleteButton = new QPushButton(i18n("Delete"), this); + deleteButton->setEnabled(false); + buttonLayout->addWidget(deleteButton); + deactivateButton = new QPushButton(i18n("Deactivate"), this); + deactivateButton->setEnabled(false); + buttonLayout->addWidget(deactivateButton); + insertButton = new QPushButton(i18n("Insert"), this); + insertButton->setEnabled(false); + buttonLayout->addWidget(insertButton); + exportButton = new QPushButton(i18n("Export"), this); + exportButton->setEnabled(false); + buttonLayout->addWidget(exportButton); + buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); + helpButton = new KPushButton(KStdGuiItem::help(), this); + buttonLayout->addWidget(helpButton); + buttonClose = new KPushButton(KStdGuiItem::close(), this); + buttonClose->setFocus(); + buttonLayout->addWidget(buttonClose); + + resize(QSize(675, 375).expandedTo(size())); + + connect(buttonClose, SIGNAL(clicked()), this, SLOT(close())); + connect(newButton, SIGNAL(clicked()), this, SLOT(newVariable())); + connect(editButton, SIGNAL(clicked()), this, SLOT(editVariable())); + connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteVariable())); + connect(deactivateButton, SIGNAL(clicked()), this, SLOT(deactivateVariable())); + connect(insertButton, SIGNAL(clicked()), this, SLOT(insertVariable())); + connect(exportButton, SIGNAL(clicked()), this, SLOT(exportVariable())); + connect(variableView, SIGNAL(selectionChanged()), this, SLOT(variableSelected())); + connect(variableView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(variableDoubleClicked(QListViewItem*))); + connect(categoryView, SIGNAL(selectionChanged()), this, SLOT(categorySelected())); + connect(helpButton, SIGNAL(clicked()), this, SLOT(slotHelp())); + +} + +QalculateVariablesDialog::~QalculateVariablesDialog() {} + +void QalculateVariablesDialog::slotHelp() { + KApplication::kApplication()->invokeHelp("qalculate-managers"); +} + +void QalculateVariablesDialog::updateVariableTree() { + variableItems.clear(); + categoryItems.clear(); + categoryView->clear(); + QListViewItem *i = new KListViewItem(categoryView, i18n("All")), *i2; + categoryItems[i] = i18n("All"); + i->setOpen(true); + QString str; + tree_struct *item, *item2; + variable_cats.it = variable_cats.items.begin(); + if(variable_cats.it != variable_cats.items.end()) { + item = &*variable_cats.it; + ++variable_cats.it; + item->it = item->items.begin(); + } else { + item = NULL; + } + str = ""; + i2 = i; + while(item) { + str += "/"; + str += item->item.c_str(); + i = new KListViewItem(i2, item->item.c_str()); + i->setOpen(false); + categoryItems[i] = str; + if(str == selected_category) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + + while(item && item->it == item->items.end()) { + int str_i = str.findRev("/"); + if(str_i < 0) { + str = ""; + } else { + str.truncate(str_i); + } + item = item->parent; + i = i->parent(); + i2 = i; + } + if(item) { + item2 = &*item->it; + if(item->it == item->items.begin()) + i2 = i; + ++item->it; + item = item2; + item->it = item->items.begin(); + } + } + + if(!variable_cats.objects.empty()) { + //add "Uncategorized" category if there are variables without category + i = new KListViewItem(categoryView, i18n("Uncategorized")); + categoryItems[i] = i18n("Uncategorized"); + if(selected_category == i18n("Uncategorized")) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + } + if(!ia_variables.empty()) { + //add "Inactive" category if there are inactive variables + i = new KListViewItem(categoryView, i18n("Inactive")); + categoryItems[i] = i18n("Inactive"); + if(selected_category == i18n("Inactive")) { + categoryView->ensureItemVisible(i); + categoryView->setSelected(i, true); + } + } + if(!categoryView->selectedItem()) { + //if no category has been selected (previously selected has been renamed/deleted), select "All" + selected_category = i18n("All"); + QListViewItemIterator it(categoryView); + if(it.current()) + categoryView->setSelected(it.current(), true); + } +} + +#define UPDATE_SELECTED_VARIABLE QListViewItem *i = variableView->selectedItem(); if(!i) return; selected_variable = variableItems[i]; if(!selected_variable) return; +#define CHECK_IF_VARIABLE_STILL_THERE if(!CALCULATOR->stillHasVariable(selected_variable)) {KMessageBox::error(this, i18n("Variable does not exist anymore.")); emit variablesChanged(); return;} + +void QalculateVariablesDialog::exportVariable() { + UPDATE_SELECTED_VARIABLE + CHECK_IF_VARIABLE_STILL_THERE + if(selected_variable->isKnown()) { + if(!export_csv_dialog) { + export_csv_dialog = new QalculateExportCSVDialog(this); + } + export_csv_dialog->exportCSVFile((KnownVariable*) selected_variable); + } +} + + +void QalculateVariablesDialog::insertVariable() { + UPDATE_SELECTED_VARIABLE + CHECK_IF_VARIABLE_STILL_THERE + emit insertRequest(selected_variable); +} + + +void QalculateVariablesDialog::deactivateVariable() { + UPDATE_SELECTED_VARIABLE + CHECK_IF_VARIABLE_STILL_THERE + selected_variable->setActive(!selected_variable->isActive()); + emit variablesChanged(); +} + +void QalculateVariablesDialog::deleteVariable() { + UPDATE_SELECTED_VARIABLE + CHECK_IF_VARIABLE_STILL_THERE + if(selected_variable->isLocal()) { + //ensure that all references are removed in Calculator + selected_variable->destroy(); + //update menus and trees + emit variablesChanged(); + } +} + + +void QalculateVariablesDialog::editVariable() { + UPDATE_SELECTED_VARIABLE + CHECK_IF_VARIABLE_STILL_THERE + Variable *v = NULL; + if(selected_variable->isKnown()) { + if(((KnownVariable*) selected_variable)->get().isVector()) { + if(!matrix_edit_dialog) { + matrix_edit_dialog = new QalculateEditMatrixVectorDialog(this); + } + v = matrix_edit_dialog->editVariable(QString::null, (KnownVariable*) selected_variable); + } else { + if(!variable_edit_dialog) { + variable_edit_dialog = new QalculateEditVariableDialog(this); + } + v = variable_edit_dialog->editVariable(QString::null, (KnownVariable*) selected_variable); + } + } else { + if(!unknown_edit_dialog) { + unknown_edit_dialog = new QalculateEditUnknownVariableDialog(this); + } + v = unknown_edit_dialog->editVariable(QString::null, (UnknownVariable*) selected_variable); + } + if(v) { + selected_variable = v; + if(!v->isActive()) { + selected_category = i18n("Inactive"); + } else if(v->category().empty()) { + selected_category = i18n("Uncategorized"); + } else { + selected_category = "/"; + selected_category += v->category().c_str(); + } + emit variablesChanged(); + } +} + +void QalculateVariablesDialog::newVariable() { + if(!variable_edit_dialog) { + variable_edit_dialog = new QalculateEditVariableDialog(this); + } + Variable *v = NULL; + if(selected_category.isEmpty() || selected_category[0] != '/') { + v = variable_edit_dialog->editVariable(""); + } else { + QString str = selected_category; + str.remove(0, 1); + v = variable_edit_dialog->editVariable(str); + } + if(v) { + selected_variable = v; + if(!v->isActive()) { + selected_category = i18n("Inactive"); + } else if(v->category().empty()) { + selected_category = i18n("Uncategorized"); + } else { + selected_category = "/"; + selected_category += v->category().c_str(); + } + emit variablesChanged(); + } +} + +void QalculateVariablesDialog::variableDoubleClicked(QListViewItem*i) { + selected_variable = variableItems[i]; + if(!selected_variable) + return; + CHECK_IF_VARIABLE_STILL_THERE + Variable *v = NULL; + if(selected_variable->isKnown()) { + if(((KnownVariable*) selected_variable)->get().isVector()) { + if(!matrix_edit_dialog) { + matrix_edit_dialog = new QalculateEditMatrixVectorDialog(this); + } + v = matrix_edit_dialog->editVariable(QString::null, (KnownVariable*) selected_variable); + } else { + if(!variable_edit_dialog) { + variable_edit_dialog = new QalculateEditVariableDialog(this); + } + v = variable_edit_dialog->editVariable(QString::null, (KnownVariable*) selected_variable); + } + } else { + if(!unknown_edit_dialog) { + unknown_edit_dialog = new QalculateEditUnknownVariableDialog(this); + } + v = unknown_edit_dialog->editVariable(QString::null, (UnknownVariable*) selected_variable); + } + if(v) { + selected_variable = v; + if(!v->isActive()) { + selected_category = i18n("Inactive"); + } else if(v->category().empty()) { + selected_category = i18n("Uncategorized"); + } else { + selected_category = "/"; + selected_category += v->category().c_str(); + } + emit variablesChanged(); + } +} + + +void QalculateVariablesDialog::variableSelected() { + QListViewItem *selected = variableView->selectedItem(); + if(selected) { + Variable *v = variableItems[selected]; + if(!CALCULATOR->stillHasVariable(v)) { + KMessageBox::error(this, i18n("Variable does not exist anymore.")); + selected_variable = NULL; + emit variablesChanged(); + return; + } + //remember selection + selected_variable = v; + editButton->setEnabled(!is_answer_variable(v)); + insertButton->setEnabled(v->isActive()); + deleteButton->setEnabled(v->isLocal() && !is_answer_variable(v) && v != CALCULATOR->v_x && v != CALCULATOR->v_y && v != CALCULATOR->v_z); + deactivateButton->setEnabled(!is_answer_variable(v)); + if(v->isActive()) + deactivateButton->setText(i18n("Deactivate")); + else + deactivateButton->setText(i18n("Activate")); + exportButton->setEnabled(v->isKnown()); + } else { + editButton->setEnabled(false); + insertButton->setEnabled(false); + deleteButton->setEnabled(false); + deactivateButton->setEnabled(false); + exportButton->setEnabled(false); + selected_variable = NULL; + } +} + +void QalculateVariablesDialog::addVariableTreeItem(Variable *v) { + QString value; + if(is_answer_variable(v)) { + value = i18n("a previous result"); + } else if(v->isKnown()) { + if(((KnownVariable*) v)->isExpression()) { + value = CALCULATOR->localizeExpression(((KnownVariable*) v)->expression()).c_str(); + if(value.length() > 20) { + value.truncate(17); + value += "..."; + } + } else { + if(((KnownVariable*) v)->get().isMatrix()) { + value = i18n("matrix"); + } else if(((KnownVariable*) v)->get().isVector()) { + value = i18n("vector"); + } else { + value = CALCULATOR->printMathStructureTimeOut(((KnownVariable*) v)->get(), 30).c_str(); + } + } + } else { + if(((UnknownVariable*) v)->assumptions()) { + switch(((UnknownVariable*) v)->assumptions()->sign()) { + case ASSUMPTION_SIGN_POSITIVE: { + value = i18n("positive"); + break; + } + case ASSUMPTION_SIGN_NONPOSITIVE: { + value = i18n("non-positive"); + break; + } + case ASSUMPTION_SIGN_NEGATIVE: { + value = i18n("negative"); + break; + } + case ASSUMPTION_SIGN_NONNEGATIVE: { + value = i18n("non-negative"); + break; + } + case ASSUMPTION_SIGN_NONZERO: { + value = i18n("non-zero"); + break; + } + default: {} + } + if(!value.isEmpty() && !((UnknownVariable*) v)->assumptions()->type() == ASSUMPTION_TYPE_NONE) + value += " "; + switch(((UnknownVariable*) v)->assumptions()->type()) { + case ASSUMPTION_TYPE_INTEGER: { + value += i18n("integer"); + break; + } + case ASSUMPTION_TYPE_RATIONAL: { + value += i18n("rational"); + break; + } + case ASSUMPTION_TYPE_REAL: { + value += i18n("real"); + break; + } + case ASSUMPTION_TYPE_COMPLEX: { + value += i18n("complex"); + break; + } + case ASSUMPTION_TYPE_NUMBER: { + value += i18n("number"); + break; + } + case ASSUMPTION_TYPE_NONMATRIX: { + value += i18n("(not matrix)"); + break; + } + default: {} + } + if(value.isEmpty()) + value = i18n("unknown"); + } else { + value = i18n("default assumptions"); + } + } + QListViewItem *i = new KListViewItem(variableView, v->title(true).c_str(), value); + variableItems[i] = v; + if(v == selected_variable) { + variableView->setSelected(i, true); + } +} + + +void QalculateVariablesDialog::categorySelected() { + QListViewItem *selected = categoryView->selectedItem(); + bool no_cat = false, b_all = false, b_inactive = false; + variableView->clear(); + variableItems.clear(); + if(!selected) { + selected_category = ""; + variableSelected(); + return; + } + selected_category = categoryItems[selected]; + if(selected_category == i18n("All")) { + b_all = true; + } else if(selected_category == i18n("Uncategorized")) { + no_cat = true; + } else if(selected_category == i18n("Inactive")) { + b_inactive = true; + } + if(!b_all && !no_cat && !b_inactive && selected_category[0] == '/') { + string str = selected_category.ascii(); + str.erase(str.begin()); + for(size_t i = 0; i < CALCULATOR->variables.size(); i++) { + if(CALCULATOR->variables[i]->isActive() && CALCULATOR->variables[i]->category().substr(0, selected_category.length() - 1) == str) { + addVariableTreeItem(CALCULATOR->variables[i]); + } + } + } else { + string str = selected_category.ascii(); + for(size_t i = 0; i < CALCULATOR->variables.size(); i++) { + if((b_inactive && !CALCULATOR->variables[i]->isActive()) || (CALCULATOR->variables[i]->isActive() && (b_all || (no_cat && CALCULATOR->variables[i]->category().empty()) || (!b_inactive && CALCULATOR->variables[i]->category() == str)))) { + addVariableTreeItem(CALCULATOR->variables[i]); + } + } + } + if(!selected_variable || !variableView->selectedItem()) { + QListViewItemIterator it(variableView); + if(it.current()) + variableView->setSelected(it.current(), true); + } +} + + +#include "qalculatevariablesdialog.moc" diff --git a/src/qalculatevariablesdialog.h b/src/qalculatevariablesdialog.h new file mode 100644 index 0000000..2fa9bc5 --- /dev/null +++ b/src/qalculatevariablesdialog.h @@ -0,0 +1,92 @@ +/*************************************************************************** + * Copyright (C) 2005 by Niklas Knutsson * + * nq@altern.org * + * * + * 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. * + ***************************************************************************/ +#ifndef QALCULATEVARIABLESDIALOG_H +#define QALCULATEVARIABLESDIALOG_H + +#include +#include + +class Variable; +class QalculateEditVariableDialog; +class QalculateEditMatrixVectorDialog; +class QalculateEditUnknownVariableDialog; +class QalculateExportCSVDialog; +class KListView; +class QListViewItem; +class QPushButton; + +/** +@author Niklas Knutsson +*/ +class QalculateVariablesDialog : public KDialog { + + Q_OBJECT + +public: + + QalculateVariablesDialog(QWidget *parent = 0, const char *name = 0); + virtual ~QalculateVariablesDialog(); + + QalculateEditVariableDialog *variable_edit_dialog; + QalculateEditMatrixVectorDialog *matrix_edit_dialog; + QalculateEditUnknownVariableDialog *unknown_edit_dialog; + QalculateExportCSVDialog *export_csv_dialog; + QString selected_category; + Variable *selected_variable; + void addVariableTreeItem(Variable *v); + QMap variableItems; + QMap categoryItems; + + KListView *categoryView; + KListView *variableView; + QPushButton *newButton; + QPushButton *editButton; + QPushButton *deleteButton; + QPushButton *deactivateButton; + QPushButton *insertButton; + QPushButton *exportButton; + QPushButton *helpButton; + QPushButton *buttonClose; + +public slots: + + void updateVariableTree(); + void variableDoubleClicked(QListViewItem*); + void variableSelected(); + void categorySelected(); + void exportVariable(); + void insertVariable(); + void deactivateVariable(); + void deleteVariable(); + void editVariable(); + void newVariable(); + +protected slots: + + void slotHelp(); + +signals: + + void variablesChanged(); + void insertRequest(Variable*); + +}; + +#endif