54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
|
|
#include <iostream>
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: QMainWindow(parent)
|
|
, ui(new Ui::MainWindow)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
QPushButton* btn = ui->pushButton;
|
|
QObject::connect(btn, SIGNAL( clicked() ), this, SLOT( buttonPressed() ));
|
|
|
|
sc = new QShortcut(QKeySequence("Shift+1"), this, 0, 0, Qt::ApplicationShortcut);
|
|
QObject::connect(sc, SIGNAL( activated() ), this, SLOT( shortcut() ));
|
|
|
|
globalShortcut = new QxtGlobalShortcut(QKeySequence("Shift+F1"));
|
|
QObject::connect(globalShortcut, SIGNAL(activated()), this, SLOT( shortcut2() ));
|
|
|
|
Sound& sound = Sound::instance(); // init sound
|
|
sound.addDeviceWithName("VirtualMic");
|
|
sound.addDefaultDevice();
|
|
}
|
|
|
|
MainWindow::~MainWindow() {
|
|
delete ui;
|
|
|
|
Sound::deinit();
|
|
}
|
|
|
|
void MainWindow::buttonPressed() {
|
|
std::cout << "Button Pressed" << std::endl;
|
|
|
|
playSound();
|
|
}
|
|
|
|
void MainWindow::shortcut() {
|
|
std::cout << "Shortcut Pressed" << std::endl;
|
|
|
|
playSound();
|
|
}
|
|
|
|
void MainWindow::shortcut2() {
|
|
std::cout << "Shortcut2 Pressed!!" << std::endl;
|
|
|
|
playSound();
|
|
}
|
|
|
|
void MainWindow::playSound() {
|
|
//Sound::instance().addPlayback("Uwu_voice-xjrU3N8M4eo-251.mp3");
|
|
Sound::instance().addPlayback("bonk.wav");
|
|
}
|