Example #1
0
int CDlgExport::exec()
{

    itemWpt = new QTreeWidgetItem(treeWidget, QStringList(tr("Waypoints")));
    itemWpt->setIcon(0,QIcon(":/icons/iconWaypoint16x16.png"));
    itemWpt->setExpanded(true);

    itemTrk = new QTreeWidgetItem(treeWidget, QStringList(tr("Tracks")));
    itemTrk->setIcon(0,QIcon(":/icons/iconTrack16x16.png"));
    itemTrk->setExpanded(true);

    itemRte = new QTreeWidgetItem(treeWidget, QStringList(tr("Routes")));
    itemRte->setIcon(0,QIcon(":/icons/iconRoute16x16.png"));
    itemRte->setExpanded(true);

    if(keysWpt)
    {

        CWptDB::keys_t key;
        QList<CWptDB::keys_t> keys = CWptDB::self().keys();

        foreach(key, keys)
        {
            QStringList str;
            str << key.name << key.comment.left(32);
            QTreeWidgetItem * item = new QTreeWidgetItem(itemWpt, str);

            CWpt *wpt = CWptDB::self().getWptByKey(key.key);
            if (wpt->sticky)
            {
                item->setCheckState(0, Qt::Unchecked);
                item->setFlags(0);
            }
            else
            {
                item->setCheckState(0, Qt::Checked);
            }

            item->setIcon(0,getWptIconByName(key.icon));
            item->setData(0, Qt::UserRole, key.key);
        }

    }
void DownloadLogImpl::buildLog(QList<LogEntry> logEntries, VideoInformation *videoInformation)
{
	for (int n = 0; n < logEntries.count(); n++)
	{
		QTreeWidgetItem *item = new LogTreeWidgetItem(lsvLog);

		item->setText(0, logEntries.at(n).dateTime.toString());
		item->setText(1, logEntries.at(n).title);
		item->setText(2, logEntries.at(n).URL);

		item->setIcon(0, QIcon(videoInformation->getHostImage(logEntries.at(n).URL)));

		item->setSizeHint(0, QSize(18,18));

		item->setData(0, Qt::UserRole, logEntries.at(n).dateTime);
	}
	// sort list
	lsvLog->sortItems(0, Qt::AscendingOrder);
}
Example #3
0
			//////////////////////////////////////////////////////////////////////////
			//																	    //
			//////////////////////////////////////////////////////////////////////////
			// Create a new folder in the specified item.
			QTreeWidgetItem *CMainWindow::CreateFolder(QTreeWidgetItem *p_pItem, const QDir &p_oPath)
			{
				// Retrieves parent folder.
				CFolder *pParentFolder = p_pItem->data(0, Qt::UserRole).value<CFolder*>();
				CFolder *pFolder = SAM_NEW CFolder(p_oPath, pParentFolder);
				pParentFolder->AddFolder(pFolder);

				QVariant oData = qVariantFromValue<CFolder*>(pFolder);

				QTreeWidgetItem *pItem = new QTreeWidgetItem();				
				pItem->setIcon(0, QIcon(QStringLiteral(":/data/32x32/directory.png")));
				pItem->setFlags(pItem->flags() | Qt::ItemIsEditable);
				pItem->setData(0, Qt::UserRole, oData);
				pItem->setText(0, p_oPath.dirName());
				p_pItem->addChild(pItem);
				ui->projectsTreeWidget->setCurrentItem(pItem);

				return pItem;
			}
Example #4
0
void EditMode::refreshChannelList()
{
    m_channelList->clear();

    for (int i = 0; i < m_mode->channels().size(); i++)
    {
        QTreeWidgetItem* item = new QTreeWidgetItem(m_channelList);
        QLCChannel* ch = m_mode->channel(i);
        Q_ASSERT(ch != NULL);

        QString str;
        str.sprintf("%.3d", (i + 1));
        item->setText(COL_NUM, str);
        item->setText(COL_NAME, ch->name());
        item->setIcon(COL_NAME, ch->getIcon());
        item->setData(COL_NAME, PROP_PTR, (qulonglong) ch);
    }
    m_channelList->header()->resizeSections(QHeaderView::ResizeToContents);
}
Example #5
0
void ActionsWidget::updateActionItem( QTreeWidgetItem* item, ClipAction* action )
{
    if ( !item || !action ) {
        qCDebug(KLIPPER_LOG) << "null pointer passed to function, nothing done";
        return;
    }

    // clear children if any
    item->takeChildren();
    item->setText( 0, action->regExp() );
    item->setText( 1, action->description() );

    foreach (const ClipCommand& command, action->commands()) {
        QStringList cmdProps;
        cmdProps << command.command << command.description;
        QTreeWidgetItem *child = new QTreeWidgetItem(item, cmdProps);
        child->setIcon(0, QIcon::fromTheme(command.icon.isEmpty() ? QStringLiteral("system-run") : command.icon));
    }
}
Example #6
0
//![10]
void FtpWindow::addToList(const QUrlInfo &urlInfo)
{
    QTreeWidgetItem *item = new QTreeWidgetItem;
    item->setText(0, urlInfo.name());
    item->setText(1, QString::number(urlInfo.size()));
    item->setText(2, urlInfo.owner());
    item->setText(3, urlInfo.group());
    item->setText(4, urlInfo.lastModified().toString("MMM dd yyyy"));

    QPixmap pixmap(urlInfo.isDir() ? ":/images/dir.png" : ":/images/file.png");
    item->setIcon(0, pixmap);

    isDirectory[urlInfo.name()] = urlInfo.isDir();
    fileList->addTopLevelItem(item);
    if (!fileList->currentItem()) {
        fileList->setCurrentItem(fileList->topLevelItem(0));
        fileList->setEnabled(true);
    }
}
Example #7
0
// public
void PluginsDialog::addPlugins( const PluginsLoader& ploader)
{
    const QList<PluginsLoader::PluginMeta>& plugins = ploader.getPlugins();

    for ( const PluginsLoader::PluginMeta& pmeta : plugins)
    {
        QTreeWidgetItem *pluginItem = new QTreeWidgetItem(ui->treeWidget);
        pluginItem->setText(0, pmeta.filepath);
        QFont font = pluginItem->font(0);
        font.setBold(true);
        pluginItem->setFont(0, font);

        if ( !pmeta.loaded)   // Show plugin in red italics if it couldn't be loaded
        {
            pluginItem->setTextColor(0, QColor::fromRgbF(1,0,0));
            QFont font = pluginItem->font(0);
            font.setItalic(true);
            pluginItem->setFont(0, font);
        }   // end if
        else
        {
            ui->treeWidget->setItemExpanded(pluginItem, true);
            // TODO Add in user selected enabling/disabling of dynamic plugins (requires restart).
            //pluginItem->setCheckState(0, Qt::CheckState::Checked);
            // Get the names of the available interfaces in this plugin
            const QStringList pnames = pmeta.plugin->getInterfaceIds();
            for ( const QString& pname : pnames)
            {
                const QTools::PluginInterface* iface = pmeta.plugin->getInterface(pname);
                if (iface)
                {
                    QTreeWidgetItem *iitem = new QTreeWidgetItem(pluginItem);
                    const QString cname = iface->metaObject()->className();
                    iitem->setText(0, iface->getDisplayName() + " (" + cname + ")");
                    iitem->setIcon(0, *iface->getIcon());
                    QFont font = iitem->font(0);
                    font.setItalic(true);
                    iitem->setFont(0, font);
                }   // end if
            }   // end foreach
        }   // end if
    }   // end foreach
}   // end addPlugins
Example #8
0
	void add_folder(const QIcon &icon, const QString &name)
	{
		QTreeWidgetItem *root;
		if (folder_tree->topLevelItemCount() == 0)
		{
			root = new QTreeWidgetItem(folder_tree);
			root->setText(0, tr("Mail"));
			folder_tree->setItemExpanded(root, true);
		}
		else
			root = folder_tree->topLevelItem(0);

		QTreeWidgetItem *item = new QTreeWidgetItem(root);
		item->setText(0, name);
		item->setIcon(0, icon);

		if (!folder_tree->currentItem())
			folder_tree->setCurrentItem(item);
	}
void ApplicationsWindow::onMenuSelection(QAction *menuAction)
{
    QString id = menuAction->data().toString();
    if (id=="NEW_CATEGORY_MENU"){
        m_DataManager->addNewCategory(tr("New Category"),QColor::fromHsv(rand() % 255,rand() % 255,255));
        rebuildApplicationsList();
        return;
    }
    if (id=="DELETE_CATEGORY_MENU"){
        QList<QTreeWidgetItem*> items =  ui->treeWidgetApplications->selectedItems();
        if (items.size()==1){
            QTreeWidgetItem* item = items.first();
            if (item->type()==cApplicationsTreeWidget::TREE_ITEM_TYPE_CATEGORY){
                int index = item->data(0,Qt::UserRole).toInt();
                if (index>-1){
                    m_DataManager->deleteCategory(index);
                }
            }
        }
        return;
    }
    if (id=="SET_CATEGORY_COLOR_MENU"){
        QList<QTreeWidgetItem*> items =  ui->treeWidgetApplications->selectedItems();
        if (items.size()==1){
            QTreeWidgetItem* item = items.first();
            if (item->type()==cApplicationsTreeWidget::TREE_ITEM_TYPE_CATEGORY){
                int index = item->data(0,Qt::UserRole).toInt();
                if (index>-1){
                    QColor newColor = QColorDialog::getColor(m_DataManager->categories(index)->color);
                    if (newColor.isValid()){
                        m_DataManager->setCategoryColor(index,newColor);
                        QPixmap pixmap(16,16);
                        pixmap.fill(newColor);
                        QIcon icon(pixmap);
                        item->setIcon(0,icon);
                    }
                }
            }
        }
        return;
    }
}
Example #10
0
void HistoryWindow::fillMonth(QTreeWidgetItem *monthItem)
{
	if (ui.fromComboBox->count() == 0)
		return;
	if (monthItem->data(0, Qt::UserRole).type() != QVariant::Date)
		return;

	auto contactIndex = ui.fromComboBox->currentIndex();
	auto contactInfo = ui.fromComboBox->itemData(contactIndex).value<History::ContactInfo>();
	auto month = monthItem->data(0, Qt::UserRole).toDate();

	history()->dates(contactInfo, month, m_search).connect(this, [this, contactInfo, month] (const QList<QDate> &dates) {
		int contactIndex = ui.fromComboBox->currentIndex();
		auto currentContactInfo = ui.fromComboBox->itemData(contactIndex).value<History::ContactInfo>();
		if (!(currentContactInfo == contactInfo))
			return;

		auto findChild = [] (QTreeWidgetItem *parent, const QVariant &value) -> QTreeWidgetItem * {
			if (!parent)
				return nullptr;

			for (int i = 0; i < parent->childCount(); ++i) {
				QTreeWidgetItem *child = parent->child(i);
				if (child->data(0, Qt::UserRole) == value)
					return child;
			}

			return nullptr;
		};

		auto monthItem = findChild(findChild(ui.dateTreeWidget->invisibleRootItem(), month.year()), month);
		if (!monthItem)
			return;

		for (const QDate &date : dates) {
			QTreeWidgetItem *item = new QTreeWidgetItem(monthItem);
			item->setText(0, QString::number(date.day()));
			item->setIcon(0, Icon("day"));
			item->setData(0, Qt::UserRole, date);
		}
	});
}
Example #11
0
/*
 * Setup all the combo boxes and display the dialog
 */
void runPage::init()
{
   QDateTime dt;
   QDesktopWidget *desk = QApplication::desktop();
   QRect scrn;

   m_name = tr("Run");
   pgInitialize();
   setupUi(this);
   /* Get screen rectangle */
   scrn = desk->screenGeometry(desk->primaryScreen());
   /* Position this window in the middle of the screen */
   this->move((scrn.width()-this->width())/2, (scrn.height()-this->height())/2);
   QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
   thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/run.png")));
   m_conn = m_console->notifyOff();

   m_console->beginNewCommand(m_conn);
   jobCombo->addItems(m_console->job_list);
   filesetCombo->addItems(m_console->fileset_list);
   levelCombo->addItems(m_console->level_list);
   clientCombo->addItems(m_console->client_list);
   poolCombo->addItems(m_console->pool_list);
   storageCombo->addItems(m_console->storage_list);
   dateTimeEdit->setDisplayFormat(mainWin->m_dtformat);
   dateTimeEdit->setDateTime(dt.currentDateTime());
   /*printf("listing messages resources");  ***FIME ***
   foreach(QString mes, m_console->messages_list) {
      printf("%s\n", mes.toUtf8().data());
   }*/
   messagesCombo->addItems(m_console->messages_list);
   messagesCombo->setEnabled(false);
   job_name_change(0);
   connect(jobCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(job_name_change(int)));
   connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
   connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));

   // find a way to place the new window at the cursor position
   // or in the middle of the page
//   dockPage();
   setCurrent();
}
Example #12
0
void VarUnit::buildVarTree( QTreeWidgetItem * p, TVar * var, bool showHidden ){
    QList< QTreeWidgetItem * > cList;
    QListIterator<TVar *> it(var->getChildren(1));
    while(it.hasNext()){
        TVar * child = it.next();
        if ( showHidden || !isHidden( child ) ){
            QStringList s1;
            s1 << child->getName();
            QTreeWidgetItem * pItem = new QTreeWidgetItem(s1);
            pItem->setText( 0, child->getName() );
            pItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsDropEnabled|Qt::ItemIsDragEnabled|Qt::ItemIsTristate|Qt::ItemIsUserCheckable);
            pItem->setToolTip(0, "Checked variables will be saved and loaded with your profile.");
            pItem->setCheckState(0, Qt::Unchecked);
            if ( isSaved( child ) )
                pItem->setCheckState(0, Qt::Checked);
            if ( ! shouldSave( child ) ){ // 6 is lua_tfunction, parent must be saveable as well if not global
                pItem->setFlags(pItem->flags() & ~(Qt::ItemIsDropEnabled|Qt::ItemIsDragEnabled|Qt::ItemIsUserCheckable));
                pItem->setForeground(0, QBrush(QColor("grey")));
                pItem->setToolTip(0, "");
            }
            pItem->setData( 0, Qt::UserRole, child->getValueType() );
            QIcon icon;
            switch (child->getValueType()){
                case 5:
                    icon.addPixmap( QPixmap( QStringLiteral( ":/icons/table.png" ) ), QIcon::Normal, QIcon::Off );
                    break;
                case 6:
                    icon.addPixmap( QPixmap( QStringLiteral( ":/icons/function.png" ) ), QIcon::Normal, QIcon::Off );
                    break;
                default:
                    icon.addPixmap( QPixmap( QStringLiteral( ":/icons/variable.png" ) ), QIcon::Normal, QIcon::Off );
                    break;
            }
            pItem->setIcon( 0, icon );
            wVars.insert( pItem, child );
            cList.append( pItem );
            if ( child->getValueType() == 5 )
                buildVarTree( (QTreeWidgetItem *)pItem, child, showHidden );
        }
    }
    p->addChildren( cList );
}
Example #13
0
void FunctionsTreeWidget::addFolder()
{
    blockSignals(true);
    if (selectedItems().isEmpty())
        return;

    QTreeWidgetItem *item = selectedItems().first();
    if (item->text(COL_PATH).isEmpty())
        item = item->parent();

    int type = item->data(COL_NAME, Qt::UserRole + 1).toInt();

    QString fullPath = item->text(COL_PATH);
    if (fullPath.endsWith('/') == false)
        fullPath.append("/");

    QString newName = "New folder";

    int folderCount = 1;

    while (m_foldersMap.contains(fullPath + newName))
    {
        newName = "New Folder " + QString::number(folderCount++);
    }

    fullPath += newName;

    QTreeWidgetItem *folder = new QTreeWidgetItem(item);
    folder->setText(COL_NAME, newName);
    folder->setIcon(COL_NAME, QIcon(":/folder.png"));
    folder->setData(COL_NAME, Qt::UserRole, Function::invalidId());
    folder->setData(COL_NAME, Qt::UserRole + 1, type);
    folder->setText(COL_PATH, fullPath);
    folder->setFlags(folder->flags() | Qt::ItemIsDropEnabled | Qt::ItemIsEditable);

    m_foldersMap[fullPath] = folder;
    item->setExpanded(true);

    blockSignals(false);

    scrollToItem(folder, QAbstractItemView::PositionAtCenter);
}
Example #14
0
QTreeWidgetItem* WordTree::addWord(const QString& word) {
	QTreeWidgetItem* item = new QTreeWidgetItem(this);
	item->setText(2, word);
	if (!m_hebrew) {
		item->setText(0, word);
	} else {
		QString copy = word;
		int end = copy.length() - 1;
		switch (copy.at(end).unicode()) {
		case 0x05db:
			copy[end] = 0x05da;
			break;
		case 0x05de:
			copy[end] = 0x05dd;
			break;
		case 0x05e0:
			copy[end] = 0x05df;
			break;
		case 0x05e4:
			copy[end] = 0x05e3;
			break;
		case 0x05e6:
			copy[end] = 0x05e5;
			break;
		default:
			break;
		}
		item->setText(0, copy);
	}

	QStringList spellings = m_trie->spellings(word, QStringList(item->text(0).toLower()));
	item->setData(1, Qt::UserRole, spellings);

	item->setIcon(1, QIcon(":/empty.png"));
	int score = Solver::score(word);
	item->setData(0, Qt::UserRole, score);

	spellings.append(tr("%n point(s)", "", score));
	item->setToolTip(0, spellings.join("\n"));

	return item;
}
void QgsConfigureShortcutsDialog::populateActions()
{
  QList<QObject *> objects = mManager->listAll();

  QList<QTreeWidgetItem *> items;
  items.reserve( objects.count() );
  Q_FOREACH ( QObject *obj, objects )
  {
    QString actionText;
    QString sequence;
    QIcon icon;

    if ( QAction *action = qobject_cast< QAction * >( obj ) )
    {
      actionText = action->text();
      actionText.remove( '&' ); // remove the accelerator
      sequence = action->shortcut().toString( QKeySequence::NativeText );
      icon = action->icon();
    }
    else if ( QShortcut *shortcut = qobject_cast< QShortcut * >( obj ) )
    {
      actionText = shortcut->whatsThis();
      sequence = shortcut->key().toString( QKeySequence::NativeText );
      icon = shortcut->property( "Icon" ).value<QIcon>();
    }
    else
    {
      continue;
    }

    if ( actionText.isEmpty() )
    {
      continue;
    }

    QStringList lst;
    lst << actionText << sequence;
    QTreeWidgetItem *item = new QTreeWidgetItem( lst );
    item->setIcon( 0, icon );
    item->setData( 0, Qt::UserRole, qVariantFromValue( obj ) );
    items.append( item );
  }
Example #16
0
QTreeWidgetItem* instDialog::createTreeItem(QTreeWidgetItem* parent,
                                            Firewall *fw)
{
    QTreeWidgetItem* item;
    QStringList sl;
    sl.push_back(QString::fromUtf8(fw->getName().c_str()));

    if (parent)
        item = new QTreeWidgetItem(parent, sl);
    else
        item = new QTreeWidgetItem(sl);

    QString icn_filename = (":/Icons/" + fw->getTypeName() + "/icon").c_str();
    QPixmap pm;
    if ( ! QPixmapCache::find(icn_filename, pm))
    {
        pm.load(icn_filename);
        QPixmapCache::insert(icn_filename, pm);
    }
    item->setIcon(0, QIcon(pm));

    item->setData(0, Qt::UserRole, QVariant(fw->getId()));

    // Mark cluster members
    // If parent!=NULL, new tree item corresponds to the cluster member
    item->setData(1, Qt::UserRole, QVariant(parent!=NULL));

    // it is useful to know how many members does this cluster have. If this is
    // not a cluster, store 0
    list<Firewall*> members;
    if (Cluster::isA(fw))
        Cluster::cast(fw)->getMembersList(members);
    int num_members = members.size();

    item->setData(2, Qt::UserRole, QVariant(num_members));

    // item->setCheckState(COMPILE_CHECKBOX_COLUMN, checkIfNeedToCompile(fw)?Qt::Checked:Qt::Unchecked);
    // if (!compile_only)
    //     item->setCheckState(INSTALL_CHECKBOX_COLUMN, checkIfNeedToInstall(fw)?Qt::Checked:Qt::Unchecked);

    return item;
}
Example #17
0
void MaMainWindow::newTopItem()
{
    MaTreeWidget* treeWidget = curTreeWidget();

    // Saving the current item:
    MaItem* curItem = this->curItem();
    if (NULL == curItem)
        return;
    doUiDataExchange(false, curItem);

    MaItem* newItem = _STORE->rootItem()->createNewChildItem();
    QTreeWidgetItem* newTreeItem = new QTreeWidgetItem(QStringList("[New Item]"));
    newTreeItem->setData(3, Qt::EditRole, qVariantFromValue((void*) newItem));
    newTreeItem->setIcon(0, mItemIcon);
    treeWidget->addTopLevelItem(newTreeItem);
    treeWidget->setCurrentItem(newTreeItem, 0);
    treeWidget->sortItems(0, Qt::AscendingOrder);
    clearUi();
    mCaptionTextEditWidget->setFocus(Qt::ShortcutFocusReason);
}
Example #18
0
void InputManager::slotInputValueChanged(quint32 universe,
					 quint32 channel,
					 uchar value)
{
	QTreeWidgetItem* item;

	Q_UNUSED(channel);
	Q_UNUSED(value);

	item = m_tree->topLevelItem(universe);
	if (item == NULL)
		return;

	/* Show an icon on a universe row that received input data */
	QIcon icon(":/input.png");
	item->setIcon(KColumnUniverse, icon);

	/* Restart the timer */
	m_timer->start(250);
}
Example #19
0
void qtractorInstrumentForm::listInstrumentData (
	QTreeWidgetItem *pParentItem, const qtractorInstrumentData& data )
{
	QTreeWidgetItem *pItem = NULL;
	if (!data.basedOn().isEmpty()) {
		pItem = new QTreeWidgetItem(pParentItem, pItem);
		pItem->setIcon(0, QIcon(":/images/itemProperty.png"));
		pItem->setText(0,
			tr("Based On = %1").arg(data.basedOn()));
	}
	qtractorInstrumentData::ConstIterator it
		= data.constBegin();
	const qtractorInstrumentData::ConstIterator& it_end
		= data.constEnd();
	for ( ; it != it_end; ++it) {
		pItem = new QTreeWidgetItem(pParentItem, pItem);
		pItem->setText(0,
			QString("%1 = %2").arg(it.key()).arg(it.value()));
	}
}
Example #20
0
QTreeWidgetItem* LibraryTreeWidget::createFolderItem(const QString& name)
{
	QStringList strings;
	strings << name;
	QTreeWidgetItem *item = new QTreeWidgetItem(strings);
	item->setIcon(0, IconLibrary::instance().icon(0, "folder"));
	item->setFlags(
		Qt::ItemIsSelectable | 
		Qt::ItemIsDragEnabled |
		Qt::ItemIsDropEnabled |
		Qt::ItemIsEnabled |
		Qt::ItemIsEditable);

	QMap<QString, QVariant> data;
	data["filename"] = QString();

	item->setData(0, Qt::UserRole, data);

	return item;
}
Example #21
0
/*
 * Mark selected items
 */
void restorePage::markButtonPushed()
{
   mainWin->waitEnter();
   QList<QTreeWidgetItem *> treeItemList = fileWidget->selectedItems();
   QTreeWidgetItem *item;
   char cmd[1000];
   int count = 0;
   statusLine->setText("");
   foreach (item, treeItemList) {
      count++;
      bsnprintf(cmd, sizeof(cmd), "mark \"%s\"", item->text(1).toUtf8().data());
      item->setIcon(0, QIcon(QString::fromUtf8(":images/check.png")));
      m_console->write_dir(m_conn, cmd, false);
      if (m_console->read(m_conn) > 0) {
         strip_trailing_newline(m_console->msg(m_conn));
         statusLine->setText(m_console->msg(m_conn));
      }
      Dmsg1(dbglvl, "cmd=%s\n", cmd);
      m_console->discardToPrompt(m_conn);
   }
void EventEditor::removeCurrentHandler()
{
	KVI_ASSERT(m_bOneTimeSetupDone);
	if(m_pLastEditedItem)
	{
		QTreeWidgetItem * it = m_pLastEditedItem;
		QTreeWidgetItem * parent = m_pLastEditedItem->parent();
		m_pLastEditedItem = 0;
		delete it;

		if(parent)
		{
			if(parent->childCount()==0)
				parent->setIcon(0,QIcon(*(g_pIconManager->getSmallIcon(KviIconManager::EventNoHandlers))));
		}

		m_pEditor->setEnabled(false);
		m_pNameEditor->setEnabled(false);
	}
}
Example #23
0
/*
 * Setup all the combo boxes and display the dialog
 */
runCmdPage::runCmdPage(int conn) : Pages()
{
   m_name = tr("Restore Run");
   pgInitialize();
   setupUi(this);
   QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
   thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/restore.png")));
   m_conn = conn;
   m_console->notify(conn, false);

   fill();
   m_console->discardToPrompt(m_conn);

   connect(okButton, SIGNAL(pressed()), this, SLOT(okButtonPushed()));
   connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
   //dockPage();
   setCurrent();
   this->show();

}
Example #24
0
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
ScriptViewWidget::ScriptViewWidget(QWidget *parent) : QWidget(parent)
{
    treeWidget = new ScriptTreeWidget(this);

    QVBoxLayout *boxlayout = new QVBoxLayout(this);
    boxlayout->setMargin(0);
    boxlayout->addWidget(treeWidget);

    generalCategory = new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("General Scripts")));
    QString iconpath(std::string(Ogitors::Globals::OGITOR_PLUGIN_ICON_PATH + "/project.svg").c_str());
    generalCategory->setIcon(0, QIcon(iconpath));
    QFont fnt = generalCategory->font(0);
    fnt.setBold(true);
    generalCategory->setFont(0, fnt);

    treeWidget->addTopLevelItem(generalCategory);

    projectCategory = new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("Project Scripts")));
    projectCategory->setIcon(0, QIcon(iconpath));
    projectCategory->setFont(0, fnt);

    treeWidget->addTopLevelItem(projectCategory);

    Ogre::String filefilter = OgitorsUtils::QualifyPath(Ogitors::Globals::SCRIPTS_PATH + "/*.as");

    QTreeWidgetItem* scriptitem = 0;
    Ogre::StringVector list;
    OgitorsSystem::getSingletonPtr()->GetFileList(filefilter, list);

    for(unsigned int i = 0;i < list.size();i++)
    {
        Ogre::String filename = list[i];
        Ogre::String scriptname = OgitorsUtils::ExtractFileName(list[i]);
        scriptitem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(scriptname.c_str())));
        scriptitem->setWhatsThis(0, QString(filename.c_str()));
        scriptitem->setIcon(0, QIcon(":/icons/script2.svg"));
        generalCategory->addChild(scriptitem);
    }

    Ogitors::EventManager::getSingletonPtr()->connectEvent(EventManager::LOAD_STATE_CHANGE, this, true, 0, true, 0, EVENT_CALLBACK(ScriptViewWidget, onSceneLoadStateChange));
}
Example #25
0
QTreeWidgetItem* LibraryTreeWidget::createFileItem(const QString& file, bool downsizing, bool excludeFromExecution)
{
	QString name = QFileInfo(file).fileName();
	QString ext = QFileInfo(file).suffix().toLower();

	QIcon icon;
	if (ext == "png" || ext == "jpg" || ext == "jpeg")
		icon = IconLibrary::instance().icon(0, "picture");
	else if (ext == "lua")
        icon = IconLibrary::instance().icon(0, excludeFromExecution ? "lua with stop" : "lua");
	else if (ext == "mp3" || ext == "wav")
		icon = IconLibrary::instance().icon(0, "sound");
	else
		icon = IconLibrary::instance().icon(0, "file");

	QStringList strings;
	strings << name;
	QTreeWidgetItem *item = new QTreeWidgetItem(strings);
	item->setIcon(0, icon);
	item->setFlags(
		Qt::ItemIsSelectable | 
		Qt::ItemIsDragEnabled |
		Qt::ItemIsEnabled);

	QMap<QString, QVariant> data;

	data["filename"] = file;

    if (downsizing)
        data["downsizing"] = true;

    if (excludeFromExecution)
        data["excludeFromExecution"] = true;

	item->setData(0, Qt::UserRole, data);

	if (ext == "lua")
        dependencyGraph_.addCode(file, excludeFromExecution);

	return item;
}
void RemoteMachineMonitorDialogImpl::sl_retrieveInfoTaskStateChanged() {
    RetrieveRemoteMachineInfoTask * retrieveInfoTask = qobject_cast< RetrieveRemoteMachineInfoTask* >( sender() );
    assert( NULL != retrieveInfoTask );
    if( Task::State_Finished != retrieveInfoTask->getState() ) {
        return;
    }

    RemoteMachineSettingsPtr machineSettings = retrieveInfoTask->getMachineSettings();
    assert( NULL != machineSettings );
    QTreeWidgetItem * treeItem = pingingItems.value( machineSettings );

    pingingItems.remove( machineSettings );

    int row = machinesTreeWidget->indexOfTopLevelItem( treeItem );
    if( -1 == row ) {
        return; /* item was deleted from the table */
    }

    RemoteMachineItemInfo & itemInfo = machinesItemsByOrder[row];

    bool pingOk = retrieveInfoTask->isPingOk();
    bool authOk = !retrieveInfoTask->hasError();

    treeItem->setIcon( 2, pingOk ? PING_YES : PING_NO);
    treeItem->setIcon( 3, authOk ? PING_YES : PING_NO);


    if ( !authOk  ) {
        rsLog.error( tr( "Test connection for machine %1 finished with error: '%2'" ).
            arg( itemInfo.settings->getName() ).arg( retrieveInfoTask->getError() ) );
    }

    itemInfo.hostname = retrieveInfoTask->getHostName();
    treeItem->setText(1, itemInfo.hostname );
    resizeTreeWidget();

    enableItem(treeItem, authOk);

    updateState();

}
Example #27
0
void K3b::ImageWritingDialog::Private::createAudioCueItems( const K3b::CueFileParser& cp )
{
    QTreeWidgetItem* rootItem = new QTreeWidgetItem( infoView );
    rootItem->setText( 0, i18n("Detected:") );
    rootItem->setText( 1, i18n("Audio Cue Image") );
    rootItem->setForeground( 0, infoTextColor );
    rootItem->setIcon( 1, KIcon( "audio-x-generic") );
    rootItem->setTextAlignment( 0, Qt::AlignRight );

    QTreeWidgetItem* trackParent = new QTreeWidgetItem( infoView );
    trackParent->setText( 0, i18np("One track", "%1 tracks", cp.toc().count() ) );
    trackParent->setText( 1, cp.toc().length().toString() );
    if( !cp.cdText().isEmpty() ) {
        trackParent->setText( 1,
                              QString("%1 (%2 - %3)")
                              .arg(trackParent->text(1))
                              .arg(cp.cdText().performer())
                              .arg(cp.cdText().title()) );
    }

    int i = 1;
    foreach( const K3b::Device::Track& track, cp.toc() ) {

        QTreeWidgetItem* trackItem = new QTreeWidgetItem( trackParent );
        trackItem->setText( 0, i18n("Track") + ' ' + QString::number(i).rightJustified( 2, '0' ) );
        trackItem->setText( 1, "    " + ( i < cp.toc().count()
                                        ? track.length().toString()
                                        : QString("??:??:??") ) );

        if( !cp.cdText().isEmpty() && (cp.cdText().count() > 0) &&!cp.cdText()[i-1].isEmpty() )
            trackItem->setText( 1,
                                QString("%1 (%2 - %3)")
                                .arg(trackItem->text(1))
                                .arg(cp.cdText()[i-1].performer())
                                .arg(cp.cdText()[i-1].title()) );

        ++i;
    }

    trackParent->setExpanded( true );
}
Example #28
0
void ScriptView::updateScripts()
{
    if (view) {
	QTreeWidgetItem *tmp = 0, *func;
    while (globals->childCount() > 0)
        globals->takeChild(0);
    while (classes->childCount() > 0)
        classes->takeChild(0);

#ifndef QSA_NO_EDITOR
	interpreter->project()->commitEditorContents();
#endif

	QStringList flist = interpreter->functions();
	for (QStringList::iterator x = flist.begin();
	     x != flist.end(); x++) {
	    func = new QTreeWidgetItem(globals);
        func->setText(0, *x);
	    func->setIcon(0, QIcon(*funcPixmap));
	}

	QStringList clist = interpreter->classes( QSInterpreter::GlobalClasses );
	for (QStringList::iterator y = clist.begin();
	     y != clist.end(); y++) {
	    tmp = new QTreeWidgetItem(classes);
        tmp->setText(0, *y);
        tmp->setFlags(Qt::ItemIsEnabled);
	    tmp->setIcon(0, QIcon(*varPixmap));
	    QStringList flist = interpreter->functions( *y );
	    for (QStringList::iterator i = flist.begin();
		 i != flist.end(); i++) {
		func = new QTreeWidgetItem(tmp);
        func->setText(0, *i);
		func->setIcon(0, QIcon(*funcPixmap));
	    }
	}

    view->setItemExpanded(globals, true);
    view->setItemExpanded(classes, true);
    }
}
DevWorkSpace::DevWorkSpace(QString name, QWidget *parent)
 : QTreeWidget(parent), n(name)
{
	setAcceptDrops(true);
	setDragEnabled(true);
	setDropIndicatorShown(true);
	setSelectionMode(QAbstractItemView::ExtendedSelection);
	//setSortingEnabled(true);
	
	setHeaderItem(new QTreeWidgetItem(	QStringList(tr("WorkSpace : ")),
										DevQt::classes) );
	
	connect(this, SIGNAL( itemActivated(QTreeWidgetItem*, int) ),
			this, SLOT  ( focus(QTreeWidgetItem*, int) ) );
	
	DevProject *p;
	QTreeWidgetItem *i;
	
	i = new QTreeWidgetItem(QStringList(tr("External")),
							DevQt::files);
	i->setIcon(0, QIcon(":/project.png"));
	i->setFlags( 	Qt::ItemIsSelectable | Qt::ItemIsEnabled | 
					Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled );
	
	p = new DevProject(tr("External"));
	p->m->clear();
	p->m->addAction(p->aSub);
	p->m->addAction(p->aNew);
	connect(p	, SIGNAL( addFile(DevFolder*) ),
			this, SLOT  ( addFile(DevFolder*) ) );
	connect(p	, SIGNAL( subFolder(DevFolder*) ),
			this, SLOT  ( subFolder(DevFolder*) ) );
	
	DevTreeMap::insert(i, p);
	DevProjectMap::insert(name, p);
	
	addTopLevelItem(i);
	
	if ( QFile::exists(n) )
		loadWorkSpace(n);
}
Example #30
0
QTreeWidgetItem * QtHelpConfig::addTableItem(const QString &icon, const QString &name,
                                             const QString &path, const QString &ghnsStatus)
{
    QTreeWidgetItem *item = new QTreeWidgetItem(m_configWidget->qchTable);
    item->setIcon(NameColumn, QIcon::fromTheme(icon));
    item->setText(NameColumn, name);
    item->setToolTip(NameColumn, name);
    item->setText(PathColumn, path);
    item->setToolTip(PathColumn, path);
    item->setText(IconColumn, icon);
    item->setText(GhnsColumn, ghnsStatus);

    QWidget *ctrlWidget = new QWidget(item->treeWidget());
    ctrlWidget->setLayout(new QHBoxLayout(ctrlWidget));

    QToolButton *modifyBtn = new QToolButton(item->treeWidget());
    modifyBtn->setIcon(QIcon::fromTheme("document-edit"));
    modifyBtn->setToolTip(i18n("Modify"));
    connect(modifyBtn, &QPushButton::clicked, this, [=](){
        modify(item);
    });
    QToolButton *removeBtn = new QToolButton(item->treeWidget());
    removeBtn->setIcon(QIcon::fromTheme("entry-delete"));
    removeBtn->setToolTip(i18n("Delete"));
    if (item->text(GhnsColumn) != "0") {
        // KNS3 currently does not provide API to uninstall entries
        // just removing the files results in wrong installed states in the KNS3 dialog
        // TODO: add API to KNS to remove files without UI interaction
        removeBtn->setEnabled(false);
        removeBtn->setToolTip(tr("Please uninstall this via GHNS"));
    } else {
        connect(removeBtn, &QPushButton::clicked, this, [=](){
            remove(item);
        });
    }
    ctrlWidget->layout()->addWidget(modifyBtn);
    ctrlWidget->layout()->addWidget(removeBtn);
    m_configWidget->qchTable->setItemWidget(item, ConfigColumn, ctrlWidget);

    return item;
}