Example #1
0
//! Add or update an entry in the cut list
void TTCutList::onAddEntry(int cutIn, int cutOut)
{
  int cutIndex;

  if ( ttAssigned(cutListData) ) {

    if (editItemIndex < 0) {
      cutIndex = cutListData->addItem( cutIn, cutOut );

      QTreeWidgetItem* treeItem = new QTreeWidgetItem(videoCutList);
      treeItem->setText(0, cutListData->streamFileName());
      treeItem->setText(1, cutListData->cutInPosString(cutIndex));
      treeItem->setText(2, cutListData->cutOutPosString(cutIndex));
      treeItem->setText(3, cutListData->cutLengthString(cutIndex));
    } else {
      cutListData->updateItem(editItemIndex, cutIn, cutOut);
      QTreeWidgetItem* editItem = videoCutList->topLevelItem(editItemIndex);
      editItem->setText(0, cutListData->streamFileName());
      editItem->setText(1, cutListData->cutInPosString(editItemIndex));
      editItem->setText(2, cutListData->cutOutPosString(editItemIndex));
      editItem->setText(3, cutListData->cutLengthString(editItemIndex));

      editItem->setBackgroundColor(0, Qt::white);
      editItem->setBackgroundColor(1, Qt::white);
      editItem->setBackgroundColor(2, Qt::white);
      editItem->setBackgroundColor(3, Qt::white);
      editItem->setBackgroundColor(4, Qt::white);

      editItemIndex = -1;
    }
    emit refreshDisplay();
    //cutListData->print();
  }
}
Example #2
0
//! [1]
int AdcListReader::read(QIODevice *device, QTreeWidgetItem **retVal)
{
    xml.setDevice(device);
    if (xml.readNextStartElement()) {
        QXmlStreamAttributes attr(xml.attributes());
        if (xml.name() == "FileListing" && attr.value("Version") == "1") {
            // Read extra metadata
            treeWidget->setProperty("generator", attr.value("Generator").toString().trimmed());
            treeWidget->setProperty("base", attr.value("Base").toString().trimmed());

            QTreeWidgetItem *topLevelNode = createChildItem(0, ShowListing::DirFileTree::RootType);
            topLevelNode->setBackgroundColor(0, QColor(240, 240, 255));
            topLevelNode->setTextColor(0, Qt::darkMagenta);
            topLevelNode->setText(0, attr.value("GeneratedDate").toString().trimmed() != "" ? QString("Date=%1").arg(attr.value("GeneratedDate").toString().trimmed()) : "");
            topLevelNode->setIcon(0, treeWidget->catalogIcon);
            topLevelNode->setData(1, Qt::UserRole, 0);

            readAdcList(topLevelNode);

            qulonglong totalSize = topLevelNode->data(1, Qt::UserRole).toLongLong();
            topLevelNode->setText(1, QString("[ %1 ]").arg(humanizeBigNums(totalSize, 2)));
            topLevelNode->setTextColor(1, getColorFromSize(totalSize));
            if (retVal) {
                *retVal = topLevelNode;
            }
        }
        else {
            xml.raiseError(QObject::tr("The file is not an ADC FileListing version 1 XML file. Found root element: %1")
                       .arg(xml.name().toString()));
        }
    }
    return xml.hasError();
}
Example #3
0
void SkladView::add(ShopItem *pItem, const bool isNew)
{
    QTreeWidgetItem*    pTreeItem = new QTreeWidgetItem();
    pTreeItem->setText(sklad_view_num, "---");
    pTreeItem->setText(sklad_view_code,  pItem->code);
    pTreeItem->setText(sklad_view_name,  pItem->name);
    pTreeItem->setText(sklad_view_count, QString::number(pItem->count));
    pTreeItem->setText(sklad_view_sell_price,  QString::number(pItem->selling_price));
    pTreeItem->setText(sklad_view_buy_price,  QString::number(pItem->buying_price));
    pTreeItem->setText(sklad_view_discont,  QString::number(pItem->discont));
    pTreeItem->setText(sklad_view_bonus,  QString::number(pItem->bonus));
    pTreeItem->setText(sklad_view_bonus_pay,  ShopState::flagToString(pItem->flags & si_flag_cant_pay_bonus));
    pTreeItem->setText(sklad_view_free_price,  ShopState::flagToString(pItem->flags & si_flag_free_price));

    float   finalPrice = pItem->selling_price*(1. - 0.01*pItem->discont);
    pTreeItem->setText(sklad_view_final_price,  QString::number(finalPrice));

    pTreeItem->setData(sklad_view_num, sklad_view_role_item, QVariant::fromValue((void*)pItem));
    pTreeItem->setData(sklad_view_num, sklad_view_role_state, isNew ? sklad_view_new_item : sklad_view_exs_item);

    pTreeItem->setFlags(pTreeItem->flags() | Qt::ItemIsEditable);

    if(isNew){
        for(int n = 0; n < sklad_view_total; ++n)
            pTreeItem->setBackgroundColor(n, QColor(200, 255, 200, 255));
    } else{
        pTreeItem->setText(sklad_view_added,        pItem->added.toString());
        pTreeItem->setText(sklad_view_last_change,  pItem->changed.toString());
    }

    ui->view->addTopLevelItem(pTreeItem);
}
Example #4
0
void DlgCustomKeyboardImp::onModifyMacroAction(const QByteArray& macro)
{
    QVariant data = categoryBox->itemData(categoryBox->currentIndex(), Qt::UserRole);
    QString group = data.toString();
    if (group == QLatin1String("Macros"))
    {
        CommandManager & cCmdMgr = Application::Instance->commandManager();
        Command* pCmd = cCmdMgr.getCommandByName(macro);
        for (int i=0; i<commandTreeWidget->topLevelItemCount(); i++) {
            QTreeWidgetItem* item = commandTreeWidget->topLevelItem(i);
            QByteArray command = item->data(1, Qt::UserRole).toByteArray();
            if (command == macro) {
                item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
                item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
                item->setData(1, Qt::UserRole, macro);
                item->setSizeHint(0, QSize(32, 32));
                item->setBackgroundColor(0, Qt::lightGray);
                if (pCmd->getPixmap())
                    item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap()));
                if (commandTreeWidget->isItemSelected(item))
                    textLabelDescription->setText(item->toolTip(1));
                break;
            }
        }
    }
}
AEResult GameAssetTreeWidget::CreateAudioAssetGameAssetBranch(AudioAsset* gameAsset)
{
	////////////////////////////////////////////
	//No need to lock this function as it is internal
	//and calling function should lock it
	////////////////////////////////////////////

	if (!m_IsReady)
	{
		return AEResult::NotReady;
	}

	AEAssert(m_EngineViewer != nullptr);
	if (m_EngineViewer == nullptr)
	{
		AETODO("Add new error GameAppNull");
		return AEResult::NullObj;
	}

	AEAssert(gameAsset != nullptr);
	if (gameAsset == nullptr)
	{
		return AEResult::NullParameter;
	}

	////////////////////////////////////////
	//Create Branch
	QTreeWidgetItem* branch = new QTreeWidgetItem();
	branch->setData(0, Qt::ItemDataRole::DisplayRole, QString::fromStdWString(gameAsset->GetName()));
	branch->setData(0, AE_QT_ITEM_DATA_ROLE_GAME_ASSET_UNIQUE_ID, QVariant(gameAsset->GetUniqueAssetID()));

	////////////////////////////////////////
	//Add to Main Tree
	this->addTopLevelItem(branch);

	////////////////////////////////////////
	//Set background as red if it not loaded
	if (!gameAsset->IsLoaded())
	{
		branch->setBackgroundColor(0, QColor(255, 0, 0));
		branch->setBackgroundColor(1, QColor(255, 0, 0));
	}

	////////////////////////////////////////
	//Game Content Type
	QTreeWidgetItem* gameContentTypeChild = new QTreeWidgetItem();
	gameContentTypeChild->setData(0, Qt::ItemDataRole::DisplayRole, "GCT");
	gameContentTypeChild->setData(1, Qt::ItemDataRole::DisplayRole, "Audio");
	gameContentTypeChild->setToolTip(0, "Game Content Type");

	////////////////////////////////////////
	//Add Child to Model Branch
	branch->addChild(gameContentTypeChild);

	////////////////////////////////////////
	//Finish
	return AEResult::Ok;
}
void CompareSideBySideView::setupItem(DiffSingleNodeResult *node, QTreeWidgetItem *currentNodeItem, const bool isReference, QList<QTreeWidgetItem*> &itemsList, QList<DiffInfo*> &diffList, const bool isChildrenBlocked)
{
    SourceElementDiffOperation *sourceRef = node->referenceElement();
    SourceElementDiffOperation *compareRef = node->compareElement();
    SourceElementDiffOperation *source = getSource(node, isReference);
    bool isEmpty = isNodeEmpty(node, isReference);
    QString text = getText(source, node->type(), isEmpty);
    setGraphic(currentNodeItem, node->type(), isEmpty) ;

    currentNodeItem->setText(0, text);

    if(node->hasAttributes()) {
        QTreeWidgetItem *attributeTextItem = newTreeItem(itemsList);
        if(isReference) {
            DiffInfo *info = NULL ;
            // if blocked, use the last item
            if(isChildrenBlocked) {
                info = diffList.at(diffList.size() - 1);
            }
            setLastItemDiff(isReference, itemsList, diffList, info);
        }
        if(!isEmpty) {
            //attributeTextItem->setBackgroundColor(0, colo);aaa
            attributeTextItem->setBackgroundColor(0, currentNodeItem->backgroundColor(0));
            attributeTextItem->setText(0, tr("Attributes:"));
        } else {
            attributeTextItem->setBackgroundColor(0, _chrome.emptyColor());
        }
        currentNodeItem->addChild(attributeTextItem);

        // added only if it is the reference
        bool emptyAddedAttributes = !isReference || isEmpty ;
        bool emptyDeletedAttributes = isReference || isEmpty ;

        if(NULL != sourceRef) {
            appendAttributes(node, attributeTextItem, EDiff::ED_ADDED, isReference, emptyAddedAttributes, sourceRef->addedAttributes(), itemsList, diffList, isChildrenBlocked);
        }
        appendAttributes(node, attributeTextItem, EDiff::ED_MODIFIED, isReference, isEmpty, source->modifiedAttributes(), itemsList, diffList, isChildrenBlocked);
        appendAttributes(node, attributeTextItem, EDiff::ED_EQUAL, isReference, isEmpty, node->equalsAttributes(), itemsList, diffList, isChildrenBlocked);

        if(NULL != compareRef) {
            appendAttributes(node, attributeTextItem, EDiff::ED_DELETED, isReference, emptyDeletedAttributes, compareRef->addedAttributes(), itemsList, diffList, isChildrenBlocked);
        }
    }
}
Example #7
0
/** Sets content of tree widget corresponding \a stops list.
  * * \sa gradientStops()
  */
void GradientEditWidget::setGradientStops(const QGradientStops &stops) {
    treeWidget->clear();
    foreach (QGradientStop stop, stops) {
        QStringList list;
        list << QString::number(stop.first, 'f', 2) << "";
        QTreeWidgetItem *item = new QTreeWidgetItem(list);
        item->setBackgroundColor(1, stop.second);
        treeWidget->addTopLevelItem(item);
    }
Example #8
0
bool wxListCtrl::SetItem(wxListItem& info)
{
    const long id = info.GetId();
    QTreeWidgetItem *qitem = QtGetItem(id);
    if ( qitem != NULL )
    {
        if ((info.m_mask & wxLIST_MASK_TEXT) && !info.GetText().IsNull() )
            qitem->setText(info.GetColumn(), wxQtConvertString(info.GetText()));
        qitem->setTextAlignment(info.GetColumn(), wxQtConvertTextAlign(info.GetAlign()));

        if ( info.m_mask & wxLIST_MASK_DATA )
        {
            QVariant variant = qVariantFromValue(info.GetData());
            qitem->setData(0, Qt::UserRole, variant);
        }
        if (info.m_mask & wxLIST_MASK_STATE)
        {
            if ((info.m_stateMask & wxLIST_STATE_FOCUSED) &&
                (info.m_state & wxLIST_STATE_FOCUSED))
                    m_qtTreeWidget->setCurrentItem(qitem, 0);
            if (info.m_stateMask & wxLIST_STATE_SELECTED)
                qitem->setSelected(info.m_state & wxLIST_STATE_SELECTED);
        }
        if (info.m_mask & wxLIST_MASK_IMAGE)
        {
            if (info.m_image >= 0)
            {
                wxImageList *imglst = GetImageList(InReportView() ? wxIMAGE_LIST_SMALL : wxIMAGE_LIST_NORMAL);
                wxCHECK_MSG(imglst, false, "invalid listctrl imagelist");
                const wxBitmap* bitmap = imglst->GetBitmapPtr(info.m_image);
                if (bitmap != NULL)
                {
                    // set the new image:
                    qitem->setIcon( info.GetColumn(), QIcon( *bitmap->GetHandle() ));
                }
            }
            else
            {
                // remove the image using and empty qt icon:
                qitem->setIcon( info.GetColumn(), QIcon() );
            }
        }
        for (int col=0; col<GetColumnCount(); col++)
        {
            if ( info.GetFont().IsOk() )
                qitem->setFont(col, info.GetFont().GetHandle() );
            if ( info.GetTextColour().IsOk() )
                qitem->setTextColor(col, info.GetTextColour().GetHandle());
            if ( info.GetBackgroundColour().IsOk() )
                qitem->setBackgroundColor(col, info.GetBackgroundColour().GetHandle());
        }
        return true;
    }
    else
        return false;
}
Example #9
0
void QUTaskItem::installSmartSettings() {
	task()->provideData(monty->unsupportedTags(), QUTask::UnsupportedTags);
	foreach(QUSmartSettingInterface *smartSetting, task()->smartSettings()) {
		QTreeWidgetItem *sItem = new QTreeWidgetItem();
		sItem->setBackgroundColor(0, QColor(239, 239, 239));
		addChild(sItem);
		treeWidget()->setItemWidget(sItem, 0, smartSetting->editor());

		connect(smartSetting, SIGNAL(changed()), this, SLOT(highlightChanges()));
	}
Example #10
0
void TestListView::onRunTestsStarted(void) {

    // gray out all tests
    const int programCount = topLevelItemCount();
    for ( int i = 0; i < programCount; ++i ) {
        QTreeWidgetItem* programItem = topLevelItem(i);
        Q_ASSERT_X(programItem, Q_FUNC_INFO, "null tree item");
        programItem->setBackgroundColor(0, m_noResultColor);

        const int suiteCount = programItem->childCount();
        for ( int j = 0; j < suiteCount; ++j ) {
            QTreeWidgetItem* suiteItem = programItem->child(j);
            Q_ASSERT_X(suiteItem, Q_FUNC_INFO, "null tree item");
            suiteItem->setBackgroundColor(0, m_noResultColor);

            const int testCount = suiteItem->childCount();
            for ( int k = 0; k < testCount; ++k ) {
                QTreeWidgetItem* testItem = suiteItem->child(k);
                Q_ASSERT_X(testItem, Q_FUNC_INFO, "null tree item");
                testItem->setBackgroundColor(0, m_noResultColor);
            }
        }
    }
}
Example #11
0
void DlgCustomKeyboardImp::onAddMacroAction(const QByteArray& macro)
{
    QVariant data = categoryBox->itemData(categoryBox->currentIndex(), Qt::UserRole);
    QString group = data.toString();
    if (group == QLatin1String("Macros"))
    {
        CommandManager & cCmdMgr = Application::Instance->commandManager();
        Command* pCmd = cCmdMgr.getCommandByName(macro);

        QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
        item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
        item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
        item->setData(1, Qt::UserRole, macro);
        item->setSizeHint(0, QSize(32, 32));
        item->setBackgroundColor(0, Qt::lightGray);
        if (pCmd->getPixmap())
            item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap()));
    }
}
Example #12
0
//Adds child to item in CFDP tree
int Item::addChild(int column, QColor color, QString text, QIcon icon)
{
    //Creates child
    QTreeWidgetItem *newChild = new QTreeWidgetItem();

    //Creates item for timestamp, to become first child of child
    QTreeWidgetItem *timeChild = new QTreeWidgetItem();

    //Sets up child and timestamp based on parameters given to child
    if(column == 0)
    {
        newChild->setText(0, text);
        newChild->setBackgroundColor(0, color);
        timeChild->setText(0, time());
        timeChild->setTextColor(0, white);
    }
    else if(column == 1)
    {
        newChild->setText(1, "      " + text);
        newChild->setBackgroundColor(1, color);
        timeChild->setText(1, "            " + time());
        timeChild->setTextColor(1, white);
    }
    else
    {
        newChild->setText(0, text);
        newChild->setText(1, "      " + text);
        newChild->setBackgroundColor(0, color);
        newChild->setBackgroundColor(1, color);
        timeChild->setText(0, time());
        timeChild->setText(1, "            " + time());
        timeChild->setTextColor(0, white);
        timeChild->setTextColor(1, white);
    }

    //Sets text color (for easy viewing) and status (for easy sorting) based on color given to child
    if(color == yellow)
    {
        newChild->setTextColor(0, black);
        newChild->setTextColor(1, black);
        status = 4;
    }
    else if(color == orange)
    {
        newChild->setTextColor(0, black);
        newChild->setTextColor(1, black);
        status = 3;
    }
    else if(color == none)
    {
        newChild->setTextColor(0, white);
        newChild->setTextColor(1, white);
        status = 5;
    }
    else
    {
        newChild->setTextColor(0, black);
        newChild->setTextColor(1, black);
    }

    //Sets top level item icon
    topLevelItem->setIcon(0, icon);
    topLevelItem->setIcon(1, icon);

    //Adds child and timestamp to top level item
    topLevelItem->addChild(newChild);
    children.push_back(newChild);
    newChild->addChild(timeChild);

    //Returns current number of children for easy access when adding grandchildren
    return(children.size());
}
Example #13
0
OptionsFileLocations::OptionsFileLocations() :
    LabeledSectionGroup(NULL)
{
    // Path locations
    QStringList columnNames;
    columnNames.append("Type");
    columnNames.append("Location");

    mpPathTree = new CustomTreeWidget(this);
    addSection(createLabeledSection(mpPathTree, columnNames, "Default Paths", this), 1000);

    // File locations
    columnNames.append("Arguments");
    mpFileTree = new CustomTreeWidget(this);
    addSection(createLabeledSection(mpFileTree, columnNames, "Default Files", this), 1000);
    addStretch(1);

    mFileLocations.push_back(FileLocationDescriptor("Default Export Path",
                             ConfigurationSettings::getSettingExportPathKey()));

    mFileLocations.push_back(FileLocationDescriptor("Default Import Path",
                             ConfigurationSettings::getSettingImportPathKey()));

    mFileLocations.push_back(FileLocationDescriptor("Default Session Save/Open Path",
                             ConfigurationSettings::getSettingSaveOpenSessionPathKey()));

    FileBrowser* pTemplateFileBrowser = new FileBrowser(mpFileTree);
    pTemplateFileBrowser->setBrowseCaption("Select Template File");
    pTemplateFileBrowser->setBrowseFileFilters("Template Files (*.spg);;All Files (*)");
    pTemplateFileBrowser->hide();
    mFileLocations.push_back(FileLocationDescriptor("Default Product Template",
                             ProductView::getSettingTemplateFileKey(), pTemplateFileBrowser));

    mFileLocations.push_back(FileLocationDescriptor("Message Log Path",
                             ConfigurationSettings::getSettingMessageLogPathKey()));

    mFileLocations.push_back(FileLocationDescriptor("Product Template Path",
                             ProductView::getSettingTemplatePathKey()));

    mFileLocations.push_back(FileLocationDescriptor("Temp Path",
                             ConfigurationSettings::getSettingTempPathKey()));

    mFileLocations.push_back(FileLocationDescriptor("Support Files Path",
                             ConfigurationSettings::getSettingSupportFilesPathKey()));

    mFileLocations.push_back(FileLocationDescriptor("Wizard Path",
                             ConfigurationSettings::getSettingWizardPathKey()));

    FileBrowser* pTextEditorBrowser = new FileBrowser(mpFileTree);
    pTextEditorBrowser->setBrowseCaption("Select Text Editor");
    pTextEditorBrowser->setToolTip(
        "If %1 is specified as an argument it will be replaced by the name of the file to be edited at run time.\n"
        "Otherwise the name of the file will be appended to the command line after all of the specified arguments.");
#if defined(WIN_API)
    pTextEditorBrowser->setBrowseFileFilters("Text Editors (*.exe);;All Files (*)");
#endif

    pTextEditorBrowser->hide();
    mFileLocations.push_back(FileLocationDescriptor("Text Editor", ConfigurationSettings::getSettingTextEditorKey(),
                             pTextEditorBrowser, ConfigurationSettings::getSettingTextEditorArgumentsKey()));

    Service<ConfigurationSettings> pSettings;
    for (vector<FileLocationDescriptor>::iterator iter = mFileLocations.begin(); iter != mFileLocations.end(); ++iter)
    {
        QString dir;
        const Filename* pFilename = dv_cast<Filename>(&pSettings->getSetting(iter->getKey()));
        if (pFilename != NULL)
        {
            dir = QString::fromStdString(pFilename->getFullPathAndName());
            dir.replace(QRegExp("\\\\"), "/");
        }

        QTreeWidgetItem* pItem = new QTreeWidgetItem(iter->getFileBrowser() == NULL ? mpPathTree : mpFileTree);
        if (pItem != NULL)
        {
            pItem->setText(0, QString::fromStdString(iter->getText()));
            pItem->setText(1, dir);

            if (iter->getFileBrowser() == NULL)
            {
                mpPathTree->setCellWidgetType(pItem, 1, CustomTreeWidget::BROWSE_DIR_EDIT);
            }
            else
            {
                mpFileTree->setCellWidgetType(pItem, 1, CustomTreeWidget::BROWSE_FILE_EDIT);
                mpFileTree->setFileBrowser(pItem, 1, iter->getFileBrowser());
                if (iter->getArgumentKey().empty())
                {
                    pItem->setBackgroundColor(2, QColor(235, 235, 235));
                }
                else
                {
                    const string& arguments = dv_cast<string>(pSettings->getSetting(iter->getArgumentKey()));
                    mpFileTree->setCellWidgetType(pItem, 2, CustomTreeWidget::LINE_EDIT);
                    pItem->setText(2, QString::fromStdString(arguments));
                }
            }
        }

        if (iter->getText() == "Wizard Path")
        {
            mWizardPath = pFilename->getFullPathAndName();
        }
    }

    mpPathTree->resizeColumnToContents(0);
    mpFileTree->resizeColumnToContents(0);
}
Example #14
0
/** Checks for an already occupied shortcut. */
void DlgCustomKeyboardImp::on_editShortcut_textChanged(const QString& sc)
{
    assignedTreeWidget->clear();
    QTreeWidgetItem* item = commandTreeWidget->currentItem();
    if (!item)
        return;
    QVariant data = item->data(1, Qt::UserRole);
    QByteArray name = data.toByteArray(); // command name

    CommandManager & cCmdMgr = Application::Instance->commandManager();
    Command* cmd = cCmdMgr.getCommandByName(name.constData());
    if (cmd && !cmd->getAction()) {
        buttonAssign->setEnabled(false); // command not in use
        return;
    }

    buttonAssign->setEnabled(true);
    QKeySequence ks(sc);
    if (!ks.isEmpty()) {
        int countAmbiguous = 0;
        QString ambiguousCommand;
        QString ambiguousMenu;

        CommandManager & cCmdMgr = Application::Instance->commandManager();
        std::vector<Command*> cmds = cCmdMgr.getAllCommands();
        for (std::vector<Command*>::iterator it = cmds.begin(); it != cmds.end(); ++it) {
            QList<QAction*> acts;
            if ((*it)->getAction()) {
                // A command may have several QAction's. So, check all of them if one of them matches (See bug #0002160)
                QList<QAction*> acts = (*it)->getAction()->findChildren<QAction*>();
                for (QList<QAction*>::iterator jt = acts.begin(); jt != acts.end(); ++jt) {
                    if ((*jt)->shortcut() == ks) {
                        ++countAmbiguous;
                        ambiguousCommand = QString::fromAscii((*it)->getName()); // store the last one
                        ambiguousMenu = qApp->translate((*it)->className(), (*it)->getMenuText());

                        QTreeWidgetItem* item = new QTreeWidgetItem(assignedTreeWidget);
                        item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText()));
                        item->setToolTip(1, qApp->translate((*it)->className(), (*it)->getToolTipText()));
                        item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
                        item->setSizeHint(0, QSize(32, 32));
                        item->setBackgroundColor(0, Qt::lightGray);
                        if ((*it)->getPixmap())
                            item->setIcon(0, BitmapFactory().iconFromTheme((*it)->getPixmap()));
                        break;
                    }
                }
            }
        }

        if (countAmbiguous > 0)
            assignedTreeWidget->resizeColumnToContents(0);
        
        if (countAmbiguous > 1) {
            QMessageBox::warning(this, tr("Multiple defined shortcut"),
                                 tr("The shortcut '%1' is defined more than once. This could result into unexpected behaviour.").arg(sc) );
            editShortcut->setFocus();
            buttonAssign->setEnabled(false);
        } else if (countAmbiguous == 1 && ambiguousCommand != QLatin1String(name)) {
            QMessageBox::warning(this, tr("Already defined shortcut"),
                                 tr("The shortcut '%1' is already assigned to '%2'.\n\nPlease define another shortcut.").arg(sc).arg(ambiguousMenu) );
            editShortcut->setFocus();
            buttonAssign->setEnabled(false);
        } else {
            if (cmd && cmd->getAction() && cmd->getAction()->shortcut() == ks)
                buttonAssign->setEnabled(false);
        }
    } else {
        if (cmd && cmd->getAction() && cmd->getAction()->shortcut().isEmpty())
            buttonAssign->setEnabled(false); // both key sequences are empty
    }
}
void FileDescriptorWidget::initialize()
{
   mpTreeWidget->clear();
   mpGcpTree->clear();
   mpGcpGroup->hide();

   if (mpFileDescriptor == NULL)
   {
      return;
   }

   // Filename
   QTreeWidgetItem* pFilenameItem = new QTreeWidgetItem(mpTreeWidget);
   if (pFilenameItem != NULL)
   {
      string filename = mpFileDescriptor->getFilename();

      pFilenameItem->setText(0, "Filename");
      pFilenameItem->setText(1, QString::fromStdString(filename));
   }

   // Data set location
   QTreeWidgetItem* pDatasetLocationItem = new QTreeWidgetItem(mpTreeWidget);
   if (pDatasetLocationItem != NULL)
   {
      string datasetLocation = mpFileDescriptor->getDatasetLocation();

      pDatasetLocationItem->setText(0, "Data Set Location");
      pDatasetLocationItem->setText(1, QString::fromStdString(datasetLocation));
   }

   // Endian
   QTreeWidgetItem* pEndianItem = new QTreeWidgetItem(mpTreeWidget);
   if (pEndianItem != NULL)
   {
      EndianType endian = mpFileDescriptor->getEndian();
      string endianText = StringUtilities::toDisplayString(endian);

      pEndianItem->setText(0, "Endian");
      pEndianItem->setText(1, QString::fromStdString(endianText));

      if (mReadOnly == false)
      {
         QComboBox* pEndianCombo = new QComboBox(mpTreeWidget);
         pEndianCombo->setEditable(false);
         pEndianCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(LITTLE_ENDIAN_ORDER)));
         pEndianCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(BIG_ENDIAN_ORDER)));
         pEndianCombo->hide();

         mpTreeWidget->setCellWidgetType(pEndianItem, 1, CustomTreeWidget::COMBO_BOX);
         mpTreeWidget->setComboBox(pEndianItem, 1, pEndianCombo);
      }
   }

   // Raster element file descriptor items
   RasterFileDescriptor* pRasterDescriptor = dynamic_cast<RasterFileDescriptor*>(mpFileDescriptor);
   if (pRasterDescriptor == NULL)
   {
      return;
   }

   mpGcpGroup->show();

   // Rows
   QTreeWidgetItem* pRowsItem = new QTreeWidgetItem();
   if (pRowsItem != NULL)
   {
      unsigned int rows = pRasterDescriptor->getRowCount();

      pRowsItem->setText(0, "Rows");
      pRowsItem->setText(1, QString::number(rows));

      mpTreeWidget->insertTopLevelItem(2, pRowsItem);
      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pRowsItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Columns
   QTreeWidgetItem* pColumnsItem = new QTreeWidgetItem();
   if (pColumnsItem != NULL)
   {
      unsigned int columns = pRasterDescriptor->getColumnCount();

      pColumnsItem->setText(0, "Columns");
      pColumnsItem->setText(1, QString::number(columns));

      mpTreeWidget->insertTopLevelItem(3, pColumnsItem);
      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pColumnsItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Bits per element
   QTreeWidgetItem* pBitsPerElementItem = new QTreeWidgetItem();
   if (pBitsPerElementItem != NULL)
   {
      unsigned int bitsPerElement = pRasterDescriptor->getBitsPerElement();

      pBitsPerElementItem->setText(0, "Bits Per Element");
      pBitsPerElementItem->setText(1, QString::number(bitsPerElement));

      mpTreeWidget->insertTopLevelItem(4, pBitsPerElementItem);
      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pBitsPerElementItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Header bytes
   QTreeWidgetItem* pHeaderBytesItem = new QTreeWidgetItem(mpTreeWidget);
   if (pHeaderBytesItem != NULL)
   {
      unsigned int headerBytes = pRasterDescriptor->getHeaderBytes();

      pHeaderBytesItem->setText(0, "Header Bytes");
      pHeaderBytesItem->setText(1, QString::number(headerBytes));

      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pHeaderBytesItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Trailer bytes
   QTreeWidgetItem* pTrailerBytesItem = new QTreeWidgetItem(mpTreeWidget);
   if (pTrailerBytesItem != NULL)
   {
      unsigned int trailerBytes = pRasterDescriptor->getTrailerBytes();

      pTrailerBytesItem->setText(0, "Trailer Bytes");
      pTrailerBytesItem->setText(1, QString::number(trailerBytes));

      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pTrailerBytesItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Preline bytes
   QTreeWidgetItem* pPrelineBytesItem = new QTreeWidgetItem(mpTreeWidget);
   if (pPrelineBytesItem != NULL)
   {
      unsigned int prelineBytes = pRasterDescriptor->getPrelineBytes();

      pPrelineBytesItem->setText(0, "Preline Bytes");
      pPrelineBytesItem->setText(1, QString::number(prelineBytes));

      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pPrelineBytesItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Postline bytes
   QTreeWidgetItem* pPostlineBytesItem = new QTreeWidgetItem(mpTreeWidget);
   if (pPostlineBytesItem != NULL)
   {
      unsigned int postlineBytes = pRasterDescriptor->getPostlineBytes();

      pPostlineBytesItem->setText(0, "Postline Bytes");
      pPostlineBytesItem->setText(1, QString::number(postlineBytes));

      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pPostlineBytesItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Pixel size
   QTreeWidgetItem* pXPixelSizeItem = new QTreeWidgetItem(mpTreeWidget);
   if (pXPixelSizeItem != NULL)
   {
      double pixelSize = pRasterDescriptor->getXPixelSize();

      pXPixelSizeItem->setText(0, "X Pixel Size");
      pXPixelSizeItem->setText(1, QString::number(pixelSize));

      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pXPixelSizeItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   QTreeWidgetItem* pYPixelSizeItem = new QTreeWidgetItem(mpTreeWidget);
   if (pYPixelSizeItem != NULL)
   {
      double pixelSize = pRasterDescriptor->getYPixelSize();

      pYPixelSizeItem->setText(0, "Y Pixel Size");
      pYPixelSizeItem->setText(1, QString::number(pixelSize));

      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pYPixelSizeItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Units
   const Units* pUnits = pRasterDescriptor->getUnits();
   if (pUnits != NULL)
   {
      QTreeWidgetItem* pUnitsItem = new QTreeWidgetItem(mpTreeWidget);
      if (pUnitsItem != NULL)
      {
         pUnitsItem->setText(0, "Units");
         pUnitsItem->setBackgroundColor(1, Qt::lightGray);

         // Name
         QTreeWidgetItem* pNameItem = new QTreeWidgetItem(pUnitsItem);
         if (pNameItem != NULL)
         {
            string unitsName = pUnits->getUnitName();

            pNameItem->setText(0, "Name");
            pNameItem->setText(1, QString::fromStdString(unitsName));

            if (mReadOnly == false)
            {
               mpTreeWidget->setCellWidgetType(pNameItem, 1, CustomTreeWidget::LINE_EDIT);
            }
         }

         // Type
         QTreeWidgetItem* pTypeItem = new QTreeWidgetItem(pUnitsItem);
         if (pTypeItem != NULL)
         {
            UnitType unitType = pUnits->getUnitType();
            string unitTypeText = StringUtilities::toDisplayString(unitType);

            pTypeItem->setText(0, "Type");
            pTypeItem->setText(1, QString::fromStdString(unitTypeText));

            if (mReadOnly == false)
            {
               QComboBox* pUnitTypeCombo = new QComboBox(mpTreeWidget);
               pUnitTypeCombo->setEditable(false);
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(ABSORBANCE)));
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(ABSORPTANCE)));
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(DIGITAL_NO)));
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(DISTANCE)));
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(EMISSIVITY)));
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(RADIANCE)));
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(REFLECTANCE)));
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(REFLECTANCE_FACTOR)));
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(TRANSMITTANCE)));
               pUnitTypeCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(CUSTOM_UNIT)));
               pUnitTypeCombo->hide();

               mpTreeWidget->setCellWidgetType(pTypeItem, 1, CustomTreeWidget::COMBO_BOX);
               mpTreeWidget->setComboBox(pTypeItem, 1, pUnitTypeCombo);
            }
         }

         // Scale
         QTreeWidgetItem* pScaleItem = new QTreeWidgetItem(pUnitsItem);
         if (pScaleItem != NULL)
         {
            double dScale = pUnits->getScaleFromStandard();

            pScaleItem->setText(0, "Scale");
            pScaleItem->setText(1, QString::number(dScale));

            if (mReadOnly == false)
            {
               mpTreeWidget->setCellWidgetType(pScaleItem, 1, CustomTreeWidget::LINE_EDIT);
            }
         }

         // Range minimum
         QTreeWidgetItem* pMinimumItem = new QTreeWidgetItem(pUnitsItem);
         if (pMinimumItem != NULL)
         {
            double dMinimum = pUnits->getRangeMin();

            pMinimumItem->setText(0, "Range Minimum");
            pMinimumItem->setText(1, QString::number(dMinimum));

            if (mReadOnly == false)
            {
               mpTreeWidget->setCellWidgetType(pMinimumItem, 1, CustomTreeWidget::LINE_EDIT);
            }
         }

         // Range maximum
         QTreeWidgetItem* pMaximumItem = new QTreeWidgetItem(pUnitsItem);
         if (pMaximumItem != NULL)
         {
            double dMaximum = pUnits->getRangeMax();

            pMaximumItem->setText(0, "Range Maximum");
            pMaximumItem->setText(1, QString::number(dMaximum));

            if (mReadOnly == false)
            {
               mpTreeWidget->setCellWidgetType(pMaximumItem, 1, CustomTreeWidget::LINE_EDIT);
            }
         }
      }
   }

   // GCPs
   if (mpGcpTree != NULL)
   {
      const list<GcpPoint>& gcps = pRasterDescriptor->getGcps();
      if (gcps.empty() == false)
      {
         list<GcpPoint>::const_iterator iter;
         unsigned int i = 0;

         for (iter = gcps.begin(), i = 0; iter != gcps.end(); ++iter, ++i)
         {
            GcpPoint gcp = *iter;

            QTreeWidgetItem* pGcpItem = new QTreeWidgetItem(mpGcpTree);
            if (pGcpItem != NULL)
            {
               QString strLatitude;
               QString strLongitude;
               LatLonPoint latLonPoint(gcp.mCoordinate);

               string latText = latLonPoint.getLatitudeText();
               if (latText.empty() == false)
               {
                  strLatitude = QString::fromStdString(latText);
               }

               string longText = latLonPoint.getLongitudeText();
               if (longText.empty() == false)
               {
                  strLongitude = QString::fromStdString(longText);
               }

               pGcpItem->setText(0, QString("GCP ") + QString::number(i + 1));
               pGcpItem->setText(1, QString::number(gcp.mPixel.mX + 1.0));
               pGcpItem->setText(2, QString::number(gcp.mPixel.mY + 1.0));
               pGcpItem->setText(3, strLatitude);
               pGcpItem->setText(4, strLongitude);
            }
         }

         mpGcpTree->setEnabled(true);
      }
      else
      {
         mpGcpTree->setEnabled(false);
      }
   }

   // Bands
   QTreeWidgetItem* pBandsItem = new QTreeWidgetItem();
   if (pBandsItem != NULL)
   {
      unsigned int bands = pRasterDescriptor->getBandCount();

      pBandsItem->setText(0, "Bands");
      pBandsItem->setText(1, QString::number(bands));

      mpTreeWidget->insertTopLevelItem(4, pBandsItem);
      if (mReadOnly == false)
      {
         mpTreeWidget->setCellWidgetType(pBandsItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Interleave format
   InterleaveFormatType interleave = pRasterDescriptor->getInterleaveFormat();

   QTreeWidgetItem* pInterleaveItem = new QTreeWidgetItem();
   if (pInterleaveItem != NULL)
   {
      string interleaveText = StringUtilities::toDisplayString(interleave);
      if (interleave == BSQ)
      {
         const vector<const Filename*>& bandFiles = pRasterDescriptor->getBandFiles();
         if (bandFiles.size() > 0)
         {
            interleaveText += BSQ_MULTI_SUFFIX;
         }
         else
         {
            interleaveText += BSQ_SINGLE_SUFFIX;
         }
      }
      pInterleaveItem->setText(0, "Interleave Format");
      pInterleaveItem->setText(1, QString::fromStdString(interleaveText));

      mpTreeWidget->insertTopLevelItem(7, pInterleaveItem);
      if (mReadOnly == false)
      {
         QComboBox* pInterleaveCombo = new QComboBox(mpTreeWidget);
         pInterleaveCombo->setEditable(false);
         pInterleaveCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(BIL)));
         pInterleaveCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(BIP)));
         pInterleaveCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(BSQ) + BSQ_SINGLE_SUFFIX));
         pInterleaveCombo->addItem(QString::fromStdString(StringUtilities::toDisplayString(BSQ) + BSQ_MULTI_SUFFIX));
         pInterleaveCombo->hide();

         mpTreeWidget->setCellWidgetType(pInterleaveItem, 1, CustomTreeWidget::COMBO_BOX);
         mpTreeWidget->setComboBox(pInterleaveItem, 1, pInterleaveCombo);
      }
   }

   // Band files
   const vector<const Filename*>& bandFiles = pRasterDescriptor->getBandFiles();
   for (unsigned int i = 0; i < bandFiles.size(); ++i)
   {
      string bandFilename = bandFiles[i]->getFullPathAndName();
      if (bandFilename.empty() == false)
      {
         QTreeWidgetItem* pBandItem = new QTreeWidgetItem(pFilenameItem);
         if (pBandItem != NULL)
         {
            pBandItem->setText(0, QString::number(i + 1));
            pBandItem->setText(1, QString::fromStdString(bandFilename));

            if (mReadOnly == false)
            {
               mpTreeWidget->setCellWidgetType(pBandItem, 1, CustomTreeWidget::BROWSE_FILE_EDIT);
               mpTreeWidget->setFileBrowser(pBandItem, 1, mpFileBrowser);
            }
         }
      }
   }

   // Preband bytes
   QTreeWidgetItem* pPrebandBytesItem = new QTreeWidgetItem();
   if (pPrebandBytesItem != NULL)
   {
      QString strPrebandBytes;
      QColor cellColor = Qt::lightGray;

      if (interleave == BSQ)
      {
         strPrebandBytes = QString::number(pRasterDescriptor->getPrebandBytes());
         cellColor = Qt::white;
      }

      pPrebandBytesItem->setText(0, "Preband Bytes");
      pPrebandBytesItem->setText(1, strPrebandBytes);
      pPrebandBytesItem->setBackgroundColor(1, cellColor);

      mpTreeWidget->insertTopLevelItem(12, pPrebandBytesItem);
      if ((mReadOnly == false) && (interleave == BSQ))
      {
         mpTreeWidget->setCellWidgetType(pPrebandBytesItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }

   // Postband bytes
   QTreeWidgetItem* pPostbandBytesItem = new QTreeWidgetItem();
   if (pPostbandBytesItem != NULL)
   {
      QString strPostbandBytes;
      QColor cellColor = Qt::lightGray;

      if (interleave == BSQ)
      {
         strPostbandBytes = QString::number(pRasterDescriptor->getPostbandBytes());
         cellColor = Qt::white;
      }

      pPostbandBytesItem->setText(0, "Postband Bytes");
      pPostbandBytesItem->setText(1, strPostbandBytes);
      pPostbandBytesItem->setBackgroundColor(1, cellColor);

      mpTreeWidget->insertTopLevelItem(13, pPostbandBytesItem);
      if ((mReadOnly == false) && (interleave == BSQ))
      {
         mpTreeWidget->setCellWidgetType(pPostbandBytesItem, 1, CustomTreeWidget::LINE_EDIT);
      }
   }
}
Example #16
0
void SoundLibraryPanel::updateDrumkitList()
{
	QString currentSL = Hydrogen::get_instance()->getCurrentDrumkitname();

	LocalFileMng mng;

	__sound_library_tree->clear();



	__system_drumkits_item = new QTreeWidgetItem( __sound_library_tree );
	__system_drumkits_item->setText( 0, trUtf8( "System drumkits" ) );
	__sound_library_tree->setItemExpanded( __system_drumkits_item, true );

	__user_drumkits_item = new QTreeWidgetItem( __sound_library_tree );
	__user_drumkits_item->setText( 0, trUtf8( "User drumkits" ) );
	__sound_library_tree->setItemExpanded( __user_drumkits_item, true );

	

	for (uint i = 0; i < __system_drumkit_info_list.size(); ++i ) {
		delete __system_drumkit_info_list[i];
	}
	__system_drumkit_info_list.clear();

	for (uint i = 0; i < __user_drumkit_info_list.size(); ++i ) {
		delete __user_drumkit_info_list[i];
	}
	__user_drumkit_info_list.clear();

	//User drumkit list
    QStringList usr_dks = Filesystem::usr_drumkits_list();
    for (int i = 0; i < usr_dks.size(); ++i) {
		QString absPath = Filesystem::usr_drumkits_dir() + "/" + usr_dks[i];
		Drumkit *pInfo = Drumkit::load( absPath );
		if (pInfo) {
			__user_drumkit_info_list.push_back( pInfo );
			QTreeWidgetItem* pDrumkitItem = new QTreeWidgetItem( __user_drumkits_item );
			pDrumkitItem->setText( 0, pInfo->get_name() );
			if ( QString(pInfo->get_name() ) == currentSL ){
				pDrumkitItem->setBackgroundColor( 0, QColor( 50, 50, 50) );
			}
			InstrumentList *pInstrList = pInfo->get_instruments();
			for ( uint nInstr = 0; nInstr < pInstrList->size(); ++nInstr ) {
				Instrument *pInstr = pInstrList->get( nInstr );
				QTreeWidgetItem* pInstrumentItem = new QTreeWidgetItem( pDrumkitItem );
				pInstrumentItem->setText( 0, QString( "[%1] " ).arg( nInstr + 1 ) + pInstr->get_name() );
				pInstrumentItem->setToolTip( 0, pInstr->get_name() );
			}
		}
	}

	//System drumkit list
    QStringList sys_dks = Filesystem::sys_drumkits_list();
    for (int i = 0; i < sys_dks.size(); ++i) {
		QString absPath = Filesystem::sys_drumkits_dir() + "/" + sys_dks[i];
		Drumkit *pInfo = Drumkit::load( absPath );
		if (pInfo) {
			__system_drumkit_info_list.push_back( pInfo );
			QTreeWidgetItem* pDrumkitItem = new QTreeWidgetItem( __system_drumkits_item );
			pDrumkitItem->setText( 0, pInfo->get_name() );
			if ( QString( pInfo->get_name() ) == currentSL ){
				pDrumkitItem->setBackgroundColor( 0, QColor( 50, 50, 50) );
			}
			InstrumentList *pInstrList = pInfo->get_instruments();
			for ( uint nInstr = 0; nInstr < pInstrList->size(); ++nInstr ) {
				Instrument *pInstr = pInstrList->get( nInstr );
				QTreeWidgetItem* pInstrumentItem = new QTreeWidgetItem( pDrumkitItem );
				pInstrumentItem->setText( 0, QString( "[%1] " ).arg( nInstr + 1 ) + pInstr->get_name() );
				pInstrumentItem->setToolTip( 0, pInstr->get_name() );
			}
		}
	}
	
	//Songlist
	QStringList songs = Filesystem::songs_list();
	if ( songs.size() > 0 ) {
		__song_item = new QTreeWidgetItem( __sound_library_tree );
		__song_item->setText( 0, trUtf8( "Songs" ) );
		__song_item->setToolTip( 0, "double click to expand the list" );
		__sound_library_tree->setItemExpanded( __song_item, __expand_songs_list );
		for (uint i = 0; i < songs.size(); i++) {
			QTreeWidgetItem* pSongItem = new QTreeWidgetItem( __song_item );
			QString song = songs[i];
			pSongItem->setText( 0 , song.left( song.indexOf(".")) );
			pSongItem->setToolTip( 0, song );
		}
	}


	//Pattern list
	std::vector<QString> patternDirList = mng.getPatternDirList();
	if ( patternDirList.size() > 0 ) {
		
		__pattern_item = new QTreeWidgetItem( __sound_library_tree );
		__pattern_item->setText( 0, trUtf8( "Patterns" ) );
		__pattern_item->setToolTip( 0, "double click to expand the list" );
		__sound_library_tree->setItemExpanded( __pattern_item, __expand_pattern_list );
			
		//this is to push the mng.getPatternList in all patterns/drumkit dirs
		for (uint i = 0; i < patternDirList.size(); ++i) {
			QString absPath =  patternDirList[i];
			mng.getPatternList( absPath );
		}
		
		//this is the second step to push the mng.funktion
		//SoundLibraryDatabase::create_instance();
		SoundLibraryDatabase* db = SoundLibraryDatabase::get_instance();
		soundLibraryInfoVector* allPatternDirList = db->getAllPatterns();
		QStringList allCategoryNameList = db->getAllPatternCategories();

		//now sorting via category

		for (uint i = 0; i < allCategoryNameList.size(); ++i) {
			QString categoryName = allCategoryNameList[i];

			QTreeWidgetItem* pCategoryItem = new QTreeWidgetItem( __pattern_item );
			pCategoryItem->setText( 0, categoryName  );

			soundLibraryInfoVector::iterator mapIterator;
			for( mapIterator=allPatternDirList->begin(); mapIterator != allPatternDirList->end(); mapIterator++ )
			{
				QString patternCategory = (*mapIterator)->getCategory();
				if ( patternCategory == categoryName || patternCategory.isEmpty() && categoryName == "No category" ){
					QTreeWidgetItem* pPatternItem = new QTreeWidgetItem( pCategoryItem );
					pPatternItem->setText( 0, (*mapIterator)->getName());
					pPatternItem->setText( 1, (*mapIterator)->getPath() );
					pPatternItem->setToolTip( 0, mng.getDrumkitNameForPattern( (*mapIterator)->getPath() ));
					INFOLOG( "Path" +  (*mapIterator)->getPath() );
				}
			}
		}
	}


}
void FileDescriptorWidget::descriptorItemChanged(QTreeWidgetItem* pItem, int iColumn)
{
   if ((pItem == NULL) || (iColumn != 1))
   {
      return;
   }

   QString strItem = pItem->text(0);
   QString strValue = pItem->text(1);

   if (strItem == "Interleave Format")
   {
      // Enable/disable the preband and postband bytes
      QString strPrebandBytes;
      QString strPostbandBytes;
      QColor cellColor = Qt::lightGray;
      CustomTreeWidget::WidgetType cellWidget = CustomTreeWidget::NO_WIDGET;

      string value = strValue.toStdString();
      if ((value == StringUtilities::toDisplayString(BSQ) + BSQ_SINGLE_SUFFIX) ||
          (value == StringUtilities::toDisplayString(BSQ) + BSQ_MULTI_SUFFIX))
      {
         const RasterFileDescriptor* pRasterFileDescriptor =
            dynamic_cast<const RasterFileDescriptor*>(mpFileDescriptor);
         if (pRasterFileDescriptor != NULL)
         {
            strPrebandBytes = QString::number(pRasterFileDescriptor->getPrebandBytes());
            strPostbandBytes = QString::number(pRasterFileDescriptor->getPostbandBytes());
            cellColor = Qt::white;
            cellWidget = CustomTreeWidget::LINE_EDIT;
         }
      }

      QTreeWidgetItem* pPrebandItem = getDescriptorItem("Preband Bytes");
      if (pPrebandItem != NULL)
      {
         pPrebandItem->setText(1, strPrebandBytes);
         pPrebandItem->setBackgroundColor(1, cellColor);
         mpTreeWidget->setCellWidgetType(pPrebandItem, 1, cellWidget);
      }

      QTreeWidgetItem* pPostbandItem = getDescriptorItem("Postband Bytes");
      if (pPostbandItem != NULL)
      {
         pPostbandItem->setText(1, strPostbandBytes);
         pPostbandItem->setBackgroundColor(1, cellColor);
         mpTreeWidget->setCellWidgetType(pPostbandItem, 1, cellWidget);
      }

      // Update the number of band file items
      updateBandFiles();
   }
   else if (strItem == "Bands")
   {
      // Update the number of band file items
      updateBandFiles();
   }

   mModified = true;
   emit valueChanged(strItem);
   emit modified();
}