コード例 #1
0
ITreeModel::ItemIndex GenericTreeModel::index(const IItem* item) const
{
	if (item == nullptr)
	{
		return std::make_pair<size_t, IItem*>(0, nullptr);
	}

	auto genericItem = static_cast<const GenericTreeItem*>(item);
	assert(genericItem != nullptr);

	size_t index = 0;
	auto parent = genericItem->getParent();
	auto indexInternal = getIndexInternal(genericItem);
	for (size_t i = 0; i < indexInternal; ++i)
	{
		auto itemInternal = getItemInternal(i, parent);
		index += itemInternal != nullptr && itemInternal->hidden() ? this->size(itemInternal) : 1;
	}

	if (parent != nullptr && parent->hidden())
	{
		auto parentIndex = this->index(parent);
		index += parentIndex.first;
		parent = const_cast<GenericTreeItem*>(static_cast<const GenericTreeItem*>(parentIndex.second));
	}
	return std::make_pair(index, parent);
}
コード例 #2
0
ファイル: Brush.cpp プロジェクト: WakaLakaLake/TrenchBroom
        void Brush::setEntity(Entity* entity) {
            if (entity == m_entity)
                return;

            if (m_entity != NULL) {
                if (selected())
                    m_entity->decSelectedBrushCount();
                else if (hidden())
                    m_entity->decHiddenBrushCount();
                if (entity == NULL && m_geometry != NULL) {
                    delete m_geometry;
                    m_geometry = NULL;
                }
            } else if (entity != NULL && m_geometry == NULL) {
                rebuildGeometry();
            }

            m_entity = entity;

            if (m_entity != NULL) {
                if (selected())
                    m_entity->incSelectedBrushCount();
                else if (hidden())
                    m_entity->incHiddenBrushCount();
            }
        }
コード例 #3
0
ファイル: editor.cpp プロジェクト: deycrypt/koalawriter
void Editor::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    if(hide == false)
    {
        painter.setPen(Qt::DashLine);
        painter.drawRect(rect);
        painter.setPen(Qt::SolidLine);//Reset default line-style so only rect is affected
        painter.setBackgroundMode(Qt::OpaqueMode);
        painter.setOpacity(opacity);
        painter.fillRect(rect,QBrush(Qt::white,Qt::SolidPattern));
        painter.setOpacity(1); //Reset default opacity so only background is affected by opacity change
        painter.drawRect(handleTL);
        painter.drawRect(handleT);
        painter.drawRect(handleTR);
        painter.drawRect(handleL);
        painter.drawRect(handleR);
        painter.drawRect(handleBL);
        painter.drawRect(handleB);
        painter.drawRect(handleBR);
        hidden(hide);
    }else if(hide == true)
    {
        painter.setOpacity(opacity);
        painter.fillRect(rect,QBrush(Qt::white,Qt::SolidPattern));
        painter.setOpacity(1); //Reset default opacity so only background is affected by opacity change
        hidden(hide);
    }
}
コード例 #4
0
static int
is_bsd_partition_type(int type)
{
    return (type == FREEBSD_PARTITION ||
            type == hidden(FREEBSD_PARTITION) ||
            type == NETBSD_PARTITION ||
            type == hidden(NETBSD_PARTITION));
}
コード例 #5
0
ファイル: tracing.cpp プロジェクト: goodwinos/pcp
void
TracingItem::redraw(void)
{
    if (removed() == false) {
	// point curve update by legend check, but not the rest:
	my.dropCurve->setVisible(hidden() == false);
	my.spanCurve->setVisible(hidden() == false);
	my.selectionCurve->setVisible(hidden() == false);
    }
}
コード例 #6
0
ファイル: controller.cpp プロジェクト: Reemjd/genius
void Controller::createConnections()
{
  connect(_clipboard,SIGNAL(changed(QClipboard::Mode)),this,SLOT(clipboardChanged(QClipboard::Mode)));

  connect(_history,SIGNAL(added(ClipboardEntity*,int)),this,SLOT(history_itemAdded(ClipboardEntity*,int)));
  connect(_history,SIGNAL(removed(int,int)),this,SLOT(history_removed(int,int)));
  connect(_history,SIGNAL(cleared()),this,SLOT(history_cleared()));
  connect(_history,SIGNAL(locationExchanged(int,int)),this,SLOT(locationExchanged(int,int)));

  connect(_manager,SIGNAL(shown()),this,SLOT(manager_shown()));
  connect(_manager,SIGNAL(hidden()),this,SLOT(manager_hidden()));
  connect(_manager,SIGNAL(hidden()),_trayIcon,SLOT(managerHidden()));
  connect(_manager,SIGNAL(shown()),_trayIcon,SLOT(managerShown()));
  connect(_manager,SIGNAL(settingsDialogRequested()),this,SLOT(settingsWindowRequested()));
  connect(_manager,SIGNAL(itemSelected(int)),this,SLOT(itemSelected(int)));
  connect(_manager,SIGNAL(showContentRequested(ClipboardEntity*)),this,SLOT(showContent(ClipboardEntity*)));
  connect(_manager,SIGNAL(locationExchangeRequested(int,int)),this,SLOT(locationExchangeRequested(int,int)));

  connect(_trayIcon,SIGNAL(showHideManagerTriggerd()),this,SLOT(showHideManagerRequest()));
  connect(_trayIcon,SIGNAL(itemSelected(int)),this,SLOT(itemSelected(int)));
  connect(_trayIcon,SIGNAL(settingsDialogRequested()),this,SLOT(settingsWindowRequested()));
  connect(_trayIcon,SIGNAL(turnOffGenius()),this,SLOT(turnOffRequest()));
  connect(_trayIcon,SIGNAL(turnOnGenius()),this,SLOT(turnOnRequest()));
  connect(_trayIcon,SIGNAL(exitRequested()),this,SLOT(exitRequested()));
  connect(_trayIcon,SIGNAL(pause()),this,SLOT(pauseRequested()));
  connect(_trayIcon,SIGNAL(resume()),this,SLOT(resumeRequested()));

  connect(_selector,SIGNAL(closing(int)),this,SLOT(selectorClosed(int)));
  connect(_settingsWindow,SIGNAL(hiding()),this,SLOT(settingsWindow_hidden()));

  if(_openSelectorHotkey)
    connect(_openSelectorHotkey,SIGNAL(activated()),this,SLOT(openSelectorHKtriggered()));

  if(_clearHistoryHotKey)
    connect(_clearHistoryHotKey,SIGNAL(activated()),this,SLOT(clearHistoryHKTrigered()));

  if(_pasteLastHotKey)
    connect(_pasteLastHotKey,SIGNAL(activated()),this,SLOT(pasteLasteHKTrigered()));

  if(_openManagerHotKey)
    connect(_openManagerHotKey,SIGNAL(activated()),this,SLOT(openManagerHKTriggered()));

  if(_openSettingsHotKey)
    connect(_openSettingsHotKey,SIGNAL(activated()),this,SLOT(openSettingsHKTriggered()));

  if(_historyMenuHotKey)
    connect(_historyMenuHotKey,SIGNAL(activated()),this,SLOT(historyMenuHotkeyActivated()));
}
コード例 #7
0
ファイル: HypToOpenFstText.cpp プロジェクト: sdl-research/hyp
  static int run_main(int ac, char* av[]) {
    namespace po = boost::program_options;
    try {
      po::options_description generic("Allowed options");

      add(generic)("config-file,c", po::value<std::string>(), "config file name");
      add(generic)("help,h", "produce help message");

      po::options_description hidden("Hidden options");
      hidden.add_options()("input-file", po::value<std::string>(), "input file");

      po::options_description cmdline_options;
      cmdline_options.add(generic).add(hidden);

      po::options_description config_file_options;
      config_file_options.add(generic).add(hidden);

      po::positional_options_description p;
      p.add("input-file", -1);

      po::variables_map vm;
      store(po::command_line_parser(ac, av).options(cmdline_options).positional(p).run(), vm);

      if (vm.count("config-file")) {
        Util::Input ifs(vm["config-file"].as<std::string>());
        store(parse_config_file(*ifs, config_file_options), vm);
        notify(vm);
      }

      if (vm.count("help")) {
        std::cout << generic << "\n\n";
        std::cout << "Convert FSM (in hypergraph format) to OpenFst text format" << '\n';
        return EXIT_FAILURE;
      }

      std::string file;
      if (vm.count("input-file")) {
        file = vm["input-file"].as<std::string>();
      }

      typedef ViterbiWeightTpl<float> Weight;
      typedef Hypergraph::ArcTpl<Weight> Arc;

      IVocabularyPtr pVoc = Vocabulary::createDefaultVocab();

      Util::Input in_(file);

      MutableHypergraph<Arc> hg;
      hg.setVocabulary(pVoc);
      parseText(*in_, file, &hg);

      writeOpenFstFormat(std::cout, hg);

      assert(hg.checkValid());
    } catch (std::exception& e) {
      std::cerr << e.what() << '\n';
      return EXIT_FAILURE;
    }
    return EXIT_SUCCESS;
  }
コード例 #8
0
ファイル: FindWidget.cpp プロジェクト: Artanomell/schat
bool FindWidget::eventFilter(QObject *watched, QEvent *event)
{
  if (watched == this && event->type() == QEvent::KeyPress) {
    QKeyEvent *e = static_cast<QKeyEvent*>(event);

    if (e->matches(QKeySequence::Find) || e->matches(QKeySequence::FindNext)) {
      ChatNotify::start(Notify::Find, ChatCore::currentId());
      return true;
    }
    else if (e->matches(QKeySequence::FindPrevious)) {
      ChatNotify::start(Notify::FindPrevious, ChatCore::currentId());
      return true;
    }
    else if (e->key() == Qt::Key_Escape) {
      hide();
      emit hidden();

      ChatNotify::start(Notify::SetSendFocus);
      return true;
    }
  }
  else if (watched == m_editFind && event->type() == QEvent::KeyPress) {
    if (static_cast<QKeyEvent*>(event)->matches(QKeySequence::Copy)) {
      if (!m_editFind->hasSelectedText()) {
        ChatNotify::start(Notify::CopyRequest);
        return true;
      }
    }
  }

  return QWidget::eventFilter(watched, event);
}
コード例 #9
0
ファイル: maze-game.c プロジェクト: hxhb/cppcode
int main(){
	//设定初始的窗口大小,使其足够容纳生成的地图
	system("mode con cols=51 lines=31");
	int i, j;
	srand((unsigned)time(NULL)); //初始化随即种子
	hidden(); //隐藏光标
	for (i = 0; i <= Height + 1; i++)
		for (j = 0; j <= Width + 1; j++)
			if (i == 0 || i == Height + 1 || j == 0 || j == Width + 1) //初始化迷宫
				map[i][j] = Road;
			else map[i][j] = Wall;

	create(2 * (rand() % (Height / 2) + 1), 2 * (rand() % (Width / 2) + 1)); //从随机一个点开始生成迷宫,该点行列都为偶数
	for (i = 0; i <= Height + 1; i++){ //边界处理
		map[i][0] = Wall;
		map[i][Width + 1] = Wall;
	}
	for (j = 0; j <= Width + 1; j++){ //边界处理
		map[0][j] = Wall;
		map[Height + 1][j] = Wall;
	}
	map[2][1] = Start; //给定入口
	map[Height - 1][Width] = End; //给定出口
	for (i = 1; i <= Height; i++)
		for (j = 1; j <= Width; j++) //画出迷宫
			paint(i, j);
	game(); //开始游戏
	getch();
	return 0;
}
コード例 #10
0
IItem* GenericTreeModel::item(size_t index, const IItem* parent) const
{
	auto genericParent = static_cast<const GenericTreeItem*>(parent);
	assert(parent == nullptr || genericParent != nullptr);

	auto itemCount = getChildCountInternal(genericParent);
	for (size_t i = 0; i < itemCount; ++i)
	{
		auto item = getItemInternal(i, genericParent);
		if (item != nullptr && item->hidden())
		{
			auto childItemCount = getChildCountInternal(item);
			if (index < childItemCount)
			{
				return this->item(index, item);
			}
			index -= childItemCount;
		}
		else
		{
			if (index == 0)
			{
				return item;
			}
			--index;
		}
	}
	return nullptr;
}
コード例 #11
0
void UBGraphicsRuler::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
    if (mResizing)
    {
        mResizing = false;
        event->accept();
    }
    else if (mRotating)
    {
        mRotating = false;
        updateResizeCursor();
        update(QRectF(rotationCenter(), QSizeF(sRotationRadius, sRotationRadius)));
        event->accept();
    }
    else if (closeButtonRect().contains(event->pos()))
    {
		hide();
		emit hidden();
        event->accept();
    }
    else
    {
		QGraphicsItem::mouseReleaseEvent(event);
    }

    if (scene())
        scene()->setModified(true);
}
コード例 #12
0
void widget::process_tooltip_string(int mousex, int mousey)
{
	if (!hidden() && sdl::point_in_rect(mousex, mousey, rect_)) {
		if (!tooltip_text_.empty())
			tooltips::add_tooltip(rect_, tooltip_text_ );
	}
}
コード例 #13
0
void UBGraphicsProtractor::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
    switch (mCurrentTool)
    {
    case Reset :
        setStartAngle(0);
        mStartAngle = 0;
        break;

    case Close :
        hide();
        emit hidden();
        break;

    case MoveMarker :
        update();
        break;

    default :
        QGraphicsEllipseItem::mouseReleaseEvent(event);
        break;
    }

    if (mCurrentTool != Move)
        event->accept();

    if (scene())
        scene()->setModified(true);

    mCurrentTool = None;
}
コード例 #14
0
void
AnimatedSplitter::hide( int index, bool animate )
{
    m_animateIndex = index;

    QWidget* w = widget( index );
    int minHeight = m_sizes.at( index ).height();

    if ( w->height() == minHeight )
        return;

    emit hidden( w );
    w->setMinimumHeight( minHeight );
    qDebug() << "animating to:" << w->height() << "from" << minHeight;

    m_animateForward = false;
    if ( animate )
    {
        if ( m_timeLine->state() == QTimeLine::Running )
            m_timeLine->stop();

        m_timeLine->setFrameRange( minHeight, w->height() );
        m_timeLine->setDirection( QTimeLine::Backward );
        m_timeLine->start();
    }
    else
    {
        onAnimationStep( minHeight );
        onAnimationFinished();
    }
}
コード例 #15
0
bool CommandRenumber::setup(const std::vector<std::string>& arguments) {
    po::options_description cmdline("Allowed options");
    cmdline.add_options()
    ("index-directory,i", po::value<std::string>(), "Index directory")
    ;

    add_common_options(cmdline);
    add_single_input_options(cmdline);
    add_output_options(cmdline);

    po::options_description hidden("Hidden options");
    hidden.add_options()
    ("input-filename", po::value<std::string>(), "Input file")
    ;

    po::options_description desc("Allowed options");
    desc.add(cmdline).add(hidden);

    po::positional_options_description positional;
    positional.add("input-filename", 1);

    po::variables_map vm;
    po::store(po::command_line_parser(arguments).options(desc).positional(positional).run(), vm);
    po::notify(vm);

    setup_common(vm);
    setup_input_file(vm);
    setup_output_file(vm);

    if (vm.count("index-directory")) {
        m_index_directory = vm["index-directory"].as<std::string>();
    }

    return true;
}
コード例 #16
0
ファイル: welcomescreen.cpp プロジェクト: dambito/kbattleship
void WelcomeScreen::hide()
{
    m_active = false;
    KGameCanvasGroup::hide();
    clearButtons();
    emit hidden();
}
コード例 #17
0
ファイル: menu.cpp プロジェクト: oys0317/opensanguo
bool menu::requires_event_focus(const SDL_Event* event) const
{
	if(!focus_ || height() == 0 || hidden()) {
		return false;
	}
	if(event == NULL) {
		//when event is not specified, signal that focus may be desired later
		return true;
	}

	if(event->type == SDL_KEYDOWN) {
		SDLKey key = event->key.keysym.sym;
		if (!click_selects_) {
			switch(key) {
			case SDLK_UP:
			case SDLK_DOWN:
			case SDLK_PAGEUP:
			case SDLK_PAGEDOWN:
			case SDLK_HOME:
			case SDLK_END:
				return true;
			default:
				break;
			}
		}
		if (num_selects_ && key >= SDLK_1 && key <= SDLK_9) {
			return true;
		}
	}
	//mouse events are processed regardless of focus
	return false;
}
コード例 #18
0
/**
 *	Check if tree has child items, excluding hidden items, including null items
 *	E.g.
 *	> group1
 *	>> group2 <- hidden
 *	>>> item1 - count
 *	>>> item2 - count
 *	>>> item3 - count
 *	hasChildren( group1 ) == true
 *	E.g.
 *	> group1
 *	>> group2 <- hidden
 *	>> group3 <- hidden
 *	hasChildren( group1 ) == false
 */
bool GenericTreeModel::empty(const IItem* item) const
{
	auto genericItem = static_cast<const GenericTreeItem*>(item);
	assert(item == nullptr || genericItem != nullptr);

	// No children
	if (this->emptyInternal(genericItem))
	{
		return true;
	}

	// Has children, but they might be hidden
	auto childCount = getChildCountInternal(genericItem);
	for (size_t i = 0; i < childCount; ++i)
	{
		auto childItem = getItemInternal(i, genericItem);
		if (childItem == nullptr || !childItem->hidden() || !this->empty(childItem))
		{
			return false;
		}
	}

	// All children are hidden
	return true;
}
コード例 #19
0
ファイル: tileset_dialog.cpp プロジェクト: sorokin/btanks
void TilesetDialog::tick(const float dt) {
	Container::tick(dt);
	if (_sl_tilesets->changed()) {
		_sl_tilesets->reset();
		if (!_sl_tilesets->empty())
			set(_sl_tilesets->get());
	}

	std::string tileset = _add_tileset->getTileset();
	if (!tileset.empty()) {
		LOG_DEBUG(("adding tileset!"));
		Map->addTileset(tileset);
		initMap();
		_tileset_added = true;
	}

	if (_current_tileset == NULL || hidden())
		return;

	GET_CONFIG_VALUE("editor.scrolling-speed", int, ss, 500);
	_pos += _vel * (ss * dt);
	if (_pos.x + _w > _current_tileset->get_width())
		_pos.x = _current_tileset->get_width() - _w;
	if (_pos.y + _h > _current_tileset->get_height())
		_pos.y = _current_tileset->get_height() - _h;

	if (_pos.x < 0)
		_pos.x  = 0;
	if (_pos.y < 0)
		_pos.y  = 0;
	//LOG_DEBUG(("%g %g", _pos.x, _pos.y));
	
}
コード例 #20
0
bool textbox::requires_event_focus(const SDL_Event* event) const
{
	if(!focus_ || !editable_ || hidden()) {
		return false;
	}
	if(event == NULL) {
		//when event is not specified, signal that focus may be desired later
		return true;
	}

	if(event->type == SDL_KEYDOWN) {
		SDLKey key = event->key.keysym.sym;
		switch(key) {
		case SDLK_UP:
		case SDLK_DOWN:
		case SDLK_PAGEUP:
		case SDLK_PAGEDOWN:
			//in the future we may need to check for input history or multi-line support
			//for now, just return false since these events are not handled.
			return false;
		default:
			return true;
		}
	}
	//mouse events are processed regardless of focus
	return false;
}
コード例 #21
0
void button::handle_event(const SDL_Event& event)
{
	if (hidden() || !enabled())
		return;

	STATE start_state = state_;

	if (!mouse_locked())
	{
		switch(event.type) {
			case SDL_MOUSEBUTTONDOWN:
				mouse_down(event.button);
				break;
			case SDL_MOUSEBUTTONUP:
				mouse_up(event.button);
				break;
			case SDL_MOUSEMOTION:
				mouse_motion(event.motion);
				break;
			default:
				return;
		}
	}

	if (start_state != state_)
		set_dirty(true);
}
コード例 #22
0
void Animation::draw(sf::RenderTarget& target)
{
    if (!hidden())
    {
        target.Draw(sprite_);
    }
}
コード例 #23
0
void SearchBar::hideEvent(QHideEvent* e)
{
    m_timer->stop();
    QWidget::hideEvent(e);

    if (focusedChild())
        emit hidden();
}
コード例 #24
0
ファイル: sampling.cpp プロジェクト: Aconex/pcp
void
SamplingItem::copyDataPoint(int index)
{
    if (hidden() || index >= my.dataCount)
	my.itemData[index] = qQNaN();
    else
	my.itemData[index] = my.data[index];
}
コード例 #25
0
void SearchBar::hide()
{
    m_timer->stop();
    SearchBarBase::hide();

    if (focusedChild())
        emit hidden();
}
コード例 #26
0
ファイル: seaview.cpp プロジェクト: TI-ECS/battleship
SeaView::SeaView(QWidget* parent)
: KGameCanvasWidget(parent)
, m_delegate(0)
, m_last_f(-1)
{/*
    setAttribute(Qt::WA_OpaquePaintEvent);
    setAttribute(Qt::WA_NoSystemBackground);*/

    // create renderer
    m_renderer = new KBSRenderer(":data/default_theme.svgz");
    m_renderer->resize(tileSize());

    // create screen
    m_screen = new WelcomeScreen(this, font());
    m_screen->hide();

    // create labels
    m_labels[0] = new PlayerLabel(
        m_renderer->render("score_mouse", QSize(32, 32)),
        "Player",
        this);
    m_labels[0]->stackUnder(m_screen);
    m_labels[0]->show();
    m_labels[1] = new PlayerLabel(
        m_renderer->render("score_ai", QSize(32, 32)),
        "Computer",
        this);
    m_labels[1]->stackUnder(m_screen);
    m_labels[1]->show();

    // create fields
    m_fields[0] = new BattleFieldView(this, m_renderer, "background", GRID_SIZE);
    m_fields[0]->stackUnder(m_screen);
    m_fields[0]->show();
    connect(m_fields[0]->screen(), SIGNAL(clicked(Button*)), this, SLOT(buttonClicked(Button*)));
    m_fields[1] = new BattleFieldView(this, m_renderer, "background2", GRID_SIZE);
    m_fields[1]->stackUnder(m_screen);
    m_fields[1]->show();
    connect(m_fields[1]->screen(), SIGNAL(clicked(Button*)), this, SLOT(buttonClicked(Button*)));

    // create stats widgets
    m_stats[0] = new StatsWidget(m_fields[0]->size().width(), m_renderer, this);
    m_stats[0]->stackUnder(m_screen);
    m_stats[0]->show();

    m_stats[1] = new StatsWidget(m_fields[1]->size().width(), m_renderer, this);
    m_stats[1]->stackUnder(m_screen);
    m_stats[1]->show();


    Animator::instance()->start();
    update();

    connect(screen(Sea::Player(0)), SIGNAL(hidden()), this, SLOT(update()));
    connect(screen(Sea::Player(0)), SIGNAL(shown()), this, SLOT(update()));

    setMouseTracking(true);
}
コード例 #27
0
ファイル: task.cpp プロジェクト: mgottschlag/kwin-tiling
void Task::resetHiddenStatus()
{
     if (d->status == NeedsAttention) {
        //tasks don't get moved anymore
        setOrder(Normal);
        if (hidden() & AutoHidden) {
            setHidden(hidden() ^ AutoHidden);
        }
    } else {
        if (d->status == Active && (hidden() & AutoHidden)) {
            setHidden(hidden() ^ AutoHidden);
        } else if (d->status == Passive) {
            setHidden(hidden() | AutoHidden);
        }

        setOrder(Normal);
    }
}
コード例 #28
0
ファイル: CoverManager.cpp プロジェクト: cancamilo/amarok
CoverManager::CoverManager( QWidget *parent )
        : KDialog( parent )
        , m_currentView( AllAlbums )
        , m_timer( new QTimer( this ) )    //search filter timer
        , m_fetchingCovers( false )
        , m_coversFetched( 0 )
        , m_coverErrors( 0 )
        , m_isLoadingCancelled( false )
{
    DEBUG_BLOCK

    setObjectName( "TheCoverManager" );

    s_instance = this;

    // Sets caption and icon correctly (needed e.g. for GNOME)
    kapp->setTopWidget( this );
    setButtons( 0 );
    setCaption( i18n("Cover Manager") );
    setAttribute( Qt::WA_DeleteOnClose );

    connect( this, SIGNAL(hidden()), SLOT(delayedDestruct()) );
    connect( this, SIGNAL(closeClicked()), SLOT(delayedDestruct()) );

    m_splitter = new QSplitter( this );
    setMainWidget( m_splitter );

    //artist listview
    m_artistView = new QTreeWidget( m_splitter );
    m_artistView->setHeaderLabel( i18n( "Albums By" ) );
    m_artistView->setSortingEnabled( false );
    m_artistView->setTextElideMode( Qt::ElideRight );
    m_artistView->setMinimumWidth( 200 );
    m_artistView->setColumnCount( 1 );
    m_artistView->setAlternatingRowColors( true );
    m_artistView->setUniformRowHeights( true );
    m_artistView->setSelectionMode( QAbstractItemView::ExtendedSelection );

    ArtistItem *item = 0;
    item = new ArtistItem( i18n( "All Artists" ) );
    item->setIcon(0, SmallIcon( "media-optical-audio-amarok" ) );
    m_items.append( item );

    Collections::Collection *coll = CollectionManager::instance()->primaryCollection();
    Collections::QueryMaker *qm = coll->queryMaker();
    qm->setAutoDelete( true );
    qm->setQueryType( Collections::QueryMaker::Artist );
    qm->setAlbumQueryMode( Collections::QueryMaker::OnlyNormalAlbums );
    qm->orderBy( Meta::valArtist );

    connect( qm, SIGNAL(newResultReady(Meta::ArtistList)),
             this, SLOT(slotArtistQueryResult(Meta::ArtistList)) );

    connect( qm, SIGNAL(queryDone()), this, SLOT(slotContinueConstruction()) );

    qm->run();
}
コード例 #29
0
    void test_all()
    {
        auto prot = xlnt::protection::unlocked_and_visible();
        xlnt_assert(!prot.hidden());
        xlnt_assert(!prot.locked());

        prot = xlnt::protection::locked_and_visible();
        xlnt_assert(!prot.hidden());
        xlnt_assert(prot.locked());

        prot = xlnt::protection::unlocked_and_hidden();
        xlnt_assert(prot.hidden());
        xlnt_assert(!prot.locked());

        prot = xlnt::protection::locked_and_hidden();
        xlnt_assert(prot.hidden());
        xlnt_assert(prot.locked());
    }
コード例 #30
0
const AttachmentStrategy * AttachmentStrategy::create( const QString & type ) {
  QString lowerType = type.toLower();
  if ( lowerType == "iconic" )  return iconic();
  //if ( lowerType == "smart" )   return smart(); // not needed, see below
  if ( lowerType == "inlined" ) return inlined();
  if ( lowerType == "hidden" )  return hidden();
  // don't kFatal here, b/c the strings are user-provided
  // (KConfig), so fail gracefully to the default:
  return smart();
}