VirtualBox

Changeset 60827 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 4, 2016 12:13:49 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: ​​​​​​​​​bugref:6769: Rework/cleanup file-path selector widget (part 03): Doxygen.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp

    r60770 r60827  
    55
    66/*
    7  * Copyright (C) 2008-2013 Oracle Corporation
     7 * Copyright (C) 2008-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
    2121
    22 /* Local includes */
     22/* GUI includes: */
    2323# include "QIFileDialog.h"
    2424# include "QIToolButton.h"
     
    2929# include "VBoxGlobal.h"
    3030
    31 /* Global includes */
     31/* Other VBox includes: */
    3232# include <iprt/assert.h>
     33
     34/* Qt includes: */
    3335# include <QAction>
    3436# include <QApplication>
     
    5052
    5153
    52 /**
    53  * Returns first position of difference between passed strings.
    54  */
     54/** Returns first position of difference between passed strings. */
    5555static int differFrom (const QString &aS1, const QString &aS2)
    5656{
     
    209209}
    210210
    211 /**
    212  * Returns @c true if the selected (active) combobox item is a path item.
    213  *
    214  * May be used in @c activated() signal handlers to distinguish between
    215  * non-path items like "Other..." or "Reset" that get temporarily activated
    216  * when performing the corresponding action and the item that contains a
    217  * real selected file/folder path.
    218  */
    219211bool UIFilePathSelector::isPathSelected() const
    220212{
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.h

    r60770 r60827  
    55
    66/*
    7  * Copyright (C) 2008-2013 Oracle Corporation
     7 * Copyright (C) 2008-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1919#define ___UIFilePathSelector_h___
    2020
    21 /* VBox includes */
     21/* GUI includes: */
    2222#include "QIWithRetranslateUI.h"
    2323
    24 /* Qt includes */
     24/* Qt includes: */
    2525#include <QComboBox>
    2626
    27 /* VBox forward declarations */
     27/* Forward declarations: */
    2828class QILabel;
    2929class QILineEdit;
    30 
    31 /* Qt forward declarations */
    3230class QHBoxLayout;
    3331class QAction;
     
    3533
    3634
     35/** QComboBox extension providing GUI with
     36  * possibility to choose/reflect file/folder path. */
    3737class UIFilePathSelector: public QIWithRetranslateUI<QComboBox>
    3838{
     
    4141public:
    4242
     43    /** Modes file-path selector operates in. */
    4344    enum Mode
    4445    {
     
    4849    };
    4950
     51    /** Constructs file-path selector passing @a aParent to QComboBox base-class. */
    5052    UIFilePathSelector (QWidget *aParent);
     53    /** Destructs file-path selector. */
    5154   ~UIFilePathSelector();
    5255
     56    /** Defines the @a aMode to operate in. */
    5357    void setMode (Mode aMode);
     58    /** Returns the mode to operate in. */
    5459    Mode mode() const;
    5560
     61    /** Defines whether the possibility to edit the path is @a aOn. */
    5662    void setEditable (bool aOn);
     63    /** Returns whether the path is editable. */
    5764    bool isEditable() const;
    5865
     66    /** Defines whether the reseting to defauilt path is @a aEnabled. */
    5967    void setResetEnabled (bool aEnabled);
     68    /** Returns whether the reseting to defauilt path is enabled. */
    6069    bool isResetEnabled () const;
    6170
     71    /** Defines the file-dialog @a aTitle. */
    6272    void setFileDialogTitle (const QString& aTitle);
     73    /** Returns the file-dialog title. */
    6374    QString fileDialogTitle() const;
    6475
     76    /** Defines the file-dialog @a aFilters. */
    6577    void setFileFilters (const QString& aFilters);
     78    /** Returns the file-dialog filters. */
    6679    QString fileFilters() const;
    6780
     81    /** Defines the file-dialog default save @a aExt. */
    6882    void setDefaultSaveExt (const QString &aExt);
     83    /** Returns the file-dialog default save extension. */
    6984    QString defaultSaveExt() const;
    7085
     86    /** Resets path modified state to false. */
    7187    void resetModified();
     88    /** Returns whether the path is modified. */
    7289    bool isModified() const;
     90    /** Returns whether the path is selected. */
    7391    bool isPathSelected() const;
    7492
     93    /** Returns the path. */
    7594    QString path() const;
    7695
    7796signals:
     97
     98    /** Notify listeners about path changed. */
    7899    void pathChanged (const QString &);
    79100
    80101public slots:
    81102
     103    /** Defines the @a aPath and @a aRefreshText after that. */
    82104    void setPath (const QString &aPath, bool aRefreshText = true);
     105
     106    /** Defines the @a aHomeDir. */
    83107    void setHomeDir (const QString &aHomeDir);
    84108
    85109protected:
    86110
     111    /** Handles resize @a aEvent. */
    87112    void resizeEvent (QResizeEvent *aEvent);
     113
     114    /** Handles focus-in @a aEvent. */
    88115    void focusInEvent (QFocusEvent *aEvent);
     116    /** Handles focus-out @a aEvent. */
    89117    void focusOutEvent (QFocusEvent *aEvent);
     118
     119    /** Preprocesses every @a aEv sent to @a aObj. */
    90120    bool eventFilter (QObject *aObj, QEvent *aEv);
     121
     122    /** Handles translation event. */
    91123    void retranslateUi();
    92124
    93125private slots:
    94126
     127    /** Handles combo-box activation. */
    95128    void onActivated (int aIndex);
     129
     130    /** Handles combo-box text editing. */
    96131    void onTextEdited (const QString &aPath);
     132
     133    /** Handles combo-box text copying. */
    97134    void copyToClipboard();
     135
     136    /** Refreshes combo-box text according to chosen path. */
    98137    void refreshText();
    99138
    100139private:
    101140
     141    /** Provokes change to @a aPath and @a aRefreshText after that. */
    102142    void changePath (const QString &aPath, bool aRefreshText = true);
     143
     144    /** Call for file-dialog to choose path. */
    103145    void selectPath();
     146
     147    /** Returns default icon. */
    104148    QIcon defaultIcon() const;
     149
     150    /** Returns full path @a aAbsolute if necessary. */
    105151    QString fullPath (bool aAbsolute = true) const;
     152
     153    /** Shrinks the reflected text to @a aWidth pixels. */
    106154    QString shrinkText (int aWidth) const;
    107155
    108     /* Private member vars */
     156    /** Holds the copy action instance. */
    109157    QAction *mCopyAction;
     158
     159    /** Holds the mode to operate in. */
    110160    Mode mMode;
     161
     162    /** Holds the path. */
    111163    QString mPath;
     164    /** Holds the home directory. */
    112165    QString mHomeDir;
     166
     167    /** Holds the file-dialog filters. */
    113168    QString mFileFilters;
     169    /** Holds the file-dialog default save extension. */
    114170    QString mDefaultSaveExt;
     171    /** Holds the file-dialog title. */
    115172    QString mFileDialogTitle;
     173
     174    /** Holds the cached text for empty path. */
    116175    QString mNoneStr;
     176    /** Holds the cached tool-tip for empty path. */
    117177    QString mNoneTip;
     178
     179    /** Holds whether the path is editable. */
    118180    bool mIsEditable;
     181
     182    /** Holds whether we are in editable mode. */
    119183    bool mIsEditableMode;
     184    /** Holds whether we are expecting mouse events. */
    120185    bool mIsMouseAwaited;
    121186
     187    /** Holds whether the path is modified. */
    122188    bool mModified;
    123189};
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette