File: ToolBar.cpp

package info (click to toggle)
dolphin-emu 5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 28,976 kB
  • ctags: 35,666
  • sloc: cpp: 213,139; java: 6,252; asm: 2,277; xml: 1,998; ansic: 1,514; python: 462; sh: 279; pascal: 247; makefile: 124; perl: 97
file content (86 lines) | stat: -rw-r--r-- 2,719 bytes parent folder | download | duplicates (2)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include <QIcon>

#include "DolphinQt2/Settings.h"
#include "DolphinQt2/ToolBar.h"

static QSize ICON_SIZE(32, 32);

ToolBar::ToolBar(QWidget* parent)
	: QToolBar(parent)
{
	setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
	setMovable(false);
	setFloatable(false);
	setIconSize(ICON_SIZE);

	MakeActions();
	UpdateIcons();

	EmulationStopped();
}

void ToolBar::EmulationStarted()
{
	m_play_action->setEnabled(false);
	m_play_action->setVisible(false);
	m_pause_action->setEnabled(true);
	m_pause_action->setVisible(true);
	m_fullscreen_action->setEnabled(true);
	m_screenshot_action->setEnabled(true);
}

void ToolBar::EmulationPaused()
{
	m_play_action->setEnabled(true);
	m_play_action->setVisible(true);
	m_pause_action->setEnabled(false);
	m_pause_action->setVisible(false);
}

void ToolBar::EmulationStopped()
{
	m_play_action->setEnabled(true);
	m_play_action->setVisible(true);
	m_pause_action->setEnabled(false);
	m_pause_action->setVisible(false);
	m_stop_action->setEnabled(false);
	m_fullscreen_action->setEnabled(false);
	m_screenshot_action->setEnabled(false);
}

void ToolBar::MakeActions()
{
	m_open_action = addAction(tr("Open"), this, SIGNAL(OpenPressed()));
	m_play_action = addAction(tr("Play"), this, SIGNAL(PlayPressed()));
	m_pause_action = addAction(tr("Pause"), this, SIGNAL(PausePressed()));
	m_stop_action = addAction(tr("Stop"), this, SIGNAL(StopPressed()));
	m_fullscreen_action = addAction(tr("Full Screen"), this, SIGNAL(FullScreenPressed()));
	m_screenshot_action = addAction(tr("Screen Shot"), this, SIGNAL(ScreenShotPressed()));

	addSeparator();

	m_paths_action = addAction(tr("Paths"), this, SIGNAL(PathsPressed()));
	m_config_action = addAction(tr("Settings"), this, SIGNAL(SettingsPressed()));
	m_controllers_action = addAction(tr("Controllers"));
	m_controllers_action->setEnabled(false);
}

void ToolBar::UpdateIcons()
{
	QString dir = Settings().GetThemeDir();

	m_open_action->setIcon(QIcon(QStringLiteral("open.png").prepend(dir)));
	m_paths_action->setIcon(QIcon(QStringLiteral("browse.png").prepend(dir)));
	m_play_action->setIcon(QIcon(QStringLiteral("play.png").prepend(dir)));
	m_pause_action->setIcon(QIcon(QStringLiteral("pause.png").prepend(dir)));
	m_stop_action->setIcon(QIcon(QStringLiteral("stop.png").prepend(dir)));
	m_fullscreen_action->setIcon(QIcon(QStringLiteral("fullscreen.png").prepend(dir)));
	m_screenshot_action->setIcon(QIcon(QStringLiteral("screenshot.png").prepend(dir)));
	m_config_action->setIcon(QIcon(QStringLiteral("config.png").prepend(dir)));
	m_controllers_action->setIcon(QIcon(QStringLiteral("classic.png").prepend(dir)));
}