Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
fullscreenkeyboarddialog.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2015 Haye Hinrichsen, Christoph Wick
3  *
4  * This file is part of Entropy Piano Tuner.
5  *
6  * Entropy Piano Tuner is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * Entropy Piano Tuner is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * Entropy Piano Tuner. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
19 
21 #include <QVBoxLayout>
22 #include <QDialogButtonBox>
24 #include "keyboardgraphicsview.h"
25 
27  QDialog(parent),
28  mParentKeyboardView(parent) {
29 
30  setWindowTitle(tr("Keyboard"));
31  QVBoxLayout *layout = new QVBoxLayout;
32  setLayout(layout);
33 
34  // create a new KeyboardGraphicsView in fullscreen mode
35  KeyboardGraphicsView *keyboardView = new KeyboardGraphicsView(this);
36  keyboardView->setKeyboard(parent->getKeyboard());
37  layout->addWidget(keyboardView);
38 
39  // show the dialog in fullscreen
40  showFullScreen();
41 
42  // select the current key
43  keyboardView->setSelection(parent->getSelectedKeyIndex(), parent->getSelectedKeyState(), parent->getPreliminaryKey());
44 
45  QDialogButtonBox *buttons = new QDialogButtonBox;
46  mDialogButtons = buttons;
47  layout->addWidget(buttons);
48  buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
49 
50  QObject::connect(keyboardView, SIGNAL(selectionChanged(int8_t)), this, SLOT(accept()));
51  QObject::connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
52  QObject::connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
53 
54  mKeyboardView = keyboardView;
55 }
56 
58 {
59 
60 }
61 
63  QDialog::reject();
64 }
65 
69  true);
70 
71  QDialog::accept();
72 }
KeyboardGraphicsView * mParentKeyboardView
int8_t getSelectedKeyIndex() const
Getter for mSelectedKey.
const Keyboard * getKeyboard() const
Getter for mKeyboard.
void selectKey(int8_t key0, KeyState keyState, bool notifyMessageListeners=true)
Function to select or deselect a key.
void setKeyboard(const Keyboard *kb)
Setter for mKeyboard.
void setSelection(int key, KeyState state, int preliminary)
Function to set the current selection.
KeyState getSelectedKeyState() const
Getter for mSelectedKeyState.
QDialogButtonBox * mDialogButtons
button box
Viewer for the keyboard.
KeyboardGraphicsView * mKeyboardView
Pointer to the displayed KeyboardGraphicsView in fullscreen.
FullScreenKeyboardDialog(KeyboardGraphicsView *parent)
Constructor.
int8_t getPreliminaryKey() const
Getter for mPreliminaryKey.