[UI][Qt][Sound] Volume dialog: Add icons and change layouts.
[UI][Qt] Add icons to some menu entries.
#ifdef USE_POWER_OFF
}
#endif // USE_POWER_OFF
-
message = buf;
emit message_changed(message);
+ emit window_title_changed(message);
update_fps_time += 1000;
total_frames = draw_frames = 0;
signals:
int message_changed(QString);
+ int window_title_changed(QString);
int sig_draw_thread(bool);
int quit_draw_thread(void);
int sig_screen_aspect(int);
#endif
AGAR_DebugLog(AGAR_LOG_DEBUG, "DrawThread : Start.");
connect(hDrawEmu, SIGNAL(sig_draw_frames(int)), hRunEmu, SLOT(print_framerate(int)));
+ connect(hRunEmu, SIGNAL(window_title_changed(QString)), this, SLOT(do_set_window_title(QString)));
connect(hDrawEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
connect(actionCapture_Screen, SIGNAL(triggered()), glv, SLOT(do_save_frame_screen()));
#ifdef USE_LED_DEVICE
QTimer *ledUpdateTimer;
#endif
+ int screen_mode_count;
QIcon WindowIcon;
QIcon InsertIcon;
QIcon EjectIcon;
QIcon RecordSoundIcon;
QIcon ResetIcon;
QIcon ExitIcon;
- int screen_mode_count;
+ QIcon VolumeMutedIcon;
+ QIcon VolumeLowIcon;
+ QIcon VolumeMidIcon;
+ QIcon VolumeHighIcon;
// Some Functions
void ConfigCpuSpeed(void);
public:
Ui_MainWindow(QWidget *parent = 0);
~Ui_MainWindow();
+
// Initializer : using from InitContext.
void setCoreApplication(QApplication *p);
void doChangeMessage_EmuThread(QString str);
void do_emu_update_config(void);
void delete_joy_thread(void);
+ void do_set_window_title(QString s);
virtual void redraw_status_bar(void);
#ifdef USE_LED_DEVICE
virtual void redraw_leds(void);
void do_recv_data_led(quint32 d);
#endif
+#ifndef WITHOUT_SOUND
+ void do_update_volume(int level);
+#endif
void set_screen_aspect(int num);
void set_screen_size(int w, int h);
void OnReset(void);
ext_rec_filter.clear();
icon_cmt = QIcon(":/icon_cmt.png");
- icon_play_start = QIcon(":/icon_play_start.png");
- icon_play_stop = QIcon(":/icon_play_stop.png");
- icon_ff = QIcon(":/icon_tape_forward.png");
- icon_rew = QIcon(":/icon_tape_backward.png");
- icon_apss_forward = QIcon(":/icon_apss_forward.png");
- icon_apss_backward = QIcon(":/icon_apss_backward.png");
- icon_record_to_wav = QIcon(":/icon_record_to_tape.png");;
+ icon_play_start = QApplication::style()->standardIcon(QStyle::SP_MediaPlay);
+ icon_play_stop = QApplication::style()->standardIcon(QStyle::SP_MediaStop);
+ icon_ff = QApplication::style()->standardIcon(QStyle::SP_MediaSkipForward);
+ icon_rew = QApplication::style()->standardIcon(QStyle::SP_MediaSkipBackward);
+ icon_apss_forward = QApplication::style()->standardIcon(QStyle::SP_MediaSeekForward);
+ icon_apss_backward = QApplication::style()->standardIcon(QStyle::SP_MediaSeekBackward);
+ icon_record_to_wav = QIcon(":/icon_record_to_tape.png");
}
Menu_CMTClass::~Menu_CMTClass()
actionReset->setIcon(ResetIcon);
#ifdef USE_SPECIAL_RESET
actionSpecial_Reset->setText(QApplication::translate("MainWindow", SpecialResetTitle, 0));
+ actionSpecial_Reset->setIcon(QIcon(":/icon_reset.png"));
#endif
actionExit_Emulator->setText(QApplication::translate("MainWindow", "Exit Emulator", 0));
actionExit_Emulator->setIcon(ExitIcon);
#ifdef USE_AUTO_KEY
actionPaste_from_Clipboard->setText(QApplication::translate("MainWindow", "Paste from Clipboard", 0));
+ actionPaste_from_Clipboard->setIcon(QIcon(":/icon_paste.png"));
actionStop_Pasting->setText(QApplication::translate("MainWindow", "Stop Pasting", 0));
+ actionStop_Pasting->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton));
#endif
#ifdef USE_STATE
actionSave_State->setText(QApplication::translate("MainWindow", "Save State", 0));
+ actionSave_State->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogSaveButton));
actionLoad_State->setText(QApplication::translate("MainWindow", "Load State", 0));
+ actionLoad_State->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOpenButton));
#endif
#ifdef USE_DEBUGGER
QImageReader reader(":/default.ico");
QImage result = reader.read();
+ MainWindow->setWindowIcon(QPixmap::fromImage(result));
+ QString tmps;
+ tmps = QString::fromUtf8("emu");
+ tmps = tmps + QString::fromUtf8(CONFIG_NAME);
+ tmps = tmps + QString::fromUtf8(" (");
+ tmps = tmps + QString::fromUtf8(DEVICE_NAME);
+ tmps = tmps + QString::fromUtf8(")");
+ MainWindow->setWindowTitle(tmps);
+
// QIcon WindowIcon;
- InsertIcon = QIcon(":/icon_open.png");
+ InsertIcon = QApplication::style()->standardIcon(QStyle::SP_FileDialogStart);
EjectIcon = QIcon(":/icon_eject.png");
StopIcon = QIcon(":/icon_process_stop.png");
RecordSoundIcon = QIcon(":/icon_record_to_wav.png");
- ResetIcon = QIcon(":/icon_reset.png");
+ ResetIcon = QApplication::style()->standardIcon(QStyle::SP_BrowserReload);
+
+ VolumeMutedIcon = QIcon(":/icon_volume_muted.png");
+ VolumeLowIcon = QIcon(":/icon_volume_low.png");
+ VolumeMidIcon = QIcon(":/icon_volume_mid.png");
+ VolumeHighIcon = QIcon(":/icon_volume_high.png");
+
ExitIcon = QIcon(":/icon_exit.png");
- MainWindow->setWindowIcon(QPixmap::fromImage(result));
- MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
+void Ui_MainWindow::do_set_window_title(QString s)
+{
+ QString tmps;
+ tmps = QString::fromUtf8("emu");
+ tmps = tmps + QString::fromUtf8(CONFIG_NAME);
+ tmps = tmps + QString::fromUtf8(" (");
+ if(!s.isEmpty()) {
+ tmps = tmps + s;
+ }
+ tmps = tmps + QString::fromUtf8(")");
+ MainWindow->setWindowTitle(tmps);
+}
// Emulator
#include "dropdown_joystick.h"
icon_insert = QIcon(":/icon_open.png");
icon_eject = QIcon(":/icon_eject.png");
+ icon_write_protected = QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton);
+ icon_write_enabled = QIcon();
}
Menu_MetaClass::~Menu_MetaClass()
{
write_protect = f;
if(f) {
+ if(use_write_protect) {
+ menu_write_protect->setIcon(icon_write_protected);
+ }
action_write_protect_on->setChecked(true);
} else {
+ if(use_write_protect) {
+ menu_write_protect->setIcon(icon_write_enabled);
+ }
action_write_protect_off->setChecked(true);
}
}
}
void Menu_MetaClass::do_write_protect_media(void) {
write_protect = true;
- if(write_protect) {
+ {
+ if(use_write_protect) {
+ menu_write_protect->setIcon(icon_write_protected);
+ }
action_write_protect_on->setChecked(true);
- } else {
- action_write_protect_off->setChecked(true);
}
emit sig_write_protect_media(media_drive, write_protect);
}
void Menu_MetaClass::do_write_unprotect_media(void) {
write_protect = false;
- if(write_protect) {
- action_write_protect_on->setChecked(true);
- } else {
+ {
+ if(use_write_protect) {
+ menu_write_protect->setIcon(icon_write_enabled);
+ }
action_write_protect_off->setChecked(true);
}
emit sig_write_protect_media(media_drive, write_protect);
QIcon icon_insert;
QIcon icon_eject;
+ QIcon icon_write_protected;
+ QIcon icon_write_enabled;
class Action_Control *action_insert;
class Action_Control *action_eject;
#include "mainwidget.h"
//#include "menuclasses.h"
#include "sound_dialog.h"
+#include <QImageReader>
+#include <QImage>
QT_BEGIN_NAMESPACE
void Ui_MainWindow::rise_volume_dialog(void)
{
Ui_SoundDialog *dlg = new Ui_SoundDialog(emu, this);
- dlg->setWindowTitle(QApplication::translate("Ui_SoundDialog", "Set Volume", 0));
+ QString tmps, s_val;
+ float n;
+ QIcon img = QIcon(":/icon_speaker.png");
+
+ dlg->setWindowIcon(img);
this->retranslateVolumeLabels(dlg);
+
+ n = (float)(((config.general_sound_level + 32768) * 100) / 65535) / 100.0;
+ s_val.setNum(n, 'f', 1);
+ tmps = QApplication::translate("Ui_SoundDialog", "Set Volume", 0);
+ tmps = tmps + QString::fromUtf8(" (") + s_val + QString::fromUtf8("%)");
+ dlg->setWindowTitle(tmps);
dlg->show();
//dlg->exec();
}
action_VolumeDialog->setObjectName(QString::fromUtf8("actionVolumedialog"));
#endif
}
-
+void Ui_MainWindow::do_update_volume(int level)
+{
+#if !defined(WITHOUT_SOUND)
+ if(level <= -32768) {
+ action_VolumeDialog->setIcon(VolumeMutedIcon);
+ } else if(level < -4096) {
+ action_VolumeDialog->setIcon(VolumeLowIcon);
+ } else if(level < 16384) {
+ action_VolumeDialog->setIcon(VolumeMidIcon);
+ } else {
+ action_VolumeDialog->setIcon(VolumeHighIcon);
+ }
+#endif
+}
+
void Ui_MainWindow::retranslateSoundMenu(void)
{
#if !defined(WITHOUT_SOUND)
menuOutput_Frequency->setTitle(QApplication::translate("MainWindow", "Output Frequency", 0));
menuSound_Latency->setTitle(QApplication::translate("MainWindow", "Sound Latency", 0));
action_VolumeDialog->setText(QApplication::translate("MainWindow", "Set Volumes", 0));
-#endif
+#endif
+ do_update_volume(config.general_sound_level);
}
QT_END_NAMESPACE
{
if(bind_num < 0) return;
if(bind_num == 0) {
+ QString tmps, s_val;
+ float n;
if(level < -32768) level = -32678;
- if(level > 32768) level = 32768;
-
+ if(level > 32767) level = 32767;
config.general_sound_level = level;
+
+ tmps = QApplication::translate("Ui_SoundDialog", "Set Volume", 0);
+ n = (float)(((level + 32768) * 1000) / 65535) / 10.0;
+ s_val.setNum(n, 'f', 1);
+ tmps = tmps + QString::fromUtf8(" (") + s_val + QString::fromUtf8("%)");
+ parent_widget->setWindowTitle(tmps);
+ emit sig_update_master_volume(level);
emit sig_emu_update_config();
}
QSlider::setValue(level);
if(level < -60) level = -60;
if(level > 3) level = 3;
if(bind_num <= USE_SOUND_VOLUME) {
+ emit sig_emu_update_volume_label(bind_num - 1, level);
emit sig_emu_update_volume_level(bind_num - 1, level);
}
}
parent_widget = this;
}
MasterLayout = new QGridLayout;
-
+
this->setMinimumWidth(620);
sliderMasterVolume = new Ui_SndSliderObject(_emu, Qt::Horizontal, this, 0);
boxMasterVolume = new QGroupBox(QApplication::translate("Ui_SoundDialog", "Main", 0));
-
+
connect(sliderMasterVolume, SIGNAL(sig_emu_update_config()),
parent_widget, SLOT(do_emu_update_config()));
sliderMasterVolume->setValue(config.general_sound_level);
sliderMasterVolume->connect(sliderMasterVolume, SIGNAL(valueChanged(int)),
sliderMasterVolume, SLOT(setValue(int)));
-
VBoxMasterVolume = new QVBoxLayout;
VBoxMasterVolume->addWidget(sliderMasterVolume);
boxMasterVolume->setLayout(VBoxMasterVolume);
+ connect(sliderMasterVolume, SIGNAL(sig_update_master_volume(int)), parent_widget, SLOT(do_update_volume(int)));
#ifdef USE_SOUND_VOLUME
MasterLayout->addWidget(boxMasterVolume, 0, 0, 1, 2);
int s_balance;
s_lvl = (l_val + r_val) / 2;
s_balance = -(l_val - r_val) / 2;
- //QString n_s;
- //n_s.setNum(ii + 1);
lbl = lbl;
sliderDeviceVolume[ij] = new Ui_SndSliderObject(_emu, Qt::Horizontal, this, ii + 1);
sliderDeviceVolume[ij], SLOT(setLevelValue(int)));
connect(sliderDeviceVolume[ij], SIGNAL(sig_emu_update_volume_level(int, int)),
parent_widget, SLOT(do_emu_update_volume_level(int, int)));
-
+ connect(sliderDeviceVolume[ij], SIGNAL(sig_emu_update_volume_label(int, int)),
+ this, SLOT(do_update_volume_label(int, int)));
+
sliderDeviceVolume[ij + 1] = new Ui_SndSliderObject(_emu, Qt::Horizontal, this, ii + 1);
sliderDeviceVolume[ij + 1]->setMinimum(-20);
sliderDeviceVolume[ij + 1]->setMaximum(20);
connect(sliderDeviceVolume[ij + 1], SIGNAL(sig_emu_update_volume_balance(int, int)),
parent_widget, SLOT(do_emu_update_volume_balance(int, int)));
- ResetVolume[ii] = new QPushButton(QApplication::translate("Ui_SoundDialog", "Reset", 0));
- ResetBalance[ii] = new QPushButton(QApplication::translate("Ui_SoundDialog", "Reset", 0));
+ ResetBalance[ii] = new QPushButton(QApplication::style()->standardIcon(QStyle::SP_DialogResetButton), "");
+ ResetBalance[ii]->setFlat(true);
+ ResetBalance[ii]->setToolTip(QApplication::translate("Ui_SoundDialog", "Reset to center.", 0));
+
LabelVolume[ii] = new QLabel(QApplication::translate("Ui_SoundDialog", "Volume", 0));
LabelBalance[ii] = new QLabel(QApplication::translate("Ui_SoundDialog", "Balance", 0));
-
- connect(ResetVolume[ii], SIGNAL(pressed()), sliderDeviceVolume[ij] ,SLOT(resetVolumeValue()));
+ LabelLevel[ii] = new QLabel(QString::fromUtf8(" 0db"));
+ LabelLevel[ii]->setMinimumWidth(48);
+ LabelLevel[ii]->setAlignment(Qt::AlignRight);
+ do_update_volume_label(ii, s_lvl);
connect(ResetBalance[ii], SIGNAL(pressed()), sliderDeviceVolume[ij + 1] ,SLOT(resetBalanceValue()));
boxDeviceVolume[ii] = new QGroupBox(lbl);
LayoutDeviceVolume[ii]->addWidget(LabelVolume[ii], 0, 0);
LayoutDeviceVolume[ii]->addWidget(LabelBalance[ii], 1, 0);
- LayoutDeviceVolume[ii]->addWidget(ResetVolume[ii], 0, 2);
+ LayoutDeviceVolume[ii]->addWidget(LabelLevel[ii], 0, 2);
LayoutDeviceVolume[ii]->addWidget(ResetBalance[ii], 1, 2);
LayoutDeviceVolume[ii]->addWidget(sliderDeviceVolume[ij], 0, 1);
LayoutDeviceVolume[ii]->addWidget(sliderDeviceVolume[ij + 1], 1, 1);
{
}
+void Ui_SoundDialog::do_update_volume_label(int num, int level)
+{
+ QString tmps;
+ if(LabelLevel[num] != NULL) {
+ QString s_val;
+ s_val.setNum(level);
+ tmps = s_val + QString::fromUtf8("db");
+ LabelLevel[num]->setText(tmps);
+ }
+}
+
void Ui_SoundDialog::do_emu_update_config()
{
if(p_emu != NULL) {
signals:
int sig_emu_update_config(void);
int sig_emu_update_volume_level(int, int);
+ int sig_emu_update_volume_label(int, int);
int sig_emu_update_volume_balance(int, int);
+ int sig_update_master_volume(int);
};
class Ui_SoundDialog : public QWidget
EMU *p_emu;
QWidget *parent_widget;
QGridLayout *MasterLayout;
-
protected:
Ui_SndSliderObject *sliderMasterVolume;
QGroupBox *boxMasterVolume;
QGridLayout *LayoutDeviceVolume[USE_SOUND_VOLUME];
QLabel *LabelVolume[USE_SOUND_VOLUME];
QLabel *LabelBalance[USE_SOUND_VOLUME];
- QPushButton *ResetVolume[USE_SOUND_VOLUME];
+ QLabel *LabelLevel[USE_SOUND_VOLUME];
+
QPushButton *ResetBalance[USE_SOUND_VOLUME];
#endif
QPushButton *closeButton;
void setSliderVisible(int num, bool flag);
public slots:
void do_emu_update_config();
-signals:
+ void do_update_volume_label(int num, int level);
+ signals:
};
QT_END_NAMESPACE
#endif //_CSP_QT_SOUND_DIALOG_H