Skip to content

Commit

Permalink
documentation & formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Apr 8, 2016
1 parent 08c9f97 commit 7d416a0
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 64 deletions.
125 changes: 62 additions & 63 deletions OMEdit/OMEditGUI/Options/NotificationsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@
#include "NotificationsDialog.h"

/*!
\class NotificationsDialog
\brief Creates a notification dialog.
Define a new notification type if you want to add a new Dialog.\n
Also add the notification to NotificationPage class.\n
Save the notification in omedit.ini settings file by defining a new key in notifications section.
*/
* \class NotificationsDialog
* \brief Creates a notification dialog.
* Define a new notification type if you want to add a new Dialog.\n
* Also add the notification to NotificationPage class.\n
* Save the notification in omedit.ini settings file by defining a new key in notifications section.
*/
/*!
\param notificationType - specifies what type of notification dialog should be created.
\param notificationIcon - specifies which icon should be used.
\param pMainWindow - pointer to MainWindow.
*/
* \brief NotificationsDialog::NotificationsDialog
* \param notificationType - specifies what type of notification dialog should be created.
* \param notificationIcon - specifies which icon should be used.
* \param pMainWindow - pointer to MainWindow.
*/
NotificationsDialog::NotificationsDialog(NotificationType notificationType, NotificationIcon notificationIcon, MainWindow *pMainWindow)
: QDialog(pMainWindow)
{
Expand Down Expand Up @@ -93,26 +93,27 @@ NotificationsDialog::NotificationsDialog(NotificationType notificationType, Noti
}

/*!
Sets the notification dialog message.
\param label - the message to set.
*/
* \brief NotificationsDialog::setNotificationLabelString
* Sets the notification dialog message.
* \param label - the message to set.
*/
void NotificationsDialog::setNotificationLabelString(QString label)
{
mpNotificationLabel->setText(label);
}

/*!
Returns the notification icon.
\param notificationIcon - the notificaiton icon to set.
\return the notificaiton icon as QPixmap
*/
* \brief NotificationsDialog::getNotificationIcon
* Returns the notification icon.
* \param notificationIcon - the notificaiton icon to set.
* \return the notificaiton icon as QPixmap
*/
QPixmap NotificationsDialog::getNotificationIcon(NotificationsDialog::NotificationIcon notificationIcon)
{
QStyle *pStyle = this->style();
int iconSize = pStyle->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, this);
QIcon tmpIcon;
switch (notificationIcon)
{
switch (notificationIcon) {
case NotificationsDialog::InformationIcon:
tmpIcon = pStyle->standardIcon(QStyle::SP_MessageBoxInformation, 0, this);
break;
Expand All @@ -127,19 +128,20 @@ QPixmap NotificationsDialog::getNotificationIcon(NotificationsDialog::Notificati
default:
break;
}
if (!tmpIcon.isNull())
if (!tmpIcon.isNull()) {
return tmpIcon.pixmap(iconSize, iconSize);
}
return QPixmap();
}

/*!
Returns the notification dialog title.
\return the title string.
*/
* \brief NotificationsDialog::getNotificationTitleString
* Returns the notification dialog title.
* \return the title string.
*/
QString NotificationsDialog::getNotificationTitleString()
{
switch (mNotificationType)
{
switch (mNotificationType) {
case NotificationsDialog::QuitApplication:
return tr("Confirm Quit");
case NotificationsDialog::ItemDroppedOnItself:
Expand All @@ -154,14 +156,13 @@ QString NotificationsDialog::getNotificationTitleString()
}

/*!
Returns the notification dialog message.
\return the message string.
*/
* \brief NotificationsDialog::getNotificationLabelString
* Returns the notification dialog message.
* \return the message string.
*/
QString NotificationsDialog::getNotificationLabelString()
{
QString tmpPath, OMCCommunicationLogFilePath, OMCCommandsLogFilePath, OMCOutputFile, stackTraceFile;
switch (mNotificationType)
{
switch (mNotificationType) {
case NotificationsDialog::QuitApplication:
return tr("Are you sure you want to quit?");
case NotificationsDialog::ItemDroppedOnItself:
Expand All @@ -178,22 +179,14 @@ QString NotificationsDialog::getNotificationLabelString()
}

/*!
Returns the notification dialog checkbox.
\return the checkbox.
*/
QCheckBox* NotificationsDialog::getNotificationCheckBox()
{
return mpNotificationCheckBox;
}

/*!
Returns the notification dialog checkbox message.
\return the checkbox message string.
*/
* \brief NotificationsDialog::getNotificationCheckBoxString
* Returns the notification dialog checkbox message.
* \return the checkbox message string.
* \return
*/
QString NotificationsDialog::getNotificationCheckBoxString()
{
switch (mNotificationType)
{
switch (mNotificationType) {
case NotificationsDialog::QuitApplication:
return tr("Always quit without prompt");
case NotificationsDialog::ItemDroppedOnItself:
Expand All @@ -208,18 +201,20 @@ QString NotificationsDialog::getNotificationCheckBoxString()
}

/*!
Saves the promptQuitApplication key settings to omedit.ini file.
*/
* \brief NotificationsDialog::saveQuitNotificationSettings
* Saves the promptQuitApplication key settings to omedit.ini file.
*/
void NotificationsDialog::saveQuitNotificationSettings()
{
QSettings *pSettings = OpenModelica::getApplicationSettings();
pSettings->setValue("notifications/promptQuitApplication", true);
}

/*!
Saves the notifications/itemDroppedOnItself key settings to omedit.ini file.\n
Sets the notifications/itemDroppedOnItself notification checkbox on the NotificationsPage.
*/
* \brief NotificationsDialog::saveItemDroppedOnItselfNotificationSettings
* Saves the notifications/itemDroppedOnItself key settings to omedit.ini file.\n
* Sets the notifications/itemDroppedOnItself notification checkbox on the NotificationsPage.
*/
void NotificationsDialog::saveItemDroppedOnItselfNotificationSettings()
{
QSettings *pSettings = OpenModelica::getApplicationSettings();
Expand All @@ -228,9 +223,10 @@ void NotificationsDialog::saveItemDroppedOnItselfNotificationSettings()
}

/*!
Saves the notifications/replaceableIfPartial key settings to omedit.ini file.\n
Sets the notifications/replaceableIfPartial notification checkbox on the NotificationsPage.
*/
* \brief NotificationsDialog::saveReplaceableIfPartialNotificationSettings
* Saves the notifications/replaceableIfPartial key settings to omedit.ini file.\n
* Sets the notifications/replaceableIfPartial notification checkbox on the NotificationsPage.
*/
void NotificationsDialog::saveReplaceableIfPartialNotificationSettings()
{
QSettings *pSettings = OpenModelica::getApplicationSettings();
Expand All @@ -239,9 +235,10 @@ void NotificationsDialog::saveReplaceableIfPartialNotificationSettings()
}

/*!
Saves the notifications/innerModelNameChanged key settings to omedit.ini file.\n
Sets the notifications/innerModelNameChanged notification checkbox on the NotificationsPage.
*/
* \brief NotificationsDialog::saveInnerModelNameChangedNotificationSettings
* Saves the notifications/innerModelNameChanged key settings to omedit.ini file.\n
* Sets the notifications/innerModelNameChanged notification checkbox on the NotificationsPage.
*/
void NotificationsDialog::saveInnerModelNameChangedNotificationSettings()
{
QSettings *pSettings = OpenModelica::getApplicationSettings();
Expand All @@ -250,9 +247,10 @@ void NotificationsDialog::saveInnerModelNameChangedNotificationSettings()
}

/*!
Saves the notifications/saveModelForBitmapInsertion key settings to omedit.ini file.\n
Sets the notifications/saveModelForBitmapInsertion notification checkbox on the NotificationsPage.
*/
* \brief NotificationsDialog::saveModelForBitmapInsertionNotificationSettings
* Saves the notifications/saveModelForBitmapInsertion key settings to omedit.ini file.\n
* Sets the notifications/saveModelForBitmapInsertion notification checkbox on the NotificationsPage.
*/
void NotificationsDialog::saveModelForBitmapInsertionNotificationSettings()
{
QSettings *pSettings = OpenModelica::getApplicationSettings();
Expand All @@ -261,9 +259,10 @@ void NotificationsDialog::saveModelForBitmapInsertionNotificationSettings()
}

/*!
Slot activated when mpOkButton clicked signal is raised.\n
Checks the notification type and calls the appropriate method.
*/
* \brief NotificationsDialog::saveNotification
* Slot activated when mpOkButton clicked signal is raised.\n
* Checks the notification type and calls the appropriate method.
*/
void NotificationsDialog::saveNotification()
{
if (mpNotificationCheckBox->isChecked()) {
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Options/NotificationsDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class NotificationsDialog : public QDialog
enum NotificationIcon {NoIcon, QuestionIcon, InformationIcon, WarningIcon, CriticalIcon};
NotificationsDialog(NotificationType notificationType, NotificationIcon notificationIcon, MainWindow *pMainWindow);
void setNotificationLabelString(QString label);
QCheckBox* getNotificationCheckBox();
QCheckBox* getNotificationCheckBox() {mpNotificationCheckBox;}
private:
MainWindow *mpMainWindow;
Label *mpNotificationLabel;
Expand Down
3 changes: 3 additions & 0 deletions OMEdit/OMEditGUI/Resources/css/stylesheet.qss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
* See the full OSMC Public License conditions for more details.
*
*/
/*
* @author Adeel Asghar <adeel.asghar@liu.se>
*/

QMainWindow::separator {
width: 4px; /* when vertical */
Expand Down

0 comments on commit 7d416a0

Please sign in to comment.