changeset 536:c35bb20e9f3f

Seems as if I've been lazy some times. Tststsss... So now I added some more method comments. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@776 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Thu, 25 Sep 2008 16:53:35 +0000
parents f7df458fe781
children a487cdd9c083
files src/AboutDialogGraphicsView.cpp src/SettingsPaths.cpp src/UiguiIndentServer.cpp src/aboutdialog.cpp src/highlighter.cpp src/indenthandler.cpp src/templateBatchScript.cpp src/uiguiIniFileParser.cpp src/uiguierrormessage.cpp
diffstat 9 files changed, 206 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/AboutDialogGraphicsView.cpp	Thu Sep 25 14:10:56 2008 +0000
+++ b/src/AboutDialogGraphicsView.cpp	Thu Sep 25 16:53:35 2008 +0000
@@ -19,6 +19,18 @@
 #include <QtGui>
 #include "AboutDialogGraphicsView.h"
 
+/*!
+    \class AboutDialogGraphicsView
+    \brief A container for the real \a AboutDialog. Makes the 3D animation possible.
+    
+    The 3D animation shall suggest the user, that he is looking at his desktop, while
+    this animation is done. Since this is not directly possible, \a AboutDialogGraphicsView
+    when shown starts in frameless fullscreen mode with a screenshot of the desktop as background.
+*/
+
+/*!
+    \brief The constructor initializes everything needed for the 3D animation.
+ */
 AboutDialogGraphicsView::AboutDialogGraphicsView(AboutDialog *aboutDialog, QWidget *parent) : QGraphicsView(parent) {
     this->parent = parent;
     setWindowFlags(Qt::SplashScreen);
@@ -64,10 +76,15 @@
     windowTitleBarWidth = parent->geometry().y() - parent->y();
 }
 
+
 AboutDialogGraphicsView::~AboutDialogGraphicsView(void) {
 }
 
 
+/*!
+    \brief Grabs a screenshot of the full desktop and shows that as background. Above that background the
+    AboutDialog 3D animation is shown. Also grabs the content of the AboutDialog itself.
+ */
 void AboutDialogGraphicsView::show() {
     QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), 0, 0, geometry().width(), geometry().height() );
     setBackgroundBrush(originalPixmap);
@@ -100,6 +117,9 @@
 }
 
 
+/*!
+    \brief Does the next calculation/transformation step.
+ */
 void AboutDialogGraphicsView::updateStep(int step)
 {
     QRectF r = graphicsProxyWidget->boundingRect();
@@ -114,6 +134,9 @@
 }
 
 
+/*!
+    \brief Stops the 3D animation, moves the AboutDialog to the correct place and really shows it.
+ */
 void AboutDialogGraphicsView::showAboutDialog() {
     //hide();
     disconnect(timeLine, SIGNAL(finished()), this, SLOT(showAboutDialog()));
@@ -122,6 +145,9 @@
 }
 
 
+/*!
+    \brief Does not directly hide the AboutDialog but instead starts the "fade out" 3D animation.
+ */
 void AboutDialogGraphicsView::hide() {
     aboutDialogAsSplashScreen->setPixmap( QPixmap::grabWidget(aboutDialog) );
     graphicsProxyWidget->setGeometry( aboutDialog->geometry() );
@@ -151,12 +177,20 @@
     timeLine->start();
 }
 
+
+/*!
+    \brief This slot really hides this AboutDialog container.
+ */
 void AboutDialogGraphicsView::hideReally() {
     disconnect(timeLine, SIGNAL(finished()), this, SLOT(hideReally()));
     QGraphicsView::hide();
 }
 
 
+/*!
+    \brief Makes it possible to set the screen shot used for the animation.
+ */
+//TODO: Test whether this function is really still needed. Not only for debug.
 void AboutDialogGraphicsView::setScreenshotPixmap(const QPixmap &screenShot) {
     originalPixmap = screenShot;
 }
--- a/src/SettingsPaths.cpp	Thu Sep 25 14:10:56 2008 +0000
+++ b/src/SettingsPaths.cpp	Thu Sep 25 16:53:35 2008 +0000
@@ -21,6 +21,15 @@
 #include "SettingsPaths.h"
 
 
+//! \defgroup grp_Settings All concerning applications settings.
+
+/*!
+    \class SettingsPaths
+    \ingroup grp_Settings
+    \brief SettingsPaths is a pure static functions class from which info about the
+    paths needed for settings can be retrieved.
+*/
+
 bool SettingsPaths::alreadyInitialized = false;
 QString SettingsPaths::applicationBinaryPath = "";
 QString SettingsPaths::settingsPath = "";
@@ -30,6 +39,16 @@
 bool SettingsPaths::portableMode = false;
 
 
+/*!
+    \brief Initializes all available information about the paths.
+    
+    Mainly during this init it is detected whether to start in portable mode or not. This is
+    done by testing whether the directory "config" is in the same directory as this 
+    applications executable file.
+    In portable mode all data is ONLY written to subdirectories of the applications executable file.
+    Means also that the directory "indenters" has to be there.
+    In not portable mode (multiuser mode) only users home directory is used for writing config data.
+ */
 void SettingsPaths::init() {
     // Get the applications binary path, with respect to MacOSXs use of the .app folder. 
 	applicationBinaryPath = QCoreApplication::applicationDirPath();
@@ -94,6 +113,9 @@
 }
 
 
+/*!
+    \brief Returns the path of the applications executable.
+ */
 const QString SettingsPaths::getApplicationBinaryPath() {
     if ( !alreadyInitialized ) {
         SettingsPaths::init();
@@ -102,6 +124,9 @@
 }
 
 
+/*!
+    \brief Returns the path where all settings are being/should be written to.
+ */
 const QString SettingsPaths::getSettingsPath() {
     if ( !alreadyInitialized ) {
         SettingsPaths::init();
@@ -110,6 +135,9 @@
 }
 
 
+/*!
+    \brief Returns the path where the files concerning all users reside. For example translations.
+ */
 const QString SettingsPaths::getGlobalFilesPath() {
     if ( !alreadyInitialized ) {
         SettingsPaths::init();
@@ -118,6 +146,9 @@
 }
 
 
+/*!
+    \brief Returns the path where the indenter executables reside.
+ */
 const QString SettingsPaths::getIndenterPath() {
     if ( !alreadyInitialized ) {
         SettingsPaths::init();
@@ -126,6 +157,9 @@
 }
 
 
+/*!
+    \brief Returns the path where the where all temporary data should be written to.
+ */
 const QString SettingsPaths::getTempPath() {
     if ( !alreadyInitialized ) {
         SettingsPaths::init();
@@ -134,6 +168,9 @@
 }
 
 
+/*!
+    \brief Returns true if portable mode shall be used.
+ */
 bool SettingsPaths::getPortableMode() {
     if ( !alreadyInitialized ) {
         SettingsPaths::init();
--- a/src/UiguiIndentServer.cpp	Thu Sep 25 14:10:56 2008 +0000
+++ b/src/UiguiIndentServer.cpp	Thu Sep 25 16:53:35 2008 +0000
@@ -21,6 +21,25 @@
 
 #include "UiguiIndentServer.h"
 
+//! \defgroup grp_Server All concerning the server component.
+
+/*!
+    \class UiguiIndentServer
+    \ingroup grp_Server
+    \brief UiguiIndentServer is in such an early state, that even the communication
+    protocol isn't completely planned. So this class lacks documentation until
+    I really know where all this will lead to.
+    
+    The plan however is to have a server that receives commands for selecting an
+    indenter and perhaps load some by the user predefined indenter config file. Then
+    the client can send a text to it and will receive it formatted.
+    The idea behind that is to make UiGUIs use as plugin or whatever more flexible.
+    So the plugin is developed for Eclipse for example and it takes the client role,
+    making it possible to use UiGUI from within Eclipse. Choosing a network protocol
+    makes everything platform and programming language independent, so it doesn't
+    matter for which application the plugin/client is developed.
+*/
+
 UiguiIndentServer::UiguiIndentServer(void) : QObject() {
     tcpServer = NULL;
     currentClientConnection = NULL;
--- a/src/aboutdialog.cpp	Thu Sep 25 14:10:56 2008 +0000
+++ b/src/aboutdialog.cpp	Thu Sep 25 16:53:35 2008 +0000
@@ -144,6 +144,9 @@
 }
 
 
+/*!
+    \brief Shows the about dialog and also starts the credits scroller.
+ */
 void AboutDialog::show() {
     timer->start(scrollSpeed);
     QDialog::show();
--- a/src/highlighter.cpp	Thu Sep 25 14:10:56 2008 +0000
+++ b/src/highlighter.cpp	Thu Sep 25 16:53:35 2008 +0000
@@ -285,18 +285,27 @@
 }
 
 
+/*!
+    \brief Sets the \a color for the given \a style.
+ */
 void Highlighter::setColor(const QColor &color, int style) {
     colorForStyles[style] = color;
     lexer->setColor( color, style );
 }
 
 
+/*!
+    \brief Sets the \a font for the given \a style.
+ */
 void Highlighter::setFont(const QFont &font, int style) {
     fontForStyles[style] = font;
     lexer->setFont( font, style );
 }
 
 
+/*!
+    \brief Sets the to be used lexer by giving his name.
+ */
 void Highlighter::setLexerByName( QString lexerName ) {
     setLexerForExtension( mapHighlighternameToExtension[lexerName].first() );
 }
--- a/src/indenthandler.cpp	Thu Sep 25 14:10:56 2008 +0000
+++ b/src/indenthandler.cpp	Thu Sep 25 16:53:35 2008 +0000
@@ -158,6 +158,9 @@
 }
 
 
+/*!
+    \brief Implicitly writes the current indenter parameters to the indenters config file.
+ */
 IndentHandler::~IndentHandler() {
     // Generate the parameter string that will be saved to the indenters config file.
     QString parameterString = getParameterString();
@@ -769,6 +772,7 @@
     }
 }
 
+
 /*!
     \brief Opens and parses the indenter ini file that is declared by \a iniFilePath.
  */
@@ -1370,9 +1374,9 @@
 
 
 /*!
-\brief Shows a file open dialog to open an existing config file for the currently selected indenter.
+    \brief Shows a file open dialog to open an existing config file for the currently selected indenter.
 
-If the file was successfully opened the indent handler is called to load the settings and update itself.
+    If the file was successfully opened the indent handler is called to load the settings and update itself.
 */
 void IndentHandler::openConfigFileDialog() {
     QString configFilePath;
@@ -1386,9 +1390,9 @@
 
 
 /*!
-\brief Calls the indenter config file save as dialog to save the config file under a chosen name.
+    \brief Calls the indenter config file save as dialog to save the config file under a chosen name.
 
-If the file already exists and it should be overwritten, a warning is shown before.
+    If the file already exists and it should be overwritten, a warning is shown before.
 */
 void IndentHandler::saveasIndentCfgFileDialog() {
     QString fileExtensions = tr("All files")+" (*.*)";
@@ -1407,10 +1411,10 @@
 
 
 /*!
-\brief Invokes the indenter to create a shell script.
+    \brief Invokes the indenter to create a shell script.
 
-Lets the indenter create a shell script for calling the indenter out of any
-other application and open a save dialog for saving the shell script.
+    Lets the indenter create a shell script for calling the indenter out of any
+    other application and open a save dialog for saving the shell script.
 */
 void IndentHandler::createIndenterCallShellScript() {
     //QString indenterCallShellScript = generateCommandlineCall(currentSourceFileExtension);
@@ -1466,6 +1470,11 @@
 }
 
 
+/*!
+    \brief Catch some events and let some other be handled by the super class.
+    
+    Is needed for use as Notepad++ plugin.
+ */
 bool IndentHandler::event( QEvent *event ) {
     if ( event->type() == QEvent::WindowActivate ) {
         event->accept();
@@ -1482,11 +1491,22 @@
 }
 
 
+/*!
+    \brief Sets the function pointer \a parameterChangedCallback to the given callback
+    function \a paramChangedCallback.
+    
+    Is needed for use as Notepad++ plugin.
+ */
 void IndentHandler::setParameterChangedCallback( void(*paramChangedCallback)(void) ) {
     parameterChangedCallback = paramChangedCallback;
 }
 
 
+/*!
+    \brief Emits the \a indenterSettingsChanged signal and if set executes the \a parameterChangedCallback function.
+   
+   Is needed for use as Notepad++ plugin.
+ */
 void IndentHandler::handleChangedIndenterSettings() {
     emit( indenterSettingsChanged() );
 
@@ -1496,11 +1516,21 @@
 }
 
 
+/*!
+    \brief Sets a callback function that shall be called, when the this indenter parameter window gets closed.
+    
+   Is needed for use as Notepad++ plugin.
+ */
 void IndentHandler::setWindowClosedCallback( void(*winClosedCallback)(void) ) {
     windowClosedCallback = winClosedCallback;
 }
 
 
+/*!
+    \brief Is called on this indenter parameter window close and if set calls the function \a windowClosedCallback.
+     
+    Is needed for use as Notepad++ plugin.
+ */
 void IndentHandler::closeEvent(QCloseEvent *event) {
     if ( windowClosedCallback != NULL ) {
         windowClosedCallback();
@@ -1509,6 +1539,9 @@
 }
 
 
+/*!
+    \brief Returns the id (list index) of the currently selected indenter.
+ */
 int IndentHandler::getIndenterId() {
     return indenterSelectionCombobox->currentIndex();
 }
--- a/src/templateBatchScript.cpp	Thu Sep 25 14:10:56 2008 +0000
+++ b/src/templateBatchScript.cpp	Thu Sep 25 16:53:35 2008 +0000
@@ -19,6 +19,17 @@
 
 #include "templateBatchScript.h"
 
+/*!
+    \brief The only and static function of this class returns a batch or shell script
+    as string that can be used to call an indenter with the current settings from 
+    the command line.
+    
+    The returned string contains some placeholders where the indenter name needs to
+    be filled in. The placeholders are "__INDENTERCALLSTRING1__" that should be replaced
+    by the indenter call string that indents a complete directory.
+    "__INDENTERCALLSTRING2__" the call string for indenting only one file.
+    And "__INDENTERCALLSTRINGSCRIPTNAME__" which is only the shown name of the indenter.
+ */
 const char* TemplateBatchScript::getTemplateBatchScript() {
     static const char* templateBatchScript =
 #if defined(Q_OS_WIN32)
--- a/src/uiguiIniFileParser.cpp	Thu Sep 25 14:10:56 2008 +0000
+++ b/src/uiguiIniFileParser.cpp	Thu Sep 25 16:53:35 2008 +0000
@@ -21,6 +21,25 @@
 
 #include <QTextStream>
 
+//! \defgroup grp_Settings All concerning applications settings.
+
+/*!
+    \class UiguiIniFileParser
+    \ingroup grp_Settings
+    \brief UiguiIniFileParser is a simple ini file format parser.
+    
+    These ini files need to have key-value pairs in the style
+    "keyname=keyvalue". Groups can be defined by writing the groupname
+    in the style [groupname] before some key-value pairs.
+    
+    The reason why I use my own class instead of QSettings is mainly, that
+    QSettings always internally sorts the groups alphabetically and also
+    rewrites a settings file sorted. Very annoying for me.
+*/
+
+/*!
+    \brief Init and empty all needed lists and strings.
+ */
 UiguiIniFileParser::UiguiIniFileParser(void)
 {
     sections.clear();
@@ -29,6 +48,9 @@
 }
 
 
+/*!
+    \brief Directly loads and parses the file with name \a iniFileName.
+ */
 UiguiIniFileParser::UiguiIniFileParser(const QString &iniFileName)
 {
     UiguiIniFileParser::UiguiIniFileParser();
--- a/src/uiguierrormessage.cpp	Thu Sep 25 14:10:56 2008 +0000
+++ b/src/uiguierrormessage.cpp	Thu Sep 25 16:53:35 2008 +0000
@@ -19,15 +19,42 @@
 
 #include "uiguierrormessage.h"
 
+/*!
+    \class UiGuiErrorMessage
+    \ingroup grp_Dialogs
+    \brief UiGuiErrorMessage is a child of QErrorMessage. But QErrorMessages
+    "Do not show again" didn't work with my strings, so this is my own, working
+    implementation of it.
+*/
+
+
+/*!
+    \brief Initializes the dialog.
+    
+    Retrieves the object pointer to the \a showAgainCheckBox check box, sets the dialogs
+    modality and for a working translation sets the check box text. 
+ */
 UiGuiErrorMessage::UiGuiErrorMessage(QWidget *parent) : QErrorMessage(parent) {
     showAgainCheckBox = findChild<QCheckBox *>();
     setWindowModality( Qt::ApplicationModal );
     showAgainCheckBox->setText( tr("Show this message again") );
 }
 
+
+/*!
+    \brief Just a lazy nothin doin destructive destructor.
+ */
 UiGuiErrorMessage::~UiGuiErrorMessage(void) {
 }
 
+
+/*!
+    \brief Shows an error \a message in a dialog box with \a title.
+    
+    The shown \a message is added to a list, if not already in there. If it is
+    already in that list and "Show this message again" is not checked, that
+    message will not be shown.
+ */
 void UiGuiErrorMessage::showMessage( const QString &title, const QString &message ) {
     bool showAgain = true;
 
@@ -49,6 +76,10 @@
     }
 }
 
+
+/*!
+    \brief For convinience, for showing a dialog box with the default title "UniversalIndentGUI".
+ */
 void UiGuiErrorMessage::showMessage( const QString &message ) {
     showMessage( "UniversalIndentGUI", message );
 }