summaryrefslogtreecommitdiffstats
path: root/ktouch/src/ktouchlectureeditor.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:39:55 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:39:55 +0000
commit0a6e0958c03e41c87b15557b6f407874f20c2f8d (patch)
tree2cdd58c4013b1be09cfcbb4ddae2b05712b9aeee /ktouch/src/ktouchlectureeditor.cpp
parent83f9dfafc157ff7823804b3ff457b43d021a5b4b (diff)
downloadtdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.tar.gz
tdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1157642 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ktouch/src/ktouchlectureeditor.cpp')
-rw-r--r--ktouch/src/ktouchlectureeditor.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/ktouch/src/ktouchlectureeditor.cpp b/ktouch/src/ktouchlectureeditor.cpp
index ce433d8c..e274732b 100644
--- a/ktouch/src/ktouchlectureeditor.cpp
+++ b/ktouch/src/ktouchlectureeditor.cpp
@@ -11,9 +11,9 @@
***************************************************************************/
-#include <qlabel.h>
-#include <qstring.h>
-#include <qstringlist.h>
+#include <tqlabel.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
#include <kpushbutton.h>
#include <klistview.h>
@@ -41,23 +41,23 @@
// ***** Public functions ***
// **************************
-KTouchLectureEditor::KTouchLectureEditor(QWidget *parent, const char* name, bool modal, WFlags fl)
+KTouchLectureEditor::KTouchLectureEditor(TQWidget *parent, const char* name, bool modal, WFlags fl)
: KTouchLectureEditorDlg(parent, name, modal, fl)
{
levelListView->setSorting(-1); // don't sort my level list view!
- connect(levelListView, SIGNAL(selectionChanged(QListViewItem*)),this, SLOT(newSelection(QListViewItem*)) );
- connect(newCharsEdit, SIGNAL(textChanged(const QString&)), this, SLOT(newCharsChanged(const QString&)) );
- connect(newBtn, SIGNAL(clicked()), this, SLOT(newLevel()) );
- connect(deleteBtn, SIGNAL(clicked()), this, SLOT(deleteLevel()) );
- connect(upBtn, SIGNAL(clicked()), this, SLOT(moveUp()) );
- connect(downBtn, SIGNAL(clicked()), this, SLOT(moveDown()) );
+ connect(levelListView, TQT_SIGNAL(selectionChanged(TQListViewItem*)),this, TQT_SLOT(newSelection(TQListViewItem*)) );
+ connect(newCharsEdit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(newCharsChanged(const TQString&)) );
+ connect(newBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(newLevel()) );
+ connect(deleteBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(deleteLevel()) );
+ connect(upBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(moveUp()) );
+ connect(downBtn, TQT_SIGNAL(clicked()), this, TQT_SLOT(moveDown()) );
// make the connections for making the lecture modified
- connect(titleEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setModified()) );
- connect(lectureCommentEdit, SIGNAL(textChanged()), this, SLOT(setModified()) );
- connect(levelCommentEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setModified()) );
- connect(linesTextEdit, SIGNAL(textChanged()), this, SLOT(setModified()) );
+ connect(titleEdit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(setModified()) );
+ connect(lectureCommentEdit, TQT_SIGNAL(textChanged()), this, TQT_SLOT(setModified()) );
+ connect(levelCommentEdit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(setModified()) );
+ connect(linesTextEdit, TQT_SIGNAL(textChanged()), this, TQT_SLOT(setModified()) );
// The font, open, save, saveas and close buttons are already connected
}
@@ -66,7 +66,7 @@ KTouchLectureEditor::KTouchLectureEditor(QWidget *parent, const char* name, bool
bool KTouchLectureEditor::startEditor(const KURL& url) {
// call open request dialog and load a lecture, and start the dialogs event loop if
// the user did not cancel the open request dialog
- if (openLectureFile(url)==QDialog::Accepted) {
+ if (openLectureFile(url)==TQDialog::Accepted) {
exec();
return true;
}
@@ -80,8 +80,8 @@ bool KTouchLectureEditor::startEditor(const KURL& url) {
// *************************
void KTouchLectureEditor::fontBtnClicked() {
- QFont f(m_lecture.m_fontSuggestions);
- if (KFontDialog::getFont(f, false, this, true)==QDialog::Accepted) {
+ TQFont f(m_lecture.m_fontSuggestions);
+ if (KFontDialog::getFont(f, false, this, true)==TQDialog::Accepted) {
linesTextEdit->setFont(f);
lectureCommentEdit->setFont(f);
levelCommentEdit->setFont(f);
@@ -111,7 +111,7 @@ void KTouchLectureEditor::saveBtnClicked() {
// -----------------------------------------------------------------------------
void KTouchLectureEditor::saveAsBtnClicked() {
- QString tmp = KFileDialog::getSaveFileName(QString::null,
+ TQString tmp = KFileDialog::getSaveFileName(TQString::null,
"*.ktouch.xml|KTouch Lecture Files(*.ktouch.xml)\n*.*|All Files", this, i18n("Save Training Lecture") );
if (!tmp.isEmpty()) {
transfer_from_dialog();
@@ -123,13 +123,13 @@ void KTouchLectureEditor::saveAsBtnClicked() {
}
// -----------------------------------------------------------------------------
-void KTouchLectureEditor::newSelection(QListViewItem* item) {
+void KTouchLectureEditor::newSelection(TQListViewItem* item) {
if (m_selecting) return;
bool current_modified_flag = m_modified; // remember our current status
// first store the current level data
storeCurrentLevel();
// now we need to find the level which has been selected
- QListViewItem *i = levelListView->firstChild();
+ TQListViewItem *i = levelListView->firstChild();
unsigned int level=0;
while (i!=0 && i!=item) {
i = i->nextSibling();
@@ -158,7 +158,7 @@ void KTouchLectureEditor::newSelection(QListViewItem* item) {
}
// -----------------------------------------------------------------------------
-void KTouchLectureEditor::newCharsChanged(const QString& text) {
+void KTouchLectureEditor::newCharsChanged(const TQString& text) {
if (m_currentItem==0) return; // shouldn't happen, but a little bit of paranoia...
m_currentItem->setText(0, text);
setModified();
@@ -167,7 +167,7 @@ void KTouchLectureEditor::newCharsChanged(const QString& text) {
void KTouchLectureEditor::newLevel() {
createNewLevel();
- QListViewItem *newItem = new QListViewItem( levelListView,
+ TQListViewItem *newItem = new TQListViewItem( levelListView,
levelListView->lastItem(), m_lecture.m_lectureData.back().m_newChars );
newSelection(newItem);
upBtn->setEnabled(true);
@@ -184,7 +184,7 @@ void KTouchLectureEditor::deleteLevel() {
// first remove the item from the list view
delete m_currentItem;
// then remove the level data
- QValueVector<KTouchLevelData>::iterator it=m_lecture.m_lectureData.begin();
+ TQValueVector<KTouchLevelData>::iterator it=m_lecture.m_lectureData.begin();
std::advance(it, m_level);
m_lecture.m_lectureData.erase(it);
m_currentItem = levelListView->firstChild();
@@ -207,7 +207,7 @@ void KTouchLectureEditor::moveUp() {
if (m_level==0) return;
m_selecting=true; // again, I don't want to process changeSelection() signals now
storeCurrentLevel();
- QListViewItem *upperItem = m_currentItem->itemAbove();
+ TQListViewItem *upperItem = m_currentItem->itemAbove();
std::swap(m_lecture.m_lectureData[m_level], m_lecture.m_lectureData[m_level-1]);
upperItem->setText(0, m_lecture.m_lectureData[m_level-1].m_newChars);
m_currentItem->setText(0, m_lecture.m_lectureData[m_level].m_newChars);
@@ -227,7 +227,7 @@ void KTouchLectureEditor::moveDown() {
if (m_level>=m_lecture.m_lectureData.size()-1) return;
m_selecting=true; // again, I don't want to process changeSelection() signals now
storeCurrentLevel();
- QListViewItem *lowerItem = m_currentItem->itemBelow();
+ TQListViewItem *lowerItem = m_currentItem->itemBelow();
std::swap(m_lecture.m_lectureData[m_level], m_lecture.m_lectureData[m_level+1]);
m_currentItem->setText(0, m_lecture.m_lectureData[m_level].m_newChars);
lowerItem->setText(0, m_lecture.m_lectureData[m_level+1].m_newChars);
@@ -258,12 +258,12 @@ void KTouchLectureEditor::transfer_to_dialog() {
else setCaption(i18n("KTouch Lecture Editor - ") + m_currentURL.fileName());
// copy the 'new char' strings of the lectures into the list view
levelListView->clear();
- QValueVector<KTouchLevelData>::const_iterator it=m_lecture.m_lectureData.begin();
+ TQValueVector<KTouchLevelData>::const_iterator it=m_lecture.m_lectureData.begin();
// add first item
- QListViewItem *item=new QListViewItem( levelListView, (it++)->m_newChars );
+ TQListViewItem *item=new TQListViewItem( levelListView, (it++)->m_newChars );
// add all the others
for (;it!=m_lecture.m_lectureData.end(); ++it)
- item = new QListViewItem( levelListView, item, it->m_newChars );
+ item = new TQListViewItem( levelListView, item, it->m_newChars );
m_currentItem=levelListView->firstChild();
m_selecting = true; // prevent the selectionChanged() signal from interfering
levelListView->setSelected(m_currentItem, true);
@@ -283,7 +283,7 @@ void KTouchLectureEditor::transfer_to_dialog() {
}
// finally the font
if (!m_lecture.m_fontSuggestions.isEmpty()) {
- QFont f("Monospace");
+ TQFont f("Monospace");
// TODO : multiple font suggestions
f.fromString(m_lecture.m_fontSuggestions);
linesTextEdit->setFont(f);
@@ -310,8 +310,8 @@ void KTouchLectureEditor::showCurrentLevel() {
levelLabel->setText(i18n("Data of Level %1").arg(m_level+1) );
levelCommentEdit->setText(m_lecture.m_lectureData[m_level].m_comment);
newCharsEdit->setText(m_lecture.m_lectureData[m_level].m_newChars);
- QString text;
- for (QValueVector<QString>::const_iterator it=m_lecture.m_lectureData[m_level].m_lines.begin();
+ TQString text;
+ for (TQValueVector<TQString>::const_iterator it=m_lecture.m_lectureData[m_level].m_lines.begin();
it!=m_lecture.m_lectureData[m_level].m_lines.end(); ++it)
{
text += *it + '\n';
@@ -325,11 +325,11 @@ void KTouchLectureEditor::storeCurrentLevel() {
m_lecture.m_lectureData[m_level].m_comment = levelCommentEdit->text();
m_lecture.m_lectureData[m_level].m_newChars = newCharsEdit->text();
m_lecture.m_lectureData[m_level].m_lines.clear();
- QString text = linesTextEdit->text();
- QStringList lines;
- QString currentLine;
+ TQString text = linesTextEdit->text();
+ TQStringList lines;
+ TQString currentLine;
for (unsigned int i=0; i<text.length(); ++i) {
- QChar c = text[i];
+ TQChar c = text[i];
if (c=='\t') c=' '; // replace tabs with spaces
if (c=='\n') {
lines.append(currentLine);
@@ -339,7 +339,7 @@ void KTouchLectureEditor::storeCurrentLevel() {
currentLine += c;
};
lines.append(currentLine);
- for (QStringList::const_iterator it=lines.begin(); it!=lines.end(); ++it) {
+ for (TQStringList::const_iterator it=lines.begin(); it!=lines.end(); ++it) {
if ((*it).isEmpty()) continue;
m_lecture.m_lectureData[m_level].m_lines.push_back(*it);
}
@@ -349,7 +349,7 @@ void KTouchLectureEditor::storeCurrentLevel() {
void KTouchLectureEditor::createNewLevel() {
KTouchLevelData newLevel;
newLevel.m_newChars = i18n("abcdefghijklmnopqrstuvwxyz");
- newLevel.m_comment = QString();
+ newLevel.m_comment = TQString();
newLevel.m_lines.clear(); // remove the lines of the default mini level
newLevel.m_lines.push_back(i18n("Enter your lines here..."));
m_lecture.m_lectureData.push_back(newLevel);
@@ -370,7 +370,7 @@ int KTouchLectureEditor::openLectureFile(const KURL& url) {
i18n("Create new lecture"),
url, KTouchPtr->lectureFiles(), i18n("<no lecture files available>"));
- if (result == QDialog::Accepted) {
+ if (result == TQDialog::Accepted) {
// Ok, user confirmed the dialog, now lets get the url
m_currentURL = new_url;
// Try to load the lecture, if that failes, we create a new lecture instead
@@ -379,7 +379,7 @@ int KTouchLectureEditor::openLectureFile(const KURL& url) {
// try to read old format first then XML format
if (!m_lecture.load(this, m_currentURL) && !m_lecture.loadXML(this, m_currentURL)) {
KMessageBox::sorry(this, i18n("Could not open the lecture file, creating a new one instead."));
- m_currentURL = QString::null; // new lectures haven't got a URL
+ m_currentURL = TQString::null; // new lectures haven't got a URL
}
}
// If we have no URL, we create a new lecture - can happen if either the user
@@ -392,9 +392,9 @@ int KTouchLectureEditor::openLectureFile(const KURL& url) {
m_modified = false; // newly read lectures are not modified in the begin
// Update our editor with the lecture data
transfer_to_dialog();
- return QDialog::Accepted;
+ return TQDialog::Accepted;
}
- else return QDialog::Rejected;
+ else return TQDialog::Rejected;
}
// -----------------------------------------------------------------------------
@@ -411,7 +411,7 @@ bool KTouchLectureEditor::saveModified() {
if (!m_modified) return true;
// ok, ask the user to save the changes
int result = KMessageBox::questionYesNoCancel(this,
- i18n("The lecture has been changed. Do you want to save the changes?"),QString::null,KStdGuiItem::save(),KStdGuiItem::discard());
+ i18n("The lecture has been changed. Do you want to save the changes?"),TQString::null,KStdGuiItem::save(),KStdGuiItem::discard());
if (result == KMessageBox::Cancel) return false; // User aborted
if (result == KMessageBox::Yes) saveBtnClicked();
// if successfully saved the modified flag will be resetted in the saveBtnClicked() function