示例#1
0
void GeneratorDaemon::onConnected()
{
  m_isConnected = true;
  if(m_tagQuery == NULL)
  {
    QSharedPointer<DataMark> mark(new JsonDataMark(0,0,0,"part of route "+m_channelName,
      "generated by generator:)","unknown",QDateTime::currentDateTime()));
    QSharedPointer<Channel> channel(new JsonChannel(m_channelName,"dummy channel"));
    mark->setChannel(channel);
    mark->setUser(m_loginQuery->getUser());
    qDebug() << "try to create WriteTagQuery";
    m_tagQuery = new WriteTagQuery(mark,this);
    qDebug() << m_tagQuery;
    connect(m_tagQuery, SIGNAL(tagAdded()), SLOT(onTagAdded()));
    connect(m_tagQuery, SIGNAL(errorOccured(QString)), SLOT(onError(QString)));
  }
}
TagFilterWidget::TagFilterWidget(TagFilter* filter, QWidget* parent) :
	QWidget(parent),
	filter_(filter),
	rows_(1)
{
	int fontHeight = qMin(fontMetrics().height(), 24);
	baseSize_ = fontHeight + 8;
	setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	resize(100, baseSize_);

	resetButton_ = new QToolButton(this);
	resetButton_->setToolTip("Reset");
	resetButton_->setIcon(QIcon(":/close-8.png"));
	resetButton_->setAutoRaise(true);

	connect(resetButton_,
			SIGNAL(clicked(bool)),
			filter_,
			SLOT(reset()));

	connect(filter_,
			SIGNAL(tagAdded(QString,TagFilter::Action)),
			SLOT(onTagAdded(QString,TagFilter::Action)));

	connect(filter_,
			SIGNAL(tagChanged(QString,TagFilter::Action)),
			SLOT(onTagChanged(QString,TagFilter::Action)));

	connect(filter_,
			SIGNAL(tagRemoved(QString)),
			SLOT(onTagRemoved(QString)));

	connect(filter_,
			SIGNAL(filterEmpty()),
			SLOT(onFilterEmpty()));

	updateLayout();
}