コード例 #1
0
void ImportDialogFileWidget::UpdateState(int action)
{
	ui->actionButtons->blockSignals(true);

	QPalette pal = ui->fileNameLabel->palette();

	activeAction = (ImportDialog::eAction)action;
	switch (activeAction)
	{
		case ImportDialog::ACTION_IGNORE:
			ui->ignoreRadioButton->setChecked(true);
			ui->actionLabel->setPixmap(QIcon(IconHelper::GetIgnoreIconPath()).pixmap(16, 16));
			ui->actionLabel->setToolTip(tr("Ignore file"));
			ui->aggregatorSizeWidget->hide();
			pal.setColor(QPalette::Foreground, IGNORED_FILE_COLOR);
			break;

		case ImportDialog::ACTION_SCREEN:
			ui->screenRadioButton->setChecked(true);
			ui->actionLabel->setPixmap(QIcon(IconHelper::GetScreenIconPath()).pixmap(16, 16));
			ui->actionLabel->setToolTip(tr("Load as Screen"));
			ui->aggregatorSizeWidget->hide();
			pal.setColor(QPalette::Foreground, ACTIVE_FILE_COLOR);
			break;

		case ImportDialog::ACTION_AGGREGATOR:
			ui->aggregatorRadioButton->setChecked(true);
			ui->actionLabel->setToolTip(tr("Load as Aggregator"));
			ui->actionLabel->setPixmap(QIcon(IconHelper::GetAggregatorIconPath()).pixmap(16, 16));

			if (!neverShowSizeWidget)
			{
				ui->aggregatorSizeWidget->show();
			}

			pal.setColor(QPalette::Foreground, ACTIVE_FILE_COLOR);
			break;

		default:
			break;
	}

	ui->upperIgnoreIcon->setVisible(showUpperIcons);
	ui->upperScreenIcon->setVisible(showUpperIcons);
	ui->upperAggregatorIcon->setVisible(showUpperIcons);

	if (showUpperIcons)
	{
		ui->actionLabel->setPixmap(QIcon().pixmap(16, 16));
	}

	ui->fileNameLabel->setPalette(pal);
	ui->actionButtons->blockSignals(false);

	emit ActionChanged(id);
}
コード例 #2
0
void Windows7ThumbBar::SetActions(const QList<QAction*>& actions) {
#ifdef Q_OS_WIN32
  qLog(Debug) << "Setting actions";
  Q_ASSERT(actions.count() <= kMaxButtonCount);

  actions_ = actions;
  foreach (QAction* action, actions) {
    if (action) {
      connect(action, SIGNAL(changed()), SLOT(ActionChanged()));
    }
  }
  qLog(Debug) << "Done";
#endif // Q_OS_WIN32
}