Back to index

fet  5.18.0
Public Slots | Public Member Functions
ActivityTagsForm Class Reference

#include <activitytagsform.h>

List of all members.

Public Slots

void addActivityTag ()
void removeActivityTag ()
void renameActivityTag ()
void sortActivityTags ()
void activityTagChanged (int index)
void activateActivityTag ()
void deactivateActivityTag ()
void help ()

Public Member Functions

 ActivityTagsForm (QWidget *parent)
 ~ActivityTagsForm ()

Detailed Description

Definition at line 23 of file activitytagsform.h.


Constructor & Destructor Documentation

ActivityTagsForm::ActivityTagsForm ( QWidget *  parent)

Definition at line 42 of file activitytagsform.cpp.

                                                 : QDialog(parent)
{
       setupUi(this);
       
       currentActivityTagTextEdit->setReadOnly(true);

       renameActivityTagPushButton->setDefault(true);

       activityTagsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

       connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
       connect(addActivityTagPushButton, SIGNAL(clicked()), this, SLOT(addActivityTag()));
       connect(removeActivityTagPushButton, SIGNAL(clicked()), this, SLOT(removeActivityTag()));
       connect(renameActivityTagPushButton, SIGNAL(clicked()), this, SLOT(renameActivityTag()));
       connect(sortActivityTagsPushButton, SIGNAL(clicked()), this, SLOT(sortActivityTags()));
       connect(activityTagsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(activityTagChanged(int)));
       connect(activateActivityTagPushButton, SIGNAL(clicked()), this, SLOT(activateActivityTag()));
       connect(deactivateActivityTagPushButton, SIGNAL(clicked()), this, SLOT(deactivateActivityTag()));
       connect(activityTagsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(renameActivityTag()));
       connect(helpPushButton, SIGNAL(clicked()), this, SLOT(help()));

       centerWidgetOnScreen(this);
       restoreFETDialogGeometry(this);
       //restore splitter state
       QSettings settings(COMPANY, PROGRAM);
       if(settings.contains(this->metaObject()->className()+QString("/splitter-state")))
              splitter->restoreState(settings.value(this->metaObject()->className()+QString("/splitter-state")).toByteArray());
              
       activityTagsListWidget->clear();
       for(int i=0; i<gt.rules.activityTagsList.size(); i++){
              ActivityTag* sbt=gt.rules.activityTagsList[i];
              activityTagsListWidget->addItem(sbt->name);
       }
              
       if(activityTagsListWidget->count()>0)
              activityTagsListWidget->setCurrentRow(0);
}

Here is the call graph for this function:

Definition at line 81 of file activitytagsform.cpp.

{
       saveFETDialogGeometry(this);
       //save splitter state
       QSettings settings(COMPANY, PROGRAM);
       settings.setValue(this->metaObject()->className()+QString("/splitter-state"), splitter->saveState());
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 214 of file activitytagsform.cpp.

{
       if(activityTagsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected activity tag"));
              return;
       }

       QString text=activityTagsListWidget->currentItem()->text();
       int count=gt.rules.activateActivityTag(text);
       QMessageBox::information(this, tr("FET information"), tr("Activated a number of %1 activities").arg(count));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ActivityTagsForm::activityTagChanged ( int  index) [slot]

Definition at line 201 of file activitytagsform.cpp.

{
       if(index<0){
              currentActivityTagTextEdit->setPlainText(QString(""));
              return;
       }
       
       ActivityTag* st=gt.rules.activityTagsList.at(index);
       assert(st);
       QString s=st->getDetailedDescriptionWithConstraints(gt.rules);
       currentActivityTagTextEdit->setPlainText(s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 89 of file activitytagsform.cpp.

{
       bool ok = FALSE;
       ActivityTag* sbt=new ActivityTag();
       sbt->name = QInputDialog::getText( this, tr("Add activity tag"), tr("Please enter activity tag's name") ,
        QLineEdit::Normal, QString(), &ok );

       if ( ok && !((sbt->name).isEmpty()) ){
              // user entered something and pressed OK
              if(!gt.rules.addActivityTag(sbt)){
                     QMessageBox::information( this, tr("Activity tag insertion dialog"),
                            tr("Could not insert item. Must be a duplicate"));
                     delete sbt;
              }
              else{
                     activityTagsListWidget->addItem(sbt->name);
                     activityTagsListWidget->setCurrentRow(activityTagsListWidget->count()-1);
              }
       }
       else{
              if(ok){ //the user entered nothing
                     QMessageBox::information(this, tr("FET information"), tr("Incorrect name"));
              }
              delete sbt;// user entered nothing or pressed Cancel
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 226 of file activitytagsform.cpp.

{
       if(activityTagsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected activity tag"));
              return;
       }

       QString text=activityTagsListWidget->currentItem()->text();
       int count=gt.rules.deactivateActivityTag(text);
       QMessageBox::information(this, tr("FET information"), tr("De-activated a number of %1 activities").arg(count));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ActivityTagsForm::help ( ) [slot]

Definition at line 238 of file activitytagsform.cpp.

{
       QMessageBox::information(this, tr("FET help on activity tags"), 
        tr("Activity tag is a field which can be used or not, depending on your wish (optional field)."
        " It is designed to help you with some constraints. Each activity has a possible empty list of activity tags"
        " (if you don't use activity tags, the list will be empty)"));
}

Here is the caller graph for this function:

Definition at line 116 of file activitytagsform.cpp.

{
       int i=activityTagsListWidget->currentRow();
       if(activityTagsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected activity tag"));
              return;
       }

       QString text=activityTagsListWidget->currentItem()->text();
       int activity_tag_ID=gt.rules.searchActivityTag(text);
       if(activity_tag_ID<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected activity tag"));
              return;
       }

       if(QMessageBox::warning( this, tr("FET"),
              tr("Are you sure you want to delete this activity tag?"),
              tr("Yes"), tr("No"), 0, 0, 1 ) == 1)
              return;

       int tmp=gt.rules.removeActivityTag(text);
       if(tmp){
              activityTagsListWidget->setCurrentRow(-1);
              QListWidgetItem* item;
              item=activityTagsListWidget->takeItem(i);
              delete item;
              
              if(i>=activityTagsListWidget->count())
                     i=activityTagsListWidget->count()-1;
              if(i>=0)
                     activityTagsListWidget->setCurrentRow(i);
              else
                     currentActivityTagTextEdit->setPlainText(QString(""));
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 152 of file activitytagsform.cpp.

{
       int i=activityTagsListWidget->currentRow();
       if(activityTagsListWidget->currentRow()<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected activity tag"));
              return;
       }
       
       QString initialActivityTagName=activityTagsListWidget->currentItem()->text();

       int activity_tag_ID=gt.rules.searchActivityTag(initialActivityTagName);
       if(activity_tag_ID<0){
              QMessageBox::information(this, tr("FET information"), tr("Invalid selected activity tag"));
              return;
       }

       bool ok = FALSE;
       QString finalActivityTagName;
       finalActivityTagName = QInputDialog::getText( this, tr("Rename activity tag"), tr("Please enter new activity tag's name") ,
        QLineEdit::Normal, initialActivityTagName, &ok );

       if ( ok && !(finalActivityTagName.isEmpty()) ){
              // user entered something and pressed OK
              if(gt.rules.searchActivityTag(finalActivityTagName)>=0){
                     QMessageBox::information( this, tr("Activity tag insertion dialog"),
                            tr("Could not modify item. New name must be a duplicate"));
              }
              else{
                     gt.rules.modifyActivityTag(initialActivityTagName, finalActivityTagName);
                     activityTagsListWidget->item(i)->setText(finalActivityTagName);
                     activityTagChanged(activityTagsListWidget->currentRow());
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 187 of file activitytagsform.cpp.

{
       gt.rules.sortActivityTagsAlphabetically();

       activityTagsListWidget->clear();
       for(int i=0; i<gt.rules.activityTagsList.size(); i++){
              ActivityTag* sbt=gt.rules.activityTagsList[i];
              activityTagsListWidget->addItem(sbt->name);
       }

       if(activityTagsListWidget->count()>0)
              activityTagsListWidget->setCurrentRow(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: