Ejemplo n.º 1
0
MashListModel::MashListModel(QWidget* parent)
   : QAbstractListModel(parent), recipe(0)
{
   connect( &(Database::instance()), SIGNAL(newMashSignal(Mash*)), this, SLOT(addMash(Mash*)) );
   connect( &(Database::instance()), SIGNAL(deletedSignal(Mash*)), this, SLOT(removeMash(Mash*)) );
   repopulateList();
}
Ejemplo n.º 2
0
MashComboBox::MashComboBox(QWidget* parent)
   : QComboBox(parent)
{
   setCurrentIndex(-1);
   connect( &(Database::instance()), SIGNAL(newMashSignal(Mash*)), this, SLOT(addMash(Mash*)) );
   connect( &(Database::instance()), SIGNAL(deletedSignal(Mash*)), this, SLOT(removeMash(Mash*)) );
   repopulateList();
}
Ejemplo n.º 3
0
TargetView::TargetView(QWidget *parent)
	: QScrollArea(parent)
	, m_panes()
	, m_layoutWidget(this)
	, m_layout(&m_layoutWidget) // Scroll area child widget

	// Right-click context menu
	, m_contextTarget(NULL)
	, m_contextMenu(this)
	, m_modifyTargetAction(NULL)
	, m_moveTargetUpAction(NULL)
	, m_moveTargetDownAction(NULL)
{
	App->applyDarkStyle(this);
	App->applyDarkStyle(verticalScrollBar());
	App->applyDarkStyle(horizontalScrollBar());

	// Display the layout widget in the scroll area
	setWidget(&m_layoutWidget);
	m_layoutWidget.installEventFilter(this);
	m_layoutWidget.setSizePolicy(
		QSizePolicy::Preferred, QSizePolicy::Maximum);

	// Remove layout margin and spacing
	m_layout.setMargin(0);
	m_layout.setSpacing(0);

	// Allow the scroll area to resize the layout widget dynamically
	setWidgetResizable(true);

	// Populate right-click context menu
	m_modifyTargetAction = m_contextMenu.addAction(tr(
		"Modify target..."));
	m_contextMenu.addSeparator();
	m_moveTargetUpAction = m_contextMenu.addAction(tr(
		"Move target up"));
	m_moveTargetDownAction = m_contextMenu.addAction(tr(
		"Move target down"));
	connect(&m_contextMenu, &QMenu::triggered,
		this, &TargetView::targetContextTriggered);

	// Populate view from existing profile
	repopulateList();

	// Watch profile for additions, deletions and moves
	Profile *profile = App->getProfile();
	connect(profile, &Profile::targetAdded,
		this, &TargetView::targetAdded);
	connect(profile, &Profile::destroyingTarget,
		this, &TargetView::destroyingTarget);
	connect(profile, &Profile::targetChanged,
		this, &TargetView::targetChanged);
	connect(profile, &Profile::targetMoved,
		this, &TargetView::targetMoved);
}
Ejemplo n.º 4
0
void TargetView::targetMoved(Target *target, int before)
{
	repopulateList();
}
Ejemplo n.º 5
0
void TargetView::targetChanged(Target *target)
{
	repopulateList();
}