From d84063fac634f7f2143062558fc4f582106944ff Mon Sep 17 00:00:00 2001 From: Denes Matetelki Date: Sun, 26 Jun 2011 15:13:11 +0200 Subject: [PATCH] ebuild work with translation files --- other/.qtmindmap-0.2.ebuild.kate-swp | Bin 392 -> 0 bytes other/qtmindmap-0.2.ebuild | 10 +++++----- src/graphwidget.cpp | 28 +++++++++++++-------------- src/main.cpp | 3 ++- src/mainwindow.cpp | 28 ++++++++++----------------- 5 files changed, 31 insertions(+), 38 deletions(-) delete mode 100644 other/.qtmindmap-0.2.ebuild.kate-swp diff --git a/other/.qtmindmap-0.2.ebuild.kate-swp b/other/.qtmindmap-0.2.ebuild.kate-swp deleted file mode 100644 index 5fcd7a785f5c3483a67ed0fb2c8100849f4ac09b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 392 zcmZ|LO$x#=5C!0g+SY$B;3D8!(L+=acLsD_N`!#6Vk%zWd4jxb45Z0Nlb1|HWO=MQ zZ{53k*nPNpyS8WljG=ApZnJe45t(Y2(jD|W!&IAD(FV434~}#nZs`Hs&>8IM9M-&( zjyMl4NG#7uq-EUv4ZqX>!hgjSy4_s4eh9zl5u99h4A=ZWfjb&+Wde-?(&FcElDB|k F`2icolor()); - if (dialog.exec()) + if (!dialog.exec()) + return; + + QColor color = dialog.selectedColor(); + foreach(Node *node, nodeList) { - QColor color = dialog.selectedColor(); - foreach(Node *node, nodeList) - { - node->setColor(color); - foreach (Edge * edge, node->edgesToThis(false)) - edge->setColor(color); - } + node->setColor(color); + foreach (Edge * edge, node->edgesToThis(false)) + edge->setColor(color); } } @@ -472,12 +472,12 @@ void GraphWidget::nodeTextColor() QColorDialog dialog(this); dialog.setWindowTitle(tr("Select text color")); dialog.setCurrentColor(m_activeNode->textColor()); - if (dialog.exec()) - { - QColor color = dialog.selectedColor(); - foreach(Node *node, nodeList) - node->setTextColor(color); - } + if (!dialog.exec()) + return; + + QColor color = dialog.selectedColor(); + foreach(Node *node, nodeList) + node->setTextColor(color); } void GraphWidget::addEdge() diff --git a/src/main.cpp b/src/main.cpp index c8752d9..53ba785 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,7 +18,8 @@ int main(int argc, char *argv[]) // translation QString locale = QLocale::system().name(); QTranslator translator; - if (locale != "C" && !translator.load(QString("qtmindmap_") + locale)) + if (locale != "C" && !translator.load( + QString("/usr/share/qtmindmap/i18n/qtmindmap_") + locale)) { std::cerr << "No translation file for locale: " << locale.toStdString() diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ca33a32..bd772e6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -100,14 +100,10 @@ void MainWindow::openFile(const QString &fileName) dialog.setAcceptMode(QFileDialog::AcceptOpen); dialog.setDefaultSuffix("qmm"); - if (dialog.exec()) - { - m_fileName = dialog.selectedFiles().first(); - } - else - { + if (!dialog.exec()) return; - } + + m_fileName = dialog.selectedFiles().first(); } else { @@ -162,17 +158,13 @@ bool MainWindow::saveFileAs() dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.setDefaultSuffix("qmm"); - if (dialog.exec()) - { - m_fileName = dialog.selectedFiles().first(); - setTitle(m_fileName); - saveFile(); - return true; - } - else - { - return false; // cancelled - } + if (!dialog.exec()) + return false; + + m_fileName = dialog.selectedFiles().first(); + setTitle(m_fileName); + saveFile(); + return true; } bool MainWindow::closeFile()