📄 configurationpanel.ui.h
字号:
/* * Copyright (C) 2004-2006 Savoir-Faire Linux inc. * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Jean-Philippe Barrette-LaPierre * <jean-philippe.barrette-lapierre@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *//****************************************************************************** ui.h extension file, included from the uic-generated form implementation.**** If you want to add, delete, or rename functions or slots, use** Qt Designer to update this file, preserving your code.**** You should not define a constructor or destructor in this file.** Instead, write your code in functions called init() and destroy().** These will automatically be called by the form's constructor and** destructor.*****************************************************************************/#include <qdir.h>#include <qmessagebox.h>#include <qstringlist.h>#include <qcolor.h>#include <qvbuttongroup.h>#include "globals.h"#include "ConfigurationManager.hpp"#include "DebugOutput.hpp"#include "QjListBoxPixmap.hpp"#include "SkinManager.hpp"#include "TransparentWidget.hpp"#define SIGNALISATIONS_IMAGE "signalisations.png"#define AUDIO_IMAGE "audio.png"#define PREFERENCES_IMAGE "preferences.png"#define ABOUT_IMAGE "about.png"void ConfigurationPanel::init(){ _cutStringCombo = 30; //DebugOutput::instance() << "ConfigurationPanel::init()\n"; lblError->hide(); Tab_Signalisations->show(); Tab_Audio->hide(); Tab_Preferences->hide(); Tab_About->hide(); /* // For reading settings at application startup // List skin choice from "skins" directory QDir dir(Skin::getPath(QString(SKINDIR))); if ( !dir.exists() ) { _debug("\nCannot find 'skins' directory\n"); return; } else { dir.setFilter( QDir::Dirs | QDir::NoSymLinks); dir.setSorting( QDir::Name ); QStringList list; list = dir.entryList(); for (unsigned int i = 0; i < dir.count(); i++) { if (list[i] != "." && list[i] != ".." && list[i] != "CVS") { SkinChoice->insertItem(list[i]); } } } */ // For preferences tab /* SkinChoice->setCurrentText(QString(manager.getConfigString(PREFERENCES, SKIN_CHOICE))); confirmationToQuit->setChecked(manager.getConfigInt(PREFERENCES, CONFIRM_QUIT)); zoneToneChoice->setCurrentText(QString(manager.getConfigString( PREFERENCES, ZONE_TONE))); checkedTray->setChecked(manager.getConfigInt( PREFERENCES, CHECKED_TRAY)); voicemailNumber->setText(QString(manager.getConfigString( PREFERENCES, VOICEMAIL_NUM))); */ // Init tab view order // Set items for QListBox new QjListBoxPixmap (QjListBoxPixmap::Above, TransparentWidget::retreive(SIGNALISATIONS_IMAGE), "Signalisation", Menu); new QjListBoxPixmap (QjListBoxPixmap::Above, TransparentWidget::retreive(AUDIO_IMAGE), "Audio", Menu ); new QjListBoxPixmap (QjListBoxPixmap::Above, TransparentWidget::retreive(PREFERENCES_IMAGE), "Preferences", Menu); new QjListBoxPixmap (QjListBoxPixmap::Above, TransparentWidget::retreive(ABOUT_IMAGE), "About", Menu);}void ConfigurationPanel::generate(){ // For audio tab codec1->setCurrentText(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_CODEC1)); codec2->setCurrentText(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_CODEC2)); codec3->setCurrentText(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_CODEC3)); ringsChoice->setCurrentText(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_RINGTONE)); // For signalisations tab // Load account QComboBox* cbo = cboSIPAccount; cbo->clear(); int nbItem = 4; for (int iItem = 0; iItem < nbItem; iItem++) { QString accountId = "SIP" + QString::number(iItem); QString aliasName = ConfigurationManager::instance().get(accountId, ACCOUNT_ALIAS); QString accountName; if (aliasName.isEmpty()) { accountName = QObject::tr("SIP Account #%1").arg(iItem+1); } else { if (aliasName.length() > 30) { aliasName = aliasName.left(30) + "..."; } accountName = aliasName + " (" + QObject::tr("SIP Account #%1").arg(iItem+1) + ")"; } cbo->insertItem(accountName,iItem); } loadSIPAccount(0); sendDTMFas->setCurrentItem(ConfigurationManager::instance().get(SIGNALISATION_SECTION, SIGNALISATION_SEND_DTMF_AS).toUInt()); playTones->setChecked(ConfigurationManager::instance().get(SIGNALISATION_SECTION, SIGNALISATION_PLAY_TONES).toUInt()); pulseLength->setValue(ConfigurationManager::instance().get(SIGNALISATION_SECTION, SIGNALISATION_PULSE_LENGTH).toUInt()); cboDriverChoiceOut->setCurrentItem(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEOUT).toUInt()); cboDriverChoiceIn->setCurrentItem(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEIN).toUInt()); // fill cboDriverRate here int nbRate = 5; int allowedRate[5] = {8000,16000,32000,44100,48000}; cboDriverRate->clear(); for(int iRate = 0; iRate < nbRate; iRate++) { cboDriverRate->insertItem(QString::number(allowedRate[iRate])); } cboDriverRate->setCurrentText(ConfigurationManager::instance().get(AUDIO_SECTION, AUDIO_SAMPLERATE)); //preference tab updateSkins();}// For saving settings at application 'save'void ConfigurationPanel::saveSlot(){ saveSIPAccount(cboSIPAccount->currentItem()); ConfigurationManager::instance().set(SIGNALISATION_SECTION, SIGNALISATION_PULSE_LENGTH, QString::number(pulseLength->value())); ConfigurationManager::instance().set(SIGNALISATION_SECTION, SIGNALISATION_PLAY_TONES, QString::number(playTones->isChecked())); ConfigurationManager::instance().set(SIGNALISATION_SECTION, SIGNALISATION_SEND_DTMF_AS, QString::number(sendDTMFas->currentItem())); if (codec1->currentText() != NULL) { ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_CODEC1, codec1->currentText()); } if (codec2->currentText() != NULL) { ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_CODEC2, codec2->currentText()); } if (codec3->currentText() != NULL) { ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_CODEC3, codec3->currentText()); } if (ringsChoice->currentText() != NULL) { ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_RINGTONE, ringsChoice->currentText()); } if (cboDriverChoiceOut->currentText() != NULL) { ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEOUT, QString::number(cboDriverChoiceOut->currentItem())); } if (cboDriverChoiceIn->currentText() != NULL) { ConfigurationManager::instance().set(AUDIO_SECTION, AUDIO_DEFAULT_DEVICEIN, QString::number(cboDriverChoiceIn->currentItem())); } SkinManager::instance().load(SkinChoice->currentText()); SkinManager::instance().save();#if 0 QMessageBox::information(this, tr("Save settings"), tr("You must restart SFLPhone"), QMessageBox::Yes);#endif ConfigurationManager::instance().save();}// Handle tab view according to current item of listboxvoid ConfigurationPanel::changeTabSlot(){ switch (Menu->currentItem()) { case 0: TitleTab->setText(tr("Setup signalisation")); Tab_Signalisations->show(); Tab_Audio->hide(); Tab_Preferences->hide(); Tab_About->hide(); break; case 1: TitleTab->setText(tr("Setup audio")); Tab_Signalisations->hide(); Tab_Audio->show(); Tab_Preferences->hide(); Tab_About->hide(); break; case 2: updateSkins(); TitleTab->setText(tr("Setup preferences")); Tab_Signalisations->hide(); Tab_Audio->hide(); Tab_Preferences->show(); Tab_About->hide(); break; case 3: TitleTab->setText(tr("About")); Tab_Signalisations->hide(); Tab_Audio->hide(); Tab_Preferences->hide(); Tab_About->show(); break; }}void ConfigurationPanel::useStunSlot(int id){ QString account = ACCOUNT_DEFAULT_NAME;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -