alt_key-2.2.5/.hg_archival.txt0000644000000000000000000000022411722111646016173 0ustar rootroot00000000000000repo: be6485e69f9f96305b625a95fab302c61bd074e1 node: 719a949ee3e6d6a0582c70a33c6692f8807386e6 branch: default latesttag: 2.2.5 latesttagdistance: 1 alt_key-2.2.5/.hgignore0000644000000000000000000000036411722111646014715 0ustar rootroot00000000000000syntax: glob java/* kuhn_munkres/* pyqt/* alt_key *.class in*.txt out*.txt rtest Makefile gpl-[0-9].[0-9].txt *.a *.o *.py[co] *.so *.sw[nop] *~ .#* [#]*# *.ld *.ldx louti[0-9]* *.li *.lix *.tmp *.bak test.* moc_* *.obj qrc_*.cpp ui_*.h .*.swp alt_key-2.2.5/.hgtags0000644000000000000000000000035311722111646014366 0ustar rootroot00000000000000ca89dfeac32dcb747b4e30b29a63105e2818100d 2.2.5 ca89dfeac32dcb747b4e30b29a63105e2818100d 2.2.5 8a954d6ee891165139e85c8dc37cf25b0cd1bbb1 2.2.5 8a954d6ee891165139e85c8dc37cf25b0cd1bbb1 2.2.5 0b6507ea5b877f6b6fd94b432b11ad00e89fd623 2.2.5 alt_key-2.2.5/CHANGES0000644000000000000000000001102311722111646014077 0ustar rootroot000000000000002012-02-24 2.2.5 - Fixed packaging error. 2012-02-24 2.2.4 - Added a Czech translation from Pavel Fric. - Minor bugfix: the Save dialog now defaults to Yes instead of No. 2009-10-20 2.2.3 - I now add accelerators to QMenus associated with QActions. 2009-09-10 2.2.2 - Small internal improvements that have no effect on the visible behaviour. 2009-08-29 2.2.1 - Renamed the accelerator.{hpp,cpp} module to alt_key.{hpp,cpp} and changed its namespace from Qtrac to AQP. Renamed the application from Accelerator to Alt_Key. 2009-04-03 2.1.4 - Internal: Now use Qt containers rather than STL for the Kuhn-Munkres algorithm. (But STL still supported.) 2009-02-04 2.1.3 - Internal: Improved the accelerator module's accelerateWidget() and accelerateWidgets() functions so that they now handle checkable group boxes. 2008-12-12 2.1.0 - Internal: Changed the API provided by the accelerator module (1) changed the namespace from Accelerator to Qtrac (2) added functions for use by programs for dynamically setting accelerators, e.g., for menus. - Internal: Accelerator's own accelerators are now set dynamically using the new functions. 2008-06-30 2.0.1 - Internal: Switched to my own implementation of the Kuhn-Munkres algorithm (essentially a translation of Brian M. Clapper's Python algorithm). 2008-06-27 2.0.0 - Switched to the Kuhn-Munkres algorithm (by using John Weaver's open source C++ implementation). This means that the algorithm always works "instantly" and there are no pathological cases. - Got rid of options that are no longer needed. 2008-06-25 1.5.3 - Removed Show Help at Startup option. - Wait cursor is no longer shown in help or about dialogs during calculations. - Added note that Unlimited recursion can lead to extremely long runtimes in some cases. 2008-06-10 1.5.2 - Improved is_valid(). - Changed the quality() function again. - Added sanity check to insert_accelerators(). - Changed default alphabet to "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ". 2008-06-06 1.5.1 - Subtle bugfix to the quality calculating algorithm. 2008-06-05 1.5.0 - Fixed bug where recursion depth was reported as 0 if max recursion depth was unlimited. - Changed the quality algorithm so that it penalises missing accelerators more and produces more consistent results. 2008-06-05 1.4.0 - Added New button. - Added more output information (and made it optional). - Changed the default max recursion depth to 10M. - Changed the default max candidates to Unlimited. - Changed weightings to avoid a subtle anomaly. 2008-06-04 1.3.0 - Dramatic speed improvements. - Changed the default max candidates to 1M. - Revised and simplified the help file. - Changed the API to Accelerator::is_valid(). 2008-06-03 1.2.0 - The speed vs. quality trade-off which used to be weakly determined by setting the maximum number of candidates is now strongly determined by the maximum recursion depth (deeper means slower and higher quality). If the maximum recursion depth is set to 1000 the algorithm is fast enough for real-time use. - Bugfixes. 2008-05-14 1.1.2 - The log now shows the alphabet that was used with the characters used as accelerators highlighted. - Separated the restore workspace and load last file options. - The upper bound of the algorithm as implemented is integer sequence http://www.research.att.com/~njas/sequences/A093965 2008-05-08 1.1.1 - Added note to help + improved tooltip about speedup that predefined accelerators can offer. - Changed the default alphabet from 0-9A-Z to 1-9A-Z. - Tweaked the algorithm's weightings slightly. 2008-05-08 1.1.0 - Refined the algorithm so that all other factors being equal if there is a choice it prefers words starting with an uppercase character and words nearer the beginning. One unexpected side-effect is that speed has improved as a result. - Added Predefined Accelerators option. - Added Restore Workspace on Startup option. - Made sure the help widget isn't too big. - Subtle code fixes. 2008-05-08 1.0.2 - Code and message text cleanups. - Subtle improvements to the GUI. 2008-05-08 1.0.1 - Changed Options dialog so that of the characters used in the accelerator alphabet, those that are letters are forced to uppercase; also ensured that all the characters in the alphabet are unique. 2008-05-08 1.0.0 - Small tweaks. 2008-05-08 1.0.1-alpha - Various changes to the log messages. - Now offer a timeout option to stop after a user specified number of minutes (default no timeout) as suggested by Jasmin Blanchette. 2008-05-07 1.0.0-alpha - First public release. alt_key-2.2.5/README0000644000000000000000000000533211722111646013772 0ustar rootroot00000000000000Alt_Key ======= Alt_Key is used to show where keyboard accelerators should go in menu option texts and dialog labels. The program instantly produces optimal results on the basis that the best accelerator is the first character, the second best is the first character of a word, the third best is any character, the worst is no accelerator at all, and no accelerator should be used more than once. It also allows accelerators to be specified by the user. Home page: http://www.qtrac.eu/alt_key.html Compiling and Installing Alt_Key ================================ Prerequisites: A C++ compiler and the Qt4 libraries. 1. Unpack the archive file, alt_key-XXX.tar.gz 2. Change directory to alt_key-XXX 3. qmake # On some systems, e.g., Fedora, run qmake-qt4 4. make 5. Windows users might like to add Alt_Key to the Start menu or add a shortcut to it on the desktop Unix users might like to copy or soft link the alt_key executable to somewhere in the PATH 6. You might like to try loading one of the example (*.acc) files so that you can see how the application works. That's it! Running Alt_Key =============== The Alt_Key program can be used as is by typing in lists of menu options and dialog labels etc. and calculating the accelerated texts. It is also possible to #include the alt_key module and automatically set alt_keys, e.g., at the end of each form's initializer. This is what the Alt_Key program itself does. If you hit a bug, please report it to mark@qtrac.eu. Be sure to include "Alt_Key" in the subject line and specify the version you are using and details of your system, e.g., operating system name and version, compiler name and version, Qt library version. Hopefully there will no longer be any excuse for not having keyboard accelerators for menu option texts and dialog labels! For developers: It is quite easy to use the kuhn_munkres.{hpp,cpp} and alt_key.{hpp,cpp} module in C++/Qt programs to produce accelerators automatically and dynamically. (See my book "Advanced Qt Programming" ISBN 0321635906 and its accompanying examples.) License ======= This program was written by Mark Summerfield. Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. 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 3 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 (in file gpl-3.0.txt) for more details. The icons are from KDE (http://www.kde.org) and are subject to the KDE license. alt_key-2.2.5/alt_key.10000644000000000000000000000156211722111646014625 0ustar rootroot00000000000000.TH ALT_KEY 1 "2012-02-25" "alt_key v2.2.5" .SH NAME alt_key \- generate keyboard accelerators .SH SYNOPSIS .B diffpdf .RI [ file1 ] .RI [ file2 ] .SH DESCRIPTION This manual page very briefly documents the \fBalt_key\fP command. (Click the GUI's Help button or press F1 for more information.) .PP \fBalt_key\fP is a GUI application used to generate keyboard accelerators .br Alt_Key is used to show where keyboard accelerators should go in menu option texts and dialog labels. The program instantly produces optimal results on the basis that the best accelerator is the first character, the second best is the first character of a word, the third best is any character, the worst is no accelerator at all, and no accelerator should be used more than once. It also allows accelerators to be specified by the user. .SH AUTHOR alt_key was written by Mark Summerfield . alt_key-2.2.5/alt_key.acc0000644000000000000000000000041411722111646015206 0ustar rootroot00000000000000# Accelerator - Main Window Calculate New Load... Save Save &As... Copy to Clipboard Set Options... Help About Quit # Accelerator - Options Alphabet Predefined Accelerators Prompt to Save Unsaved Changes on Exit Restore Workspace at Startup Load Last File at Startup alt_key-2.2.5/alt_key.cpp0000644000000000000000000003070111722111646015244 0ustar rootroot00000000000000/* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. */ #include "alt_key.hpp" #include "kuhn_munkres.hpp" #include #include #include #include #include #include #include #include namespace { typedef QSet CharSet; struct StringItem { explicit StringItem(const QString &string_=QString(), const CharSet alphabet=CharSet()) : string(string_), ustring(string_.toUpper()) { foreach (const QChar &c, ustring) if (alphabet.contains(c)) unique.insert(c); } void calculateWeights(int sizeOfAlphabet) { const double factor = unique.count() / static_cast(sizeOfAlphabet); QList characters = QList::fromSet(unique); qSort(characters); double weight; foreach (const QChar &c, characters) { if (ustring[0] == c) // First character's weight weight = factor; else if (ustring.contains(QString(" %1").arg(c))) { int pos = string.indexOf(QString(" %1").arg(c)); if (pos > -1) // Capital start of word's weight weight = factor * 10; else { // Start of word's weight weight = factor * 100; pos = ustring.indexOf(QString(" %1").arg(c)); } weight += pos; } else // Any character's weight weight = (factor * 1000) + ustring.indexOf(c); weightOf[c] = weight; } } QString string; QString ustring; CharSet unique; QHash weightOf; }; QStringList accelerated_(const QStringList &strings, const CharSet &alphabet) { const double Invalid = std::numeric_limits::max(); QList items; foreach (const QString &string, strings) items.append(StringItem(string, alphabet)); CharSet alphabetSet; foreach (const StringItem &item, items) alphabetSet |= item.unique; QList characters = QList::fromSet(alphabetSet); qSort(characters); QString alphabetString; foreach (const QChar &c, characters) alphabetString.append(c); const int rows = items.count(); const int columns = alphabetString.count(); KuhnMunkres::Grid grid; for (int row = 0; row < rows; ++row) { StringItem &item = items[row]; item.calculateWeights(alphabetString.count()); KuhnMunkres::Row rowData; foreach (const QChar &c, alphabetString) rowData.push_back(item.weightOf.value(c, Invalid)); grid.push_back(rowData); } KuhnMunkres km; KuhnMunkres::Indexes indexes = km.calculate(grid); QStringList results; foreach (const KuhnMunkres::Index &index, indexes) { int row = index.first; int column = index.second; if (row >= rows || column >= columns) continue; StringItem &item = items[row]; QString string = item.string; if (grid.at(row).at(column) < Invalid) { const QChar &c = alphabetString.at(column); if (c == item.ustring.at(0)) string = QString("&%1").arg(item.string); else { int i = item.ustring.indexOf(QString(" %1").arg(c)); if (i > -1) ++i; else i = item.ustring.indexOf(c); string = item.string.left(i) + "&" + item.string.mid(i); } } results.append(string); } return results; } } // anonymous namespace namespace AQP { /* Returns a copy of the given strings but with accelerators inserted where possible. Accelerators are only chosen from the given alphabet (which defaults to 0-9A-Z). */ QStringList accelerated(const QStringList &strings, const QString &alphabet) { CharSet alphabetSet; foreach (const QChar &c, alphabet.toUpper()) alphabetSet.insert(c); QStringList fullResults; QStringList newStrings; foreach (const QString &string, strings) { QString string_copy = string; string_copy = string_copy.replace("&&", ""); int i = string_copy.indexOf("&"); if (i > -1 && i + 1 < string_copy.length()) { alphabetSet.remove(string_copy[string_copy.indexOf("&") + 1] .toUpper()); fullResults.append(string); } else { fullResults.append(QString()); newStrings.append(string); } } if (newStrings.isEmpty()) // They're already accelerated return strings; QStringList results = accelerated_(newStrings, alphabetSet); for (int i = 0; i < fullResults.count(); ++i) { if (fullResults.at(i).isEmpty()) fullResults[i] = results.isEmpty() ? strings.at(i) : results.takeFirst(); } return fullResults; } /* Adds accelerators to every action that has text in the menu or menu bar, and to all the menu or menu bar's menus and sub-menus, recursively. */ void accelerateMenu(QWidget *menuOrMenuBar, const QString &alphabet) { Q_ASSERT(menuOrMenuBar->inherits("QMenuBar") || menuOrMenuBar->inherits("QMenu")); accelerateActions(menuOrMenuBar->actions()); foreach (QMenu *menu, menuOrMenuBar->findChildren()) accelerateActions(menu->actions(), alphabet); } /* Adds accelerators to every action that has text, but skipping separators. */ void accelerateActions(QList actions, const QString &alphabet) { QStringList texts; QList acceleratedActions; foreach (QAction *action, actions) { if (action->isSeparator()) continue; const QString &text = action->text(); if (!text.isEmpty()) { texts << action->text(); acceleratedActions << action; } if (QMenu *menu = action->menu()) accelerateMenu(menu, alphabet); } texts = accelerated(texts, alphabet); Q_ASSERT(isValid(texts, 0, alphabet)); for (int i = 0; i < texts.count(); ++i) acceleratedActions.at(i)->setText(texts.at(i)); } /* Adds accelerators to all labels that have buddies and all abstract button's that have a text and all group boxes that are checkable and have a text that are children of the given widget. */ void accelerateWidget(QWidget *widget, const QString &alphabet) { QStringList texts; QList widgets; foreach (QLabel *label, widget->findChildren()) { if (label->buddy() && !label->text().isEmpty()) { texts << label->text(); widgets << label; } } foreach (QAbstractButton *button, widget->findChildren()) { if (!qobject_cast(button) && !button->text().isEmpty()) { texts << button->text(); widgets << button; } } foreach (QGroupBox *groupBox, widget->findChildren()) { if (groupBox->isCheckable() && !groupBox->title().isEmpty()) { texts << groupBox->title(); widgets << groupBox; } } texts = accelerated(texts, alphabet); Q_ASSERT(isValid(texts, 0, alphabet)); for (int i = 0; i < texts.count(); ++i) { if (QLabel *label = qobject_cast(widgets.at(i))) { label->setText(texts.at(i)); continue; } if (QGroupBox *groupBox = qobject_cast(widgets.at(i))) { groupBox->setTitle(texts.at(i)); continue; } QAbstractButton *button = qobject_cast(widgets.at(i)); Q_ASSERT(button); button->setText(texts.at(i)); } } /* Adds accelerators to all the widgets in the list that are labels that have buddies or that are abstract button's that have a text or that are group boxes that are checkable and have a text. */ void accelerateWidgets(QList widgets, const QString &alphabet) { QStringList texts; foreach (QWidget *widget, widgets) { QLabel *label = qobject_cast(widget); if (label && label->buddy() && !label->text().isEmpty()) { texts << label->text(); continue; } QGroupBox *groupBox = qobject_cast(widget); if (groupBox && groupBox->isCheckable() && !groupBox->title().isEmpty()) { texts << groupBox->title(); continue; } QAbstractButton *button = qobject_cast(widget); if (button && !qobject_cast(button) && !button->text().isEmpty()) texts << button->text(); else texts << QString(); } texts = accelerated(texts, alphabet); Q_ASSERT(isValid(texts, 0, alphabet)); for (int i = 0; i < texts.count(); ++i) { const QString &text = texts.at(i); if (text.isEmpty()) continue; if (QLabel *label = qobject_cast(widgets.at(i))) { label->setText(text); continue; } if (QGroupBox *groupBox = qobject_cast(widgets.at(i))) { groupBox->setTitle(text); continue; } QAbstractButton *button = qobject_cast(widgets.at(i)); Q_ASSERT(button); button->setText(text); } } /* Returns true if all the strings are valid (i.e., each one has a unique accelerator---or no accelerator) and ignores where. Otherwise returns false and sets where to the (index of string, column) for the first string that is invalid (e.g., has a duplicate accelerator). */ bool isValid(const QStringList &listOfStrings, QPair *where, const QString &alphabet) { CharSet seen; for (int i = 0; i < listOfStrings.count(); ++i) { QString string = listOfStrings.at(i); string = string.replace("&&", ""); int j = string.indexOf("&"); if (j > -1 && j + 1 < string.length()) { const QChar c = string.at(j + 1).toUpper(); if (seen.contains(c) || !alphabet.contains(c)) { if (where) { where->first = i; where->second = j; } return false; } seen.insert(c); } } return true; } /* Returns a quality value in the range 0.0 (worst) to 1.0 (best). The best quality is when a string has an accelerator for its first character, second best is an accelerator for a start of word, third best is any accelerator at all, and worst is no accelerator. */ double quality(const QStringList &listOfStrings) { enum {FIRST_CHARACTER = 4, START_OF_WORD = 2, IN_STRING = 1}; int done = 0; int weight = 0; foreach (QString string, listOfStrings) { string = string.replace("&&", ""); ++done; if (string.at(0) == QChar('&')) weight += FIRST_CHARACTER; else if (string.contains(" &")) weight += START_OF_WORD; else if (string.contains("&")) weight += IN_STRING; else --done; } double range = (listOfStrings.count() * static_cast(FIRST_CHARACTER)); return ((weight * (done / static_cast(listOfStrings.count()))) / range); } /* Returns the number of strings in the given list that have accelerators. */ int numberAccelerated(const QStringList &listOfStrings) { int count = 0; foreach (QString string, listOfStrings) { string = string.replace("&&", ""); int i = string.indexOf("&"); if (i > -1 && i + 1 < string.length()) ++count; } return count; } } // namespace AQP alt_key-2.2.5/alt_key.hpp0000644000000000000000000000512311722111646015251 0ustar rootroot00000000000000#ifndef ALT_KEY_HPP #define ALT_KEY_HPP /* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. This module is used to show where keyboard accelerators should go in menu option texts and dialog labels and instantly produces optimal results using the Kuhn-Munkres algorithm. It easily outperforms all the naive algorithms. */ #include // For Q_DECLARE_TR_FUNCTIONS #include #include #include class QAction; class QWidget; namespace AQP { /* The original Alphabet QString constant wasn't translatable because it is translated before the application has a chance to load its translations. An ideal solution would be to make Alphabet a function that returns the string, but that would break the Alt_Key module's API. Konrad Rosenbaum spotted these problems and came up with this class as a solution. Thanks to the _Alphabet class the Alphabet can be translated and can also be used pretty well everywhere a string is required, thus preserving the Alt_Key module's API. */ class _Alphabet { Q_DECLARE_TR_FUNCTIONS(_Alphabet); public: _Alphabet() {} operator QString() const { return tr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", "Accelerator Keys"); } }; const _Alphabet Alphabet; QStringList accelerated(const QStringList &strings, const QString &alphabet=Alphabet); void accelerateMenu(QWidget *menuOrMenuBar, const QString &alphabet=Alphabet); void accelerateActions(QList actions, const QString &alphabet=Alphabet); void accelerateWidget(QWidget *widget, const QString &alphabet=Alphabet); void accelerateWidgets(QList widgets, const QString &alphabet=Alphabet); bool isValid(const QStringList &listOfStrings, QPair *where=0, const QString &alphabet=Alphabet); int numberAccelerated(const QStringList &listOfStrings); double quality(const QStringList &listOfStrings); } // namespace AQP #endif // ALT_KEY_HPP alt_key-2.2.5/alt_key.pro0000644000000000000000000000073011722111646015261 0ustar rootroot00000000000000#DEFINES += USE_STL HEADERS += kuhn_munkres.hpp SOURCES += kuhn_munkres.cpp HEADERS += alt_key.hpp SOURCES += alt_key.cpp HEADERS += optionsdlg.hpp SOURCES += optionsdlg.cpp HEADERS += syntaxhighlighter.hpp SOURCES += syntaxhighlighter.cpp HEADERS += mainwindow.hpp SOURCES += mainwindow.cpp SOURCES += main.cpp RESOURCES += resources.qrc TRANSLATIONS += alt_key_cz.ts # CHANGES # README # help.html # alt_key.1 alt_key-2.2.5/alt_key_cz.qm0000644000000000000000000001764711722111646015611 0ustar rootroot00000000000000~I/4SWq^brRtSZ]3@C>'3 %WU)m- RZJw$1C%gN1V P:A O 'bvg m  F 8 v : _$v Ej < p4 8 8X!B`6&?45tui%1/%2 urychleno%1/%2 accelerated MainWindow>'%1' %2 %3 %4 %5% kvalita %6 %7'%1' %2 %3 %4 %5% quality %6 %7 MainWindowH0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ MainWindow <b><u>%1</u></b>%1 MainWindowP<font color=red>NepodaYilo se nahrt: %1"Failed to load: %1 MainWindowP<font color=red>NepodaYilo se ulo~it: %1"Failed to save: %1 MainWindow<p><b><a href="http://www.qtrac.eu/alt_key.html">Alt_Key</a> %1</b> od Marka Summerfielda.<p>Autorsk prvo &copy; 2008-12 <a href="http://www.qtrac.eu">Qtrac</a> Ltd. Vaechna prva vyhrazena.<hr><p>Tento program je svobodn software: Tento balk je svobodnm softwarem; mo~ete jej rozdvat a/nebo upravovat za podmnek GNU General Public License (GPL), jak jsou zveYejnny Free Software Foundation; bu ve verzi 2 licence, nebo (podle sv volby) v kterkoli pozdja verzi. Tento balk je aYen v nadji, ~e bude u~ite n, ale BEZ JAKKOLI ZRUKY; tak bez pYedpokldan zruky PRODEJNOSTI nebo POU}ITELNOSTI PRO NJAK UR IT  EL: Vce podrobnost naleznete v GNU Library General Public License (v souboru <tt>gpl-2.0.txt</tt>). {1<?} {2008-12 ?} {3 ?} {3.0.?}

Alt_Key %1 by Mark Summerfield.

Copyright © 2008-12 Qtrac Ltd. All rights reserved.


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 3 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 (in file gpl-3.0.txt) for more details. MainWindowO programuAbout MainWindow$Vaech %1 urychlenoAll %1 accelerated MainWindowAlt_KeyAlt_Key MainWindowAlt_Key - %1 Alt_Key - %1 MainWindow(Alt_Key - O programuAlt_Key - About MainWindow$Alt_Key - NpovdaAlt_Key - Help MainWindow0Alt_Key - Nahrt YetzceAlt_Key - Load Strings MainWindow0Alt_Key - Ulo~it YetzceAlt_Key - Save Strings MainWindow&Alt_Key - Bez nzvuAlt_Key - Unnamed MainWindow2Alt_Key - Neulo~en zmnyAlt_Key - Unsaved Changes MainWindow>Soubory Alt_Key (*.acc) Vae (*)Alt_Key Files (*.acc) All (*) MainWindowSpo tat Calculate MainWindow(Spo tat urychlova eCalculate the accelerators MainWindowSmazat pole pro zadvn textu, aby bylo pYipraveno pro nov seznam.Clear the input text edit ready for a new list MainWindowPVsledn Yetzce zkoprovny do schrnky&Copied result strings to the clipboard MainWindowNKoprovat urychlen Yetzce do schrnky-Copy the accelerated strings to the clipboard MainWindow*Koprovat do schrnkyCopy to Clipboard MainWindow Ctrl+SCtrl+S MainWindowF1F1 MainWindowNpovdaHelp MainWindow`Nahrt soubor s prostm textem vstupnch Yetzco'Load a plain text file of input strings MainWindowNahrt...Load... MainWindowNahrno %1 Loaded %1 MainWindowNovNew MainWindowLZobrazit okno s informacemi o programuPop-up the about box MainWindow2Zobrazit dialog s volbamiPop-up the options dialog MainWindowUkon itQuit MainWindow Ulo~itSave MainWindowUlo~it &jako... Save &As... MainWindow,Ulo~it vstupn YetzceSave the input strings MainWindowNUlo~it vstupn Yetzce pod novm nzvem+Save the input strings under a new filename MainWindow.Ulo~it neulo~en zmny?Save unsaved changes? MainWindowUlo~eno %1Saved %1 MainWindow"Nastavit volby...Set Options... MainWindow.Ukzat text s npovdouShow the help text MainWindowUkon it programTerminate the program MainWindow<p>PYidejte Yetzce s urychlova i (napY., Vyj&amp;mout, &amp;Koprovat, &amp;Vlo~it, U&amp;kon it, &amp;Ukon it) pro zlepaen soudr~nostiu

Add strings with accelerators (e.g., Cu&t, &Copy, &Paste, E&xit, &Quit) to improve consistency OptionsDlgAbeceda: Alphabet: OptionsDlgAlt_Key - VolbyAlt_Key - Options OptionsDlgFNahrt posledn soubor pYi spuatnLoad Last File at Startup OptionsDlg4PYednastaven urychlova e:Predefined Accelerators: OptionsDlgdVyzvat pYi ukon en kvoli ulo~en neulo~ench zmn&Prompt to Save Unsaved Changes on Exit OptionsDlgJObnovit pracovn prostor pYi spuatnRestore Workspace at Startup OptionsDlgZnaky, kterch lze pou~t jako urychlova o, obvykle A-Z nebo 01-9A-ZGThe characters that can be used as accelerators, usually A-Z or 01-9A-Z OptionsDlgH0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ _Alphabetalt_key-2.2.5/alt_key_cz.ts0000644000000000000000000003474711722111646015622 0ustar rootroot00000000000000 MainWindow 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ Calculate Spočítat Calculate the accelerators Spočítat urychlovače New Nový Clear the input text edit ready for a new list Smazat pole pro zadávání textu, aby bylo připraveno pro nový seznam Load... Nahrát... Load a plain text file of input strings Nahrát soubor s prostým textem vstupních řetězců Save Uložit Save the input strings Uložit vstupní řetězce Save &As... Uložit &jako... Save the input strings under a new filename Uložit vstupní řetězce pod novým názvem Copy to Clipboard Kopírovat do schránky Copy the accelerated strings to the clipboard Kopírovat urychlené řetězce do schránky Set Options... Nastavit volby... Pop-up the options dialog Zobrazit dialog s volbami Help Nápověda Show the help text Ukázat text s nápovědou About O programu Pop-up the about box Zobrazit okno s informacemi o programu Quit Ukončit Terminate the program Ukončit program F1 F1 Ctrl+S Ctrl+S Alt_Key Alt_Key Alt_Key - Unsaved Changes Alt_Key - Neuložené změny Save unsaved changes? Uložit neuložené změny? All %1 accelerated Všech %1 urychleno %1/%2 accelerated %1/%2 urychleno '%1' %2 %3 %4 %5% quality %6 %7 '%1' %2 %3 %4 %5% kvalita %6 %7 <b><u>%1</u></b> <b><u>%1</u></b> Copied result strings to the clipboard Výsledné řetězce zkopírovány do schránky Alt_Key - Unnamed Alt_Key - Bez názvu Alt_Key - Load Strings Alt_Key - Nahrát řetězce Alt_Key Files (*.acc) All (*) Soubory Alt_Key (*.acc) Vše (*) <font color=red>Failed to load: %1 <font color=red>Nepodařilo se nahrát: %1 Alt_Key - %1 Alt_Key - %1 Loaded %1 Nahráno %1 <font color=red>Failed to save: %1 <font color=red>Nepodařilo se uložit: %1 Saved %1 Uloženo %1 Alt_Key - Save Strings Alt_Key - Uložit řetězce Alt_Key - Help Alt_Key - Nápověda Alt_Key - About Alt_Key - O programu <p><b><a href="http://www.qtrac.eu/alt_key.html">Alt_Key</a> %1</b> by Mark Summerfield.<p>Copyright &copy; 2008-12 <a href="http://www.qtrac.eu">Qtrac</a> Ltd. All rights reserved.<hr><p>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 3 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 (in file <tt>gpl-3.0.txt</tt>) for more details. <p><b><a href="http://www.qtrac.eu/alt_key.html">Alt_Key</a> %1</b> od Marka Summerfielda.<p>Autorské právo &copy; 2008-12 <a href="http://www.qtrac.eu">Qtrac</a> Ltd. Všechna práva vyhrazena.<hr><p>Tento program je svobodný software: Tento balík je svobodným softwarem; můžete jej rozdávat a/nebo upravovat za podmínek GNU General Public License (GPL), jak jsou zveřejněny Free Software Foundation; buď ve verzi 2 licence, nebo (podle své volby) v kterékoli pozdější verzi. Tento balík je šířen v naději, že bude užitečný, ale BEZ JAKÉKOLI ZÁRUKY; také bez předpokládané záruky PRODEJNOSTI nebo POUŽITELNOSTI PRO NĚJAKÝ URČITÝ ÚČEL: Více podrobností naleznete v GNU Library General Public License (v souboru <tt>gpl-2.0.txt</tt>). {1<?} {2008-12 ?} {3 ?} {3.0.?} <p><b><a href="http://www.qtrac.eu/alt_key.html">Alt_Key</a> %1</b> by Mark Summerfield.<p>Copyright &copy; 2008-9 <a href="http://www.qtrac.eu">Qtrac</a> Ltd. All rights reserved.<hr><p>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 3 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 (in file <tt>gpl-3.0.txt</tt>) for more details. <p><b><a href="http://www.qtrac.eu/alt_key.html">Alt_Key</a> %1</b> od Marka Summerfielda.<p>Autorské právo &copy; 2008-9 <a href="http://www.qtrac.eu">Qtrac</a> Ltd. Všechna práva vyhrazena.<hr><p>Tento program je svobodný software: Tento balík je svobodným softwarem; můžete jej rozdávat a/nebo upravovat za podmínek GNU General Public License (GPL), jak jsou zveřejněny Free Software Foundation; buď ve verzi 2 licence, nebo (podle své volby) v kterékoli pozdější verzi. Tento balík je šířen v naději, že bude užitečný, ale BEZ JAKÉKOLI ZÁRUKY; také bez předpokládané záruky PRODEJNOSTI nebo POUŽITELNOSTI PRO NĚJAKÝ URČITÝ ÚČEL: Více podrobností naleznete v GNU Library General Public License (v souboru <tt>gpl-2.0.txt</tt>). OptionsDlg Alphabet: Abeceda: The characters that can be used as accelerators, usually A-Z or 01-9A-Z Znaky, kterých lze použít jako urychlovačů, obvykle A-Z nebo 01-9A-Z Predefined Accelerators: Přednastavené urychlovače: <p>Add strings with accelerators (e.g., Cu&amp;t, &amp;Copy, &amp;Paste, E&amp;xit, &amp;Quit) to improve consistency <p>Přidejte řetězce s urychlovači (např., Vyj&amp;mout, &amp;Kopírovat, &amp;Vložit, U&amp;končit, &amp;Ukončit) pro zlepšení soudržnosti Prompt to Save Unsaved Changes on Exit Vyzvat při ukončení kvůli uložení neuložených změn Restore Workspace at Startup Obnovit pracovní prostor při spuštění Load Last File at Startup Nahrát poslední soubor při spuštění Alt_Key - Options Alt_Key - Volby QObject 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ Accelerator Keys 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ _Alphabet 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ Accelerator Keys 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ alt_key-2.2.5/example.acc0000644000000000000000000000277611722111646015226 0ustar rootroot00000000000000# Examples Add Edit Delete Delete Edit Add Cu&t &Copy Paste Find && Replace Replace Basic Advanced Automatically Save on Exit Restore Workspace on Startup Remember Clipboard between Sessions Notebook Edit Clipboard Promotion Notes Calendar Calendar &View Calendar &Goto Note Clipboard Edit Search Style Font Alignment Category Type Title Forenames Surname Company Email Phone Mobile URL Find New Duplicate Update Delete Configure Statistics Export Open Save Quit Remaining Issues Type Title Forenames Surname Company Email Phone Mobile URL Find New Duplicate Update Delete Configure Statistics Export Open Save Quit Lists New List Duplicate List Delete List Items New Rename Up Down Delete Configure About Quit Initial No Max Supportable No Initial Memory Size Mutation Rate Survival Rate Start Pa&use Zoom General Remember Geometry Start With Editor &Window Start With &Shell Window Automatically Hide the Find and Replace dialog Input prompt Output prompt &Python executable Working directory Show Window Information at Startup Max Tooltip Length Max Lines to Scan Highlighting Tab width Font On New File At Startup Python Documentation Undo Redo &Copy Cu&t &Paste Select &All Complete &Find Find &Next R&eplace Next Goto Line Goto &Matching Indent Region Unindent Region Comment Region Uncomment Region Add Top-Level Term Add Sub-Term of Add Child-Term of Add Sibling-Term of Find Insert Unicode Character Bold Italic Underline Strike-out Superscript Subscript No Superscript or Subscript Monospace Sans Serif Serif alt_key-2.2.5/help.html0000644000000000000000000000535411722111646014734 0ustar rootroot00000000000000 Alt_Key Help

The Alt_Key program is used to show where keyboard accelerators (mnemonics in Gtk-speak) should go in menu option texts and dialog labels. The program produces optimal results on the basis that the best accelerator is the first character, the second best is the first character of a word, the third best is any character, the worst is no accelerator at all, and no accelerator should be used more than once. (When there are choices the algorithm favours an uppercase letter at the start of a word over a lowercase one, and favours words nearer the beginning.)

Enter a list of strings (such as menu option texts or dialog labels), one per line, in the left hand text edit. You can use the standard keyboard shortcuts (e.g., Ctrl+A to select all, Ctrl+C to copy, Ctrl+X to cut, Ctrl+V to paste, Ctrl+Z to undo), when editing the text. You can save your strings by clicking Save (or by pressing Ctrl+S). Once you have entered your strings, click Calculate and the right hand (read-only, but selectable with Ctrl+A) text edit will show the same list of strings but with accelerators added. You can copy the accelerated strings to the clipboard by clicking the Copy to Clipboard button.

If you want to force a particular accelerator to be used (for example, Cut in an Edit menu), precede the character to be accelerated with an ampersand (e.g., Cu&t). If you want a literal &, use &&. Lines can be turned into comments by starting them with #. If you want to ensure consistency you can set some global predefined accelerators in the Options dialog, for example, Cu&t and &Copy.

If you want to have more than one list of strings (two or more lists of menu option texts or two or more sets of dialog labels, perhaps from different tabs), simply separate each list with a single (uncommented) blank line—then, when you click Calculate each list will be calculated individually.

A summary of the results are output in the log area at the bottom of the main window.

The quality is a measure against the optimal results criteria—in most cases it is impossible to get a quality of 100% (since this means that the first character of every string is used as an accelerator, and quite often two or more strings begin with the same character), but providing there are fewer strings than the alphabet being used (normally < 36), then a quality of > 50% should be routinely achieved.

Several example files are supplied; they all have .acc extensions. Now that the Kuhn-Munkres algorithm is used calculations are always "instantaneous". alt_key-2.2.5/images/editcalculate.png0000644000000000000000000000256111722111646017671 0ustar rootroot00000000000000PNG  IHDR szzgAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxb?@bb`@p ###-]`@L, !As.bpXp}~1}z0 2gɰ!!sddh`.va3@11bxC) |@L52(2{q7 oZͰz@L@?oedr12t2̣#&- P\Yг_341LfT_@37CCZ<b1?CZpÑG>{a-C9P AQ@͖/_c;10|fPǐDTZ 8VvV # csc?0ۼO_\ư,P3PO @_3}g*e+[ Ku ; 4Y_TA[W Vb= '.Y6 -e' @GV V0313(0|fn2yl@-(% @HK, *˰a=> E @nƠ t)>4ف(|AkA@*y = Ӂy3chVr (;0;>cdx #bA fb/4Se ~|rH{NL. ,]Vpp7 W@, @!0"X-xaP@˷28Y I#(ϰnK$̔t+}e8 c "r `L{ЄAerpp X^ON @M񘖃r" ~ W$;9@;?01|D*4Ax-8]cl\b9JN l0VhN!pǰXȥE ^k# 03?_mb@ؚ~:.H}0 CTb9~W` V> @xFŠU+[G$b# @M@@;{+IENDB`alt_key-2.2.5/images/editcancel.png0000644000000000000000000000267411722111646017166 0ustar rootroot00000000000000PNG  IHDR szzgAMA7tEXtSoftwareAdobe ImageReadyqe<NIDATxb?@b O>erـ\O3g8_! eb&dybf9Pp<+YJ PX4k?=̕ 9@a.d{%@?5guJǷeçir @iRRG E e@i# i 0U0:0"`OlH|.&/o*#CBn,XH."!E fN@GL"l3 q4*C.#i ?uxVO|h11>!NEFZ;7/|~r_?AP׉au#o;3y묟  /3!Ñ3,mŰL g4Pu`X+p)?{댟 eK0@\ À@q vd!'2p $vb? g=7s4)0R;(薃@xZW|j/&G@ w((An9_8 Jd-ȲvPŹG8o-Y@w(s -#@am^Y{ZpG2۳3Ք啳v @LjkFPV2 _[\@ K8¿}óW߾a/И@Lj,gAUBAǕaY  m9OAMA׆au#3 (\a9A?~3q3H2HX@ NJȖ 1<Chȉ P@NJ , @q vt33MFp~|? GX篫X@ `Gn2@p@pJ\˟B9(hF#쀳y<-@Ab`U;{_w@G00h8|P7[K n(^ >')~;5;J-rv#1/(ob6-ҍ@7uL@u1e_[p3|`7́X H{>]gW > 1Š  {F`G; ex_$r8r9;i(;9! ˱:r  l!$?R 8T 8!D)0'EmNIENDB`alt_key-2.2.5/images/editcopy.png0000644000000000000000000000155711722111646016712 0ustar rootroot00000000000000PNG  IHDR szzbKGD pHYs  tIME 8dkIDATxŗMoFY@5Dž|(@^co!ڿaXA{^Ӑܙ4MZ%Z*DaξJܝOY"닿F8;_ӏ?Ȧ{u-.͛_~mwL,xoûwWtz aU e,yt3}A"D@iaG|WO>sNu fgf_V4M S/DC, sRPcf(lW0d7>PuL&&Z|g<=w>QJ U%K**b !Tc104 sL S+2B H2&F؆X)T̪P6(EQ < ;^ Ry%q' NnrRVBܥ[vP&ڃ;p]> Ax'2eSO&m qAlM*-qg9֍*f^{(3f}؂[^E})fV?;W&e9 %"Çfz#ܫ07BXJUD.*Y,662vʓu':=}ϟP 5c^s.,Gܤ-X6sg:EYL>ۙvԅ]f͙&gخ}XUVtIbwalۍl [('N/S=X1ƋIENDB`alt_key-2.2.5/images/editoptions.png0000644000000000000000000000404111722111646017422 0ustar rootroot00000000000000PNG  IHDR szzgAMA7IDATxkpUsy$KKIxJtmjeǶؙvG 8XhAIy\Cb]3g·Z/\r?ݳ@ź,?5~7mf^HsR?c7ğ[E o6#̀'wRnK؀ 8Z.'xn({-lm s!H4 gs;o]҇J~?]llk$x̏݀d6t>LJoL ttJOɁ .PP^zcgNdrPC F0T*J(KBK܍- 1Ӄw+҃^f$΍z~['5{^qׇi0˃`hE3!xd8l @ yYӡ0+q' =)p, r 9 T  Qo}$d- | C@-!A_6@ʹͬO;3\ N e17 Ck89%9з7o$V~[m^ctbǵ@|sA^U栦OKn}fM5s_fĒgkoM]zGVԝpxb< 2.-[>WlKGJsد%Xѵjͬ]uk9|uDP@1 F$ih٩npfM/z4a]/}:yloX0TS{q]g73wSy0Ab#@P*`JRMRl&BuG) ##%Fi/tV 9ӭ݃ŗhR Ȟ2n0#ՠ@*Kp] z:Gϣ~fặI.*` )N@H^' -&$ÁBB( Ùc =\l+odm<5Gv !?E>BU"жr@( 4-{0uza!1lz{󂤾)оvA8?;nAfÌj1jE(|SQ4jk?$AU̜m2l1vxH8-{hBmo%T0a"k4WLw?%;jn9T@BК(\sN1a36R5A,VIC}fT13bԤi!f; )&,G:Z(` 30uSB Ȫyuaj#[ccHq9g["] A)!,@f`4jy`J|/q$ mUA?TU2hnX *PqFI,Q+h:ok}gՖe +^x)cՆ15+&@1lUn'R#H[ytDj.`y&WF=cF˲k*pr)'0Orx3w$i7%鈠ZE ¶]ljiE{@~݌Y肋%h@ ]tgJG Q-TGǯm,8ݴp-  ]oM< wKrߡ>]]XtEC %.[ -TzK9g|8K[ڦ;33GhdQLk0hWG5+HQPEвL5CC,^CV[乮|mxO8ArJ!@J1-)%H |>A%Ykbn 42SI%CMmj&Yf 4 nxefP͚/Ss<7M0~Y+J6űPS[|n+HO !> ~,1)έ+FPS[֢K!L~22 Y~%UZPS[1R94ݡ]p5()h9W?[*Er`6˳y;q#Ük?Wg@2(Mp]/D.oK+H'=b[+(gb@;+ʋy2137&~b 7h3o> @BB A?|߿Lg(:(盶{|޷?| 5 y_m_?1@kC<4Pw Q`#dV/ vPΓz\⹤IXTP7IANǏ ?.&& o<FFT $>'߀A?C=>(Eow[[+0ؘ+;޿pc#Wna}(9$\g'A\ ?͛ 1F 7ᅨGQ5@Ϡ@ @!>=%K#yCM_$x>~x4 4-@,D?sxyH˭W~ar ǧ l, ~KxZno_ H@~}ȐoM<r@CAEN~gзaP P6{ OL e o0I1dEj3| I /Nj2|q p6cNtBʇD0 eG/1k2dGk3=+lp,Xz& ܿv hx2,-ga=AA(˂gdge`x ,uu!c71`(CW >f |bbecOX^|_@>C=oO3\=r+/^2dr((GJ쵻14F)1Ug| fP%_@f2|\O_gx? ?eÏo~WwO1{_30ga`$x@D Bh~o >B "P B w>|¿`   /0H~AJ@vn?0;B@O|E ȹ'{`pH(:0?+`!? `/|ңw ^-XJ@ 7$1_O?1| /# Ç@%Ba0Ó/ ` SS023 ?`_C踗20rr10:?7zu +O | 19@_ #$ 030~3<}򙁓 )2P (/!O ,#C' u_4?8a0ky1 ?@dBA * yyC2x(@pϩODÈ F`T1[;L@&&`EQ@*ξÏ@׽Y @Ag3$a/!l!n#,e!?|cq V!]gE3p!)Sgf8x @ν r R;L"D '0?~1|HT5}c`vШ/b{`!\~Z72C Zf/0c`7$A\C񿟯o~)@jYk,"h"(C)&+PM+E"ѡ!\'t`||p4aRJDP=%Ϥ*3g2>8/@8i3Rnp"M(@²mL)VVpVVu?˗Yuu6mcZ##$wBVǸX$  f\ `5<]3/ZG$29IRupqP.' @|x 5űm37ݹ9"CCt=07=͛WW*qPJ#J=_~ק)b}-DL`N]*ѿo_^5Mǜ;r?@{;kkD,d\KG"`sϑf4DDL\~cdu۷_~O^c==,5M"Dq sϑI|ڳtw7dH(Ze+7O`$K% }Na.\4T:sLї_@ꪖ֑JN&;ؗJΝMO>;wTH?ǵmb]]daLYu۶^Bxfh 84Tp,FPiiSM Tivc jyW]C5ZZ䭁4ׅJe\if,k j!P^Xw {y=bmJR*A>b]iV2*J t۶єBjU"B\׃LĶlR.#Qߐ!+-C?7@S cz:8>NAu(P5fe0J)@6 hW)AOYVv0T oUFڡL@k/ou*٬Px);X#Fw.]"i!PfQ4R eu" ލo_J}ƭ?v&޽たs1{ʉ`!k Z_'BiObO8y2 a"CZeO(D[4y|o)=XooЦ Akdbx]‡SY)Qtk^6l&*Gdo!B br}=z&&hn;)^FU"6:JmQl4Cm AS4 /D䭷|O2]#w1y(:oJV{̞=%f9w&5ܷk&8zהBD8sۋ%66F֭W2Tfg.,01mP*eIsMZҵ)ŃO?~qY Mcs8d^Z*:0uPx\넓(Eֹ&Yms"u*E_Ŀ'[lf~q .t`f>ʶ͂_װ]R?y =kIENDB`alt_key-2.2.5/images/filesave.png0000644000000000000000000000250411722111646016661 0ustar rootroot00000000000000PNG  IHDR szzgAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxb?@bb`@bAX߿0ϟ@ FШ?`5U #w.Ɉn@8`m1AFB,~M2$r ~fpr.oo#7o?E8ԿARTFp+280HJ|5`pZn.v#yA>.~.Լ_~1&;bAW90 )& ry'Z=8$Ju7觏tj@!(P ͘A_S<$;o2&D 0!rX@]Yyܯ^}` @G@8*^4' > _&?r \A;Q !ѠtW_" 0Pri 0.9_|c$3ߘ!@Q(/0 n1@w@gXDXӿVFVvfF.Vf%" PK' Kf9( \r o"cHQq_$=C [^0 BXkJP(@a?H R F`D {@5~ǐ/ ¼@ox `9w`EjAG98,vF"*(@e,֬p%JHP, T2?xars!?PAB'@PaT@oC* >FNp(#CȆ"!i l0#3A}c``c?C2`QBq}+pb{Fky^??ڦ F 10Hp7@ |]7PJ s @7w@p RIENDB`alt_key-2.2.5/images/filesaveas.png0000644000000000000000000000402511722111646017205 0ustar rootroot00000000000000PNG  IHDR szzgAMA7tEXtSoftwareAdobe ImageReadyqe<IDATxb?5)ՙ~}x3e7~^?wgOH/@Q2@vCO/@Ba#_FF?1AՀhY x𥜁V?O{ΧA@_> cK\E VOdP2p%0~+ #.o~O?0od``e`ge8C_fe``:rn>0ܔgpa j PZn.v#yA>.~.ySho@5L nc+&Q@,Z @6 0H 0>00lc`dd`xL _f ԇJHB Q~ @^fx ho?]8j3k1?/``VZh9ec`&LO݋>W~3+Aâpjs@P'P`xx ×}k@f:_p"T?PAA<Ǡ|"0 v 1%Û}~.7~b=8*;Q F+Ơo Lt@YvfvPrx@AB ,BPII|߄d 7$ @1|L= 2 ˿Cх+ 9>[ o`T;ѐv @,a /`I/?X &@` XN=bg`Y Wh 1!)A k-KA߀Eϟ}C 4?/+dy%f<3k=Pt1aNb 7`!1p=bl,~}}z@C3lƏ??H Rp9}@)? ~F0 r_~@a >" }ǐNrPe`,r|:XF +ý.J2|q`22tڮbՂ ?~f&ʿ( 00F]pZx:s%.[فY(8 ( @7x$(03]6 0:ñ^d3R l_p=, 8Pp} Xu0QJc'RT,_Yhod8̟JŠ2\V&@.}2(2ppY/Y Ь )x  :8[< 2~660\l?h-ήK17?_C *:(q'Bb׿> @XZ% _R UD!Jο(YX,02 ×  @0dO#$ ,~h3 eOp,%A W&` ~H !3N/`{O#(1޽{)|D~$Ty__We\8@10Hp7=x0lt/@Ճ::p ZSr@11 0w@{()IENDB`alt_key-2.2.5/images/helphelp.png0000644000000000000000000000306311722111646016665 0ustar rootroot00000000000000PNG  IHDR szzbKGD pHYs  #utIME 0u?IDATxŗMl\~sr*R&FTi iQ$"@Y{($ҫ{񢗢HQuZh+;b&vR5-ڪAR!%XÒ)&K0ٙy/rhil5 LJƜ KlA,#oܙ ,`":yVBH,)|2m@` DÉGDA(]2r80ui:c.|.k[,qMX{J|Je h |&x.F 2]4Ft?=چM4}RgQ7J| Ú=3} a|O|*Ǝ֎3zyyi/?ͥmt,^mDssA 8UHe+PlgΡgƨWn"0jv מwT d/A"7pk g;q!wZJ]Pxn丆S w;7pmY뫐/W}4~Ʌwu恳q('4MnsNn&aYP,Mpʕ=h<fM"C0S)i nBmIs|X%V] 7,5 $+Rzn : IMFy6|hl;4 %%(|kzTZG%W@C?)AxKZkQ1"5e1PǏ_=WXڄ(^ zuB .K)~Fwm[ʩG@x\AqޓJOJoۃaI|U(g~&"mk|L K{PyD4ug$ki e6LDlI!I٠*hC;(.Utʹd[5,%#ֿS16P,y5!0@suqfu+Ǘ823FOHd 2Wj'fNH.+*='~^yU #Cm2yĥʹ\~@&>zT.G29FO_ِǬ2L&C‘0Nkx rA3;fNHf$w#dRwU{iPr;ݾɛ#M@]񩜙>dM +cm|XSgφ~oӒɤ珆HDCu]ZH#~s#bL26$ yqP,qL 6伀;.&B\g̺][z^N[ K dw..z f\\ {St5s;Ft(_myCIENDB`alt_key-2.2.5/images/icon.png0000644000000000000000000000150711722111646016015 0ustar rootroot00000000000000PNG  IHDR szzIDATXWKLQ=ZZE)[HI qntÂdWl a϶+$TaЙiLJ7i{w=vywf` AH*5G/k|viHA2\\QH$fܩ$?j* .~QQ|_V8`, H$Oݘx||l+Z"`FpEY*)|7/di,0.ye:9p htB}G _YeJ@9ams%"Dq3IͮdrZ~^M|%2XN'e!5E-3P/V:݆2hheW՝#nMN2~Q Q~c ׿"<2j/.`I?}Tojgb2ߌ DA"o4o,xnk4cY ?boon\T5Q BY4MxxonvC`UU@H (-u$踪-$|J9b`uԕ@ur82[<*5Ebi郮K N־/*&<" r044o8Zi W2_T8Ww_ϺfkdB!Yk\Ў[HO] /jNq{7~NZsŢJExYg5 M _܂QrlFF(#eE&aU'PzEryzIENDB`alt_key-2.2.5/kuhn_munkres.cpp0000644000000000000000000002172011722111646016326 0ustar rootroot00000000000000/* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. This is based on Brian M. Clapper's Python 2 implementation at http://www.clapper.org/bmc/ itself based on the implementation at http://www.public.iastate.edu/~ddoty/HungarianAlgorithm.html */ #include "kuhn_munkres.hpp" #include KuhnMunkres::Indexes KuhnMunkres::calculate(const Grid &grid) { grid_ = grid; const Dimensions dimensions = ensure_grid_is_square(); size = static_cast(grid_.size()); #ifdef USE_STL row_covered.resize(size, false); column_covered.resize(size, false); #else row_covered.fill(false, size); column_covered.fill(false, size); #endif z0_row = 0; z0_column = 0; path = make_grid(size * 2, static_cast(ZERO)); marked = make_grid(size, static_cast(ZERO)); int step = 1; while (step) { switch (step) { case 1: step = step1(); break; case 2: step = step2(); break; case 3: step = step3(); break; case 4: step = step4(); break; case 5: step = step5(); break; case 6: step = step6(); break; default: break; } } Indexes indexes; for (int row = 0; row < size; ++row) { for (int column = 0; column < size; ++column) { if ((row < dimensions.first) && (column < dimensions.second) && marked.at(row).at(column) == STAR) #ifdef USE_STL indexes.push_back(std::make_pair(row, column)); #else indexes.push_back(qMakePair(row, column)); #endif } } return indexes; } KuhnMunkres::Dimensions KuhnMunkres::ensure_grid_is_square() { int max_columns = 0; int total_rows = grid_.size(); for (int row = 0; row < total_rows; ++row) max_columns = std::max(max_columns, static_cast(grid_.at(row).size())); total_rows = std::max(total_rows, max_columns); const int rows_used = grid_.size(); const int columns_used = max_columns; Grid new_grid; for (int row = 0; row < static_cast(grid_.size()); ++row) { Row new_row(grid_.at(row)); #ifdef USE_STL new_row.resize(total_rows, DBL_MIN); #else // QVector::fill() is _not_ the same as std::vector::resize()! new_row.reserve(total_rows); while (new_row.size() < total_rows) new_row.push_back(DBL_MIN); #endif new_grid.push_back(new_row); } while (static_cast(new_grid.size()) < total_rows) new_grid.push_back(Row(total_rows, DBL_MIN)); grid_ = new_grid; #ifdef USE_STL return std::make_pair(rows_used, columns_used); #else return qMakePair(rows_used, columns_used); #endif } template #ifdef USE_STL std::vector > #else QVector > #endif KuhnMunkres::make_grid(int size, T value) { #ifdef USE_STL std::vector > grid; grid.resize(size, std::vector()); #else QVector > grid; grid.fill(QVector(), size); #endif for (int row = 0; row < size; ++row) #ifdef USE_STL grid[row].resize(size, value); #else grid[row].fill(value, size); #endif return grid; } int KuhnMunkres::step1() { for (int row = 0; row < size; ++row) { double minimum = grid_.at(row).at(0); for (int column = 1; column < size; ++column) minimum = std::min(minimum, grid_.at(row).at(column)); for (int column = 0; column < size; ++column) grid_[row][column] -= minimum; } return 2; } int KuhnMunkres::step2() { for (int row = 0; row < size; ++row) { for (int column = 0; column < size; ++column) { if (is_zero(grid_.at(row).at(column)) && (!row_covered.at(row)) && (!column_covered.at(column))) { marked[row][column] = STAR; row_covered[row] = true; column_covered[column] = true; } } } clear_covers(); return 3; } int KuhnMunkres::step3() { int count = 0; for (int row = 0; row < size; ++row) { for (int column = 0; column < size; ++column) { if (marked.at(row).at(column) == STAR) { column_covered[column] = true; ++count; } } } return (count >= size) ? 0 : 4; } int KuhnMunkres::step4() { int step = 0; bool done = false; int row = -1; int column = -1; int star_column = -1; while (!done) { Index index = find_a_zero(); row = index.first; column = index.second; if (row < 0) { done = true; step = 6; } else { marked[row][column] = PRIME; star_column = find_star_in_row(row); if (star_column >= 0) { column = star_column; row_covered[row] = true; column_covered[column] = false; } else { done = true; z0_row = row; z0_column = column; step = 5; } } } return step; } int KuhnMunkres::step5() { int count = 0; path[count][0] = z0_row; path[count][1] = z0_column; bool done = false; while (!done) { int row = find_star_in_column(path.at(count).at(1)); if (row >= 0) { ++count; path[count][0] = row; path[count][1] = path.at(count - 1).at(1); } else done = true; if (!done) { int column = find_prime_in_row(path.at(count).at(0)); ++count; path[count][0] = path.at(count - 1).at(0); path[count][1] = column; } } convert_path(count); clear_covers(); erase_primes(); return 3; } int KuhnMunkres::step6() { double minimum = find_smallest(); for (int row = 0; row < size; ++row) { for (int column = 0; column < size; ++column) { if (row_covered.at(row)) grid_[row][column] += minimum; if (!column_covered.at(column)) grid_[row][column] -= minimum; } } return 4; } void KuhnMunkres::clear_covers() { #ifdef USE_STL row_covered.assign(size, false); column_covered.assign(size, false); #else row_covered.fill(false, size); column_covered.fill(false, size); #endif } KuhnMunkres::Index KuhnMunkres::find_a_zero() { int row = -1; int column = -1; int i = 0; bool done = false; while (!done) { int j = 0; while (true) { if (is_zero(grid_.at(i).at(j)) && (!row_covered.at(i)) && (!column_covered.at(j))) { row = i; column = j; done = true; } ++j; if (j >= size) break; } ++i; if (i >= size) done = true; } #ifdef USE_STL return std::make_pair(row, column); #else return qMakePair(row, column); #endif } int KuhnMunkres::find_star_in_row(int row) { int column = -1; for (int j = 0; j < size; ++j) if (marked.at(row).at(j) == STAR) { column = j; break; } return column; } int KuhnMunkres::find_star_in_column(int column) { int row = -1; for (int i = 0; i < size; ++i) if (marked.at(i).at(column) == STAR) { row = i; break; } return row; } int KuhnMunkres::find_prime_in_row(int row) { int column = -1; for (int j = 0; j < size; ++j) if (marked.at(row).at(j) == PRIME) { column = j; break; } return column; } void KuhnMunkres::convert_path(int count) { for (int i = 0; i <= count; ++i) { int &x = marked[path.at(i).at(0)][path.at(i).at(1)]; x = (x == STAR ? ZERO : STAR); } } void KuhnMunkres::erase_primes() { for (int row = 0; row < size; ++row) { for (int column = 0; column < size; ++column) { int &x = marked[row][column]; if (x == PRIME) x = ZERO; } } } double KuhnMunkres::find_smallest() { double minimum = DBL_MAX; for (int row = 0; row < size; ++row) { for (int column = 0; column < size; ++column) if ((!row_covered.at(row)) && (!column_covered.at(column))) { if (minimum > grid_.at(row).at(column)) minimum = grid_[row][column]; } } return minimum; } alt_key-2.2.5/kuhn_munkres.hpp0000644000000000000000000000511511722111646016333 0ustar rootroot00000000000000#ifndef KUHN_MUNKRES_HPP #define KUHN_MUNKRES_HPP /* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. This is based on Brian M. Clapper's Python 2 implementation at http://www.clapper.org/bmc/ itself based on the implementation at http://www.public.iastate.edu/~ddoty/HungarianAlgorithm.html */ #include #include #ifdef USE_STL #include #else #include #include #endif class KuhnMunkres { public: #ifdef USE_STL typedef std::pair Index; typedef std::vector Indexes; typedef std::vector Row; typedef std::vector Grid; #else typedef QPair Index; typedef QVector Indexes; typedef QVector Row; typedef QVector Grid; #endif explicit KuhnMunkres() {} Indexes calculate(const Grid &grid); static bool is_zero(double x) { return std::fabs(x) <= DBL_EPSILON; } private: #ifdef USE_STL typedef std::pair Dimensions; typedef std::vector IntRow; typedef std::vector IntGrid; #else typedef QPair Dimensions; typedef QVector IntRow; typedef QVector IntGrid; #endif enum {ZERO, STAR, PRIME}; Dimensions ensure_grid_is_square(); template #ifdef USE_STL std::vector > make_grid(int size, T value); #else QVector > make_grid(int size, T value); #endif int step1(); int step2(); int step3(); int step4(); int step5(); int step6(); void clear_covers(); Index find_a_zero(); int find_star_in_row(int row); int find_star_in_column(int column); int find_prime_in_row(int row); void convert_path(int count); void erase_primes(); double find_smallest(); Grid grid_; #ifdef USE_STL std::vector row_covered; std::vector column_covered; #else QVector row_covered; QVector column_covered; #endif int z0_row; int z0_column; IntGrid path; IntGrid marked; int size; }; #endif // KUHN_MUNKRES_HPP alt_key-2.2.5/main.cpp0000644000000000000000000000326211722111646014542 0ustar rootroot00000000000000/* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. */ #include "mainwindow.hpp" #include #include #include #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setCursorFlashTime(0); app.setOrganizationName("Qtrac Ltd."); app.setOrganizationDomain("qtrac.eu"); app.setApplicationName("Alt_Key"); QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); QString language = QLocale::system().name(); const QString LanguageOption = "--language="; if (app.arguments().count() > 1) { const QString arg = app.arguments().at(1); if (arg.startsWith(LanguageOption)) language = arg.mid(LanguageOption.length()); } QTranslator qtTranslator; qtTranslator.load("qt_" + language, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); app.installTranslator(&qtTranslator); QTranslator appTranslator; appTranslator.load("alt_key_" + language, ":/"); app.installTranslator(&appTranslator); MainWindow window; window.show(); return app.exec(); } alt_key-2.2.5/mainwindow.cpp0000644000000000000000000003666711722111646016011 0ustar rootroot00000000000000/* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. */ #include "alt_key.hpp" #include "mainwindow.hpp" #include "optionsdlg.hpp" #include "syntaxhighlighter.hpp" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), helpDialog(0), alphabet(tr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")), prompt_to_save_on_exit(true), restore_workspace_at_startup(true), load_last_file_at_startup(true) { QSettings settings; alphabet = settings.value("alphabet", alphabet).toString(); prompt_to_save_on_exit = settings.value("prompt_to_save_on_exit", prompt_to_save_on_exit).toBool(); restore_workspace_at_startup = settings.value( "restore_workspace_at_startup", restore_workspace_at_startup).toBool(); load_last_file_at_startup = settings.value("load_last_file_at_startup", load_last_file_at_startup).toBool(); predefined_accelerators = settings.value("predefined_accelerators") .toStringList(); inputText = new QTextEdit; SyntaxHighlighter *highlighter = new SyntaxHighlighter(inputText); inputText->setAcceptRichText(false); inputText->setTabChangesFocus(true); outputText = new QTextBrowser; outputText->setObjectName("OutputText"); highlighter = new SyntaxHighlighter(outputText); outputText->setTabChangesFocus(true); logText = new QTextBrowser; logText->setObjectName("LogText"); logText->setTabChangesFocus(true); calculateButton = new QPushButton( QIcon(":/editcalculate.png"), tr("Calculate")); calculateButton->setToolTip(tr("Calculate the accelerators")); QPushButton *newButton = new QPushButton( QIcon(":/filenew.png"), tr("New")); newButton->setToolTip(tr("Clear the input text edit ready for a " "new list")); QPushButton *loadButton = new QPushButton( QIcon(":/fileopen.png"), tr("Load...")); loadButton->setToolTip(tr("Load a plain text file of input strings")); QPushButton *saveButton = new QPushButton( QIcon(":/filesave.png"), tr("Save")); saveButton->setToolTip(tr("Save the input strings")); QPushButton *saveAsButton = new QPushButton( QIcon(":/filesaveas.png"), tr("Save &As...")); saveAsButton->setToolTip(tr("Save the input strings under a new " "filename")); QPushButton *copyButton = new QPushButton( QIcon(":/editcopy.png"), tr("Copy to Clipboard")); copyButton->setToolTip(tr("Copy the accelerated strings to the " "clipboard")); QPushButton *optionsButton = new QPushButton( QIcon(":/editoptions.png"), tr("Set Options...")); optionsButton->setToolTip(tr("Pop-up the options dialog")); QPushButton *helpButton = new QPushButton( QIcon(":/helphelp.png"), tr("Help")); helpButton->setToolTip(tr("Show the help text")); QPushButton *aboutButton = new QPushButton( QIcon(":/icon.png"), tr("About")); aboutButton->setToolTip(tr("Pop-up the about box")); QPushButton *quitButton = new QPushButton( QIcon(":/filequit.png"), tr("Quit")); quitButton->setToolTip(tr("Terminate the program")); QSplitter *middleSplitter = new QSplitter(Qt::Horizontal); middleSplitter->addWidget(inputText); middleSplitter->addWidget(outputText); splitter = new QSplitter(Qt::Vertical); splitter->addWidget(middleSplitter); splitter->setStretchFactor(0, 1); splitter->addWidget(logText); QVBoxLayout *rightLayout = new QVBoxLayout; rightLayout->addWidget(calculateButton); rightLayout->addStretch(); rightLayout->addWidget(newButton); rightLayout->addWidget(loadButton); rightLayout->addWidget(saveButton); rightLayout->addWidget(saveAsButton); rightLayout->addWidget(copyButton); rightLayout->addStretch(); rightLayout->addWidget(optionsButton); rightLayout->addWidget(helpButton); rightLayout->addWidget(aboutButton); rightLayout->addStretch(); rightLayout->addWidget(quitButton); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(splitter, 1); layout->addLayout(rightLayout); QWidget *widget = new QWidget; widget->setLayout(layout); setCentralWidget(widget); new QShortcut(QKeySequence(tr("F1")), this, SLOT(help())); new QShortcut(QKeySequence(tr("Ctrl+S")), this, SLOT(save())); connect(calculateButton, SIGNAL(clicked()), this, SLOT(calculate())); connect(optionsButton, SIGNAL(clicked()), this, SLOT(setOptions())); connect(newButton, SIGNAL(clicked()), this, SLOT(new_())); connect(loadButton, SIGNAL(clicked()), this, SLOT(load())); connect(saveButton, SIGNAL(clicked()), this, SLOT(save())); connect(saveAsButton, SIGNAL(clicked()), this, SLOT(saveAs())); connect(copyButton, SIGNAL(clicked()), this, SLOT(copy())); connect(helpButton, SIGNAL(clicked()), this, SLOT(help())); connect(aboutButton, SIGNAL(clicked()), this, SLOT(about())); connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); AQP::accelerateWidget(this); setWindowTitle(tr("Alt_Key")); setWindowIcon(QIcon(":/icon.png")); if (restore_workspace_at_startup) restoreGeometry( settings.value("MAINWINDOW/GEOMETRY").toByteArray()); QTimer::singleShot(0, this, SLOT(afterCreation())); } void MainWindow::afterCreation() { QSettings settings; if (restore_workspace_at_startup) { QByteArray bytes = settings.value("mainwindow/splitter") .toByteArray(); if (bytes.isEmpty()) { QList sizes = splitter->sizes(); int total = sizes[0] + sizes[1]; splitter->setSizes(QList() << (total - 15) << 15); } else splitter->restoreState(bytes); } if (load_last_file_at_startup) { QString filename = settings.value("currentfile").toString(); if (!filename.isEmpty() && QFile::exists(filename)) loadFile(filename); } } void MainWindow::closeEvent(QCloseEvent *) { if (helpDialog) helpDialog->deleteLater(); if (prompt_to_save_on_exit && inputText->document()->isModified() && QMessageBox::question(this, tr("Alt_Key - Unsaved Changes"), tr("Save unsaved changes?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) save(); QSettings settings; settings.setValue("mainwindow/geometry", saveGeometry()); settings.setValue("mainwindow/splitter", splitter->saveState()); settings.setValue("alphabet", alphabet); settings.setValue("prompt_to_save_on_exit", prompt_to_save_on_exit); settings.setValue("restore_workspace_at_startup", restore_workspace_at_startup); settings.setValue("load_last_file_at_startup", load_last_file_at_startup); settings.setValue("predefined_accelerators", predefined_accelerators); settings.setValue("currentfile", filename); QMainWindow::close(); } void MainWindow::calculate() { const QChar Cdot(0xB7); QHash hash; foreach (const QString &string, predefined_accelerators) { QString key = string; hash[key.replace("&", "").toUpper()] = string; } outputText->clear(); logText->clear(); QString data = inputText->toPlainText() + "\n"; QStringList string_lists = data.split("\n\n", QString::SkipEmptyParts); foreach (const QString &list, string_lists) { QStringList strings; QStringList fields = list.split("\n"); foreach (QString string, fields) { string = string.trimmed(); if (string.startsWith("#") || string.isEmpty()) continue; strings.append(hash.value(string.toUpper(), string)); } if (strings.join("").trimmed().isEmpty()) continue; QStringList results = AQP::accelerated(strings, alphabet); foreach (const QString &string, results) outputText->append(string); outputText->append(""); int count = AQP::numberAccelerated(results); QString number; if (count == results.count()) number = tr("All %1 accelerated").arg(count); else number = tr("%1/%2 accelerated").arg(count) .arg(results.count()); logText->append(tr("'%1' %2 %3 %4 %5% quality %6 %7") .arg(strings[0]).arg(Cdot) .arg(number).arg(Cdot) .arg(AQP::quality(results) * 100, 0, 'f', 1) .arg(Cdot).arg(highlightUnused(results))); } } QString MainWindow::highlightUnused(const QStringList &list_of_strings) { QSet used; foreach (QString string, list_of_strings) { string = string.replace("&&", ""); int i = string.indexOf("&"); if (i > -1) used.insert(string[i + 1].toUpper()); } QString result; foreach (const QChar &x, alphabet) { if (used.contains(x)) result += tr("%1").arg(x); else result += x; } return result; } void MainWindow::copy() { QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(outputText->toPlainText()); logText->append(tr("Copied result strings to the clipboard")); } void MainWindow::new_() { if (inputText->document()->isModified() && QMessageBox::question(this, tr("Alt_Key - Unsaved Changes"), tr("Save unsaved changes?"), QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes) save(); inputText->clear(); inputText->document()->setModified(false); outputText->clear(); logText->clear(); filename.clear(); inputText->setFocus(); setWindowTitle(tr("Alt_Key - Unnamed")); } void MainWindow::load() { if (inputText->document()->isModified() && QMessageBox::question(this, tr("Alt_Key - Unsaved Changes"), tr("Save unsaved changes?"), QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes) save(); QString fname = QFileDialog::getOpenFileName(this, tr("Alt_Key - Load Strings"), filename.isEmpty() ? "." : QFileInfo(filename).absolutePath(), tr("Alt_Key Files (*.acc)\nAll (*)")); if (fname.isEmpty()) return; loadFile(fname); } void MainWindow::loadFile(const QString &new_filename) { QFile file(new_filename); if (!file.open(QIODevice::ReadOnly)) { logText->append(tr("Failed to load: %1") .arg(file.errorString())); return; } QTextStream in(&file); in.setCodec("UTF-8"); inputText->setText(in.readAll()); file.close(); filename = new_filename; setWindowTitle(tr("Alt_Key - %1") .arg(QFileInfo(filename).baseName())); outputText->clear(); logText->append(tr("Loaded %1").arg(filename)); } void MainWindow::save() { if (filename.isEmpty()) return saveAs(); QFile file(filename); if (!file.open(QIODevice::WriteOnly)) { logText->append(tr("Failed to save: %1") .arg(file.errorString())); return; } QTextStream out(&file); out.setCodec("UTF-8"); out << inputText->toPlainText(); file.close(); inputText->document()->setModified(false); logText->append(tr("Saved %1").arg(filename)); } void MainWindow::saveAs() { QString fname = QFileDialog::getSaveFileName(this, tr("Alt_Key - Save Strings"), filename.isEmpty() ? "." : QFileInfo(filename).absolutePath(), tr("Alt_Key Files (*.acc)\nAll (*)")); if (fname.isEmpty()) return; if (!fname.contains(".")) fname += ".acc"; filename = fname; setWindowTitle(tr("Alt_Key - %1").arg(QFileInfo(filename).baseName())); save(); } void MainWindow::setOptions() { OptionsDlg dialog(alphabet, prompt_to_save_on_exit, restore_workspace_at_startup, load_last_file_at_startup, predefined_accelerators, this); if (dialog.exec()) { alphabet = dialog.alphabet(); predefined_accelerators = dialog.predefined_accelerators(); prompt_to_save_on_exit = dialog.prompt_to_save_on_exit(); restore_workspace_at_startup = dialog.restore_workspace_at_startup(); load_last_file_at_startup = dialog.load_last_file_at_startup(); } } void MainWindow::help() { if (!helpDialog) { helpDialog = new QDialog(this); helpDialog->setWindowTitle(tr("Alt_Key - Help")); QTextBrowser *browser = new QTextBrowser; QFile file(":/help.html"); file.open(QIODevice::ReadOnly); browser->setText(file.readAll()); file.close(); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(browser); layout->setContentsMargins(0, 0, 0, 0); helpDialog->setLayout(layout); #ifndef Q_WS_WIN QRect rect = QApplication::desktop()->availableGeometry(); helpDialog->resize(qMin(600, rect.width()), qMin(800, rect.height())); #else helpDialog->resize(400, 400); #endif } helpDialog->show(); helpDialog->raise(); helpDialog->activateWindow(); } void MainWindow::about() { static const QString version("2.2.5"); QMessageBox::about(this, tr("Alt_Key - About"), tr("

" "Alt_Key %1 by Mark Summerfield." "

Copyright © 2008-12 " "Qtrac " "Ltd. All rights reserved." "


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 3 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 (in file gpl-3.0.txt) " "for more details.").arg(version)); } alt_key-2.2.5/mainwindow.hpp0000644000000000000000000000314511722111646015777 0ustar rootroot00000000000000#ifndef MAINWINDOW_HPP #define MAINWINDOW_HPP /* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. */ #include class QPushButton; class QSplitter; class QTextBrowser; class QTextEdit; class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent=0); protected: void closeEvent(QCloseEvent *event); private slots: void setOptions(); void calculate(); void copy(); void new_(); void load(); void save(); void saveAs(); void help(); void about(); void afterCreation(); private: void loadFile(const QString &new_filename); QString highlightUnused(const QStringList &list_of_strings); QTextEdit *inputText; QTextBrowser *outputText; QTextBrowser *logText; QSplitter *splitter; QPushButton *calculateButton; QDialog *helpDialog; QString filename; QString alphabet; bool prompt_to_save_on_exit; bool restore_workspace_at_startup; bool load_last_file_at_startup; QStringList predefined_accelerators; }; #endif // MAINWINDOW_HPP alt_key-2.2.5/openoffice-wp.acc0000644000000000000000000000332611722111646016324 0ustar rootroot00000000000000# OpenOffice Wordprocessor Menus # File Menu New Open... Recent Documents Wizards Close Save Save As... Save All Reload Versions... Export... Export as PDF... Send Properties... Digital Signatures... Templates Preview in Web Browser Page Preview Print... Printer Settings... Exit # Edit Menu Undo Redo Cut Copy Paste Paste Special... Select Text Select All Changes Compare Documents... Find && Replace Navigator AutoText... Exchange Database... Fields... Footnote... Index Entry... Bibliography Entry Hyperlink Links... Plug-in ImageMap Object # View Menu Print Layout Web Layout Toolbars Status Bar Input Method Status Ruler Text Boundaries Field Shadings Field Names Nonprinting Characters Hidden Paragraphs Data Sources Full Screen Zoom # Insert Menu Manual Break Fields Special Character... Formatting Mark Section... Hyperlink Header Footer Footnote Caption Bookmark Cross-reference... Note... Script... Indexes and Tables Envelope... Frame... Table... Horizontal Ruler... Picture Video and Sound Object Floating Frame File... # Format Menu Default Formatting Character... Paragraph... Bullets and Numbering... Page... Title Page Change Case Columns Sections... Styles and Formatting AutoFormat Anchor Wrap Alignment Arrange Flip Group Object Frame... Picture... # Table Menu Insert Delete Select Merge Cells Split Cells Protect Cells Merge Table Split Table AutoFormat... Autofit Heading rows repeat Convert Sort... Formula Number Format... Table Boundaries Table Properties... # Tools Menu Spellcheck... Language Word Count AutoCorrect... Outline Numbering... Footnotes... Gallery Media Player Bibliography Database Mail Merge Wizard... Sort... Calculate Update Macros Extension Manager... XML Filter Settings... Customize... Options... alt_key-2.2.5/optionsdlg.cpp0000644000000000000000000001132611722111646016000 0ustar rootroot00000000000000/* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. */ #include "alt_key.hpp" #include "optionsdlg.hpp" #include "syntaxhighlighter.hpp" #include #include #include #include #include #include #include #include #include OptionsDlg::OptionsDlg(const QString &alphabet, bool prompt_to_save_on_exit, bool restore_workspace_at_startup, bool load_last_file_at_startup, const QStringList &predefined_accelerators, QWidget *parent) : QDialog(parent) { QLabel *alphabetLabel = new QLabel(tr("Alphabet:")); alphabetEdit = new QLineEdit(alphabet); alphabetEdit->setToolTip(tr("The characters that can be used as " "accelerators, usually A-Z or 01-9A-Z")); alphabetEdit->setMinimumWidth(QFontMetrics(font()) .width(alphabet + "W")); alphabetLabel->setBuddy(alphabetEdit); QLabel *label = new QLabel(tr("Predefined Accelerators:")); predefinedAcceleratorsText = new QTextEdit; label->setBuddy(predefinedAcceleratorsText); (void) new SyntaxHighlighter(predefinedAcceleratorsText); predefinedAcceleratorsText->setAcceptRichText(false); predefinedAcceleratorsText->setTabChangesFocus(true); foreach (const QString &string, predefined_accelerators) predefinedAcceleratorsText->append(string); predefinedAcceleratorsText->setToolTip(tr("

Add strings with " "accelerators (e.g., Cu&t, &Copy, &Paste, " "E&xit, &Quit) to improve consistency")); promptToSaveCheckBox = new QCheckBox(tr("Prompt to Save Unsaved " "Changes on Exit")); promptToSaveCheckBox->setChecked(prompt_to_save_on_exit); restoreWorkspaceCheckBox = new QCheckBox( tr("Restore Workspace at Startup")); restoreWorkspaceCheckBox->setChecked(restore_workspace_at_startup); loadLastFileCheckBox = new QCheckBox( tr("Load Last File at Startup")); loadLastFileCheckBox->setChecked(load_last_file_at_startup); QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok|QDialogButtonBox::Cancel); QGridLayout *grid = new QGridLayout; grid->addWidget(alphabetLabel, 0, 0); grid->addWidget(alphabetEdit, 0, 1); grid->addWidget(label, 1, 0, 1, 2); grid->addWidget(predefinedAcceleratorsText, 2, 0, 1, 2); QGridLayout *innerGrid = new QGridLayout; innerGrid->addWidget(promptToSaveCheckBox, 0, 0); innerGrid->addWidget(restoreWorkspaceCheckBox, 1, 0); innerGrid->addWidget(loadLastFileCheckBox, 1, 1); grid->addLayout(innerGrid, 4, 0, 1, 2); QVBoxLayout *layout = new QVBoxLayout; layout->addLayout(grid); layout->addStretch(); layout->addWidget(buttonBox); setLayout(layout); connect(alphabetEdit, SIGNAL(textEdited(const QString&)), this, SLOT(fixAlphabet(const QString&))); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); AQP::accelerateWidget(this); setWindowTitle(tr("Alt_Key - Options")); } void OptionsDlg::accept() { alphabet_ = alphabetEdit->text().simplified(); predefined_accelerators_ = QStringList(); for (QTextBlock block = predefinedAcceleratorsText->document()->begin(); block.isValid(); block = block.next()) { QString string = block.text().simplified(); if (!string.isEmpty()) predefined_accelerators_ << string; } prompt_to_save_on_exit_ = promptToSaveCheckBox->isChecked(); restore_workspace_at_startup_ = restoreWorkspaceCheckBox->isChecked(); load_last_file_at_startup_ = loadLastFileCheckBox->isChecked(); QDialog::accept(); } void OptionsDlg::fixAlphabet(const QString &text) { int i = alphabetEdit->cursorPosition(); QSet seen; QString temp; foreach (const QChar c, text.toUpper()) { if (seen.contains(c)) continue; seen += c; temp += c; } alphabetEdit->setText(temp); alphabetEdit->setCursorPosition(i); } alt_key-2.2.5/optionsdlg.hpp0000644000000000000000000000362411722111646016007 0ustar rootroot00000000000000#ifndef OPTIONS_DLG #define OPTIONS_DLG /* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. */ #include class QCheckBox; class QLineEdit; class QTextEdit; class OptionsDlg : public QDialog { Q_OBJECT public: explicit OptionsDlg(const QString &alphabet, bool prompt_to_save_on_exit, bool restore_workspace_at_startup, bool load_last_file_at_startup, const QStringList &predefined_accelerators, QWidget *parent=0); QString alphabet() const { return alphabet_; } bool prompt_to_save_on_exit() const { return prompt_to_save_on_exit_; } bool restore_workspace_at_startup() const { return restore_workspace_at_startup_; } bool load_last_file_at_startup() const { return load_last_file_at_startup_; } QStringList predefined_accelerators() const { return predefined_accelerators_; } private slots: void accept(); void fixAlphabet(const QString &alphabet); private: QLineEdit *alphabetEdit; QCheckBox *promptToSaveCheckBox; QCheckBox *restoreWorkspaceCheckBox; QCheckBox *loadLastFileCheckBox; QTextEdit *predefinedAcceleratorsText; QString alphabet_; bool prompt_to_save_on_exit_; bool restore_workspace_at_startup_; bool load_last_file_at_startup_; QStringList predefined_accelerators_; }; #endif // OPTIONS_DLG alt_key-2.2.5/resources.qrc0000644000000000000000000000132411722111646015630 0ustar rootroot00000000000000 images/icon.png images/filenew.png images/fileopen.png images/filesave.png images/filesaveas.png images/filequit.png images/editcalculate.png images/editcancel.png images/editcopy.png images/editoptions.png images/helphelp.png help.html alt_key_cz.qm alt_key-2.2.5/squish.acc0000644000000000000000000000134511722111646015076 0ustar rootroot00000000000000# File menu New Test Case New Test Case from Template New Test Suite OpenTest Suite OpenTest Suite from Quality Center Import Test Log Explore Wrapper Library Save E&xit # Edit menu &Undo Redo Cut &Copy &Paste Select All Comment Block Uncomment Block &Find Find Next Find Previous Replace Preferences Spy Filters # Test Suite menu Execute Execute and Record Execute without Breakpoints Execute with Valgrind Stop Break &Step Step Into Record Record and Insert End Recording Settings # Spy menu Spy AUT Run Pause Pick Object # Help menu &Manual (HTML) Manual (HTML, Offline Version) Manual (&PDF) About # Find & Find and Replace dialogs Find &Find Replace &Replace Replace All Case Sensitive From Cursor Whole words only Backwards &Closealt_key-2.2.5/syntaxhighlighter.cpp0000644000000000000000000000220711722111646017361 0ustar rootroot00000000000000/* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. */ #include "syntaxhighlighter.hpp" void SyntaxHighlighter::highlightBlock(const QString &text) { QTextCharFormat comment; comment.setFontItalic(true); if (text.trimmed().startsWith("#")) { setFormat(0, text.length(), comment); return; } QTextCharFormat format; format.setFontWeight(QFont::Bold); format.setFontUnderline(true); for (int i = 1; i < text.length(); ++i) if (text[i - 1] == '&' && text[i] != '&' && text[i].isLetterOrNumber()) setFormat(i, 1, format); } alt_key-2.2.5/syntaxhighlighter.hpp0000644000000000000000000000165211722111646017371 0ustar rootroot00000000000000#ifndef SYNTAXHIGHLIGHTER_HPP #define SYNTAXHIGHLIGHTER_HPP /* Copyright (c) 2008-12 Qtrac Ltd. All rights reserved. This program or module 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 version 3 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. */ #include class SyntaxHighlighter : public QSyntaxHighlighter { public: explicit SyntaxHighlighter(QTextEdit *parent) : QSyntaxHighlighter(parent) {} void highlightBlock(const QString &text); }; #endif // SYNTAXHIGHLIGHTER_HPP