File indexing completed on 2024-04-28 04:02:51

0001 /***************************************************************************
0002                                dlgmapdirections.cpp
0003                              -------------------
0004     begin                : Tue Nov 19 2002
0005     copyright            : (C) 2002 by Kmud Developer Team
0006                            (C) 2007 Tomas Mecir <kmuddy@kmuddy.com>
0007     email                : kmud-devel@kmud.de
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *   This program is free software; you can redistribute it and/or modify  *
0013  *   it under the terms of the GNU General Public License as published by  *
0014  *   the Free Software Foundation; either version 2 of the License, or     *
0015  *   (at your option) any later version.                                   *
0016  *                                                                         *
0017  ***************************************************************************/
0018 
0019 #include "dlgmapdirections.h"
0020 
0021 #include <qlineedit.h>
0022 
0023 #include "../cmapmanager.h"
0024 
0025 
0026 DlgMapDirections::DlgMapDirections(const CMapManager *mapManager, QWidget *parent) : QDialog(parent)
0027 {
0028   setupUi (this);
0029   connect(this, SIGNAL(accepted()), this, SLOT(slotOkPressed()));
0030 
0031     m_mapManager = mapManager;
0032 
0033     m_txtNorthLong->setText(m_mapManager->getMapData()->directions[NORTH]);
0034     m_txtNorthEastLong->setText(m_mapManager->getMapData()->directions[NORTHEAST]);
0035     m_txtEastLong->setText(m_mapManager->getMapData()->directions[EAST]);
0036     m_txtSouthEastLong->setText(m_mapManager->getMapData()->directions[SOUTHEAST]);
0037     m_txtSouthLong->setText(m_mapManager->getMapData()->directions[SOUTH]);
0038     m_txtSouthWestLong->setText(m_mapManager->getMapData()->directions[SOUTHWEST]);
0039     m_txtWestLong->setText(m_mapManager->getMapData()->directions[WEST]);
0040     m_txtNorthWestLong->setText(m_mapManager->getMapData()->directions[NORTHWEST]);
0041     m_txtUpLong->setText(m_mapManager->getMapData()->directions[UP]);
0042     m_txtDownLong->setText(m_mapManager->getMapData()->directions[DOWN]);
0043 
0044     m_txtNorthShort->setText(m_mapManager->getMapData()->directions[NORTH+(NUM_DIRECTIONS/2)]);
0045     m_txtNorthEastShort->setText(m_mapManager->getMapData()->directions[NORTHEAST+(NUM_DIRECTIONS/2)]);
0046     m_txtEastShort->setText(m_mapManager->getMapData()->directions[EAST+(NUM_DIRECTIONS/2)]);
0047     m_txtSouthEastShort->setText(m_mapManager->getMapData()->directions[SOUTHEAST+(NUM_DIRECTIONS/2)]);
0048     m_txtSouthShort->setText(m_mapManager->getMapData()->directions[SOUTH+(NUM_DIRECTIONS/2)]);
0049     m_txtSouthWestShort->setText(m_mapManager->getMapData()->directions[SOUTHWEST+(NUM_DIRECTIONS/2)]);
0050     m_txtWestShort->setText(m_mapManager->getMapData()->directions[WEST+(NUM_DIRECTIONS/2)]);
0051     m_txtNorthWestShort->setText(m_mapManager->getMapData()->directions[NORTHWEST+(NUM_DIRECTIONS/2)]);
0052     m_txtUpShort->setText(m_mapManager->getMapData()->directions[UP+(NUM_DIRECTIONS/2)]);
0053     m_txtDownShort->setText(m_mapManager->getMapData()->directions[DOWN+(NUM_DIRECTIONS/2)]);
0054 
0055 }
0056 
0057 DlgMapDirections::~DlgMapDirections()
0058 {
0059 }
0060 
0061 /** This slot is called when the OK button is pressed */
0062 void DlgMapDirections::slotOkPressed()
0063 {
0064     m_mapManager->getMapData()->directions[NORTH] = m_txtNorthLong->text();
0065     m_mapManager->getMapData()->directions[NORTHEAST] = m_txtNorthEastLong->text();
0066     m_mapManager->getMapData()->directions[EAST] = m_txtEastLong->text();
0067     m_mapManager->getMapData()->directions[SOUTHEAST] = m_txtSouthEastLong->text();
0068     m_mapManager->getMapData()->directions[SOUTH] = m_txtSouthLong->text();
0069     m_mapManager->getMapData()->directions[SOUTHWEST] = m_txtSouthWestLong->text();
0070     m_mapManager->getMapData()->directions[WEST] = m_txtWestLong->text();
0071     m_mapManager->getMapData()->directions[NORTHWEST] = m_txtNorthWestLong->text();
0072     m_mapManager->getMapData()->directions[UP] = m_txtUpLong->text();
0073     m_mapManager->getMapData()->directions[DOWN] = m_txtDownLong->text();
0074 
0075     m_mapManager->getMapData()->directions[NORTH+(NUM_DIRECTIONS/2)] = m_txtNorthShort->text();
0076     m_mapManager->getMapData()->directions[NORTHEAST+(NUM_DIRECTIONS/2)] = m_txtNorthEastShort->text();
0077     m_mapManager->getMapData()->directions[EAST+(NUM_DIRECTIONS/2)] = m_txtEastShort->text();
0078     m_mapManager->getMapData()->directions[SOUTHEAST+(NUM_DIRECTIONS/2)] = m_txtSouthEastShort->text();
0079     m_mapManager->getMapData()->directions[SOUTH+(NUM_DIRECTIONS/2)] = m_txtSouthShort->text();
0080     m_mapManager->getMapData()->directions[SOUTHWEST+(NUM_DIRECTIONS/2)] = m_txtSouthWestShort->text();
0081     m_mapManager->getMapData()->directions[WEST+(NUM_DIRECTIONS/2)] = m_txtWestShort->text();
0082     m_mapManager->getMapData()->directions[NORTHWEST+(NUM_DIRECTIONS/2)] = m_txtNorthWestShort->text();
0083     m_mapManager->getMapData()->directions[UP+(NUM_DIRECTIONS/2)] = m_txtUpShort->text();
0084     m_mapManager->getMapData()->directions[DOWN+(NUM_DIRECTIONS/2)] = m_txtDownShort->text();
0085 }
0086 
0087 #include "moc_dlgmapdirections.cpp"