summaryrefslogtreecommitdiffstats
path: root/src/gui/ratingfieldwidget.cpp
blob: 77b167734e0e16da26c3a180ee7e425591d08472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/***************************************************************************
    copyright            : (C) 2005-2006 by Robby Stephenson
    email                : [email protected]
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of version 2 of the GNU General Public License as  *
 *   published by the Free Software Foundation;                            *
 *                                                                         *
 ***************************************************************************/

#include "ratingfieldwidget.h"
#include "ratingwidget.h"
#include "../field.h"

using Tellico::GUI::RatingFieldWidget;

RatingFieldWidget::RatingFieldWidget(Data::FieldPtr field_, TQWidget* parent_, const char* name_/*=0*/)
    : FieldWidget(field_, parent_, name_) {
  m_rating = new RatingWidget(field_, this);
  connect(m_rating, TQT_SIGNAL(modified()), TQT_SIGNAL(modified()));

  registerWidget();
}

TQString RatingFieldWidget::text() const {
  return m_rating->text();
}

void RatingFieldWidget::setText(const TQString& text_) {
  blockSignals(true);

  m_rating->blockSignals(true);
  m_rating->setText(text_);
  m_rating->blockSignals(false);

  blockSignals(false);

  if(m_rating->text() != text_) {
    emit modified();
  }
}

void RatingFieldWidget::clear() {
  m_rating->clear();
  editMultiple(false);
}

void RatingFieldWidget::updateFieldHook(Data::FieldPtr, Data::FieldPtr newField_) {
  m_rating->updateField(newField_);
}

TQWidget* RatingFieldWidget::widget() {
  return m_rating;
}

#include "ratingfieldwidget.moc"