Debian Codegraph @

src/aboutview.cpp

raw symbols SCIP
1 /*
2 * midisnoop - MIDI monitor and prober
3 * Copyright (C) 2012 Devin Anderson
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 675 Mass
17 * Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <QtCore/QLocale>
21
22 #include "aboutview.h"
23 #include "util.h"
24
25 AboutView::AboutView(QObject *parent):
26 DialogView(":/midisnoop/aboutview.ui", parent)
27 {
28 closeButton = getChild<QPushButton>(dialog, "closeButton");
29 connect(closeButton, SIGNAL(clicked()), SIGNAL(closeRequest()));
30
31 majorVersion = 0;
32 minorVersion = 0;
33 revision = 0;
34
35 version = getChild<QLabel>(dialog, "version");
36
37 updateVersion();
38 }
39
40 AboutView::~AboutView()
41 {
42 // Empty
43 }
44
45 void
46 AboutView::setMajorVersion(int majorVersion)
47 {
48 this->majorVersion = majorVersion;
49 updateVersion();
50 }
51
52 void
53 AboutView::setMinorVersion(int minorVersion)
54 {
55 this->minorVersion = minorVersion;
56 updateVersion();
57 }
58
59 void
60 AboutView::setRevision(int revision)
61 {
62 this->revision = revision;
63 updateVersion();
64 }
65
66 void
67 AboutView::updateVersion()
68 {
69 QLocale locale = QLocale::system();
70 version->setText(tr("%1.%2.%3", "versionFormat").
71 arg(locale.toString(majorVersion)).
72 arg(locale.toString(minorVersion)).
73 arg(locale.toString(revision)));
74 }