Exemplo n.º 1
0
/*virtual*/
void AbstractItemView::setModel(QAbstractItemModel *model, AbstractViewItem *prototype)
{    
    if( m_model == model || !model)
        return;

    if (m_model) {
        disconnect(m_model, SIGNAL(destroyed()),
                   this, SLOT(_q_modelDestroyed()));
        disconnect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
                   this, SLOT( dataChanged(QModelIndex,QModelIndex)));
        disconnect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)),
                   this, SLOT(rowsInserted(QModelIndex,int,int)));
        disconnect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
                   this, SLOT(rowsRemoved(QModelIndex,int,int)));
        disconnect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
                   this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
        disconnect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
                   this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)));
        disconnect(m_model, SIGNAL(columnsInserted(QModelIndex,int,int)),
                   this, SLOT(columnsInserted(QModelIndex,int,int)));
        disconnect(m_model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
                   this, SLOT(columnsAboutToBeInserted(QModelIndex,int,int)));
        disconnect(m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
                   this, SLOT(columnsRemoved(QModelIndex,int,int)));
        disconnect(m_model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
                   this, SLOT(columnsAboutToBeRemoved(QModelIndex,int,int)));
        disconnect(m_model, SIGNAL(modelReset()), this, SLOT(reset()));
        disconnect(m_model, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged()));

        m_model = 0;
    }

    setSelectionModel(0);

    m_currentIndex = QModelIndex();
    m_rootIndex = QModelIndex();

    m_model = model;

    Q_ASSERT_X(m_model->index(0,0) == m_model->index(0,0),
               "AbstractItemView::setModel",
               "A model should return the exact same index "
               "(including its internal id/pointer) when asked for it twice in a row.");
    Q_ASSERT_X(m_model->index(0,0).parent() == QModelIndex(),
               "AbstractItemView::setModel",
               "The parent of a top level index should be invalid");


    connect(m_model, SIGNAL(destroyed()), this, SLOT(modelDestroyed()));
    connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
            this, SLOT( dataChanged(QModelIndex,QModelIndex)));
    connect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
            this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)));
    connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)),
            this, SLOT(rowsInserted(QModelIndex,int,int)));
    connect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
            this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
    connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
            this, SLOT(rowsRemoved(QModelIndex,int,int)));
    connect(m_model, SIGNAL(modelReset()), this, SLOT(reset()));
    connect(m_model, SIGNAL(layoutChanged()), this, SLOT(layoutChanged()));

    setSelectionModel(new QItemSelectionModel(m_model));

    if (prototype && m_container) {
        m_container->setItemPrototype(prototype);
        m_container->reset();
    }
}
Exemplo n.º 2
0
ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFileModel_MetaInfo *metaInfo, SettingsModel *settings, QWidget *parent)
:
	QDialog(parent),
	ui(new Ui::ProcessingDialog),
	m_windowIcon(NULL),
	m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)),
	m_settings(settings),
	m_metaInfo(metaInfo),
	m_shutdownFlag(shutdownFlag_None),
	m_threadPool(NULL),
	m_diskObserver(NULL),
	m_cpuObserver(NULL),
	m_ramObserver(NULL),
	m_progressViewFilter(-1),
	m_initThreads(0),
	m_firstShow(true)
{
	//Init the dialog, from the .ui file
	ui->setupUi(this);
	setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
	
	//Update the window icon
	m_windowIcon = lamexp_set_window_icon(this, lamexp_app_icon(), true);

	//Update header icon
	ui->label_headerIcon->setPixmap(lamexp_app_icon().pixmap(ui->label_headerIcon->size()));
	
	//Setup version info
	ui->label_versionInfo->setText(QString().sprintf("v%d.%02d %s (Build %d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build()));
	ui->label_versionInfo->installEventFilter(this);

	//Register meta type
	qRegisterMetaType<QUuid>("QUuid");

	//Center window in screen
	QRect desktopRect = QApplication::desktop()->screenGeometry();
	QRect thisRect = this->geometry();
	move((desktopRect.width() - thisRect.width()) / 2, (desktopRect.height() - thisRect.height()) / 2);
	setMinimumSize(thisRect.width(), thisRect.height());

	//Enable buttons
	connect(ui->button_AbortProcess, SIGNAL(clicked()), this, SLOT(abortEncoding()));
	
	//Init progress indicator
	m_progressIndicator = new QMovie(":/images/Working.gif");
	m_progressIndicator->setCacheMode(QMovie::CacheAll);
	ui->label_headerWorking->setMovie(m_progressIndicator);
	ui->progressBar->setValue(0);

	//Init progress model
	m_progressModel = new ProgressModel();
	ui->view_log->setModel(m_progressModel);
	ui->view_log->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	ui->view_log->verticalHeader()->hide();
	ui->view_log->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	ui->view_log->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
	ui->view_log->viewport()->installEventFilter(this);
	connect(m_progressModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(modelReset()), this, SLOT(progressModelChanged()));
	connect(ui->view_log, SIGNAL(activated(QModelIndex)), this, SLOT(logViewDoubleClicked(QModelIndex)));
	connect(ui->view_log->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(logViewSectionSizeChanged(int,int,int)));

	//Create context menu
	m_contextMenu = new QMenu();
	QAction *contextMenuDetailsAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), tr("Show details for selected job"));
	QAction *contextMenuShowFileAction = m_contextMenu->addAction(QIcon(":/icons/folder_go.png"), tr("Browse Output File Location"));
	m_contextMenu->addSeparator();

	//Create "filter" context menu
	m_progressViewFilterGroup = new QActionGroup(this);
	QAction *contextMenuFilterAction[5] = {NULL, NULL, NULL, NULL, NULL};
	if(QMenu *filterMenu = m_contextMenu->addMenu(QIcon(":/icons/filter.png"), tr("Filter Log Items")))
	{
		contextMenuFilterAction[0] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobRunning), tr("Show Running Only"));
		contextMenuFilterAction[1] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobComplete), tr("Show Succeeded Only"));
		contextMenuFilterAction[2] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobFailed), tr("Show Failed Only"));
		contextMenuFilterAction[3] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobSkipped), tr("Show Skipped Only"));
		contextMenuFilterAction[4] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobState(-1)), tr("Show All Items"));
		if(QAction *act = contextMenuFilterAction[0]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobRunning); }
		if(QAction *act = contextMenuFilterAction[1]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobComplete); }
		if(QAction *act = contextMenuFilterAction[2]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobFailed); }
		if(QAction *act = contextMenuFilterAction[3]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobSkipped); }
		if(QAction *act = contextMenuFilterAction[4]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(-1); act->setChecked(true); }
	}

	//Create info label
	if(m_filterInfoLabel = new QLabel(ui->view_log))
	{
		m_filterInfoLabel->setFrameShape(QFrame::NoFrame);
		m_filterInfoLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
		m_filterInfoLabel->setUserData(0, new IntUserData(-1));
		SET_FONT_BOLD(m_filterInfoLabel, true);
		SET_TEXT_COLOR(m_filterInfoLabel, Qt::darkGray);
		m_filterInfoLabel->setContextMenuPolicy(Qt::CustomContextMenu);
		connect(m_filterInfoLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
		m_filterInfoLabel->hide();
	}
	if(m_filterInfoLabelIcon = new QLabel(ui->view_log))
	{
		m_filterInfoLabelIcon->setFrameShape(QFrame::NoFrame);
		m_filterInfoLabelIcon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
		m_filterInfoLabelIcon->setContextMenuPolicy(Qt::CustomContextMenu);
		const QIcon &ico = m_progressModel->getIcon(ProgressModel::JobState(-1));
		m_filterInfoLabelIcon->setPixmap(ico.pixmap(16, 16));
		connect(m_filterInfoLabelIcon, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
		m_filterInfoLabelIcon->hide();
	}

	//Connect context menu
	ui->view_log->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(ui->view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
	connect(contextMenuDetailsAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuDetailsActionTriggered()));
	connect(contextMenuShowFileAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuShowFileActionTriggered()));
	for(size_t i = 0; i < 5; i++)
	{
		if(contextMenuFilterAction[i]) connect(contextMenuFilterAction[i], SIGNAL(triggered(bool)), this, SLOT(contextMenuFilterActionTriggered()));
	}
	SET_FONT_BOLD(contextMenuDetailsAction, true);

	//Enque jobs
	if(fileListModel)
	{
		for(int i = 0; i < fileListModel->rowCount(); i++)
		{
			m_pendingJobs.append(fileListModel->getFile(fileListModel->index(i,0)));
		}
	}

	//Translate
	ui->label_headerStatus->setText(QString("<b>%1</b><br>%2").arg(tr("Encoding Files"), tr("Your files are being encoded, please be patient...")));
	
	//Enable system tray icon
	connect(m_systemTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));

	//Init other vars
	m_runningThreads = 0;
	m_currentFile = 0;
	m_allJobs.clear();
	m_succeededJobs.clear();
	m_failedJobs.clear();
	m_skippedJobs.clear();
	m_userAborted = false;
	m_forcedAbort = false;
	m_timerStart = 0I64;
}
Exemplo n.º 3
0
AccountsToolButton::AccountsToolButton( QWidget* parent )
    : QToolButton( parent )
{
    m_popup = new AccountsPopupWidget( this );
    m_popup->hide();

    QToolBar* toolbar = qobject_cast< QToolBar* >( parent );
    if ( toolbar )
        setIconSize( toolbar->iconSize() );
    else
        setIconSize( QSize( 22, 22 ) );

    //Set up popup...
    QWidget *w = new QWidget( this );
    w->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
    QVBoxLayout *wMainLayout = new QVBoxLayout( w );
    w->setLayout( wMainLayout  );

    TomahawkUtils::unmarginLayout( w->layout() );

    w->setContentsMargins( 6, 6, 6, 6 );
#ifdef Q_OS_MAC
    w->setContentsMargins( 6, 6, 6, 0 );
    wMainLayout->setMargin( 12 );
#endif

    m_popup->setWidget( w );
    connect( m_popup, SIGNAL( hidden() ), SLOT( popupHidden() ) );

    m_model = new Tomahawk::Accounts::AccountModel( this );
    m_proxy = new AccountModelFactoryProxy( m_model );
    m_proxy->setSourceModel( m_model );
    m_proxy->setFilterRowType( Tomahawk::Accounts::AccountModel::TopLevelFactory );
    m_proxy->setFilterEnabled( true );

    AccountListWidget *view = new AccountListWidget( m_proxy, m_popup );
    wMainLayout->addWidget( view );
    view->setAutoFillBackground( false );
    view->setAttribute( Qt::WA_TranslucentBackground, true );

    connect( m_proxy, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ),
             this, SLOT( repaint() ) );

    QWidget *separatorLine = new QWidget( w );
    separatorLine->setFixedHeight( 1 );
    separatorLine->setContentsMargins( 0, 0, 0, 0 );
    separatorLine->setStyleSheet( "QWidget { border-top: 1px solid " +
                                  TomahawkUtils::Colors::BORDER_LINE.name() + "; }" ); //from ProxyStyle
    wMainLayout->addWidget( separatorLine );

    wMainLayout->addSpacing( 6 );

    QPushButton *settingsButton = new QPushButton( w );
    settingsButton->setIcon( QIcon( RESPATH "images/account-settings.png" ) );
    settingsButton->setText( tr( "Configure Accounts" ) );
    connect( settingsButton, SIGNAL( clicked() ),
             window(), SLOT( showSettingsDialog() ) );

    QHBoxLayout *bottomLayout = new QHBoxLayout( w );
    TomahawkUtils::unmarginLayout( bottomLayout );
    bottomLayout->addStretch();
    bottomLayout->addWidget( settingsButton );
    wMainLayout->addLayout( bottomLayout );


    //ToolButton stuff
    m_defaultPixmap = QPixmap( RESPATH "images/account-none.png" )
                        .scaled( iconSize(),
                                 Qt::KeepAspectRatio,
                                 Qt::SmoothTransformation );

    connect( m_proxy, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ),
             this, SLOT( updateIcons() ) );
    connect( m_proxy, SIGNAL( rowsInserted ( QModelIndex, int, int ) ),
             this, SLOT( updateIcons() ) );
    connect( m_proxy, SIGNAL( rowsRemoved( QModelIndex, int, int ) ),
             this, SLOT( updateIcons() ) );
    connect( m_proxy, SIGNAL( modelReset() ),
             this, SLOT( updateIcons() ) );
}
Exemplo n.º 4
0
void TestEntryModel::test()
{
    Group* group1 = new Group();
    Group* group2 = new Group();

    Entry* entry1 = new Entry();
    entry1->setGroup(group1);
    entry1->setTitle("testTitle1");

    Entry* entry2 = new Entry();
    entry2->setGroup(group1);
    entry2->setTitle("testTitle2");

    EntryModel* model = new EntryModel(this);

    ModelTest* modelTest = new ModelTest(model, this);

    model->setGroup(group1);

    QCOMPARE(model->rowCount(), 2);

    QSignalSpy spyDataChanged(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
    entry1->setTitle("changed");
    QCOMPARE(spyDataChanged.count(), 1);

    QModelIndex index1 = model->index(0, 1);
    QModelIndex index2 = model->index(1, 1);

    QCOMPARE(model->data(index1).toString(), entry1->title());
    QCOMPARE(model->data(index2).toString(), entry2->title());

    QSignalSpy spyAboutToAdd(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
    QSignalSpy spyAdded(model, SIGNAL(rowsInserted(QModelIndex,int,int)));
    QSignalSpy spyAboutToRemove(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
    QSignalSpy spyRemoved(model, SIGNAL(rowsRemoved(QModelIndex,int,int)));

    Entry* entry3 = new Entry();
    entry3->setGroup(group1);

    QCOMPARE(spyAboutToAdd.count(), 1);
    QCOMPARE(spyAdded.count(), 1);
    QCOMPARE(spyAboutToRemove.count(), 0);
    QCOMPARE(spyRemoved.count(), 0);

    entry2->setGroup(group2);

    QCOMPARE(spyAboutToAdd.count(), 1);
    QCOMPARE(spyAdded.count(), 1);
    QCOMPARE(spyAboutToRemove.count(), 1);
    QCOMPARE(spyRemoved.count(), 1);

    QSignalSpy spyReset(model, SIGNAL(modelReset()));
    model->setGroup(group2);
    QCOMPARE(spyReset.count(), 1);

    delete group1;
    delete group2;

    delete modelTest;
    delete model;
}
Exemplo n.º 5
0
void VRFSystemListController::reset()
{
  emit modelReset();
}
Exemplo n.º 6
0
void QxtFlowViewPrivate::setModel(QAbstractItemModel * m)
{


	if (model)
	{

		disconnect(this->model, SIGNAL(columnsAboutToBeInserted(const QModelIndex &, int, int)),
			this, SLOT(columnsAboutToBeInserted(const QModelIndex &, int, int)));
		disconnect(this->model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex &, int, int)),
			this, SLOT(columnsAboutToBeRemoved(const QModelIndex &, int, int)));
		disconnect(this->model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
			this, SLOT(columnsInserted(const QModelIndex &, int, int)));
		disconnect(this->model, SIGNAL(columnsRemoved(const QModelIndex &, int, int)),
			this, SLOT(columnsRemoved(const QModelIndex &, int, int)));
		disconnect(this->model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
			this, SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
		disconnect(this->model, SIGNAL(headerDataChanged(Qt::Orientation, int, int)),
			this, SLOT(headerDataChanged(Qt::Orientation, int, int)));
		disconnect(this->model, SIGNAL(layoutAboutToBeChanged()),
			this, SLOT(layoutAboutToBeChanged()));
		disconnect(this->model, SIGNAL(layoutChanged()),
			this, SLOT(layoutChanged()));
		disconnect(this->model, SIGNAL(modelAboutToBeReset()),
			this, SLOT(modelAboutToBeReset()));
		disconnect(this->model, SIGNAL(modelReset()),
			this, SLOT(modelReset()));
		disconnect(this->model, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
			this, SLOT(rowsAboutToBeInserted(const QModelIndex &, int, int)));
		disconnect(this->model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
			this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int)));
		disconnect(this->model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
			this, SLOT(rowsInserted(const QModelIndex &, int, int)));
		disconnect(this->model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
			this, SLOT(rowsRemoved(const QModelIndex &, int, int)));
	}
	model = m;
	if (model)
	{
		rootindex = model->parent(QModelIndex());

		connect(this->model, SIGNAL(columnsAboutToBeInserted(const QModelIndex &, int, int)),
			this, SLOT(columnsAboutToBeInserted(const QModelIndex &, int, int)));
		connect(this->model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex &, int, int)),
			this, SLOT(columnsAboutToBeRemoved(const QModelIndex &, int, int)));
		connect(this->model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
			this, SLOT(columnsInserted(const QModelIndex &, int, int)));
		connect(this->model, SIGNAL(columnsRemoved(const QModelIndex &, int, int)),
			this, SLOT(columnsRemoved(const QModelIndex &, int, int)));
		connect(this->model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
			this, SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
		connect(this->model, SIGNAL(headerDataChanged(Qt::Orientation, int, int)),
			this, SLOT(headerDataChanged(Qt::Orientation, int, int)));
		connect(this->model, SIGNAL(layoutAboutToBeChanged()),
			this, SLOT(layoutAboutToBeChanged()));
		connect(this->model, SIGNAL(layoutChanged()),
			this, SLOT(layoutChanged()));
		connect(this->model, SIGNAL(modelAboutToBeReset()),
			this, SLOT(modelAboutToBeReset()));
		connect(this->model, SIGNAL(modelReset()),
			this, SLOT(modelReset()));
		connect(this->model, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
			this, SLOT(rowsAboutToBeInserted(const QModelIndex &, int, int)));
		connect(this->model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
			this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int)));
		connect(this->model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
			this, SLOT(rowsInserted(const QModelIndex &, int, int)));
		connect(this->model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
			this, SLOT(rowsRemoved(const QModelIndex &, int, int)));
	}

	reset();
}
Exemplo n.º 7
0
KisLayerBox::KisLayerBox()
        : QDockWidget(i18n("Layers"))
        , m_canvas(0)
        , m_wdgLayerBox(new Ui_WdgLayerBox)
{
    setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    QWidget* mainWidget = new QWidget(this);
    setWidget(mainWidget);
    m_delayTimer.setSingleShot(true);

    m_wdgLayerBox->setupUi(mainWidget);

    m_wdgLayerBox->listLayers->setDefaultDropAction(Qt::MoveAction);
    m_wdgLayerBox->listLayers->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
    m_wdgLayerBox->listLayers->setSelectionBehavior(QAbstractItemView::SelectRows);

    connect(m_wdgLayerBox->listLayers, SIGNAL(contextMenuRequested(const QPoint&, const QModelIndex&)),
            this, SLOT(slotContextMenuRequested(const QPoint&, const QModelIndex&)));
    connect(m_wdgLayerBox->listLayers, SIGNAL(collapsed(const QModelIndex&)), SLOT(slotCollapsed(const QModelIndex &)));
    connect(m_wdgLayerBox->listLayers, SIGNAL(expanded(const QModelIndex&)), SLOT(slotExpanded(const QModelIndex &)));

    m_viewModeMenu = new KMenu(this);
    QActionGroup *group = new QActionGroup(this);
    QList<QAction*> actions;

    actions << m_viewModeMenu->addAction(koIcon("view-list-text"),
                                         i18n("Minimal View"), this, SLOT(slotMinimalView()));
    actions << m_viewModeMenu->addAction(koIcon("view-list-details"),
                                         i18n("Detailed View"), this, SLOT(slotDetailedView()));
    actions << m_viewModeMenu->addAction(koIcon("view-preview"),
                                         i18n("Thumbnail View"), this, SLOT(slotThumbnailView()));

    for (int i = 0, n = actions.count(); i < n; ++i) {
        actions[i]->setCheckable(true);
        actions[i]->setActionGroup(group);
    }

    m_wdgLayerBox->bnAdd->setIcon(koIcon("list-add"));

    m_wdgLayerBox->bnViewMode->setMenu(m_viewModeMenu);
    m_wdgLayerBox->bnViewMode->setPopupMode(QToolButton::InstantPopup);
    m_wdgLayerBox->bnViewMode->setIcon(koIcon("view-choose"));
    m_wdgLayerBox->bnViewMode->setText(i18n("View mode"));

    m_wdgLayerBox->bnDelete->setIcon(koIcon("list-remove"));
    m_wdgLayerBox->bnDelete->setIconSize(QSize(22, 22));

    m_wdgLayerBox->bnRaise->setEnabled(false);
    m_wdgLayerBox->bnRaise->setIcon(koIcon("go-up"));
    m_wdgLayerBox->bnRaise->setIconSize(QSize(22, 22));

    m_wdgLayerBox->bnLower->setEnabled(false);
    m_wdgLayerBox->bnLower->setIcon(koIcon("go-down"));
    m_wdgLayerBox->bnLower->setIconSize(QSize(22, 22));

    m_wdgLayerBox->bnLeft->setEnabled(true);
    m_wdgLayerBox->bnLeft->setIcon(koIcon("arrow-left"));
    m_wdgLayerBox->bnLeft->setIconSize(QSize(22, 22));

    m_wdgLayerBox->bnRight->setEnabled(true);
    m_wdgLayerBox->bnRight->setIcon(koIcon("arrow-right"));
    m_wdgLayerBox->bnRight->setIconSize(QSize(22, 22));

    m_wdgLayerBox->bnProperties->setIcon(koIcon("document-properties"));
    m_wdgLayerBox->bnProperties->setIconSize(QSize(22, 22));

    m_wdgLayerBox->bnDuplicate->setIcon(koIcon("edit-copy"));
    m_wdgLayerBox->bnDuplicate->setIconSize(QSize(22, 22));

    m_removeAction  = new ButtonAction(m_wdgLayerBox->bnDelete, koIcon("edit-delete"), i18n("&Remove Layer"), this);
    m_removeAction->setActivationFlags(KisAction::ACTIVE_NODE);
    m_removeAction->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
    connect(m_removeAction, SIGNAL(triggered()), this, SLOT(slotRmClicked()));
    m_actions.append(m_removeAction);

    KisAction* action  = new ButtonAction(m_wdgLayerBox->bnLeft, this);
    action->setActivationFlags(KisAction::ACTIVE_NODE);
    action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
    connect(action, SIGNAL(triggered()), this, SLOT(slotLeftClicked()));
    m_actions.append(action);

    action  = new ButtonAction(m_wdgLayerBox->bnRight, this);
    action->setActivationFlags(KisAction::ACTIVE_NODE);
    action->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
    connect(action, SIGNAL(triggered()), this, SLOT(slotRightClicked()));
    m_actions.append(action);

    m_propertiesAction  = new ButtonAction(m_wdgLayerBox->bnProperties, koIcon("document-properties"), i18n("&Properties..."),this);
    m_propertiesAction->setActivationFlags(KisAction::ACTIVE_NODE);
    m_propertiesAction->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
    connect(m_propertiesAction, SIGNAL(triggered()), this, SLOT(slotPropertiesClicked()));
    m_actions.append(m_propertiesAction);

    m_dulicateAction  = new ButtonAction(m_wdgLayerBox->bnDuplicate, koIcon("edit-copy"), i18n("&Duplicate Layer or Mask"), this);
    m_dulicateAction->setActivationFlags(KisAction::ACTIVE_NODE);
    connect(m_dulicateAction, SIGNAL(triggered()), this, SLOT(slotDuplicateClicked()));
    m_actions.append(m_dulicateAction);

    // NOTE: this is _not_ a mistake. The layerbox shows the layers in the reverse order
    connect(m_wdgLayerBox->bnRaise, SIGNAL(clicked()), SLOT(slotLowerClicked()));
    connect(m_wdgLayerBox->bnLower, SIGNAL(clicked()), SLOT(slotRaiseClicked()));
    // END NOTE

    connect(m_wdgLayerBox->doubleOpacity, SIGNAL(valueChanged(qreal)), SLOT(slotOpacitySliderMoved(qreal)));
    connect(&m_delayTimer, SIGNAL(timeout()), SLOT(slotOpacityChanged()));

    connect(m_wdgLayerBox->cmbComposite, SIGNAL(activated(int)), SLOT(slotCompositeOpChanged(int)));
    connect(m_wdgLayerBox->bnAdd, SIGNAL(clicked()), SLOT(slotNewPaintLayer()));

    m_newPainterLayerAction = new KisAction(koIcon("document-new"), i18n("&Paint Layer"), this);
    connect(m_newPainterLayerAction, SIGNAL(triggered(bool)), this, SLOT(slotNewPaintLayer()));
    m_actions.append(m_newPainterLayerAction);

    m_newGroupLayerAction = new KisAction(koIcon("folder-new"), i18n("&Group Layer"), this);
    connect(m_newGroupLayerAction, SIGNAL(triggered(bool)), this, SLOT(slotNewGroupLayer()));
    m_actions.append(m_newGroupLayerAction);

    m_newCloneLayerAction = new KisAction(koIcon("edit-copy"), i18n("&Clone Layer"), this);
    connect(m_newCloneLayerAction, SIGNAL(triggered(bool)), this, SLOT(slotNewCloneLayer()));
    m_actions.append(m_newCloneLayerAction);

    m_newShapeLayerAction = new KisAction(koIcon("bookmark-new"), i18n("&Vector Layer"), this);
    connect(m_newShapeLayerAction, SIGNAL(triggered(bool)), this, SLOT(slotNewShapeLayer()));
    m_actions.append(m_newShapeLayerAction);

    m_newAdjustmentLayerAction = new KisAction(koIcon("view-filter"), i18n("&Filter Layer..."), this);
    connect(m_newAdjustmentLayerAction, SIGNAL(triggered(bool)), this, SLOT(slotNewAdjustmentLayer()));
    m_actions.append(m_newAdjustmentLayerAction);

    m_newGeneratorLayerAction = new KisAction(koIcon("view-filter"), i18n("&Generated Layer..."), this);
    connect(m_newGeneratorLayerAction, SIGNAL(triggered(bool)), this, SLOT(slotNewGeneratorLayer()));
    m_actions.append(m_newGeneratorLayerAction);

    m_newTransparencyMaskAction = new KisAction(koIcon("edit-copy"), i18n("&Transparency Mask"), this);
    m_newTransparencyMaskAction->setActivationFlags(KisAction::ACTIVE_LAYER);
    connect(m_newTransparencyMaskAction, SIGNAL(triggered(bool)), this, SLOT(slotNewTransparencyMask()));
    m_actions.append(m_newTransparencyMaskAction);

    m_newEffectMaskAction = new KisAction(koIcon("bookmarks"), i18n("&Filter Mask..."), this);
    m_newEffectMaskAction->setActivationFlags(KisAction::ACTIVE_LAYER);
    connect(m_newEffectMaskAction, SIGNAL(triggered(bool)), this, SLOT(slotNewEffectMask()));
    m_actions.append(m_newEffectMaskAction);

    m_newSelectionMaskAction = new KisAction(koIcon("edit-paste"), i18n("&Local Selection"), this);
    m_newSelectionMaskAction->setActivationFlags(KisAction::ACTIVE_LAYER);
    connect(m_newSelectionMaskAction, SIGNAL(triggered(bool)), this, SLOT(slotNewSelectionMask()));
    m_actions.append(m_newSelectionMaskAction);

    m_selectOpaque = new KisAction(i18n("&Select Opaque"), this);
    m_selectOpaque->setActivationFlags(KisAction::ACTIVE_LAYER);
    connect(m_selectOpaque, SIGNAL(triggered(bool)), this, SLOT(slotSelectOpaque()));
    m_actions.append(m_selectOpaque);

    m_newLayerMenu = new KMenu(this);
    m_wdgLayerBox->bnAdd->setMenu(m_newLayerMenu);
    m_wdgLayerBox->bnAdd->setPopupMode(QToolButton::MenuButtonPopup);

    m_newLayerMenu->addAction(m_newPainterLayerAction);
    m_newLayerMenu->addAction(m_newGroupLayerAction);
    m_newLayerMenu->addAction(m_newCloneLayerAction);
    m_newLayerMenu->addAction(m_newShapeLayerAction);
    m_newLayerMenu->addAction(m_newAdjustmentLayerAction);
    m_newLayerMenu->addAction(m_newGeneratorLayerAction);
    m_newLayerMenu->addSeparator();
    m_newLayerMenu->addAction(m_newTransparencyMaskAction);
    m_newLayerMenu->addAction(m_newEffectMaskAction);
#if 0 // XXX_2.0
    m_newLayerMenu->addAction(koIcon("view-filter"), i18n("&Transformation Mask..."), this, SLOT(slotNewTransformationMask()));
#endif
    m_newLayerMenu->addAction(m_newSelectionMaskAction);
    
    m_nodeModel = new KisNodeModel(this);

    /**
     * Connect model updateUI() to enable/disable controls.
     * Note: nodeActivated() is connected separately in setImage(), because
     *       it needs particular order of calls: first the connection to the
     *       node manager should be called, then updateUI()
     */
    connect(m_nodeModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), SLOT(updateUI()));
    connect(m_nodeModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), SLOT(updateUI()));
    connect(m_nodeModel, SIGNAL(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)), SLOT(updateUI()));
    connect(m_nodeModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), SLOT(updateUI()));
    connect(m_nodeModel, SIGNAL(modelReset()), SLOT(updateUI()));

    m_wdgLayerBox->listLayers->setModel(m_nodeModel);
}
TsDeviceDialogContainer::TsDeviceDialogContainer(QAbstractListModel *model,
                                                 QObject *parent)
    :
    QObject(parent),
    mVisibilityPublisher(TsProperty::KTsPath),
    mDismissRequestSubscriber(QString("%1/%2").arg(TsProperty::KTsPath).arg(TsProperty::KDismissRequestPath))
{
    bool ok(true);
    mLoader.load(KDocmlPath, &ok);
    Q_ASSERT(ok);

    HbDialog *dialog =
        qobject_cast<HbDialog *>(mLoader.findWidget("tsdevicedialog"));
    TsTasksGrid *grid =
        qobject_cast<TsTasksGrid *>(mLoader.findWidget("taskgrid"));
    Q_ASSERT(dialog);
    Q_ASSERT(grid);
    
    bool cssLoaded = HbStyleLoader::registerFilePath(":/resource/hbdialog.css");
    Q_ASSERT(cssLoaded);
    {
        HbLabel *dialogHeading = qobject_cast<HbLabel *>(dialog->headingWidget());
        Q_ASSERT(dialogHeading);
        HbFrameDrawer *headingFrame = new HbFrameDrawer(QLatin1String("qtg_fr_popup_heading"), HbFrameDrawer::ThreePiecesHorizontal);
        dialogHeading->setBackgroundItem(new HbFrameItem(headingFrame));
    }

    grid->setEnabledAnimations(HbAbstractItemView::None);
    grid->setModel(model);

    changeOrientation(dialog->mainWindow()->orientation());
    switchViewOnModelChange();

    // needed because of Qt::QueuedConnection used below
    // @todo: check if we actually need queued connections
    qRegisterMetaType<QModelIndex>("QModelIndex");

    // connect the grid and model
    connect(grid,
            SIGNAL(activated(QModelIndex)),
            model,
            SLOT(openApplication(QModelIndex)));
    connect(grid,
            SIGNAL(activated(QModelIndex)),
            dialog,
            SLOT(close()));
    connect(grid,
            SIGNAL(deleteButtonClicked(QModelIndex)),
            model, SLOT(closeApplication(QModelIndex)),
            Qt::QueuedConnection);

    connect(dialog->mainWindow(),
            SIGNAL(orientationChanged(Qt::Orientation)),
            this,
            SLOT(changeOrientation(Qt::Orientation)));
    connect(dialog,
            SIGNAL(aboutToClose()),
            this,
            SIGNAL(deviceDialogClosed()));

    // switch between grid and "no items" label when model is updated
    connect(model, SIGNAL(modelReset()), this, SLOT(switchViewOnModelChange()));
    connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange()));
    connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(switchViewOnModelChange()));

    connect(this,
            SIGNAL(deviceDialogClosed()),
            this,
            SLOT(notifyDialogClosed()));
    mVisibilityPublisher.setValue(TsProperty::KVisibilityPath,
                                  static_cast<int>(true));
    mVisibilityPublisher.sync();

    connect(&mDismissRequestSubscriber,
            SIGNAL(contentsChanged()),
            this,
            SLOT(handleDismissRequest()));
}
NemoCalendarEventQuery::NemoCalendarEventQuery()
: mIsComplete(true), mOccurrence(0)
{
    connect(NemoCalendarEventCache::instance(), SIGNAL(modelReset()), this, SLOT(refresh()));
}
Exemplo n.º 10
0
FeatureListModel::FeatureListModel( QObject *parent )
  :  QAbstractItemModel( parent )
{
  connect( this, SIGNAL( modelReset() ), this, SIGNAL( countChanged() ) );
}
Exemplo n.º 11
0
void ContactDetails::init( const QContact &entry )
{
    // If we redisplay the same entry, don't shift our view around too much
    bool sameEntry = (entry.uid() == ent.uid());

    ent = entry;
    mLink.clear();


    // We create tabs for each addressbook detail view plugin
    // We ask them if they want to be shown for this contact (or they can
    // just hide themselves in the init function)
    // they need to provide certain actions
    // and signals
    // maybe a view factory plugin
    // returns view plugins for list, details?
    // maybe string, maybe enum


    /* Create our members, if we haven't */
    if ( !mModel ) {
        mModel = new QContactModel(this);
        connect(mModel, SIGNAL(modelReset()), this, SLOT(modelChanged()));

        mTabs = new QTabWidget();

        mQuickTab = new ContactOverview(0);
        mDetailsTab = new ContactBrowser(0);
#if defined(QTOPIA_TELEPHONY)
        mCallHistoryTab = new ContactCallHistoryList(0);
#endif
        mMessageHistoryTab = new ContactMessageHistoryList(0);

        mTabs->addTab(mQuickTab, QIcon(":icon/contactdetails"), tr("Overview"));
        mTabs->addTab(mDetailsTab, QIcon(":icon/details"), tr("Details"));
#if defined(QTOPIA_TELEPHONY)
        mTabs->addTab(mCallHistoryTab, QIcon(":icon/phone/calls"), tr("Calls"));
#endif
        mTabs->addTab(mMessageHistoryTab, QIcon(":icon/email"), tr("Messages"));

        connect(mQuickTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mQuickTab, SIGNAL(closeView()), this, SIGNAL(closeView()));
        connect(mDetailsTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mDetailsTab, SIGNAL(closeView()), this, SIGNAL(closeView()));
#if defined(QTOPIA_TELEPHONY)
        connect(mCallHistoryTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mCallHistoryTab, SIGNAL(closeView()), this, SIGNAL(closeView()));
#endif
        connect(mMessageHistoryTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mMessageHistoryTab, SIGNAL(closeView()), this, SIGNAL(closeView()));

        connect(mQuickTab, SIGNAL(callContact()), this, SIGNAL(callContact()));
        connect(mQuickTab, SIGNAL(textContact()), this, SIGNAL(textContact()));
        connect(mQuickTab, SIGNAL(emailContact()), this, SIGNAL(emailContact()));
        connect(mQuickTab, SIGNAL(editContact()), this, SIGNAL(editContact()));

        connect(mDetailsTab, SIGNAL(highlighted(QString)), this, SIGNAL(highlighted(QString)));

        QVBoxLayout *v = new QVBoxLayout();
        v->addWidget(mTabs);
        v->setMargin(0);
        setLayout(v);
    }

    modelChanged();

    if (!sameEntry)
        mTabs->setCurrentIndex(0);
    mTabs->currentWidget()->setFocus();
}
Exemplo n.º 12
0
RoutingWidget::RoutingWidget( MarbleWidget *marbleWidget, QWidget *parent ) :
    QWidget( parent ), d( new RoutingWidgetPrivate( marbleWidget ) )
{
    d->m_ui.setupUi( this );
    d->m_ui.routeComboBox->setVisible( false );
    d->m_ui.routeComboBox->setModel( d->m_routingManager->alternativeRoutesModel() );

    d->m_routingLayer->synchronizeAlternativeRoutesWith( d->m_ui.routeComboBox );

    d->m_ui.routingProfileComboBox->setModel( d->m_routingManager->profilesModel() );

    connect( d->m_routingManager->profilesModel(), SIGNAL( rowsInserted( QModelIndex, int, int ) ),
             this, SLOT( selectFirstProfile() ) );
    connect( d->m_routingManager->profilesModel(), SIGNAL( modelReset() ),
             this, SLOT( selectFirstProfile() ) );
    connect( d->m_routingLayer, SIGNAL( placemarkSelected( QModelIndex ) ),
             this, SLOT( activatePlacemark( QModelIndex ) ) );
    connect( d->m_routingLayer, SIGNAL( pointSelected( GeoDataCoordinates ) ),
             this, SLOT( retrieveSelectedPoint( GeoDataCoordinates ) ) );
    connect( d->m_routingLayer, SIGNAL( pointSelectionAborted() ),
             this, SLOT( pointSelectionCanceled() ) );
    connect( d->m_routingManager, SIGNAL( stateChanged( RoutingManager::State, RouteRequest* ) ),
             this, SLOT( updateRouteState( RoutingManager::State, RouteRequest* ) ) );
    connect( d->m_routingManager, SIGNAL( routeRetrieved( GeoDataDocument* ) ),
             this, SLOT( indicateRoutingFailure( GeoDataDocument* ) ) );
    connect( d->m_routeRequest, SIGNAL( positionAdded( int ) ),
             this, SLOT( insertInputWidget( int ) ) );
    connect( d->m_routeRequest, SIGNAL( positionRemoved( int ) ),
             this, SLOT( removeInputWidget( int ) ) );
    connect( d->m_routeRequest, SIGNAL( routingProfileChanged() ),
             this, SLOT( updateActiveRoutingProfile() ) );
    connect( &d->m_progressTimer, SIGNAL( timeout() ),
             this, SLOT( updateProgress() ) );
    connect( d->m_ui.routeComboBox, SIGNAL( currentIndexChanged( int ) ),
             this, SLOT( switchRoute( int ) ) );
    connect( d->m_ui.routingProfileComboBox, SIGNAL( currentIndexChanged( int ) ),
             this, SLOT( setRoutingProfile( int ) ) );
    connect( d->m_routingManager->alternativeRoutesModel(), SIGNAL( rowsInserted( QModelIndex, int, int ) ),
             this, SLOT( updateAlternativeRoutes() ) );

    d->m_ui.directionsListView->setModel( d->m_routingModel );

    QItemSelectionModel *selectionModel = d->m_ui.directionsListView->selectionModel();
    d->m_routingLayer->synchronizeWith( selectionModel );
    connect( d->m_ui.directionsListView, SIGNAL( activated ( QModelIndex ) ),
             this, SLOT( activateItem ( QModelIndex ) ) );

    connect( d->m_ui.searchButton, SIGNAL( clicked( ) ),
             this, SLOT( retrieveRoute () ) );
    connect( d->m_ui.showInstructionsButton, SIGNAL( clicked( bool ) ),
             this, SLOT( showDirections() ) );
    connect( d->m_ui.configureButton, SIGNAL( clicked() ),
             this, SLOT( configureProfile() ) );

    for( int i=0; i<d->m_routeRequest->size(); ++i ) {
        insertInputWidget( i );
    }

    for ( int i=0; i<2 && d->m_inputWidgets.size()<2; ++i ) {
        // Start with source and destination if the route is empty yet
        addInputWidget();
    }
    //d->m_ui.descriptionLabel->setVisible( false );
    d->m_ui.resultLabel->setVisible( false );
    setShowDirectionsButtonVisible( false );
    updateActiveRoutingProfile();

    if ( MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen ) {
        d->m_ui.directionsListView->setVisible( false );
#ifdef Q_WS_MAEMO_5
        d->m_ui.directionsListView->setAttribute( Qt::WA_Maemo5StackedWindow );
        d->m_ui.directionsListView->setWindowFlags( Qt::Window );
        d->m_ui.directionsListView->setWindowTitle( tr( "Directions - Marble" ) );
#endif // Q_WS_MAEMO_5
    }
}
Exemplo n.º 13
0
PortsWindow::PortsWindow(PortGroupList *pgl, QWidget *parent)
    : QWidget(parent)
{
    QAction *sep;

    delegate = new StreamListDelegate;
    //slm = new StreamListModel();
    //plm = new PortGroupList();
    plm = pgl;

    setupUi(this);

    tvPortList->header()->hide();

    tvStreamList->setItemDelegate(delegate);

    tvStreamList->verticalHeader()->setDefaultSectionSize(
            tvStreamList->verticalHeader()->minimumSectionSize());

    // Populate PortList Context Menu Actions
    tvPortList->addAction(actionNew_Port_Group);
    tvPortList->addAction(actionDelete_Port_Group);
    tvPortList->addAction(actionConnect_Port_Group);
    tvPortList->addAction(actionDisconnect_Port_Group);

    tvPortList->addAction(actionExclusive_Control);
    tvPortList->addAction(actionPort_Configuration);

    // Populate StramList Context Menu Actions
    tvStreamList->addAction(actionNew_Stream);
    tvStreamList->addAction(actionEdit_Stream);
    tvStreamList->addAction(actionDuplicate_Stream);
    tvStreamList->addAction(actionDelete_Stream);

    sep = new QAction(this);
    sep->setSeparator(true);
    tvStreamList->addAction(sep);

    tvStreamList->addAction(actionOpen_Streams);
    tvStreamList->addAction(actionSave_Streams);

    // PortList and StreamList actions combined make this window's actions
    addActions(tvPortList->actions());
    sep = new QAction(this);
    sep->setSeparator(true);
    addAction(sep);
    addActions(tvStreamList->actions());

    tvStreamList->setModel(plm->getStreamModel());
    tvPortList->setModel(plm->getPortModel());
    
    connect( plm->getPortModel(), 
        SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), 
        this, SLOT(when_portModel_dataChanged(const QModelIndex&, 
            const QModelIndex&)));

    connect(plm->getPortModel(), SIGNAL(modelReset()), 
        SLOT(when_portModel_reset()));

    connect( tvPortList->selectionModel(), 
        SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), 
        this, SLOT(when_portView_currentChanged(const QModelIndex&, 
            const QModelIndex&)));

    connect(plm->getStreamModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), 
        SLOT(updateStreamViewActions()));
    connect(plm->getStreamModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), 
        SLOT(updateStreamViewActions()));

    connect(tvStreamList->selectionModel(), 
        SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), 
        SLOT(updateStreamViewActions()));
    connect(tvStreamList->selectionModel(), 
        SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
        SLOT(updateStreamViewActions()));

    tvStreamList->resizeColumnToContents(StreamModel::StreamIcon);
    tvStreamList->resizeColumnToContents(StreamModel::StreamStatus);

    // Initially we don't have any ports/streams - so send signal triggers
    when_portView_currentChanged(QModelIndex(), QModelIndex());
    updateStreamViewActions();

    connect(plm->getStreamModel(), 
        SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), 
        this, SLOT(streamModelDataChanged()));
    connect(plm->getStreamModel(), 
        SIGNAL(modelReset()), 
        this, SLOT(streamModelDataChanged()));
}
Exemplo n.º 14
0
ItemModel::ItemModel(ToolbarItems& t_items)
	: items(t_items), v(t_items.getAllElems())
{
	connect(&t_items, SIGNAL(reset()), this, SIGNAL(modelReset()));
}
Exemplo n.º 15
0
/*!
    \reimp
 */
void QIdentityProxyModel::setSourceModel(QAbstractItemModel* newSourceModel)
{
    beginResetModel();

    if (sourceModel()) {
        disconnect(sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
                   this, SLOT(_q_sourceRowsAboutToBeInserted(QModelIndex,int,int)));
        disconnect(sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
                   this, SLOT(_q_sourceRowsInserted(QModelIndex,int,int)));
        disconnect(sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
                   this, SLOT(_q_sourceRowsAboutToBeRemoved(QModelIndex,int,int)));
        disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
                   this, SLOT(_q_sourceRowsRemoved(QModelIndex,int,int)));
        disconnect(sourceModel(), SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
                   this, SLOT(_q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
        disconnect(sourceModel(), SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
                   this, SLOT(_q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int)));
        disconnect(sourceModel(), SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
                   this, SLOT(_q_sourceColumnsAboutToBeInserted(QModelIndex,int,int)));
        disconnect(sourceModel(), SIGNAL(columnsInserted(QModelIndex,int,int)),
                   this, SLOT(_q_sourceColumnsInserted(QModelIndex,int,int)));
        disconnect(sourceModel(), SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
                   this, SLOT(_q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int)));
        disconnect(sourceModel(), SIGNAL(columnsRemoved(QModelIndex,int,int)),
                   this, SLOT(_q_sourceColumnsRemoved(QModelIndex,int,int)));
        disconnect(sourceModel(), SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
                   this, SLOT(_q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
        disconnect(sourceModel(), SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
                   this, SLOT(_q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int)));
        disconnect(sourceModel(), SIGNAL(modelAboutToBeReset()),
                   this, SLOT(_q_sourceModelAboutToBeReset()));
        disconnect(sourceModel(), SIGNAL(modelReset()),
                   this, SLOT(_q_sourceModelReset()));
        disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
                   this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>)));
        disconnect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
                   this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int)));
        disconnect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
                   this, SLOT(_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
        disconnect(sourceModel(), SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
                   this, SLOT(_q_sourceLayoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
    }

    QAbstractProxyModel::setSourceModel(newSourceModel);

    if (sourceModel()) {
        connect(sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
                SLOT(_q_sourceRowsAboutToBeInserted(QModelIndex,int,int)));
        connect(sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
                SLOT(_q_sourceRowsInserted(QModelIndex,int,int)));
        connect(sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
                SLOT(_q_sourceRowsAboutToBeRemoved(QModelIndex,int,int)));
        connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
                SLOT(_q_sourceRowsRemoved(QModelIndex,int,int)));
        connect(sourceModel(), SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
                SLOT(_q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
        connect(sourceModel(), SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
                SLOT(_q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int)));
        connect(sourceModel(), SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
                SLOT(_q_sourceColumnsAboutToBeInserted(QModelIndex,int,int)));
        connect(sourceModel(), SIGNAL(columnsInserted(QModelIndex,int,int)),
                SLOT(_q_sourceColumnsInserted(QModelIndex,int,int)));
        connect(sourceModel(), SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
                SLOT(_q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int)));
        connect(sourceModel(), SIGNAL(columnsRemoved(QModelIndex,int,int)),
                SLOT(_q_sourceColumnsRemoved(QModelIndex,int,int)));
        connect(sourceModel(), SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
                SLOT(_q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
        connect(sourceModel(), SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
                SLOT(_q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int)));
        connect(sourceModel(), SIGNAL(modelAboutToBeReset()),
                SLOT(_q_sourceModelAboutToBeReset()));
        connect(sourceModel(), SIGNAL(modelReset()),
                SLOT(_q_sourceModelReset()));
        connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
                SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>)));
        connect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
                SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int)));
        connect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
                SLOT(_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
        connect(sourceModel(), SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
                SLOT(_q_sourceLayoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
    }

    endResetModel();
}
Exemplo n.º 16
0
PlaylistTableModel::PlaylistTableModel(QObject *parent)
	: QAbstractTableModel(parent),
		song_id(-1)
{
	connect(this, SIGNAL(modelReset()), this, SLOT(playListReset()));
}