瀏覽代碼

Rename a number of classes to enhance compatibility with KDE4

tags/r14.0.0
Timothy Pearson 6 年之前
父節點
當前提交
6d33c9774c
共有 9 個檔案被更改,包括 92 行新增92 行删除
  1. +1
    -1
      README
  2. +3
    -3
      src/abakuslistview.cpp
  3. +4
    -4
      src/abakuslistview.h
  4. +55
    -55
      src/mainwindow.cpp
  5. +7
    -7
      src/mainwindow.h
  6. +5
    -5
      src/resultlistview.cpp
  7. +3
    -3
      src/resultlistview.h
  8. +10
    -10
      src/resultlistviewtext.cpp
  9. +4
    -4
      src/resultlistviewtext.h

+ 1
- 1
README 查看文件

@@ -71,7 +71,7 @@ v0.85 adds a lot:
type stuff like "3 sin pi" without having to manually add the * in between
3 and sin. This also works with numbers and variables, and numbers and
parenthesized expressions.
* GUI changes. The main result view now uses KListView, so it gains tooltip
* GUI changes. The main result view now uses TDEListView, so it gains tooltip
support for long answers for free, along with a bevy of other improvements.
* You can right-click on an answer and copy it to the clipboard.
* Corrected information in the about box.

+ 3
- 3
src/abakuslistview.cpp 查看文件

@@ -30,7 +30,7 @@
#include "function.h"

ListView::ListView(TQWidget *parent, const char *name) :
KListView(parent, name), m_menu(0), m_usePopup(false), m_removeSingleId(0),
TDEListView(parent, name), m_menu(0), m_usePopup(false), m_removeSingleId(0),
m_removeAllId(0)
{
setResizeMode(LastColumn);
@@ -68,7 +68,7 @@ void ListView::enablePopupHandler(bool enable)
if(m_menu)
kdError() << "ListView menu shouldn't exist here!\n";

m_menu = new KPopupMenu(this);
m_menu = new TDEPopupMenu(this);

m_removeSingleId = m_menu->insertItem(removeItemString(), this, TQT_SLOT(removeSelected()));
m_removeAllId = m_menu->insertItem("Placeholder", this, TQT_SLOT(removeAllItems()));
@@ -124,7 +124,7 @@ void ListView::removeSelected()

ValueListViewItem::ValueListViewItem(TQListView *listView, const TQString &name,
const Abakus::number_t &value) :
KListViewItem(listView, name), m_value(value)
TDEListViewItem(listView, name), m_value(value)
{
valueChanged();
}

+ 4
- 4
src/abakuslistview.h 查看文件

@@ -23,9 +23,9 @@

#include "numerictypes.h"

class KPopupMenu;
class TDEPopupMenu;

class ListView : public KListView
class ListView : public TDEListView
{
Q_OBJECT
@@ -83,14 +83,14 @@ class ListView : public KListView
void removeSelected();

private:
KPopupMenu *m_menu;
TDEPopupMenu *m_menu;
bool m_usePopup;

int m_removeSingleId;
int m_removeAllId;
};

class ValueListViewItem : public KListViewItem
class ValueListViewItem : public TDEListViewItem
{
public:
ValueListViewItem (TQListView *listView, const TQString &name, const Abakus::number_t &value);

+ 55
- 55
src/mainwindow.cpp 查看文件

@@ -50,7 +50,7 @@
#include "abakuslistview.h"
#include "result.h"

MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_insert(false)
MainWindow::MainWindow() : TDEMainWindow(0, "abakus-mainwindow"), m_popup(0), m_insert(false)
{
m_mainSplitter = new TQSplitter(this);
TQWidget *box = new TQWidget(m_mainSplitter);
@@ -156,36 +156,36 @@ MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_in

bool MainWindow::inRPNMode() const
{
return action<KToggleAction>("toggleExpressionMode")->isChecked();
return action<TDEToggleAction>("toggleExpressionMode")->isChecked();
}

bool MainWindow::eventFilter(TQObject *o, TQEvent *e)
{
return KMainWindow::eventFilter(o, e);
return TDEMainWindow::eventFilter(o, e);
}

bool MainWindow::queryExit()
{
saveConfig();
return KMainWindow::queryExit();
return TDEMainWindow::queryExit();
}

void MainWindow::contextMenuEvent(TQContextMenuEvent *e)
{
static KPopupMenu *popup = 0;
static TDEPopupMenu *popup = 0;

if(!popup) {
popup = new KPopupMenu(this);
popup = new TDEPopupMenu(this);
action("options_show_menubar")->plug(popup);
}

if(!action<KToggleAction>("options_show_menubar")->isChecked())
if(!action<TDEToggleAction>("options_show_menubar")->isChecked())
popup->popup(e->globalPos());
}

void MainWindow::polish()
{
KMainWindow::polish();
TDEMainWindow::polish();
loadConfig();
}

@@ -326,7 +326,7 @@ void MainWindow::slotDegrees()
setTrigMode(Abakus::Degrees);
m_degrees->setChecked(true);
if(action("setDegreesMode"))
action<KToggleAction>("setDegreesMode")->setChecked(true);
action<TDEToggleAction>("setDegreesMode")->setChecked(true);
}

void MainWindow::slotRadians()
@@ -334,7 +334,7 @@ void MainWindow::slotRadians()
setTrigMode(Abakus::Radians);
m_radians->setChecked(true);
if(action("setRadiansMode"))
action<KToggleAction>("setRadiansMode")->setChecked(true);
action<TDEToggleAction>("setRadiansMode")->setChecked(true);
}

int MainWindow::getParenthesesLevel(const TQString &str)
@@ -366,7 +366,7 @@ void MainWindow::loadConfig()
}

bool useRPN = config.readBoolEntry("Use RPN Mode", false);
action<KToggleAction>("toggleExpressionMode")->setChecked(useRPN);
action<TDEToggleAction>("toggleExpressionMode")->setChecked(useRPN);

int precision = config.readNumEntry("Decimal Precision", -1);
if(precision < -1 || precision > 75)
@@ -395,20 +395,20 @@ void MainWindow::loadConfig()
TDEConfigGroup config(TDEGlobal::config(), "GUI");

bool showHistory = config.readBoolEntry("ShowHistory", true);
action<KToggleAction>("toggleHistoryList")->setChecked(showHistory);
action<TDEToggleAction>("toggleHistoryList")->setChecked(showHistory);
m_history->setShown(showHistory);

bool showFunctions = config.readBoolEntry("ShowFunctions", true);
action<KToggleAction>("toggleFunctionList")->setChecked(showFunctions);
action<TDEToggleAction>("toggleFunctionList")->setChecked(showFunctions);
m_fnList->setShown(showFunctions);

bool showVariables = config.readBoolEntry("ShowVariables", true);
action<KToggleAction>("toggleVariableList")->setChecked(showVariables);
action<TDEToggleAction>("toggleVariableList")->setChecked(showVariables);
m_varList->setShown(showVariables);

bool compactMode = config.readBoolEntry("InCompactMode", false);
compactMode = compactMode || !showHistory;
action<KToggleAction>("toggleCompactMode")->setChecked(compactMode);
action<TDEToggleAction>("toggleCompactMode")->setChecked(compactMode);

if(compactMode)
TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotToggleCompactMode()));
@@ -463,7 +463,7 @@ void MainWindow::saveConfig()

{
TDEConfigGroup config(TDEGlobal::config(), "GUI");
bool inCompactMode = action<KToggleAction>("toggleCompactMode")->isChecked();
bool inCompactMode = action<TDEToggleAction>("toggleCompactMode")->isChecked();

config.writeEntry("InCompactMode", inCompactMode);

@@ -501,62 +501,62 @@ void MainWindow::saveConfig()

void MainWindow::setupLayout()
{
KActionCollection *ac = actionCollection();
TDEActionCollection *ac = actionCollection();

KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), ac);
KStdAction::showMenubar(TQT_TQOBJECT(this), TQT_SLOT(slotToggleMenuBar()), ac);

KToggleAction *ta = new KToggleAction(i18n("&Degrees"), SHIFT + ALT + Key_D, TQT_TQOBJECT(this), TQT_SLOT(slotDegrees()), ac, "setDegreesMode");
TDEToggleAction *ta = new TDEToggleAction(i18n("&Degrees"), SHIFT + ALT + Key_D, TQT_TQOBJECT(this), TQT_SLOT(slotDegrees()), ac, "setDegreesMode");
ta->setExclusiveGroup("TrigMode");
ta->setChecked(trigMode() == Abakus::Degrees);

ta = new KToggleAction(i18n("&Radians"), SHIFT + ALT + Key_R, TQT_TQOBJECT(this), TQT_SLOT(slotRadians()), ac, "setRadiansMode");
ta = new TDEToggleAction(i18n("&Radians"), SHIFT + ALT + Key_R, TQT_TQOBJECT(this), TQT_SLOT(slotRadians()), ac, "setRadiansMode");
ta->setExclusiveGroup("TrigMode");
ta->setChecked(trigMode() == Abakus::Radians);

ta = new KToggleAction(i18n("Show &History List"), SHIFT + ALT + Key_H, TQT_TQOBJECT(this), TQT_SLOT(slotToggleHistoryList()), ac, "toggleHistoryList");
ta = new TDEToggleAction(i18n("Show &History List"), SHIFT + ALT + Key_H, TQT_TQOBJECT(this), TQT_SLOT(slotToggleHistoryList()), ac, "toggleHistoryList");
ta->setChecked(true);

ta = new KToggleAction(i18n("Show &Variables"), SHIFT + ALT + Key_V, TQT_TQOBJECT(this), TQT_SLOT(slotToggleVariableList()), ac, "toggleVariableList");
ta = new TDEToggleAction(i18n("Show &Variables"), SHIFT + ALT + Key_V, TQT_TQOBJECT(this), TQT_SLOT(slotToggleVariableList()), ac, "toggleVariableList");
ta->setChecked(true);

ta = new KToggleAction(i18n("Show &Functions"), SHIFT + ALT + Key_F, TQT_TQOBJECT(this), TQT_SLOT(slotToggleFunctionList()), ac, "toggleFunctionList");
ta = new TDEToggleAction(i18n("Show &Functions"), SHIFT + ALT + Key_F, TQT_TQOBJECT(this), TQT_SLOT(slotToggleFunctionList()), ac, "toggleFunctionList");
ta->setChecked(true);

ta = new KToggleAction(i18n("Activate &Compact Mode"), SHIFT + ALT + Key_C, TQT_TQOBJECT(this), TQT_SLOT(slotToggleCompactMode()), ac, "toggleCompactMode");
ta = new TDEToggleAction(i18n("Activate &Compact Mode"), SHIFT + ALT + Key_C, TQT_TQOBJECT(this), TQT_SLOT(slotToggleCompactMode()), ac, "toggleCompactMode");
ta->setChecked(false);

ta = new KToggleAction(i18n("Use R&PN Mode"), SHIFT + ALT + Key_P, TQT_TQOBJECT(this), TQT_SLOT(slotToggleExpressionMode()), ac, "toggleExpressionMode");
ta = new TDEToggleAction(i18n("Use R&PN Mode"), SHIFT + ALT + Key_P, TQT_TQOBJECT(this), TQT_SLOT(slotToggleExpressionMode()), ac, "toggleExpressionMode");
ta->setChecked(false);

// Precision actions.
ta = new KToggleAction(i18n("&Automatic Precision"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionAuto()), ac, "precisionAuto");
ta = new TDEToggleAction(i18n("&Automatic Precision"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionAuto()), ac, "precisionAuto");
ta->setExclusiveGroup("Precision");
ta->setChecked(true);

ta = new KToggleAction(i18n("&3 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision3()), ac, "precision3");
ta = new TDEToggleAction(i18n("&3 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision3()), ac, "precision3");
ta->setExclusiveGroup("Precision");
ta->setChecked(false);

ta = new KToggleAction(i18n("&8 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision8()), ac, "precision8");
ta = new TDEToggleAction(i18n("&8 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision8()), ac, "precision8");
ta->setExclusiveGroup("Precision");
ta->setChecked(false);

ta = new KToggleAction(i18n("&15 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision15()), ac, "precision15");
ta = new TDEToggleAction(i18n("&15 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision15()), ac, "precision15");
ta->setExclusiveGroup("Precision");
ta->setChecked(false);

ta = new KToggleAction(i18n("&50 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision50()), ac, "precision50");
ta = new TDEToggleAction(i18n("&50 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision50()), ac, "precision50");
ta->setExclusiveGroup("Precision");
ta->setChecked(false);

ta = new KToggleAction(i18n("C&ustom Precision..."), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionCustom()), ac, "precisionCustom");
ta = new TDEToggleAction(i18n("C&ustom Precision..."), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionCustom()), ac, "precisionCustom");
ta->setExclusiveGroup("Precision");
ta->setChecked(false);

new KAction(i18n("Clear &History"), "editclear", SHIFT + ALT + Key_L, TQT_TQOBJECT(m_result), TQT_SLOT(clear()), ac, "clearHistory");
new TDEAction(i18n("Clear &History"), "editclear", SHIFT + ALT + Key_L, TQT_TQOBJECT(m_result), TQT_SLOT(clear()), ac, "clearHistory");

new KAction(i18n("Select Editor"), "goto", Key_F6, TQT_TQOBJECT(m_edit), TQT_SLOT(setFocus()), ac, "select_edit");
new TDEAction(i18n("Select Editor"), "goto", Key_F6, TQT_TQOBJECT(m_edit), TQT_SLOT(setFocus()), ac, "select_edit");
}

void MainWindow::populateListViews()
@@ -570,7 +570,7 @@ void MainWindow::populateListViews()
new ValueListViewItem(m_varList, "e", value);
}

KAction *MainWindow::action(const char *key) const
TDEAction *MainWindow::action(const char *key) const
{
return actionCollection()->action(key);
}
@@ -593,38 +593,38 @@ void MainWindow::slotToggleMenuBar()

void MainWindow::slotToggleFunctionList()
{
bool show = action<KToggleAction>("toggleFunctionList")->isChecked();
bool show = action<TDEToggleAction>("toggleFunctionList")->isChecked();
m_fnList->setShown(show);

if(!m_history->isShown()) {
m_history->setShown(true);
action<KToggleAction>("toggleHistoryList")->setChecked(true);
action<TDEToggleAction>("toggleHistoryList")->setChecked(true);
slotToggleHistoryList();
}

action<KToggleAction>("toggleCompactMode")->setChecked(false);
action<TDEToggleAction>("toggleCompactMode")->setChecked(false);
}

void MainWindow::slotToggleVariableList()
{
bool show = action<KToggleAction>("toggleVariableList")->isChecked();
bool show = action<TDEToggleAction>("toggleVariableList")->isChecked();
m_varList->setShown(show);

if(!m_history->isShown()) {
m_history->setShown(true);
action<KToggleAction>("toggleHistoryList")->setChecked(true);
action<TDEToggleAction>("toggleHistoryList")->setChecked(true);
slotToggleHistoryList();
}

action<KToggleAction>("toggleCompactMode")->setChecked(false);
action<TDEToggleAction>("toggleCompactMode")->setChecked(false);
}

void MainWindow::slotToggleHistoryList()
{
bool show = action<KToggleAction>("toggleHistoryList")->isChecked();
bool show = action<TDEToggleAction>("toggleHistoryList")->isChecked();
m_history->setShown(show);

action<KToggleAction>("toggleCompactMode")->setChecked(false);
action<TDEToggleAction>("toggleCompactMode")->setChecked(false);
}

void MainWindow::slotNewFunction(const TQString &name)
@@ -634,7 +634,7 @@ void MainWindow::slotNewFunction(const TQString &name)
TQString fnName = TQString("%1(%2)").arg(name, userFn->varName);
TQString expr = fn->operand()->infixString();

new KListViewItem(m_fnList, fnName, expr);
new TDEListViewItem(m_fnList, fnName, expr);
}

void MainWindow::slotRemoveFunction(const TQString &name)
@@ -667,7 +667,7 @@ void MainWindow::slotRemoveValue(const TQString &name)

void MainWindow::slotToggleCompactMode()
{
if(action<KToggleAction>("toggleCompactMode")->isChecked()) {
if(action<TDEToggleAction>("toggleCompactMode")->isChecked()) {
m_wasFnShown = m_fnList->isShown();
m_wasVarShown = m_varList->isShown();
m_wasHistoryShown = m_history->isShown();
@@ -676,9 +676,9 @@ void MainWindow::slotToggleCompactMode()
m_varList->setShown(false);
m_history->setShown(false);

action<KToggleAction>("toggleFunctionList")->setChecked(false);
action<KToggleAction>("toggleVariableList")->setChecked(false);
action<KToggleAction>("toggleHistoryList")->setChecked(false);
action<TDEToggleAction>("toggleFunctionList")->setChecked(false);
action<TDEToggleAction>("toggleVariableList")->setChecked(false);
action<TDEToggleAction>("toggleHistoryList")->setChecked(false);

m_oldSize = size();
m_newSize = TQSize(0, 0);
@@ -689,9 +689,9 @@ void MainWindow::slotToggleCompactMode()
m_varList->setShown(m_wasVarShown);
m_history->setShown(m_wasHistoryShown);

action<KToggleAction>("toggleFunctionList")->setChecked(m_wasFnShown);
action<KToggleAction>("toggleVariableList")->setChecked(m_wasVarShown);
action<KToggleAction>("toggleHistoryList")->setChecked(m_wasHistoryShown);
action<TDEToggleAction>("toggleFunctionList")->setChecked(m_wasFnShown);
action<TDEToggleAction>("toggleVariableList")->setChecked(m_wasVarShown);
action<TDEToggleAction>("toggleHistoryList")->setChecked(m_wasHistoryShown);

m_newSize = m_oldSize;
TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotUpdateSize()));
@@ -796,27 +796,27 @@ void MainWindow::selectCorrectPrecisionAction()
{
switch(Abakus::m_prec) {
case 3:
action<KToggleAction>("precision3")->setChecked(true);
action<TDEToggleAction>("precision3")->setChecked(true);
break;

case 8:
action<KToggleAction>("precision8")->setChecked(true);
action<TDEToggleAction>("precision8")->setChecked(true);
break;

case 15:
action<KToggleAction>("precision15")->setChecked(true);
action<TDEToggleAction>("precision15")->setChecked(true);
break;

case 50:
action<KToggleAction>("precision50")->setChecked(true);
action<TDEToggleAction>("precision50")->setChecked(true);
break;

case -1:
action<KToggleAction>("precisionAuto")->setChecked(true);
action<TDEToggleAction>("precisionAuto")->setChecked(true);
break;

default:
action<KToggleAction>("precisionCustom")->setChecked(true);
action<TDEToggleAction>("precisionCustom")->setChecked(true);
}
}


+ 7
- 7
src/mainwindow.h 查看文件

@@ -34,16 +34,16 @@ class TQTimer;

//class KComboBox;
class Editor;
class KPopupMenu;
class KAction;
class KListView;
class TDEPopupMenu;
class TDEAction;
class TDEListView;
class ResultListView;
class ResultListViewText;

class AbakusIface;

// Main window class, handles events and layout and stuff
class MainWindow : public KMainWindow
class MainWindow : public TDEMainWindow
{
Q_OBJECT
@@ -105,7 +105,7 @@ class MainWindow : public KMainWindow
TQString interpolateExpression(const TQString &text, ResultListViewText *after);

// Donated via JuK
KAction *action(const char *key) const;
TDEAction *action(const char *key) const;

template <class T> T *action(const char *key) const
{
@@ -117,11 +117,11 @@ class MainWindow : public KMainWindow
TQRadioButton *m_degrees;
TQRadioButton *m_radians;
Editor *m_edit;
KPopupMenu *m_popup;
TDEPopupMenu *m_popup;
ResultListView *m_result;
TQString m_lastError;
TQBoxLayout *m_layout;
KListView *m_fnList, *m_varList;
TDEListView *m_fnList, *m_varList;
TQSplitter *m_mainSplitter, *m_listSplitter;
TQSize m_newSize, m_oldSize;


+ 5
- 5
src/resultlistview.cpp 查看文件

@@ -35,7 +35,7 @@ using DragSupport::makePixmap;
using namespace ResultList;

ResultListView::ResultListView(TQWidget *parent, const char *name) :
KListView(parent, name), m_itemRightClicked(0)
TDEListView(parent, name), m_itemRightClicked(0)
{
connect(this, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)),
TQT_SLOT(slotDoubleClicked(TQListViewItem *, const TQPoint &, int)));
@@ -94,7 +94,7 @@ TQDragObject *ResultListView::dragObject()
void ResultListView::contextMenuEvent(TQContextMenuEvent *e)
{
m_itemRightClicked = itemUnderCursor();
KPopupMenu *menu = constructPopupMenu(m_itemRightClicked);
TDEPopupMenu *menu = constructPopupMenu(m_itemRightClicked);

menu->popup(e->globalPos());
}
@@ -111,9 +111,9 @@ void ResultListView::slotDoubleClicked(TQListViewItem *item, const TQPoint &, in
emit signalResultSelected(textItem->resultText());
}

KPopupMenu *ResultListView::constructPopupMenu(const ResultListViewText *item)
TDEPopupMenu *ResultListView::constructPopupMenu(const ResultListViewText *item)
{
KPopupMenu *menu = new KPopupMenu(this, "list view context menu");
TDEPopupMenu *menu = new TDEPopupMenu(this, "list view context menu");

menu->insertItem(i18n("Clear &History"), this, TQT_SLOT(clear()), ALT+Key_R);

@@ -136,7 +136,7 @@ void ResultListView::slotCopyResult()

ResultListViewText *ResultListView::lastItem() const
{
return static_cast<ResultListViewText *>(KListView::lastItem());
return static_cast<ResultListViewText *>(TDEListView::lastItem());
}

ResultListViewText *ResultListView::itemUnderCursor() const

+ 3
- 3
src/resultlistview.h 查看文件

@@ -22,7 +22,7 @@
#include <klistview.h>
#include "numerictypes.h"

class KPopupMenu;
class TDEPopupMenu;
class TQLabel;
class TQDragObject;
class ResultListViewText;
@@ -31,7 +31,7 @@ namespace ResultList {
enum { ExpressionColumn = 0, ResultColumn, ShortcutColumn };
}

class ResultListView : public KListView
class ResultListView : public TDEListView
{
Q_OBJECT
@@ -56,7 +56,7 @@ class ResultListView : public KListView
void slotCopyResult();

private:
KPopupMenu *constructPopupMenu(const ResultListViewText *item);
TDEPopupMenu *constructPopupMenu(const ResultListViewText *item);
ResultListViewText *itemUnderCursor() const;

ResultListViewText *m_itemRightClicked;

+ 10
- 10
src/resultlistviewtext.cpp 查看文件

@@ -28,24 +28,24 @@

using namespace ResultList;

ResultListViewText::ResultListViewText(KListView *listView,
ResultListViewText::ResultListViewText(TDEListView *listView,
const TQString &text,
const TQString &result,
ResultListViewText *after,
bool isError)
: KListViewItem(listView, after, text, result), m_text(text),
: TDEListViewItem(listView, after, text, result), m_text(text),
m_result(result), m_wasError(isError), m_stackPosition(0)
{
// This is some kind of non-result answer, don't bother worrying about the
// stack status, it hasn't changed.
}

ResultListViewText::ResultListViewText(KListView *listView,
ResultListViewText::ResultListViewText(TDEListView *listView,
const TQString &text,
const Abakus::number_t &result,
ResultListViewText *after,
bool isError)
: KListViewItem(listView, after, text), m_text(text),
: TDEListViewItem(listView, after, text), m_text(text),
m_result(result.toString()), m_wasError(isError), m_stackPosition(0),
m_value(result)
{
@@ -102,7 +102,7 @@ void ResultListViewText::paintCell(TQPainter *p, const TQColorGroup &cg, int col
p->setFont(f);
}

KListViewItem::paintCell(p, group, column, width, align);
TDEListViewItem::paintCell(p, group, column, width, align);
}

int ResultListViewText::width(const TQFontMetrics &fm, const TQListView *lv, int c) const
@@ -111,25 +111,25 @@ int ResultListViewText::width(const TQFontMetrics &fm, const TQListView *lv, int
if(c == ResultColumn) {
TQFont f = lv->font();
f.setBold(true);
return KListViewItem::width(TQFontMetrics(f), lv, c);
return TDEListViewItem::width(TQFontMetrics(f), lv, c);
}

if(c == ShortcutColumn) {
TQFont f = lv->font();
f.setItalic(true);
f.setPointSize(TQMIN(f.pointSize() * 9 / 11, 10));
return KListViewItem::width(TQFontMetrics(f), lv, c);
return TDEListViewItem::width(TQFontMetrics(f), lv, c);
}

return KListViewItem::width(fm, lv, c);
return TDEListViewItem::width(fm, lv, c);
}

void ResultListViewText::setText(int column, const TQString &text)
{
if(!m_wasError && column == ResultColumn) {
KListViewItem::setText(column, m_value.toString());
TDEListViewItem::setText(column, m_value.toString());
return;
}

KListViewItem::setText(column, text);
TDEListViewItem::setText(column, text);
}

+ 4
- 4
src/resultlistviewtext.h 查看文件

@@ -27,16 +27,16 @@ class TQColorGroup;
class TQFontMetrics;

// This class shows the results shown in the MainWindow result pane.
class ResultListViewText : public KListViewItem
class ResultListViewText : public TDEListViewItem
{
public:
ResultListViewText(KListView *listView,
ResultListViewText(TDEListView *listView,
const TQString &text,
const TQString &result,
ResultListViewText *after,
bool isError = false);

ResultListViewText(KListView *listView,
ResultListViewText(TDEListView *listView,
const TQString &text,
const Abakus::number_t &result,
ResultListViewText *after,
@@ -53,7 +53,7 @@ class ResultListViewText : public KListViewItem
// Redisplays the text by calling value.toString again.
void precisionChanged();

// Reimplemented from KListViewItem
// Reimplemented from TDEListViewItem
virtual void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align);
virtual int width(const TQFontMetrics &fm, const TQListView *lv, int c) const;


Loading…
取消
儲存