summaryrefslogtreecommitdiffstats
path: root/src/qalculateunitsdialog.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2016-04-09 20:52:09 +0200
committerSlávek Banko <slavek.banko@axis.cz>2016-04-09 20:52:09 +0200
commit91d2d7482c36e67cb36df9d1dcdbd989911e4ceb (patch)
treec842adfbb1a172d9b61241d7dde70354e821bb75 /src/qalculateunitsdialog.cpp
parent4870c0c8c53d3df6ba954b2b4d8ebd87a8c43060 (diff)
downloadqalculate-tde-91d2d7482c36e67cb36df9d1dcdbd989911e4ceb.tar.gz
qalculate-tde-91d2d7482c36e67cb36df9d1dcdbd989911e4ceb.zip
Initial TQt conversion
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'src/qalculateunitsdialog.cpp')
-rw-r--r--src/qalculateunitsdialog.cpp92
1 files changed, 46 insertions, 46 deletions
diff --git a/src/qalculateunitsdialog.cpp b/src/qalculateunitsdialog.cpp
index e94982a..399e5d4 100644
--- a/src/qalculateunitsdialog.cpp
+++ b/src/qalculateunitsdialog.cpp
@@ -21,16 +21,16 @@
#include "qalculate_tde_utils.h"
#include "qalculateeditunitdialog.h"
#include <kpushbutton.h>
-#include <qsplitter.h>
-#include <qvbox.h>
-#include <qhbox.h>
+#include <tqsplitter.h>
+#include <tqvbox.h>
+#include <tqhbox.h>
#include <klistview.h>
#include <kmessagebox.h>
#include <klocale.h>
-#include <qlayout.h>
+#include <tqlayout.h>
#include <kcombobox.h>
-#include <qlabel.h>
-#include <qgroupbox.h>
+#include <tqlabel.h>
+#include <tqgroupbox.h>
#include <klineedit.h>
#include <kiconloader.h>
#include <kapplication.h>
@@ -41,7 +41,7 @@ extern vector<void*> ia_units;
extern PrintOptions printops;
extern EvaluationOptions evalops;
-QalculateUnitsDialog::QalculateUnitsDialog(QWidget *parent, const char *name) : KDialog(parent, name, false) {
+QalculateUnitsDialog::QalculateUnitsDialog(TQWidget *parent, const char *name) : KDialog(parent, name, false) {
unit_edit_dialog = NULL;
selected_category = "";
@@ -49,14 +49,14 @@ QalculateUnitsDialog::QalculateUnitsDialog(QWidget *parent, const char *name) :
selected_to_unit = NULL;
block_unit_convert = true;
- QHBoxLayout *layout = new QHBoxLayout(this, marginHint(), spacingHint());
+ TQHBoxLayout *layout = new TQHBoxLayout(this, marginHint(), spacingHint());
setCaption(i18n("Units"));
- QVBoxLayout *leftLayout = new QVBoxLayout(layout, spacingHint());
+ TQVBoxLayout *leftLayout = new TQVBoxLayout(layout, spacingHint());
- QSplitter *splitter = new QSplitter(Qt::Horizontal, this);
- splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ TQSplitter *splitter = new TQSplitter(TQt::Horizontal, this);
+ splitter->setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding);
leftLayout->addWidget(splitter);
categoryView = new KListView(splitter);
@@ -69,43 +69,43 @@ QalculateUnitsDialog::QalculateUnitsDialog(QWidget *parent, const char *name) :
unitView->addColumn(i18n("Base"));
unitView->setRootIsDecorated(false);
- convertGroup = new QGroupBox(3, Qt::Horizontal, i18n("Conversion"), this);
- convertGroup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+ convertGroup = new TQGroupBox(3, TQt::Horizontal, i18n("Conversion"), this);
+ convertGroup->setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Minimum);
convertGroup->setInsideSpacing(spacingHint());
convertGroup->setInsideMargin(spacingHint());
- convertButton = new KPushButton(QIconSet(SmallIcon("reload")), "", convertGroup);
+ convertButton = new KPushButton(TQIconSet(SmallIcon("reload")), "", convertGroup);
fromEdit = new KLineEdit("1", convertGroup);
- fromEdit->setAlignment(Qt::AlignRight);
+ fromEdit->setAlignment(TQt::AlignRight);
fromEdit->setMinimumWidth(100);
- fromLabel = new QLabel(convertGroup);
- equalsLabel = new QLabel("=", convertGroup);
- equalsLabel->setAlignment(Qt::AlignRight);
+ fromLabel = new TQLabel(convertGroup);
+ equalsLabel = new TQLabel("=", convertGroup);
+ equalsLabel->setAlignment(TQt::AlignRight);
toEdit = new KLineEdit("1", convertGroup);
- toEdit->setAlignment(Qt::AlignRight);
+ toEdit->setAlignment(TQt::AlignRight);
toEdit->setMinimumWidth(100);
toCombo = new KComboBox(convertGroup);
leftLayout->addWidget(convertGroup);
- QVBoxLayout *buttonLayout = new QVBoxLayout(layout, spacingHint());
+ TQVBoxLayout *buttonLayout = new TQVBoxLayout(layout, spacingHint());
- newButton = new QPushButton(i18n("New"), this);
+ newButton = new TQPushButton(i18n("New"), this);
buttonLayout->addWidget(newButton);
- editButton = new QPushButton(i18n("Edit"), this);
+ editButton = new TQPushButton(i18n("Edit"), this);
editButton->setEnabled(false);
buttonLayout->addWidget(editButton);
- deleteButton = new QPushButton(i18n("Delete"), this);
+ deleteButton = new TQPushButton(i18n("Delete"), this);
deleteButton->setEnabled(false);
buttonLayout->addWidget(deleteButton);
- deactivateButton = new QPushButton(i18n("Deactivate"), this);
+ deactivateButton = new TQPushButton(i18n("Deactivate"), this);
deactivateButton->setEnabled(false);
buttonLayout->addWidget(deactivateButton);
- insertButton = new QPushButton(i18n("Insert"), this);
+ insertButton = new TQPushButton(i18n("Insert"), this);
insertButton->setEnabled(false);
buttonLayout->addWidget(insertButton);
- convertResultButton = new QPushButton(i18n("Convert Result"), this);
+ convertResultButton = new TQPushButton(i18n("Convert Result"), this);
convertResultButton->setEnabled(false);
buttonLayout->addWidget(convertResultButton);
- buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
+ buttonLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Minimum, TQSizePolicy::Expanding));
helpButton = new KPushButton(KStdGuiItem::help(), this);
buttonLayout->addWidget(helpButton);
buttonClose = new KPushButton(KStdGuiItem::close(), this);
@@ -113,7 +113,7 @@ QalculateUnitsDialog::QalculateUnitsDialog(QWidget *parent, const char *name) :
fromEdit->setFocus();
- resize(QSize(675, 425).expandedTo(size()));
+ resize(TQSize(675, 425).expandedTo(size()));
connect(buttonClose, SIGNAL(clicked()), this, SLOT(close()));
connect(newButton, SIGNAL(clicked()), this, SLOT(newUnit()));
@@ -123,7 +123,7 @@ QalculateUnitsDialog::QalculateUnitsDialog(QWidget *parent, const char *name) :
connect(insertButton, SIGNAL(clicked()), this, SLOT(insertUnit()));
connect(convertResultButton, SIGNAL(clicked()), this, SLOT(convertResult()));
connect(unitView, SIGNAL(selectionChanged()), this, SLOT(unitSelected()));
- connect(unitView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(unitDoubleClicked(QListViewItem*)));
+ connect(unitView, SIGNAL(doubleClicked(TQListViewItem*)), this, SLOT(unitDoubleClicked(TQListViewItem*)));
connect(categoryView, SIGNAL(selectionChanged()), this, SLOT(categorySelected()));
connect(toCombo, SIGNAL(activated(int)), this, SLOT(toUnitSelected(int)));
connect(convertButton, SIGNAL(clicked()), this, SLOT(convertClicked()));
@@ -147,10 +147,10 @@ void QalculateUnitsDialog::updateUnitTree() {
comboItems.clear();
categoryItems.clear();
categoryView->clear();
- QListViewItem *i = new KListViewItem(categoryView, i18n("All")), *i2;
+ TQListViewItem *i = new KListViewItem(categoryView, i18n("All")), *i2;
categoryItems[i] = i18n("All");
i->setOpen(true);
- QString str;
+ TQString str;
tree_struct *item, *item2;
unit_cats.it = unit_cats.items.begin();
if(unit_cats.it != unit_cats.items.end()) {
@@ -213,13 +213,13 @@ void QalculateUnitsDialog::updateUnitTree() {
if(!categoryView->selectedItem()) {
//if no category has been selected (previously selected has been renamed/deleted), select "All"
selected_category = i18n("All");
- QListViewItemIterator it(categoryView);
+ TQListViewItemIterator it(categoryView);
if(it.current())
categoryView->setSelected(it.current(), true);
}
}
-#define UPDATE_SELECTED_UNIT QListViewItem *i = unitView->selectedItem(); if(!i) return; selected_unit = unitItems[i]; if(!selected_unit) return;
+#define UPDATE_SELECTED_UNIT TQListViewItem *i = unitView->selectedItem(); if(!i) return; selected_unit = unitItems[i]; if(!selected_unit) return;
#define CHECK_IF_UNIT_STILL_THERE if(!CALCULATOR->stillHasUnit(selected_unit)) {KMessageBox::error(this, i18n("Unit does not exist anymore.")); emit unitsChanged(); return;}
void QalculateUnitsDialog::insertUnit() {
@@ -264,7 +264,7 @@ void QalculateUnitsDialog::editUnit() {
if(!unit_edit_dialog) {
unit_edit_dialog = new QalculateEditUnitDialog(this);
}
- Unit *u = unit_edit_dialog->editUnit(QString::null, selected_unit);
+ Unit *u = unit_edit_dialog->editUnit(TQString::null, selected_unit);
if(u) {
selected_unit = u;
if(!u->isActive()) {
@@ -287,7 +287,7 @@ void QalculateUnitsDialog::newUnit() {
if(selected_category.isEmpty() || selected_category[0] != '/') {
u = unit_edit_dialog->editUnit();
} else {
- QString str = selected_category;
+ TQString str = selected_category;
str.remove(0, 1);
u = unit_edit_dialog->editUnit(str);
}
@@ -305,7 +305,7 @@ void QalculateUnitsDialog::newUnit() {
}
}
-void QalculateUnitsDialog::unitDoubleClicked(QListViewItem*i) {
+void QalculateUnitsDialog::unitDoubleClicked(TQListViewItem*i) {
selected_unit = unitItems[i];
if(!selected_unit)
return;
@@ -313,7 +313,7 @@ void QalculateUnitsDialog::unitDoubleClicked(QListViewItem*i) {
if(!unit_edit_dialog) {
unit_edit_dialog = new QalculateEditUnitDialog(this);
}
- Unit *u = unit_edit_dialog->editUnit(QString::null, selected_unit);
+ Unit *u = unit_edit_dialog->editUnit(TQString::null, selected_unit);
if(u) {
selected_unit = u;
if(!u->isActive()) {
@@ -330,7 +330,7 @@ void QalculateUnitsDialog::unitDoubleClicked(QListViewItem*i) {
void QalculateUnitsDialog::unitSelected() {
- QListViewItem *selected = unitView->selectedItem();
+ TQListViewItem *selected = unitView->selectedItem();
if(selected) {
Unit *u = unitItems[selected];
if(!CALCULATOR->stillHasUnit(u)) {
@@ -365,7 +365,7 @@ void QalculateUnitsDialog::unitSelected() {
}
void QalculateUnitsDialog::addUnitTreeItem(Unit *u) {
- QString snames, sbase;
+ TQString snames, sbase;
//display name, plural name and short name in the second column
AliasUnit *au;
for(size_t i = 1; i <= u->countNames(); i++) {
@@ -384,7 +384,7 @@ void QalculateUnitsDialog::addUnitTreeItem(Unit *u) {
sbase = au->firstBaseUnit()->preferredDisplayName(printops.abbreviate_names, printops.use_unicode_signs, false, false, &can_display_unicode_string_function, (void*) unitView).name.c_str();
if(au->firstBaseExponent() != 1) {
sbase += POWER;
- sbase += QString::number(au->firstBaseExponent());
+ sbase += TQString::number(au->firstBaseExponent());
}
break;
}
@@ -393,7 +393,7 @@ void QalculateUnitsDialog::addUnitTreeItem(Unit *u) {
break;
}
}
- QListViewItem *i = new KListViewItem(unitView, u->title(true).c_str(), snames, sbase);
+ TQListViewItem *i = new KListViewItem(unitView, u->title(true).c_str(), snames, sbase);
unitItems[i] = u;
if(u == selected_unit) {
unitView->setSelected(i, true);
@@ -403,7 +403,7 @@ void QalculateUnitsDialog::addUnitTreeItem(Unit *u) {
void QalculateUnitsDialog::categorySelected() {
block_unit_convert = true;
- QListViewItem *selected = categoryView->selectedItem();
+ TQListViewItem *selected = categoryView->selectedItem();
bool no_cat = false, b_all = false, b_inactive = false;
unitView->clear();
unitItems.clear();
@@ -437,7 +437,7 @@ void QalculateUnitsDialog::categorySelected() {
}
}
if(!selected_unit || !unitView->selectedItem()) {
- QListViewItemIterator it(unitView);
+ TQListViewItemIterator it(unitView);
if(it.current())
unitView->setSelected(it.current(), true);
}
@@ -447,7 +447,7 @@ void QalculateUnitsDialog::categorySelected() {
comboItems.clear();
int i = 0, h = -1;
//add all units in units tree to menu
- QListViewItemIterator it(unitView);
+ TQListViewItemIterator it(unitView);
Unit *u;
while(it.current()) {
u = unitItems[it.current()];
@@ -471,7 +471,7 @@ void QalculateUnitsDialog::categorySelected() {
//if no menu item was selected, select the first
if(h < 0) {
h = 0;
- QListViewItemIterator it2(unitView);
+ TQListViewItemIterator it2(unitView);
if(it2.current()) {
selected_to_unit = unitItems[it2.current()];
} else {
@@ -547,7 +547,7 @@ void QalculateUnitsDialog::convertReversed() {
}
}
-void QalculateUnitsDialog::keyPressEvent(QKeyEvent *e) {
+void QalculateUnitsDialog::keyPressEvent(TQKeyEvent *e) {
if(e->key() == Key_Return) {
convertClicked();
e->accept();