Do not repeat the application name and organization name everywhere

This commit is contained in:
Olivier Teulière 2012-02-02 09:02:20 +01:00
parent a3b8b9872a
commit e86d71626c
8 changed files with 20 additions and 20 deletions

View file

@ -85,7 +85,7 @@ void AuxWindow::closeEvent(QCloseEvent *event)
void AuxWindow::writeSettings() const
{
QSettings settings(ORGANIZATION, PACKAGE_NAME);
QSettings settings;
settings.beginGroup(m_windowName);
settings.setValue("size", size());
settings.setValue("pos", pos());
@ -95,7 +95,7 @@ void AuxWindow::writeSettings() const
void AuxWindow::readSettings()
{
QSettings settings(ORGANIZATION, PACKAGE_NAME);
QSettings settings;
settings.beginGroup(m_windowName);
QSize size = settings.value("size").toSize();
if (size.isValid())

View file

@ -124,7 +124,7 @@ void HistoryWidget::updateModel()
if (m_history != NULL && m_history->getSize() != 0)
{
// Should we align the rack with its solution?
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
bool align = qs.value(PrefsDialog::kINTF_ALIGN_HISTORY).toBool();
if (!align)

View file

@ -119,6 +119,9 @@ int main(int argc, char **argv)
MyApplication app(argc, argv);
app.setWindowIcon(QIcon(":/images/eliot.xpm"));
// Used for QSettings
app.setApplicationName(PACKAGE_NAME);
app.setOrganizationName("eliot");
#ifdef ENABLE_NLS
// Set the message domain

View file

@ -99,7 +99,7 @@ MainWindow::MainWindow(QWidget *iParent)
// Make it easier to reproduce bugs
LOG_DEBUG("Rand seed: " << val);
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
int timerTotal = qs.value(PrefsDialog::kINTF_TIMER_TOTAL_DURATION, 180).toInt();
int timerAlert = qs.value(PrefsDialog::kINTF_TIMER_ALERT_DURATION, 30).toInt();
m_timerModel = new TimerModel(timerTotal, timerAlert);
@ -260,7 +260,7 @@ void MainWindow::linkTrainingAnd7P1()
// Reconnect it only if needed
if (m_dicToolsWindow != NULL)
{
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
if (qs.value(PrefsDialog::kINTF_LINK_TRAINING_7P1, false).toBool())
{
QObject::connect(m_trainingWidget,
@ -285,7 +285,7 @@ void MainWindow::prefsUpdated()
}
// Refresh the timer values
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
int timerTotal = qs.value(PrefsDialog::kINTF_TIMER_TOTAL_DURATION).toInt();
int timerAlert = qs.value(PrefsDialog::kINTF_TIMER_ALERT_DURATION).toInt();
m_timerModel->setTotalDuration(timerTotal);
@ -424,7 +424,7 @@ void MainWindow::displayInfoMsg(QString iMsg)
void MainWindow::showDefinition(QString iWord)
{
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
QString url = qs.value(PrefsDialog::kINTF_DEFINITIONS_SITE_URL,
PrefsDialog::kDEFAULT_DEF_SITE).toString();
if (url == "")
@ -477,7 +477,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
void MainWindow::writeSettings() const
{
QSettings settings(ORGANIZATION, PACKAGE_NAME);
QSettings settings;
settings.beginGroup(m_windowName);
settings.setValue("size", size());
settings.setValue("pos", pos());
@ -492,7 +492,7 @@ void MainWindow::writeSettings() const
void MainWindow::readSettings()
{
QSettings settings(ORGANIZATION, PACKAGE_NAME);
QSettings settings;
settings.beginGroup(m_windowName);
QSize size = settings.value("size").toSize();
if (size.isValid())
@ -528,7 +528,7 @@ void MainWindow::changeDictionary(QString iFileName)
displayInfoMsg(_q("Loaded dictionary '%1'").arg(iFileName));
// Save the location of the dictionary in the preferences
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
qs.setValue(PrefsDialog::kINTF_DIC_PATH, iFileName);
}
catch (std::exception &e)
@ -558,7 +558,7 @@ QAction * MainWindow::addMenuAction(QMenu *menu, QString iText,
void MainWindow::createMenu()
{
// Decide whether to show the toolbar
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
bool showToolBar = qs.value(PrefsDialog::kINTF_SHOW_TOOLBAR, true).toBool();
m_ui.toolBar->setVisible(showToolBar);
@ -944,7 +944,7 @@ void MainWindow::onWindowsToolbar()
m_ui.toolBar->hide();
else
m_ui.toolBar->show();
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
qs.setValue(PrefsDialog::kINTF_SHOW_TOOLBAR, m_ui.toolBar->isVisible());
}
@ -1161,7 +1161,7 @@ void MainWindow::onHistoryReplayTurn()
if (m_game == NULL)
return;
QSettings settings(ORGANIZATION, PACKAGE_NAME);
QSettings settings;
bool warn = settings.value(PrefsDialog::kINTF_WARN_REPLAY_TURN, true).toBool();
if (warn) {
// Ask for a confirmation, because this may lead to data loss

View file

@ -125,7 +125,7 @@ NewGame::NewGame(QWidget *iParent)
void NewGame::refresh()
{
// Retrieve the default computer level
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
int defLevel = qs.value(PrefsDialog::kINTF_DEFAULT_AI_LEVEL, 100).toInt();
// Ensure a valid range
if (defLevel < 0)

View file

@ -73,7 +73,7 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
try
{
// Interface settings
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
lineEditIntfDicPath->setText(qs.value(kINTF_DIC_PATH, "").toString());
lineEditDefSite->setText(qs.value(kINTF_DEFINITIONS_SITE_URL,
kDEFAULT_DEF_SITE).toString());
@ -133,7 +133,7 @@ void PrefsDialog::updateSettings()
try
{
// Interface settings
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
qs.setValue(kINTF_DIC_PATH, lineEditIntfDicPath->text());
qs.setValue(kINTF_DEFINITIONS_SITE_URL, lineEditDefSite->text());
if (qs.value(kINTF_ALIGN_HISTORY, true).toBool() != checkBoxIntfAlignHistory->isChecked())

View file

@ -55,9 +55,6 @@ QString qfw(const wstring &wstr);
# define _q(s) QString::fromLocal8Bit(_(s))
#endif
// Used for QSettings
#define ORGANIZATION "eliot"
class QObject;
class QWidget;

View file

@ -194,7 +194,7 @@ void TileWidget::paintEvent(QPaintEvent *iEvent)
painter.setPen(TextNormalColour);
// Should we display the tiles points?
QSettings qs(ORGANIZATION, PACKAGE_NAME);
QSettings qs;
const bool showPoints = qs.value(PrefsDialog::kINTF_SHOW_TILES_POINTS, true).toBool();
// Draw the points of the tile