Ejemplo n.º 1
0
// Construct the H-Curve of order k
LSystem::LSystem(Rules rules, std::string ax, uint k) : _order(k), _rules(rules), _axiom(ax) {
    
    // The production string begins as the axiom
    _production = _axiom;
    
    // For each Rule append the LHS to the nonTerminals String
    for (Rules::iterator R = rules.begin(); R != rules.end(); R++) {
        // (duplicates don't matter)
        _nonTerminals.append(1,R->first);
    }
    
    // Do exactly 'k' rewrites of the L-System
    for (int rewrites = 0; rewrites < _order; rewrites++) {
        rewrite(_production);
    }

    // Remove all occurrences of bad commands 
    while (findAndRemove(_production, "+-"));
    while (findAndRemove(_production, "-+"));
    while (findAndRemove(_production, "A"));
    while (findAndRemove(_production, "B"));
    
    // Slightly modify the user's L-System to work with a DawBug
    while (findAndReplace(_production, "F", "W$"));
    while (findAndReplace(_production, "$+", "+"));
    while (findAndReplace(_production, "$-", "-"));
}
Ejemplo n.º 2
0
void Editor::findDialog()
    {
    FindDialog dialog(mEditFiles);
    bool done = false;
    while(!done)
        {
        int ret = dialog.runHideCancel();
        if(ret == GTK_RESPONSE_CANCEL || ret == GTK_RESPONSE_DELETE_EVENT)
            {
            done = true;
            }
        else
            {
            GtkToggleButton *downCheck = GTK_TOGGLE_BUTTON(getBuilder().getWidget(
                    "FindDownCheckbutton"));
            GtkToggleButton *caseCheck = GTK_TOGGLE_BUTTON(getBuilder().getWidget(
                    "CaseSensitiveCheckbutton"));
            GtkEntry *entry = GTK_ENTRY(Builder::getBuilder()->getWidget("FindEntry"));
            if(ret == GTK_RESPONSE_OK)
                {
                find(gtk_entry_get_text(entry), gtk_toggle_button_get_active(downCheck),
                    gtk_toggle_button_get_active(caseCheck));
                }
            else
                {
                GtkEntry *replaceEntry = GTK_ENTRY(getBuilder().getWidget("ReplaceEntry"));
                findAndReplace(gtk_entry_get_text(entry), gtk_toggle_button_get_active(downCheck),
                    gtk_toggle_button_get_active(caseCheck), gtk_entry_get_text(replaceEntry));
                }
            }
        }
    }
Ejemplo n.º 3
0
void escapeParens(ECString& word) {
    findAndReplace(word, "(", "-LRB-");
    findAndReplace(word, ")", "-RRB-");
    findAndReplace(word, "{", "-LCB-");
    findAndReplace(word, "}", "-RCB-");
    findAndReplace(word, "[", "-LSB-");
    findAndReplace(word, "]", "-RSB-");
}
Ejemplo n.º 4
0
string SingleResultItem::toString() {
  string outputString=thisTemplate;

  // ResCachedURL
  string cachedURL="{$appPath}?d={$datasource}&i={$resID}";
  findAndReplace(&cachedURL, "scriptname", "{$appPath}");
  findAndReplace(&cachedURL, "datasource", "{$datasource}");
  findAndReplace(&cachedURL, "id", "{$resID}");
  replaceAll(&outputString, "{%ResCachedURL%}", cachedURL);

  // ResURL
  // if the URL is "" or missing, use the cached URL
  string URLStringToUse=cachedURL;
  if (variables.get("URL")) {
    URLStringToUse=variables.get("URL");

   if (URLStringToUse=="") {
      // see if we have an original URL set at least...
      URLStringToUse=variables.get("origURL");
      if (URLStringToUse=="") {
        // still nothing? default to the cache.
        URLStringToUse=cachedURL;
      }
    } else {
      // insert anything from the root add path... (only if not cached)
      URLStringToUse.insert(0, CGIConfiguration::getInstance().getRootAddPath());
      // ensure http:// is not included if it already exists...
      if ((URLStringToUse.find("http://")!=0) && (URLStringToUse.find("HTTP://")!=0)) {
        URLStringToUse="http://" + URLStringToUse;
      }
    }
  }
  // check the URL - change any %7E's to ~'s - 
  replaceAll(&URLStringToUse, "/%7E", "/~");
  replaceAll(&outputString, "{%ResURL%}", URLStringToUse);

  // ResTitle
  string thisTitle="(no title)";
  if (variables.get("title")) {
    thisTitle=variables.get("title");
    replaceAll(&thisTitle, "<", "&lt;");
    replaceAll(&thisTitle, ">", "&gt;");
  }
  replaceAll(&outputString, "{%ResTitle%}", thisTitle);

  // ResSummary
  findAndReplace(&outputString, "summary", "{%ResSummary%}");

  // ResScore
  findAndReplace(&outputString, "score", "{%ResScore%}");

  // ResOrigUrl
  findAndReplace(&outputString, "origURL", "{%ResOrigURL%}");

  return outputString;
}
Ejemplo n.º 5
0
  std::string
  Url::escape(const char * url)
  {
    Pool pool;

    // First make sure % gets escaped
    std::string partlyEscaped(url);
    findAndReplace(partlyEscaped, "%", "%25");

    // Let svn do the first part of the work
    partlyEscaped=svn_path_uri_autoescape(partlyEscaped.c_str(), pool);

    // Then worry about the rest
    findAndReplace(partlyEscaped, "#", "%23");
    findAndReplace(partlyEscaped, ";", "%3B");
    findAndReplace(partlyEscaped, "?", "%3F");
    findAndReplace(partlyEscaped, "[", "%5B");
    findAndReplace(partlyEscaped, "]", "%5D");

    return partlyEscaped;
  }
Ejemplo n.º 6
0
/**
 * \brief Function to return the converted script
 */
std::string
ScriptGenConvertor::getConvertedScript() {

  std::string result ;
  std::string key, value;
  std::string torqueNodes;
  bool torqueNodeIsAdd = false;
  std::vector< std::pair<std::string, std::string> >::const_iterator iter;
  for(iter = mjobDescriptor.begin(); iter!=mjobDescriptor.end(); ++iter) {

    key =  iter->first;
    value = iter->second;

    //Special case
    if (key.compare(nbNodesAndCpuPerNode)==0) {

      if (!value.empty()){
        if (*(value.begin())=='\"'){
          value.replace(value.begin(), value.begin()+1, "");
        }
        if (*(value.end()-1)=='\"'){
          value.replace(value.end()-1, value.end(), "");
        }
      }

      size_t posNbNodes = value.find(":");
      if (posNbNodes!=std::string::npos) {
        std::string nbNodes = value.substr(0, posNbNodes);
        std::string cpuPerNode = value.substr(posNbNodes+1);

        if (mbatchType==LOADLEVELER) {
          value = " node="+nbNodes+"\n";
          value += "# @ tasks_per_node=1\n";
          value += "# @ tasks_affinity = core(1)\n";
          value += "# @ cpus_per_node = "+cpuPerNode;
        } else if ((mbatchType==TORQUE) || (mbatchType==PBSPRO)) {
          value = " nodes="+nbNodes+":ppn="+cpuPerNode;
        } else if (mbatchType==SLURM) {
          value = " --nodes="+nbNodes+"\n#SBATCH --mincpus="+cpuPerNode;
        }
      }
    }
    //Special case
    if (mbatchType==LOADLEVELER && key.compare(nbCpu)==0) {
      value ="# @ tasks_per_node = 1\n";
      value +="# @ tasks_affinity = core(1)\n";
      value +="# @ cpus_per_node = "+nbCpu+"\n";
    }

    //Special case
    if (mbatchType==TORQUE && key.compare(nbCpu)==0) {
      std::istringstream imscriptGenContent(mscriptGenContent);
      std::string line;
      bool ppnNotDefined=true;;
      while(!imscriptGenContent.eof()) {
        getline(imscriptGenContent, line);
        size_t pos = line.find("#PBS");
        if (pos!=std::string::npos) {
          size_t posL = line.find("-l", pos);
          if (posL!=std::string::npos){
            if (line.find("nodes=", pos)!=std::string::npos) {
              line = line.substr(posL+2);
              ppnNotDefined = false;
              findAndReplace(":ppn=", value, line);
              torqueNodes += "#PBS -l "+line+"\n";
            }
          }
        }
      }
      if (ppnNotDefined){
        value = " nodes=1:ppn="+value;
      }
    }

    //Special case
    if (mbatchType==TORQUE && key.compare(commandSec)==0){
      if (!torqueNodes.empty() && !torqueNodeIsAdd){
        result += torqueNodes;
        torqueNodeIsAdd = true;
      }
    }

    //Special case
    if (key.compare(mailNotification)==0) {

      bool notificationIsNotValid = false;
      if (mbatchType==LOADLEVELER) {
        if (value.compare("BEGIN")==0) {
          value= "start";
        } else if (value.compare("END")==0) {
          value = "complete";
        } else if (value.compare("ERROR")==0) {
          value = "error";
        } else if (value.compare("ALL")==0) {
          value= "always";
        } else {
          notificationIsNotValid = true;
        }
      } else if ((mbatchType == TORQUE) || (mbatchType == PBSPRO)) {
        if (value.compare("BEGIN")==0) {
          value= "b";
        } else if (value.compare("END")==0) {
          value = "e";
        } else if (value.compare("ERROR")==0) {
          value = "a";
        } else if (value.compare("ALL")==0) {
          value= "abe";
        } else {
          notificationIsNotValid = true;
        }
      } else if (mbatchType==SLURM) {
        if (value.compare("BEGIN")==0) {
          value= "BEGIN";
        } else if (value.compare("END")==0) {
          value = "END";
        } else if (value.compare("ERROR")==0) {
          value = "FAIL";
        } else if (value.compare("ALL")==0) {
          value= "ALL";
        } else {
          notificationIsNotValid = true;
        }
      } else if (mbatchType==SGE){
        if (value.compare("BEGIN")==0) {
          value= "b";
        } else if (value.compare("END")==0) {
          value = "e";
        } else if (value.compare("ERROR")==0) {
          value = "a";
        } else if (value.compare("ALL")==0) {
          value= "abe";
        } else {
          notificationIsNotValid = true;
        }
      }

      if (notificationIsNotValid) {
        throw UserException(ERRCODE_INVALID_PARAM, value+" is an invalid notification type:"+" consult the vishnu user manuel");
      }
    }

    result += mconversionTable[key]  + value + "\n";
  }

  return result+mendScript;
}
Ejemplo n.º 7
0
String escapeForRegularExpressions(const String &str)
{
	String aux;
	aux=findAndReplace(str,"+","\\+");
	return aux;
}
Ejemplo n.º 8
0
int main(int argc, char* argv[])
{
	int ciErrNum = 0;
	
	printf("press a key to start\n");
	getchar();

	const char* vendorSDK = btOpenCLUtils::getSdkVendorName();
	printf("This program was compiled using the %s OpenCL SDK\n",vendorSDK);

	cl_device_type  deviceType = CL_DEVICE_TYPE_GPU;//CL_DEVICE_TYPE_ALL
	
	void* glCtx=0;
	void* glDC = 0;
	printf("Initialize OpenCL using btOpenCLUtils::createContextFromType for CL_DEVICE_TYPE_GPU\n");
	g_cxMainContext = btOpenCLUtils::createContextFromType(deviceType, &ciErrNum, glCtx, glDC);
	oclCHECKERROR(ciErrNum, CL_SUCCESS);

	int numDev = btOpenCLUtils::getNumDevices(g_cxMainContext);

	if (numDev>0)
	{
		int deviceIndex=0;

		cl_device_id		device;
		device = btOpenCLUtils::getDevice(g_cxMainContext,deviceIndex);
		btOpenCLDeviceInfo clInfo;
		btOpenCLUtils::getDeviceInfo(device,clInfo);
		btOpenCLUtils::printDeviceInfo(device);


		const char* globalAtomicsKernelStringPatched = globalAtomicsKernelString;
		if (!strstr(clInfo.m_deviceExtensions,"cl_ext_atomic_counters_32"))
		{
			globalAtomicsKernelStringPatched = findAndReplace(globalAtomicsKernelString,"counter32_t", "volatile __global int*");
		}

		

		// create a command-queue
		g_cqCommandQue = clCreateCommandQueue(g_cxMainContext, device, 0, &ciErrNum);
		oclCHECKERROR(ciErrNum, CL_SUCCESS);
		
		cl_mem counterBuffer = clCreateBuffer(g_cxMainContext, CL_MEM_READ_WRITE, sizeof(int), NULL, &ciErrNum);
		oclCHECKERROR(ciErrNum, CL_SUCCESS);

		char* kernelMethods[] = 
		{
			"globalAtomicKernelOpenCL1_1",
			"counterAtomicKernelExt",
			"globalAtomicKernelExt",
			"globalAtomicKernelCounters32Broken"
		};
		int numKernelMethods = sizeof(kernelMethods)/sizeof(char*);

		for (int i=0;i<numKernelMethods;i++)
		{
			int myCounter = 0;

			//write to counterBuffer
			int deviceOffset=0;
			int hostOffset=0;

			ciErrNum = clEnqueueWriteBuffer(g_cqCommandQue, counterBuffer,CL_FALSE, deviceOffset, sizeof(int), &myCounter, 0, NULL, NULL);
			oclCHECKERROR(ciErrNum, CL_SUCCESS);

			g_atomicsKernel = btOpenCLUtils::compileCLKernelFromString(g_cxMainContext,device,globalAtomicsKernelStringPatched,kernelMethods[i], &ciErrNum);
			oclCHECKERROR(ciErrNum, CL_SUCCESS);

		


			ciErrNum = clSetKernelArg(g_atomicsKernel, 0, sizeof(cl_mem),(void*)&counterBuffer);
			oclCHECKERROR(ciErrNum, CL_SUCCESS);

			size_t	numWorkItems = workGroupSize*((NUM_OBJECTS + (workGroupSize-1)) / workGroupSize);
			ciErrNum = clEnqueueNDRangeKernel(g_cqCommandQue, g_atomicsKernel, 1, NULL, &numWorkItems, &workGroupSize,0 ,0 ,0);
			oclCHECKERROR(ciErrNum, CL_SUCCESS);
			
			clFinish(g_cqCommandQue);
			oclCHECKERROR(ciErrNum, CL_SUCCESS);

			//read from counterBuffer
			ciErrNum = clEnqueueReadBuffer(g_cqCommandQue, counterBuffer, CL_TRUE, deviceOffset, sizeof(int), &myCounter, 0, NULL, NULL);
			 oclCHECKERROR(ciErrNum, CL_SUCCESS);

			 if (myCounter != NUM_OBJECTS)
			 {
				 printf("%s is broken, expected %d got %d\n",kernelMethods[i],NUM_OBJECTS,myCounter);
			 } else
			 {
				 printf("%s success, got %d\n",kernelMethods[i],myCounter);
			 }
		}

		clReleaseCommandQueue(g_cqCommandQue);
		oclCHECKERROR(ciErrNum, CL_SUCCESS);
	}

	clReleaseContext(g_cxMainContext);
	
	printf("press a key to end\n");
	getchar();

	return 0;
}
Ejemplo n.º 9
0
    void run()
    {
        if (node->rank == 0)
        {
            std::ifstream fh_in;
            fh_in.open(fn_commands.c_str());
            if (!fh_in)
                REPORT_ERROR(ERR_IO_NOTOPEN, (std::string)"Cannot open " + fn_commands);
            std::string line;
            int number_of_node_waiting = 0; // max is nprocs -1
            while (!fh_in.eof())
            {
                //wait until a server is free
                MPI_Recv(0, 0, MPI_INT, MPI_ANY_SOURCE, 0,
                         MPI_COMM_WORLD, &status);
                number_of_node_waiting++;
                getline(fh_in, line);
                line=findAndReplace(line,"MPI_NEWLINE","\n");
                strcpy(szline, line.c_str());

                std::string::size_type loc = line.find("MPI_BARRIER", 0);
                if (loc != std::string::npos)
                {
                    while (number_of_node_waiting < (node->size - 1))
                    {
                        MPI_Recv(0, 0, MPI_INT, MPI_ANY_SOURCE, 0,
                                 MPI_COMM_WORLD, &status);
                        number_of_node_waiting++;
                    }
                    while (number_of_node_waiting > 0)
                    {
                        MPI_Send(&szline, 1, MPI_CHAR, number_of_node_waiting,
                                 TAG_WAIT, MPI_COMM_WORLD);
                        number_of_node_waiting--;
                    }
                    continue;
                }

                //send work
                MPI_Send(&szline, MAX_LINE, MPI_CHAR, status.MPI_SOURCE,
                         TAG_WORK, MPI_COMM_WORLD);
                number_of_node_waiting--;
            }

            fh_in.close();
            for (size_t i = 1; i < node->size; i++)
                MPI_Send(0, 0, MPI_INT, i, TAG_STOP, MPI_COMM_WORLD);
        }
        else
        {
            while (1)
            {
                //I am free
                MPI_Send(0, 0, MPI_INT, 0, 0, MPI_COMM_WORLD);
                //get your next task
                MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
                if (status.MPI_TAG == TAG_STOP)//I am free
                    break;
                else if (status.MPI_TAG == TAG_WAIT)//wait
                {
                    MPI_Recv(&szline, 1, MPI_CHAR, 0, TAG_WAIT, MPI_COMM_WORLD, &status);
                    continue;
                }
                else if (status.MPI_TAG == TAG_WORK)//work to do
                {
                    MPI_Recv(&szline, MAX_LINE, MPI_CHAR, 0, TAG_WORK, MPI_COMM_WORLD, &status);
                    //do the job
                    if(strlen(szline)<1)
                        continue;
                    else
                    {
                        if (system(szline)==-1)
                        	REPORT_ERROR(ERR_UNCLASSIFIED,"Cannot open shell");
                    }
                }
                else
                    std::cerr << "WRONG TAG RECEIVED" << std::endl;

            }
        }

    }
Ejemplo n.º 10
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
	// open database connection
    db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName("/Users/jdoud/dev/brainstorm.sqlite");
	if(!db.open())
	{
		qDebug() << db.lastError();
		qFatal("Failed to connect.");
	}

	// setup UI
    ui->setupUi(this);
	ui->toolBar->addWidget(ui->comboFonts);
	ui->toolBar->addWidget(ui->comboFontSizes);
	ui->toolBar->addWidget(ui->comboColors);

	// set text editor defaults
	ui->textNote->document()->setIndentWidth(20);
	ui->textNote->setTabStopWidth(20);
	ui->textNote->setTabChangesFocus(false);
	ui->actionIncrease_Indent->setShortcut(Qt::Key_Tab);
	ui->actionDecrease_Indent->setShortcut(Qt::Key_Backtab);

	// setup comboColors
	QPixmap pix(16, 16);
	pix.fill(Qt::white);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::black);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::red);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::blue);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::darkGreen);
	ui->comboColors->addItem(pix, "");
	pix.fill(Qt::gray);
	ui->comboColors->addItem(pix, "");


	// create system tray icon
	createActions();
	createTrayIcon();

	// create models
    categoriesModel = new QSqlTableModel();
	categoriesModel->setTable("categories");
	categoriesModel->setSort(1, Qt::AscendingOrder);
	categoriesModel->select();
	ui->listCategories->setModel(categoriesModel);
	ui->listCategories->setModelColumn(1);

    notesModel = new QSqlTableModel();
	notesModel->setTable("notes");
	ui->listNotes->setModel(notesModel);
	ui->listNotes->setModelColumn(2);

    // set splitter size
    QList<int> sizes;
    sizes << 230 << 150;
    ui->splitterLists->setSizes(sizes);
    sizes.clear();
    sizes << 230 << 600;
    ui->splitterNote->setSizes(sizes);

    // connect File menu slots
    connect(ui->actionNew_Category, SIGNAL(triggered()), this, SLOT(newCategory()));
    connect(ui->actionRename_Category, SIGNAL(triggered()), this, SLOT(renameCategory()));
    connect(ui->actionDelete_Category, SIGNAL(triggered()), this, SLOT(deleteCategory()));
    connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote()));
    connect(ui->actionRename_Note, SIGNAL(triggered()), this, SLOT(renameNote()));
    connect(ui->actionSave_Note, SIGNAL(triggered()), this, SLOT(saveNote()));
    connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote()));
    connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(quit()));
    // connect Edit menu slots	
    connect(ui->actionFind_Replace, SIGNAL(triggered()), this, SLOT(findAndReplace()));
    // connect Format menu slots
    connect(ui->actionBold, SIGNAL(triggered()), this, SLOT(bold()));
    connect(ui->actionItalic, SIGNAL(triggered()), this, SLOT(italic()));
    connect(ui->actionUnderline, SIGNAL(triggered()), this, SLOT(underline()));
    connect(ui->actionStrikethrough, SIGNAL(triggered()), this, SLOT(strikethrough()));
    connect(ui->actionBullet_List, SIGNAL(triggered()), this, SLOT(bulletList()));
    connect(ui->actionNumber_List, SIGNAL(triggered()), this, SLOT(numberList()));
    connect(ui->actionIncrease_Indent, SIGNAL(triggered()), this, SLOT(increaseIndent()));
    connect(ui->actionDecrease_Indent, SIGNAL(triggered()), this, SLOT(decreaseIndent()));
    connect(ui->actionShow_Colors, SIGNAL(triggered()), this, SLOT(showColors()));
    connect(ui->actionShow_Fonts, SIGNAL(triggered()), this, SLOT(showFonts()));
    connect(ui->actionIncrease_Font, SIGNAL(triggered()), this, SLOT(increaseFont()));
    connect(ui->actionDecrease_Font, SIGNAL(triggered()), this, SLOT(decreaseFont()));
    connect(ui->actionReset_Font, SIGNAL(triggered()), this, SLOT(resetFont()));
    connect(ui->actionAlign_Left, SIGNAL(triggered()), this, SLOT(alignLeft()));
    connect(ui->actionAlign_Center, SIGNAL(triggered()), this, SLOT(alignCenter()));
    connect(ui->actionAlign_Right, SIGNAL(triggered()), this, SLOT(alignRight()));
    connect(ui->actionAlign_Justify, SIGNAL(triggered()), this, SLOT(alignJustify()));
    // connect View menu slots
    connect(ui->actionHide_Window, SIGNAL(triggered()), this, SLOT(hide()));
    connect(ui->actionPrevious_Category, SIGNAL(triggered()), this, SLOT(previousCategory()));
    connect(ui->actionNext_Category, SIGNAL(triggered()), this, SLOT(nextCategory()));
    connect(ui->actionPrevious_Note, SIGNAL(triggered()), this, SLOT(previousNote()));
    connect(ui->actionNext_Note, SIGNAL(triggered()), this, SLOT(nextNote()));
    // connect Help menu slots
    connect(ui->actionAbout_Brainstorm, SIGNAL(triggered()), this, SLOT(aboutBrainstorm()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), this, SLOT(aboutQt()));
	// connect application slots
	connect(ui->textNote, SIGNAL(cursorPositionChanged()), this, SLOT(updateMenus()));
	connect(ui->textNote, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(updateMenus()));
    connect(ui->comboFonts, SIGNAL(activated(QString)), this, SLOT(setFont(QString)));
    connect(ui->comboFontSizes, SIGNAL(activated(QString)), this, SLOT(setFontSize(QString)));
    connect(ui->comboColors, SIGNAL(activated(int)), this, SLOT(setFontColor(int)));
	// connect category list slots
	connect(ui->listCategories->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateNoteList(QModelIndex)));
	// connect note list slots
	connect(ui->listNotes->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateNoteText(QModelIndex)));
	// connect text slots
	ui->textNote->installEventFilter((this));
	// connect system tray icon
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

	// initialize default data
	ui->listCategories->selectionModel()->setCurrentIndex(categoriesModel->index(0, 1), QItemSelectionModel::SelectCurrent);

}