From: <mrj...@us...> - 2007-12-12 07:58:09
|
Revision: 2330 http://tora.svn.sourceforge.net/tora/?rev=2330&view=rev Author: mrjohnson0 Date: 2007-12-11 23:58:08 -0800 (Tue, 11 Dec 2007) Log Message: ----------- port to qt4 / qactions Modified Paths: -------------- branches/tora-1.4/tora/src/toeditextensions.cpp branches/tora-1.4/tora/src/toeditextensions.h Modified: branches/tora-1.4/tora/src/toeditextensions.cpp =================================================================== --- branches/tora-1.4/tora/src/toeditextensions.cpp 2007-12-12 07:45:41 UTC (rev 2329) +++ branches/tora-1.4/tora/src/toeditextensions.cpp 2007-12-12 07:58:08 UTC (rev 2330) @@ -50,26 +50,14 @@ #include <qmenubar.h> #include <qspinbox.h> #include <qtoolbutton.h> -//Added by qt3to4: + #include <QPixmap> -#include <Q3PopupMenu> +#include <QMenu> +#include <QAction> #include "icons/deindent.xpm" #include "icons/indent.xpm" -static int AutoIndentBlock; -static int AutoIndentBuffer; -static int DeindentIndex; -static int IndentIndex; -static int ObfuscateBlock; -static int ObfuscateBuffer; -static int ReverseSearch; -static int IncrementalSearch; -static int UpperCase; -static int LowerCase; -static int GotoLine; -static int AutoComplete; - #define CONF_EXPAND_SPACES "ExpandSpaces" #define CONF_COMMA_BEFORE "CommaBefore" #define CONF_BLOCK_OPEN_LINE "BlockOpenLine" @@ -82,51 +70,57 @@ #define CONF_COMMENT_COLUMN "CommentColumn" #define DEFAULT_COMMENT_COLUMN "60" -static QToolButton *IndentButton; -static QToolButton *DeindentButton; -void toEditExtensions::receivedFocus(toEditWidget *widget) -{ -#if 0 // todo - if (widget) +QMenu *IncMenu = NULL; +QAction *IncrementalSearch = NULL; +QAction *ReverseSearch = NULL; + +QMenu *IndentMenu = NULL; +QAction *IndentBlock = NULL; +QAction *IndentBuffer = NULL; +QAction *ObsBlock = NULL; +QAction *ObsBuffer = NULL; + +QMenu *CaseMenu = NULL; +QAction *UpperCase = NULL; +QAction *LowerCase = NULL; + +QAction *Indent = NULL; +QAction *Deindent = NULL; +QAction *GotoLine = NULL; +QAction *AutoComplete = NULL; + +toEditExtensions::toEditExtensions() : toEditWidget::editHandler() { +} + +void toEditExtensions::receivedFocus(toEditWidget *widget) { + if(widget) Current = dynamic_cast<toMarkedText *>(widget); else Current = NULL; bool enable = Current && !Current->isReadOnly(); - toMainWidget()->editMenu()->setItemEnabled(IndentIndex, enable); - toMainWidget()->editMenu()->setItemEnabled(DeindentIndex, enable); - toMainWidget()->editMenu()->setItemEnabled(AutoIndentBlock, enable); - toMainWidget()->editMenu()->setItemEnabled(ObfuscateBlock, enable); - toMainWidget()->editMenu()->setItemEnabled(AutoIndentBuffer, Current); - toMainWidget()->editMenu()->setItemEnabled(ObfuscateBuffer, Current); - toMainWidget()->editMenu()->setItemEnabled(IncrementalSearch, Current); - toMainWidget()->editMenu()->setItemEnabled(ReverseSearch, Current); - toMainWidget()->editMenu()->setItemEnabled(UpperCase, Current); - toMainWidget()->editMenu()->setItemEnabled(LowerCase, Current); - toMainWidget()->editMenu()->setItemEnabled(GotoLine, Current); + IncMenu->setEnabled(enable); + IndentMenu->setEnabled(enable); + CaseMenu->setEnabled(enable); - if (IndentButton) - IndentButton->setEnabled(enable); - if (DeindentButton) - DeindentButton->setEnabled(enable); + Indent->setEnabled(enable); + Deindent->setEnabled(enable); + GotoLine->setEnabled(enable); + toHighlightedText * cur = dynamic_cast<toHighlightedText *>(widget); - toMainWidget()->editMenu()->setItemEnabled(AutoComplete, cur); -#endif + AutoComplete->setEnabled(cur); } -void toEditExtensions::autoComplete() -{ +void toEditExtensions::autoComplete() { toHighlightedText *cur = dynamic_cast<toHighlightedText *>(Current); if (cur) cur->autoCompleteFromAPIs(); } -void toEditExtensions::lostFocus(toEditWidget *widget) -{ - if (widget) - { +void toEditExtensions::lostFocus(toEditWidget *widget) { + if (widget) { toMarkedText *current = dynamic_cast<toMarkedText *>(widget); if (current && Current == current) receivedFocus(NULL); @@ -134,35 +128,28 @@ } -void toEditExtensions::gotoLine() -{ - if (Current) - { +void toEditExtensions::gotoLine() { + if (Current) { toEditExtensionGoto dialog(Current); if (dialog.exec()) dialog.gotoLine(); } } -void toEditExtensions::intIndent(int delta) -{ +void toEditExtensions::intIndent(int delta) { int line1, col1, line2, col2; - if (Current) - { - if (!Current->getSelection(&line1, &col1, &line2, &col2)) - { - Current->getCursorPosition (&line1, &col1); + if (Current) { + if (!Current->getSelection(&line1, &col1, &line2, &col2)) { + Current->getCursorPosition(&line1, &col1); line2 = line1; } - else if (col2 == 0) - { + else if (col2 == 0) { line2--; } QString res; - for (int i = line1;i <= line2;i++) - { + for (int i = line1;i <= line2;i++) { QString t = Current->text(i); int chars = 0; int level = toSQLParse::countIndent(t, chars); @@ -183,37 +170,29 @@ } } -void toEditExtensions::deindentBlock(void) -{ - intIndent( -toSQLParse::getSetting().IndentLevel); +void toEditExtensions::deindentBlock(void) { + intIndent(-toSQLParse::getSetting().IndentLevel); } -void toEditExtensions::indentBlock(void) -{ +void toEditExtensions::indentBlock(void) { intIndent(toSQLParse::getSetting().IndentLevel); } -void toEditExtensions::autoIndentBlock(void) -{ - if (Current) - { - try - { +void toEditExtensions::autoIndentBlock(void) { + if (Current) { + try { int line1, col1, line2, col2; - if (Current->getSelection(&line1, &col1, &line2, &col2)) - { + if (Current->getSelection(&line1, &col1, &line2, &col2)) { QString t = Current->text(line1).mid(0, col1); t += QString::fromLatin1("a"); int chars = 0; QString ind = toSQLParse::indentString(toSQLParse::countIndent(t, chars)); QString mrk = Current->selectedText(); QString res; - try - { + try { res = toSQLParse::indent(ind + mrk, toCurrentConnection(Current)); } - catch (...) - { + catch (...) { res = toSQLParse::indent(ind + mrk); } t = Current->text(line2); @@ -224,58 +203,47 @@ Current->insert(res, true); } } - TOCATCH + TOCATCH; } } -void toEditExtensions::autoIndentBuffer(void) -{ - if (Current) - { +void toEditExtensions::autoIndentBuffer(void) { + if (Current) { QString text = Current->text(); int pos = 0; - while (pos < text.length() && text.at(pos).isSpace()) - { + while (pos < text.length() && text.at(pos).isSpace()) { pos++; } Current->selectAll(); - try - { - try - { + try { + try { Current->insert(toSQLParse::indent(text.mid(pos), toCurrentConnection(Current))); } - catch (...) - { + catch (...) { Current->insert(toSQLParse::indent(text.mid(pos))); } } - TOCATCH + TOCATCH; } } -void toEditExtensions::upperCase(void) -{ - if (Current) - { +void toEditExtensions::upperCase(void) { + if (Current) { QString text = Current->selectedText().upper(); if (!text.isEmpty()) Current->insert(text, true); } } -void toEditExtensions::lowerCase(void) -{ - if (Current) - { +void toEditExtensions::lowerCase(void) { + if (Current) { QString text = Current->selectedText().lower(); if (!text.isEmpty()) Current->insert(text, true); } } -static int CountLine(const QString &str) -{ +static int CountLine(const QString &str) { int found = str.findRev(QString::fromLatin1("\n")); if (found < 0) return str.length(); @@ -283,39 +251,32 @@ return str.length() - found + 1; } -static void ObfuscateStat(toSQLParse::statement &stat, QString &ret) -{ +static void ObfuscateStat(toSQLParse::statement &stat, QString &ret) { if (ret.length() > 0 && stat.String.length() > 0 && toIsIdent(ret.at(ret.length() - 1)) && - toIsIdent(stat.String.at(0))) - { + toIsIdent(stat.String.at(0))) { if (CountLine(ret) < 60) ret += QString::fromLatin1(" "); else ret += QString::fromLatin1("\n"); } ret += stat.String; - if (!stat.Comment.isEmpty()) - { + if (!stat.Comment.isEmpty()) { ret += stat.Comment; ret += QString::fromLatin1("\n"); } for (std::list<toSQLParse::statement>::iterator i = stat.subTokens().begin(); i != stat.subTokens().end(); - i++) - { + i++) { ObfuscateStat(*i, ret); } } -void toEditExtensions::obfuscateBlock(void) -{ - if (Current) - { +void toEditExtensions::obfuscateBlock(void) { + if (Current) { QString str = Current->selectedText(); - if (!str.isEmpty()) - { + if (!str.isEmpty()) { toSQLParse::statement stat; stat.subTokens() = toSQLParse::parse(str); QString res; @@ -325,13 +286,10 @@ } } -void toEditExtensions::obfuscateBuffer(void) -{ - if (Current) - { +void toEditExtensions::obfuscateBuffer(void) { + if (Current) { QString str = Current->text(); - if (!str.isEmpty()) - { + if (!str.isEmpty()) { toSQLParse::statement stat; stat.subTokens() = toSQLParse::parse(str); Current->selectAll(); @@ -346,16 +304,22 @@ class toEditExtensionTool; -class toEditExtensionSetup : public QWidget, public Ui::toEditExtensionSetupUI, public toSettingTab -{ +class toEditExtensionSetup : public QWidget, + public Ui::toEditExtensionSetupUI, + public toSettingTab { toEditExtensionTool *Tool; toSQLParse::settings Current; bool Ok; bool Started; + public: - toEditExtensionSetup(toEditExtensionTool *tool, QWidget *parent, const char *name = NULL) - : QWidget(parent/*, name*/), toSettingTab("editextension.html"), Tool(tool) - { + toEditExtensionSetup( + toEditExtensionTool *tool, + QWidget *parent, + const char *name = NULL) : QWidget(parent), + toSettingTab("editextension.html"), + Tool(tool) { + setupUi(this); Current = toSQLParse::getSetting(); @@ -369,63 +333,66 @@ EndBlockNewline->setChecked(Current.EndBlockNewline); IndentLevel->setValue(Current.IndentLevel); CommentColumn->setValue(Current.CommentColumn); - AutoIndent->setChecked(!toConfigurationSingle::Instance().globalConfig(CONF_AUTO_INDENT_RO, "Yes").isEmpty()); + AutoIndent->setChecked( + !toConfigurationSingle::Instance().globalConfig( + CONF_AUTO_INDENT_RO, "Yes").isEmpty()); Ok = false; - try - { + try { Example->setAnalyzer(toMainWidget()->currentConnection().analyzer()); } - TOCATCH + TOCATCH; - try - { + try { #ifdef TO_NO_ORACLE - Example->setText(toSQLParse::indent("CREATE PROCEDURE COUNT_EMPS_IN_DEPTS (OUT V_TOTAL INT)\n" - "BEGIN\n" - " DECLARE V_DEPTNO INT DEFAULT 10;\n" - " DECLARE V_COUNT INT DEFAULT 0;\n" - " SET V_TOTAL = 0;\n" - " WHILE V_DEPTNO < 100 DO\n" - " SELECT COUNT(*)\n" - " INTO V_COUNT\n" - " FROM TEST.EMP\n" - " WHERE DEPTNO = V_DEPTNO;\n" - " SET V_TOTAL = V_TOTAL + V_COUNT;\n" - " SET V_DEPTNO = V_DEPTNO + 10;\n" - " END WHILE;\n" - "END", Example->analyzer())); + Example->setText(toSQLParse::indent( + "CREATE PROCEDURE COUNT_EMPS_IN_DEPTS (OUT V_TOTAL INT)\n" + "BEGIN\n" + " DECLARE V_DEPTNO INT DEFAULT 10;\n" + " DECLARE V_COUNT INT DEFAULT 0;\n" + " SET V_TOTAL = 0;\n" + " WHILE V_DEPTNO < 100 DO\n" + " SELECT COUNT(*)\n" + " INTO V_COUNT\n" + " FROM TEST.EMP\n" + " WHERE DEPTNO = V_DEPTNO;\n" + " SET V_TOTAL = V_TOTAL + V_COUNT;\n" + " SET V_DEPTNO = V_DEPTNO + 10;\n" + " END WHILE;\n" + "END", + Example->analyzer())); #else - - Example->setText(toSQLParse::indent("CREATE OR REPLACE procedure spTuxGetAccData (oRet OUT NUMBER)\n" - "AS\n" - " vYear CHAR(4);\n" - "BEGIN\n" - "select a.TskCod TskCod, -- A Comment\n" - " count(1) Tot\n" - " from (select * from EssTsk where PrsID >= '1940');\n" - "having count(a.TspActOprID) > 0;\n" - " DECLARE\n" - " oTrdStt NUMBER;\n" - " BEGIN\n" - " oTrdStt := 0;\n" - " END;\n" - " EXCEPTION\n" - " WHEN VALUE_ERROR THEN\n" - " oRet := 3;\n" - "END;", Example->analyzer())); + Example->setText(toSQLParse::indent( + "CREATE OR REPLACE procedure spTuxGetAccData (oRet OUT NUMBER)\n" + "AS\n" + " vYear CHAR(4);\n" + "BEGIN\n" + "select a.TskCod TskCod, -- A Comment\n" + " count(1) Tot\n" + " from (select * from EssTsk where PrsID >= '1940');\n" + "having count(a.TspActOprID) > 0;\n" + " DECLARE\n" + " oTrdStt NUMBER;\n" + " BEGIN\n" + " oTrdStt := 0;\n" + " END;\n" + " EXCEPTION\n" + " WHEN VALUE_ERROR THEN\n" + " oRet := 3;\n" + "END;", + Example->analyzer())); #endif } - TOCATCH + TOCATCH; Started = true; } - virtual ~toEditExtensionSetup() - { + + virtual ~toEditExtensionSetup() { if (!Ok) toSQLParse::setSetting(Current); } - void saveCurrent(void) - { + + void saveCurrent(void) { Current.ExpandSpaces = ExpandSpaces->isChecked(); Current.CommaBefore = CommaBefore->isChecked(); Current.BlockOpenLine = BlockOpenLine->isChecked(); @@ -437,41 +404,34 @@ Current.CommentColumn = CommentColumn->value(); toSQLParse::setSetting(Current); } - virtual void changed(void) - { - if (Started) - { + + virtual void changed(void) { + if (Started) { saveCurrent(); - try - { + try { Example->setText(toSQLParse::indent(Example->text(), Example->analyzer())); } - TOCATCH + TOCATCH; } } + virtual void saveSetting(void); }; -void toEditExtensions::searchForward(void) -{ +void toEditExtensions::searchForward(void) { if (Current) Current->incrementalSearch(true); } -void toEditExtensions::searchBackward(void) -{ +void toEditExtensions::searchBackward(void) { if (Current) Current->incrementalSearch(false); } -#define TO_EDIT_SEARCH_NEXT 209 +class toEditExtensionTool : public toTool { -class toEditExtensionTool : public toTool -{ public: - toEditExtensionTool() - : toTool(910, "Editor Extensions") - { + toEditExtensionTool() : toTool(910, "Editor Extensions") { toSQLParse::settings cur; cur.ExpandSpaces = !config(CONF_EXPAND_SPACES, "Yes").isEmpty(); cur.CommaBefore = !config(CONF_COMMA_BEFORE, "").isEmpty(); @@ -484,91 +444,123 @@ cur.CommentColumn = config(CONF_COMMENT_COLUMN, DEFAULT_COMMENT_COLUMN).toInt(); toSQLParse::setSetting(cur); } - virtual QWidget *toolWindow(QWidget *, toConnection &) - { + + virtual QWidget *toolWindow(QWidget *, toConnection &) { return NULL; // Has no tool window } - virtual void closeWindow(toConnection &connection){}; - virtual void customSetup(int) - { -#if 0 // todo - toMainWidget()->editMenu()->insertSeparator(); - int idx = toMainWidget()->editMenu()->indexOf(TO_EDIT_SEARCH_NEXT); + virtual void closeWindow(toConnection &connection) {}; - Q3PopupMenu *menu = new Q3PopupMenu(toMainWidget()); + virtual void customSetup(void) { + QMenu *edit = toMainWidget()->getEditMenu(); - IncrementalSearch = menu->insertItem(qApp->translate("toEditExtensionTool", "Forward"), &EditExtensions, SLOT(searchForward()), - toKeySequence(qApp->translate("toEditExtensionTool", "Ctrl+S", "Edit|Incremental search forward"))); - ReverseSearch = menu->insertItem(qApp->translate("toEditExtensionTool", "Backward"), &EditExtensions, SLOT(searchBackward()), - toKeySequence(qApp->translate("toEditExtensionTool", "Ctrl+R", "Edit|Incremental search backward"))); + edit->addSeparator(); - toMainWidget()->editMenu()->insertItem(qApp->translate("toEditExtensionTool", "Incremental Search"), menu, -1, (idx >= 0 ? idx + 1 : 0)); + IncMenu = edit->addMenu( + qApp->translate("toEditExtensionTool", "Incremental Search")); + + IncrementalSearch = IncMenu->addAction(qApp->translate("toEditExtensionTool", + "Forward"), + &EditExtensions, + SLOT(searchForward())); + IncrementalSearch->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S); - menu = new Q3PopupMenu(toMainWidget()); - AutoIndentBlock = menu->insertItem(qApp->translate("toEditExtensionTool", "Selection"), + ReverseSearch = IncMenu->addAction(qApp->translate("toEditExtensionTool", + "Backward"), &EditExtensions, - SLOT(autoIndentBlock()), - toKeySequence(qApp->translate("toEditExtensionTool", "Ctrl+Alt+I", "Edit|Indent selection"))); - AutoIndentBuffer = menu->insertItem(qApp->translate("toEditExtensionTool", "Editor"), + SLOT(searchBackward())); + ReverseSearch->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_R); + + // ------------------------------ indentation menu + + IndentMenu = edit->addMenu( + qApp->translate("toEditExtensionTool", "Auto Indent")); + + IndentBlock = IndentMenu->addAction(qApp->translate( + "toEditExtensionTool", + "Selection"), &EditExtensions, - SLOT(autoIndentBuffer()), - toKeySequence(qApp->translate("toEditExtensionTool", "Ctrl+Alt+Shift+I", "Edit|Indent editor"))); - menu->insertSeparator(); - ObfuscateBlock = menu->insertItem(qApp->translate("toEditExtensionTool", "Obfuscate Selection"), + SLOT(autoIndentBlock())); + IndentBlock->setShortcut(Qt::CTRL + + Qt::ALT + Qt::Key_I); + + IndentBuffer = IndentMenu->addAction(qApp->translate( + "toEditExtensionTool", + "Editor"), + &EditExtensions, + SLOT(autoIndentBuffer())); + IndentBuffer->setShortcut(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_I); + + IndentMenu->addSeparator(); + + ObsBlock = IndentMenu->addAction(qApp->translate( + "toEditExtensionTool", + "Obfuscate Selection"), + &EditExtensions, + SLOT(obfuscateBlock())); + + ObsBuffer = IndentMenu->addAction(qApp->translate("toEditExtensionTool", + "Obfuscate Editor"), &EditExtensions, - SLOT(obfuscateBlock())); - ObfuscateBuffer = menu->insertItem(qApp->translate("toEditExtensionTool", "Obfuscate Editor"), - &EditExtensions, - SLOT(obfuscateBuffer())); - toMainWidget()->editMenu()->insertItem(qApp->translate("toEditExtensionTool", "Auto Indent"), menu); + SLOT(obfuscateBuffer())); - menu = new Q3PopupMenu(toMainWidget()); - UpperCase = menu->insertItem(qApp->translate("toEditExtensionTool", "Upper"), - &EditExtensions, - SLOT(upperCase()), - toKeySequence(qApp->translate("toEditExtensionTool", "Ctrl+U", "Edit|Uppercase"))); - LowerCase = menu->insertItem(qApp->translate("toEditExtensionTool", "Lower"), - &EditExtensions, - SLOT(lowerCase()), - toKeySequence(qApp->translate("toEditExtensionTool", "Ctrl+L", "Edit|Lowercase"))); - toMainWidget()->editMenu()->insertItem(qApp->translate("toEditExtensionTool", "Modify Case"), menu); + // ------------------------------ case menu - IndentIndex = toMainWidget()->editMenu()->insertItem(QPixmap(const_cast<const char**>(indent_xpm)), - qApp->translate("toEditExtensionTool", "Indent Block"), &EditExtensions, - SLOT(indentBlock()), - toKeySequence(qApp->translate("toEditExtensionTool", "Alt+Right", "Edit|Indent block"))); - DeindentIndex = toMainWidget()->editMenu()->insertItem(QPixmap(const_cast<const char**>(deindent_xpm)), - qApp->translate("toEditExtensionTool", "De-indent Block"), &EditExtensions, - SLOT(deindentBlock()), - toKeySequence(qApp->translate("toEditExtensionTool", "Alt+Left", "Edit|De-indent block"))); - GotoLine = toMainWidget()->editMenu()->insertItem(qApp->translate("toEditExtensionTool", "Goto Line"), &EditExtensions, - SLOT(gotoLine())); + CaseMenu = edit->addMenu( + qApp->translate("toEditExtensionTool", "Modify Case")); - AutoComplete = toMainWidget()->editMenu()->insertItem(qApp->translate("toEditExtensionTool", "Complete"), &EditExtensions, SLOT(autoComplete()), toKeySequence(qApp->translate("toEditExtensionTool", "Ctrl+Space", "Edit|Complete"))); + UpperCase = CaseMenu->addAction(qApp->translate("toEditExtensionTool", + "Upper"), + &EditExtensions, + SLOT(upperCase())); + UpperCase->setShortcut(Qt::CTRL + Qt::Key_U); - IndentButton = new QToolButton(QPixmap(const_cast<const char**>(indent_xpm)), - qApp->translate("toEditExtensionTool", "Indent block in editor"), - qApp->translate("toEditExtensionTool", "Indent block in editor"), - &EditExtensions, SLOT(indentBlock()), - toMainWidget()->editToolbar()); - DeindentButton = new QToolButton(QPixmap(const_cast<const char**>(deindent_xpm)), - qApp->translate("toEditExtensionTool", "De-indent block in editor"), - qApp->translate("toEditExtensionTool", "De-indent block in editor"), - &EditExtensions, SLOT(deindentBlock()), - toMainWidget()->editToolbar()); + LowerCase = CaseMenu->addAction(qApp->translate("toEditExtensionTool", + "Lower"), + &EditExtensions, + SLOT(lowerCase())); + LowerCase->setShortcut(Qt::CTRL + Qt::Key_L); + // ------------------------------ etc + + Indent = edit->addAction( + QIcon(QPixmap(const_cast<const char**>(indent_xpm))), + qApp->translate("toEditExtensionTool", "Indent Block"), + &EditExtensions, + SLOT(indentBlock())); + Indent->setShortcut(Qt::ALT + Qt::Key_Right); + + Deindent = edit->addAction( + QIcon(QPixmap(const_cast<const char**>(deindent_xpm))), + qApp->translate("toEditExtensionTool", "De-indent Block"), + &EditExtensions, + SLOT(deindentBlock())); + Deindent->setShortcut(Qt::ALT + Qt::Key_Left); + + GotoLine = edit->addAction(qApp->translate("toEditExtensionTool", + "Goto Line"), + &EditExtensions, + SLOT(gotoLine())); + + AutoComplete = edit->addAction( + qApp->translate("toEditExtensionTool", + "Complete"), + &EditExtensions, + SLOT(autoComplete())); + AutoComplete->setShortcut(Qt::CTRL + Qt::Key_Space); + + // add buttons to main window + toMainWidget()->addButtonApplication(Deindent); + toMainWidget()->addButtonApplication(Indent); + EditExtensions.receivedFocus(NULL); -#endif } - virtual QWidget *configurationTab(QWidget *parent) - { + + virtual QWidget *configurationTab(QWidget *parent) { return new toEditExtensionSetup(this, parent); } }; -void toEditExtensionSetup::saveSetting(void) -{ +void toEditExtensionSetup::saveSetting(void) { Ok = true; Tool->setConfig(CONF_EXPAND_SPACES, ExpandSpaces->isChecked() ? "Yes" : ""); Tool->setConfig(CONF_COMMA_BEFORE, CommaBefore->isChecked() ? "Yes" : ""); @@ -586,8 +578,9 @@ static toEditExtensionTool EditExtensionTool; toEditExtensionGoto::toEditExtensionGoto(toMarkedText *editor) - : QDialog(editor/*, "GotoLine", true*/), Editor(editor) -{ + : QDialog(editor), + Editor(editor) { + setupUi(this); toHelp::connectDialog(this); @@ -600,7 +593,6 @@ } } -void toEditExtensionGoto::gotoLine() -{ +void toEditExtensionGoto::gotoLine() { Editor->setCursorPosition(Line->value() - 1, 0); } Modified: branches/tora-1.4/tora/src/toeditextensions.h =================================================================== --- branches/tora-1.4/tora/src/toeditextensions.h 2007-12-12 07:45:41 UTC (rev 2329) +++ branches/tora-1.4/tora/src/toeditextensions.h 2007-12-12 07:58:08 UTC (rev 2330) @@ -46,17 +46,15 @@ class toMarkedText; -class toEditExtensions : public QObject, public toEditWidget::editHandler -{ - Q_OBJECT +class toEditExtensions : public QObject, public toEditWidget::editHandler { + Q_OBJECT; toMarkedText *Current; void intIndent(int level); + public: - toEditExtensions() - : toEditWidget::editHandler() - { } + toEditExtensions(); virtual void receivedFocus(toEditWidget *widget); virtual void lostFocus(toEditWidget *widget); @@ -81,11 +79,12 @@ void autoComplete(void); }; -class toEditExtensionGoto : public QDialog, public Ui::toEditExtensionGotoUI -{ - Q_OBJECT +class toEditExtensionGoto : public QDialog, public Ui::toEditExtensionGotoUI { + Q_OBJECT; + toMarkedText *Editor; + public: toEditExtensionGoto(toMarkedText *editor); void gotoLine(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-12 07:59:59
|
Revision: 2332 http://tora.svn.sourceforge.net/tora/?rev=2332&view=rev Author: mrjohnson0 Date: 2007-12-12 00:00:01 -0800 (Wed, 12 Dec 2007) Log Message: ----------- add public function to append qactions to application toolbar Modified Paths: -------------- branches/tora-1.4/tora/src/tomain.cpp branches/tora-1.4/tora/src/tomain.h Modified: branches/tora-1.4/tora/src/tomain.cpp =================================================================== --- branches/tora-1.4/tora/src/tomain.cpp 2007-12-12 07:58:25 UTC (rev 2331) +++ branches/tora-1.4/tora/src/tomain.cpp 2007-12-12 08:00:01 UTC (rev 2332) @@ -495,7 +495,6 @@ editToolbar->addSeparator(); editToolbar->addAction(searchReplaceAct); - editToolbar->addSeparator(); connectionToolbar = toAllocBar(this, tr("Connections")); @@ -526,6 +525,11 @@ } +void toMain::addButtonApplication(QAction *act) { + editToolbar->addAction(act); +} + + void toMain::createStatusbar() { statusBar()->message(QString::null); Modified: branches/tora-1.4/tora/src/tomain.h =================================================================== --- branches/tora-1.4/tora/src/tomain.h 2007-12-12 07:58:25 UTC (rev 2331) +++ branches/tora-1.4/tora/src/tomain.h 2007-12-12 08:00:01 UTC (rev 2332) @@ -348,12 +348,16 @@ * @param data A map that can be used to recreate the session. * @param prefix Prefix to add to the map. */ - virtual void exportData(std::map<Q3CString, QString> &data, const Q3CString &prefix); + virtual void exportData(std::map<Q3CString, + QString> &data, + const Q3CString &prefix); /** Import data * @param data Data to read from a map. * @param prefix Prefix to read data from. */ - virtual void importData(std::map<Q3CString, QString> &data, const Q3CString &prefix); + virtual void importData(std::map<Q3CString, + QString> &data, + const Q3CString &prefix); /** Added chart. */ void addChart(toLineChart *chart); @@ -402,6 +406,15 @@ return selectAllAct; } + QMenu* getEditMenu() { + return editMenu; + } + + /** + * add a button to the application toolbar + */ + void addButtonApplication(QAction *); + signals: /** Invoked to start editing an SQL identifier. * @param str Identifier to start editing. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-12 08:00:32
|
Revision: 2333 http://tora.svn.sourceforge.net/tora/?rev=2333&view=rev Author: mrjohnson0 Date: 2007-12-12 00:00:36 -0800 (Wed, 12 Dec 2007) Log Message: ----------- customSetup is now void Modified Paths: -------------- branches/tora-1.4/tora/src/tobrowser.cpp branches/tora-1.4/tora/src/tobrowser.h branches/tora-1.4/tora/src/tochartmanager.cpp branches/tora-1.4/tora/src/tosqledit.cpp Modified: branches/tora-1.4/tora/src/tobrowser.cpp =================================================================== --- branches/tora-1.4/tora/src/tobrowser.cpp 2007-12-12 08:00:01 UTC (rev 2332) +++ branches/tora-1.4/tora/src/tobrowser.cpp 2007-12-12 08:00:36 UTC (rev 2333) @@ -147,7 +147,7 @@ return toIsOracle(conn) || toIsMySQL(conn) || toIsPostgreSQL(conn) || toIsSapDB(conn); } -void toBrowserTool::customSetup(int) +void toBrowserTool::customSetup() { #if 0 // todo Q3PopupMenu *createMenu = new Q3PopupMenu(toMainWidget()); Modified: branches/tora-1.4/tora/src/tobrowser.h =================================================================== --- branches/tora-1.4/tora/src/tobrowser.h 2007-12-12 08:00:01 UTC (rev 2332) +++ branches/tora-1.4/tora/src/tobrowser.h 2007-12-12 08:00:36 UTC (rev 2333) @@ -222,7 +222,7 @@ virtual const char *menuItem(); virtual QWidget *toolWindow(QWidget *parent, toConnection &connection); virtual bool canHandle(toConnection &conn); - virtual void customSetup(int id); + virtual void customSetup(void); virtual void closeWindow(toConnection &connection) {}; public slots: Modified: branches/tora-1.4/tora/src/tochartmanager.cpp =================================================================== --- branches/tora-1.4/tora/src/tochartmanager.cpp 2007-12-12 08:00:01 UTC (rev 2332) +++ branches/tora-1.4/tora/src/tochartmanager.cpp 2007-12-12 08:00:36 UTC (rev 2333) @@ -98,7 +98,7 @@ Window->setFocus(); return Window; } - virtual void customSetup(int toolid) + virtual void customSetup() { #if 0 // todo toMainWidget()->editMenu()->insertItem(QIcon(/*const_cast<const char**>(*/chart_xpm)/*)*/, Modified: branches/tora-1.4/tora/src/tosqledit.cpp =================================================================== --- branches/tora-1.4/tora/src/tosqledit.cpp 2007-12-12 08:00:01 UTC (rev 2332) +++ branches/tora-1.4/tora/src/tosqledit.cpp 2007-12-12 08:00:36 UTC (rev 2333) @@ -96,7 +96,7 @@ Window->setIcon(QPixmap(const_cast<const char**>(tosqledit_xpm))); return Window; } - virtual void customSetup(int toolid) + virtual void customSetup() { #if 0 // todo toMainWidget()->editMenu()->insertSeparator(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-12 08:11:22
|
Revision: 2334 http://tora.svn.sourceforge.net/tora/?rev=2334&view=rev Author: mrjohnson0 Date: 2007-12-12 00:11:26 -0800 (Wed, 12 Dec 2007) Log Message: ----------- use closeEvent to make sure clicking a window manager 'x' is the same as file -> quit Modified Paths: -------------- branches/tora-1.4/tora/src/tomain.cpp branches/tora-1.4/tora/src/tomain.h Modified: branches/tora-1.4/tora/src/tomain.cpp =================================================================== --- branches/tora-1.4/tora/src/tomain.cpp 2007-12-12 08:00:36 UTC (rev 2333) +++ branches/tora-1.4/tora/src/tomain.cpp 2007-12-12 08:11:26 UTC (rev 2334) @@ -1211,18 +1211,22 @@ SQLEditor = tool; } -bool toMain::close() { + +void toMain::closeEvent(QCloseEvent *event) { Workspace->closeAllWindows(); - if(Workspace->activeWindow() != NULL) - return false; // stop widget refused + if(Workspace->activeWindow() != NULL) { + event->ignore(); // stop widget refused + return; + } std::map<Q3CString, QString> session; exportData(session, "TOra"); - try - { - toConfigurationSingle::Instance().saveMap(toConfigurationSingle::Instance().globalConfig(CONF_DEFAULT_SESSION, + try { + toConfigurationSingle::Instance().saveMap( + toConfigurationSingle::Instance().globalConfig( + CONF_DEFAULT_SESSION, DEFAULT_SESSION), - session); + session); } TOCATCH; @@ -1232,6 +1236,12 @@ // return false; // } toConfigurationSingle::Instance().saveConfig(); + + event->accept(); +} + + +bool toMain::close() { return QMainWindow::close(); } Modified: branches/tora-1.4/tora/src/tomain.h =================================================================== --- branches/tora-1.4/tora/src/tomain.h 2007-12-12 08:00:36 UTC (rev 2333) +++ branches/tora-1.4/tora/src/tomain.h 2007-12-12 08:11:26 UTC (rev 2334) @@ -482,6 +482,12 @@ /** Change current connection */ void changeConnection(void); + +protected: + /** intercept close event from parent + */ + void closeEvent(QCloseEvent *event); + private slots: /** Add a connection */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-13 04:57:20
|
Revision: 2337 http://tora.svn.sourceforge.net/tora/?rev=2337&view=rev Author: mrjohnson0 Date: 2007-12-12 20:57:24 -0800 (Wed, 12 Dec 2007) Log Message: ----------- add qscrollarea so tables with lots of columns get scrollbars. Modified Paths: -------------- branches/tora-1.4/tora/src/toresultcontent.cpp branches/tora-1.4/tora/src/toresultcontent.h Modified: branches/tora-1.4/tora/src/toresultcontent.cpp =================================================================== --- branches/tora-1.4/tora/src/toresultcontent.cpp 2007-12-12 17:03:07 UTC (rev 2336) +++ branches/tora-1.4/tora/src/toresultcontent.cpp 2007-12-13 04:57:24 UTC (rev 2337) @@ -74,6 +74,7 @@ #include <stdio.h> #include <QGridLayout> #include <QScrollArea> +#include <QHBoxLayout> #include "ui_toresultcontentfilterui.h" @@ -1504,17 +1505,31 @@ } toResultContentSingle::toResultContentSingle(QWidget *parent) - : QScrollArea(parent) { + : QWidget(parent) { Container = NULL; Row = -1; setBackgroundRole(QPalette::Window); + + // fscking qscrollarea won't resize this is added + QHBoxLayout *h = new QHBoxLayout; + setLayout(h); + + setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); } void toResultContentSingle::changeSource(Q3Table *table) { delete Container; - Container = new QGridLayout(this); + Container = new QScrollArea(this); + layout()->addWidget(Container); + QWidget *ext = new QWidget(Container); + Container->setWidget(ext); + Container->setWidgetResizable(true); + + QGridLayout *grid = new QGridLayout; + ext->setLayout(grid); + Value.clear(); Null.clear(); @@ -1525,33 +1540,33 @@ for(; row < table->numCols(); row++, col = 0) { QLabel *name = new QLabel(head->label(row), this); - Container->addWidget(name, row, col++); + grid->addWidget(name, row, col++); QLineEdit *edit = new QLineEdit(this, QString::number(row)); edit->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum)); - Container->addWidget(edit, row, col); + grid->addWidget(edit, row, col); // edit widget should get the most space - Container->setColumnStretch(col++, 1); + grid->setColumnStretch(col++, 1); QCheckBox *box = new QCheckBox(("NULL"), this); connect(box, SIGNAL(toggled(bool)), edit, SLOT(setDisabled(bool))); - Container->addWidget(box, row, col++); + grid->addWidget(box, row, col++); toParamGetButton *btn = new toParamGetButton(row, this); btn->setText(tr("Edit")); btn->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed)); connect(btn, SIGNAL(clicked(int)), this, SLOT(showMemo(int))); connect(box, SIGNAL(toggled(bool)), btn, SLOT(setDisabled(bool))); - Container->addWidget(btn, row, col++); + grid->addWidget(btn, row, col++); Value.insert(Value.end(), edit); Null.insert(Null.end(), box); } // add widget at bottom of grid that can resize - Container->addWidget(new QLabel(this), row, 0); - Container->setRowStretch(row, 1); + grid->addWidget(new QLabel(this), row, 0); + grid->setRowStretch(row, 1); Row = table->currentRow(); changeRow(table, Row); Modified: branches/tora-1.4/tora/src/toresultcontent.h =================================================================== --- branches/tora-1.4/tora/src/toresultcontent.h 2007-12-12 17:03:07 UTC (rev 2336) +++ branches/tora-1.4/tora/src/toresultcontent.h 2007-12-13 04:57:24 UTC (rev 2337) @@ -59,7 +59,6 @@ #include <QKeyEvent> #include <QEvent> #include <QDragEnterEvent> -#include <QGridLayout> #include <QScrollArea> class QChecBox; @@ -100,11 +99,11 @@ * @internal */ -class toResultContentSingle : public QScrollArea { +class toResultContentSingle : public QWidget { Q_OBJECT; int Row; - QGridLayout *Container; + QScrollArea *Container; std::list<QCheckBox *> Null; std::list<QLineEdit *> Value; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-14 22:43:13
|
Revision: 2338 http://tora.svn.sourceforge.net/tora/?rev=2338&view=rev Author: mrjohnson0 Date: 2007-12-14 14:43:10 -0800 (Fri, 14 Dec 2007) Log Message: ----------- no, -really- fix intermittent crash on closing connections. change to a list of widgets for Widgets member (it _is_ called Widgets and nothing else calls it with a qobject). the problem was closeWidgets was destroying tools which would call delWidget and cause a crash. use qpointer and stop calling delWidget. --This line, and those below, will be ignored-- M toconnection.cpp M toconnection.h M totool.cpp Modified Paths: -------------- branches/tora-1.4/tora/src/toconnection.cpp branches/tora-1.4/tora/src/toconnection.h branches/tora-1.4/tora/src/totool.cpp Modified: branches/tora-1.4/tora/src/toconnection.cpp =================================================================== --- branches/tora-1.4/tora/src/toconnection.cpp 2007-12-13 04:57:24 UTC (rev 2337) +++ branches/tora-1.4/tora/src/toconnection.cpp 2007-12-14 22:43:10 UTC (rev 2338) @@ -52,9 +52,10 @@ #include <q3progressdialog.h> #include <q3textstream.h> #include <qwidget.h> -//Added by qt3to4: + #include <Q3CString> #include <QDateTime> +#include <QPointer> // A little magic to get lrefresh to work and get a check on qApp @@ -1028,17 +1029,11 @@ { toLocker lock(Lock); - // patch 1188297 removed. causing crash on file -> quit -// for_each(Widgets.begin(), Widgets.end(), DeleteObject()); - + // widgets is a std::list of qpointers. we don't own those + // pointers, so don't delete them. they are qobjects and will + // be deleted with their parents. Widgets.clear(); -// for (std::list<QObject *>::iterator i = Widgets.begin(); -// i != Widgets.end(); -// i = Widgets.begin()) { -// delete(*i); -// } - for (std::list<toConnectionSub *>::iterator i = Running.begin();i != Running.end();i++) try { (*i)->cancel(); @@ -1167,31 +1162,35 @@ setNeedCommit(false); } -void toConnection::delWidget(QObject *widget) { - for (std::list<QObject *>::iterator i = Widgets.begin(); - i != Widgets.end(); - i++) { +void toConnection::delWidget(QWidget *widget) { + for(std::list<QPointer<QWidget> >::iterator i = Widgets.begin(); + i != Widgets.end(); + i++) { - if ((*i) == widget) { + if ((*i) && (*i) == widget) { Widgets.erase(i); break; } } } +void toConnection::addWidget(QWidget *widget) { + Widgets.insert(Widgets.end(), QPointer<QWidget>(widget)); +} + bool toConnection::closeWidgets(void) { - for (std::list<QObject *>::iterator i = Widgets.begin(); - i != Widgets.end(); - i++) { + for(std::list<QPointer<QWidget> >::iterator i = Widgets.begin(); + i != Widgets.end(); + i++) { - if ((*i)->inherits("QWidget")) { - QWidget * widget = static_cast<QWidget *>(*i); - if (!widget->close(true)) - return false; - } - else - delete *i; + if(!(*i)) + continue; + + if(!(*i)->close(true)) + return false; } + + Widgets.clear(); return true; } Modified: branches/tora-1.4/tora/src/toconnection.h =================================================================== --- branches/tora-1.4/tora/src/toconnection.h 2007-12-13 04:57:24 UTC (rev 2337) +++ branches/tora-1.4/tora/src/toconnection.h 2007-12-14 22:43:10 UTC (rev 2338) @@ -46,10 +46,9 @@ #include <map> #include <set> -#include <QObject> #include <QString> -//Added by qt3to4: #include <Q3CString> +#include <QPointer> class QWidget; class toConnection; @@ -453,7 +452,7 @@ QString Host; QString Database; Q3CString Version; - std::list<QObject *> Widgets; + std::list<QPointer<QWidget> > Widgets; std::list<QString> InitStrings; std::set <QString> Options; @@ -653,17 +652,17 @@ connectionImpl *Connection; -class cacheObjects : public toTask + class cacheObjects : public toTask { toConnection &Connection; public: - cacheObjects(toConnection &conn) - : Connection(conn) + cacheObjects(toConnection &conn) + : Connection(conn) { } virtual void run(void); }; friend class cacheObjects; - + bool ReadingCache; toSemaphore ReadingValues; bool Abort; @@ -875,9 +874,8 @@ * * @param widget The widget to add to the connection. */ - void addWidget(QObject *widget) { - Widgets.insert(Widgets.end(), widget); - } + void addWidget(QWidget *widget); + /** * Remove a widget from this connection. Should be called by the destructor of the * widget that has called addWidget. @@ -885,7 +883,7 @@ * @see addWidget * @param widget Widget to remove from the widget list. */ - void delWidget(QObject *widget); + void delWidget(QWidget *widget); /** * Add a statement to be run uppon making new connections. Modified: branches/tora-1.4/tora/src/totool.cpp =================================================================== --- branches/tora-1.4/tora/src/totool.cpp 2007-12-13 04:57:24 UTC (rev 2337) +++ branches/tora-1.4/tora/src/totool.cpp 2007-12-14 22:43:10 UTC (rev 2338) @@ -84,10 +84,7 @@ } } -toConnectionWidget::~toConnectionWidget() -{ - if (Connection) - Connection->delWidget(Widget); +toConnectionWidget::~toConnectionWidget() { } void toToolWidget::parentConnection(void) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-15 18:55:56
|
Revision: 2339 http://tora.svn.sourceforge.net/tora/?rev=2339&view=rev Author: mrjohnson0 Date: 2007-12-15 10:54:51 -0800 (Sat, 15 Dec 2007) Log Message: ----------- - make sql pretty - make sure to setObjectName() for object like tobrowser that use the name to identify objects. - add a central widget to for qscrollarea Modified Paths: -------------- branches/tora-1.4/tora/src/toresultitem.cpp branches/tora-1.4/tora/src/toresultitem.h Modified: branches/tora-1.4/tora/src/toresultitem.cpp =================================================================== --- branches/tora-1.4/tora/src/toresultitem.cpp 2007-12-14 22:43:10 UTC (rev 2338) +++ branches/tora-1.4/tora/src/toresultitem.cpp 2007-12-15 18:54:51 UTC (rev 2339) @@ -50,25 +50,88 @@ #include <qlabel.h> #include <qlayout.h> #include <qtooltip.h> -//Added by qt3to4: + #include <QResizeEvent> static toSQL SQLResource( "toResultResources:Information", - "SELECT 'Total' \"-\", 'per Execution' \"-\", 'per Row processed' \"-\",\n" - " Sorts, DECODE(Executions,0,'N/A',ROUND(Sorts/Executions,3)) \" \", DECODE(Rows_Processed,0,'N/A',ROUND(Sorts/Rows_Processed,3)) \" \",\n" - " Parse_Calls \"Parse\", DECODE(Executions,0,'N/A',ROUND(Parse_Calls/Executions,3)) \" \", DECODE(Rows_Processed,0,'N/A',ROUND(Parse_Calls/Rows_Processed,3)) \" \",\n" - " Disk_Reads, DECODE(Executions,0,'N/A',ROUND(Disk_Reads/Executions,3)) \" \", DECODE(Rows_Processed,0,'N/A',ROUND(Disk_Reads/Rows_Processed,3)) \" \",\n" - " Buffer_Gets, DECODE(Executions,0,'N/A',ROUND(Buffer_Gets/Executions,3)) \" \", DECODE(Rows_Processed,0,'N/A',ROUND(Buffer_Gets/Rows_Processed,3)) \" \",\n" - " Rows_Processed, DECODE(Executions,0,'N/A',ROUND(Rows_Processed/Executions,3)) \" \",' ' \"-\",\n" - " Executions, ' ' \"-\", ' ' \"-\",\n" - " ' ' \"-\", ' ' \"-\", ' ' \"-\",\n" - " Loads, First_Load_Time, Parsing_User_Id,\n" - " Parsing_Schema_Id, Users_Executing, Users_Opening,\n" - " Open_Versions, Sharable_Mem, Kept_Versions,\n" - " Persistent_Mem, Optimizer_Mode, Loaded_Versions,\n" - " Runtime_Mem, Serializable_Aborts, Invalidations\n" - " FROM v$sqlarea WHERE Address||':'||Hash_Value = :f1<char[100]>", + "SELECT 'Total' AS \"-\", " + " 'per Execution' AS \"-\", " + " 'per Row processed' AS \"-\", " + " Sorts, " + " DECODE ( Executions, " + " 0, " + " 'N/A', " + " ROUND ( Sorts / Executions, " + " 3 ) ) AS \" \", " + " DECODE ( Rows_Processed, " + " 0, " + " 'N/A', " + " ROUND ( Sorts / Rows_Processed, " + " 3 ) ) AS \" \", " + " Parse_Calls AS \"Parse\", " + " DECODE ( Executions, " + " 0, " + " 'N/A', " + " ROUND ( Parse_Calls / Executions, " + " 3 ) ) AS \" \", " + " DECODE ( Rows_Processed, " + " 0, " + " 'N/A', " + " ROUND ( Parse_Calls / Rows_Processed, " + " 3 ) ) AS \" \", " + " Disk_Reads, " + " DECODE ( Executions, " + " 0, " + " 'N/A', " + " ROUND ( Disk_Reads / Executions, " + " 3 ) ) AS \" \", " + " DECODE ( Rows_Processed, " + " 0, " + " 'N/A', " + " ROUND ( Disk_Reads / Rows_Processed, " + " 3 ) ) AS \" \", " + " Buffer_Gets, " + " DECODE ( Executions, " + " 0, " + " 'N/A', " + " ROUND ( Buffer_Gets / Executions, " + " 3 ) ) AS \" \", " + " DECODE ( Rows_Processed, " + " 0, " + " 'N/A', " + " ROUND ( Buffer_Gets / Rows_Processed, " + " 3 ) ) AS \" \", " + " Rows_Processed, " + " DECODE ( Executions, " + " 0, " + " 'N/A', " + " ROUND ( Rows_Processed / Executions, " + " 3 ) ) AS \" \", " + " ' ' AS \"-\", " + " Executions, " + " ' ' AS \"-\", " + " ' ' AS \"-\", " + " ' ' AS \"-\", " + " ' ' AS \"-\", " + " ' ' AS \"-\", " + " Loads, " + " First_Load_Time, " + " Parsing_User_Id, " + " Parsing_Schema_Id, " + " Users_Executing, " + " Users_Opening, " + " Open_Versions, " + " Sharable_Mem, " + " Kept_Versions, " + " Persistent_Mem, " + " Optimizer_Mode, " + " Loaded_Versions, " + " Runtime_Mem, " + " Serializable_Aborts, " + " Invalidations " + " FROM v$sqlarea " + " WHERE Address || ':' || Hash_Value = :f1<char[100]> ", "Display information about an SQL statement"); toResultResources::toResultResources(QWidget *parent, const char *name) @@ -79,16 +142,24 @@ void toResultItem::setup(int num, bool readable) { ReadableColumns = readable; - NumWidgets = 0; - WidgetPos = 0; - Columns = num; - setBackgroundRole(QPalette::Window); - Result = new QGridLayout(this); // set as layout for widget + NumWidgets = 0; + WidgetPos = 0; + Columns = num; + ShowTitle = true; + Right = true; + Query = NULL; + DataFont.setBold(true); + + // qscrollarea needs a central widget for it's resizing policies. + + QWidget *w = new QWidget(this); + setWidget(w); + setWidgetResizable(true); + + Result = new QGridLayout; Result->setSpacing(3); - ShowTitle = true; - Right = true; - DataFont.setBold(true); - Query = NULL; + w->setLayout(Result); + connect(&Poll, SIGNAL(timeout()), this, SLOT(poll())); } @@ -98,12 +169,14 @@ const char *name) : QScrollArea(parent), DataFont(QFont::defaultFont()) { + setObjectName(name); setup(num, readable); } toResultItem::toResultItem(int num, QWidget *parent, const char *name) : QScrollArea(parent), DataFont(QFont::defaultFont()) { + setObjectName(name); setup(num, false); } Modified: branches/tora-1.4/tora/src/toresultitem.h =================================================================== --- branches/tora-1.4/tora/src/toresultitem.h 2007-12-14 22:43:10 UTC (rev 2338) +++ branches/tora-1.4/tora/src/toresultitem.h 2007-12-15 18:54:51 UTC (rev 2339) @@ -111,9 +111,6 @@ /** Done with adding queries. */ void done(void); - /** Reimplemented for internal reasons. - */ -/* virtual void resizeEvent(QResizeEvent *e); */ public: /** Create widget. * @param num Number of columns to arrange data in. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-15 19:43:51
|
Revision: 2341 http://tora.svn.sourceforge.net/tora/?rev=2341&view=rev Author: mrjohnson0 Date: 2007-12-15 11:42:32 -0800 (Sat, 15 Dec 2007) Log Message: ----------- and signal to enable/disable edit related widgets. Modified Paths: -------------- branches/tora-1.4/tora/src/toeditextensions.cpp branches/tora-1.4/tora/src/toeditextensions.h branches/tora-1.4/tora/src/tomain.cpp branches/tora-1.4/tora/src/tomain.h Modified: branches/tora-1.4/tora/src/toeditextensions.cpp =================================================================== --- branches/tora-1.4/tora/src/toeditextensions.cpp 2007-12-15 18:57:02 UTC (rev 2340) +++ branches/tora-1.4/tora/src/toeditextensions.cpp 2007-12-15 19:42:32 UTC (rev 2341) @@ -128,6 +128,18 @@ } +void toEditExtensions::editEnabled(bool enable) { + IncMenu->setEnabled(enable); + IndentMenu->setEnabled(enable); + CaseMenu->setEnabled(enable); + + Indent->setEnabled(enable); + Deindent->setEnabled(enable); + GotoLine->setEnabled(enable); + + AutoComplete->setEnabled(enable); +} + void toEditExtensions::gotoLine() { if (Current) { toEditExtensionGoto dialog(Current); @@ -553,6 +565,11 @@ toMainWidget()->addButtonApplication(Indent); EditExtensions.receivedFocus(NULL); + + connect(toMainWidget(), + SIGNAL(editEnabled(bool)), + &EditExtensions, + SLOT(editEnabled(bool))); } virtual QWidget *configurationTab(QWidget *parent) { Modified: branches/tora-1.4/tora/src/toeditextensions.h =================================================================== --- branches/tora-1.4/tora/src/toeditextensions.h 2007-12-15 18:57:02 UTC (rev 2340) +++ branches/tora-1.4/tora/src/toeditextensions.h 2007-12-15 19:42:32 UTC (rev 2341) @@ -77,6 +77,8 @@ void gotoLine(void); void autoComplete(void); + + void editEnabled(bool); }; Modified: branches/tora-1.4/tora/src/tomain.cpp =================================================================== --- branches/tora-1.4/tora/src/tomain.cpp 2007-12-15 18:57:02 UTC (rev 2340) +++ branches/tora-1.4/tora/src/tomain.cpp 2007-12-15 19:42:32 UTC (rev 2341) @@ -1149,6 +1149,8 @@ searchNextAct->setEnabled(false); selectAllAct->setEnabled(false); readAllAct->setEnabled(false); + + emit editEnabled(false); } else if(edit && edit == Edit) { openAct->setEnabled(open); @@ -1167,6 +1169,8 @@ searchNextAct->setEnabled(search); selectAllAct->setEnabled(search); readAllAct->setEnabled(readAll); + + emit editEnabled(open); } } Modified: branches/tora-1.4/tora/src/tomain.h =================================================================== --- branches/tora-1.4/tora/src/tomain.h 2007-12-15 18:57:02 UTC (rev 2340) +++ branches/tora-1.4/tora/src/tomain.h 2007-12-15 19:42:32 UTC (rev 2341) @@ -279,10 +279,10 @@ * is cleared. */ static void editDisable(toEditWidget *edit); + /** Get current edit widget */ - toEditWidget *editWidget() - { + toEditWidget *editWidget() { return Edit; } @@ -292,6 +292,7 @@ * This is the tool with the highest priority, usually the SQL worksheet. */ void createDefault(void); + /** * Set coordinates in the statusbar. * @@ -450,6 +451,10 @@ * @param cmt True if commit, false if rollback. */ void willCommit(toConnection &conn, bool cmt); + /** + * emitted when widgets related to editing. + */ + void editEnabled(bool en); public slots: /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <su...@us...> - 2007-12-15 22:20:44
|
Revision: 2343 http://tora.svn.sourceforge.net/tora/?rev=2343&view=rev Author: subik Date: 2007-12-15 14:19:14 -0800 (Sat, 15 Dec 2007) Log Message: ----------- Modified Paths: -------------- branches/tora-1.4/tora/src/CMakeLists.txt branches/tora-1.4/tora/src/tobrowser.cpp Modified: branches/tora-1.4/tora/src/CMakeLists.txt =================================================================== --- branches/tora-1.4/tora/src/CMakeLists.txt 2007-12-15 20:31:54 UTC (rev 2342) +++ branches/tora-1.4/tora/src/CMakeLists.txt 2007-12-15 22:19:14 UTC (rev 2343) @@ -342,13 +342,17 @@ # static TARGET_LINK_LIBRARIES(${EXE_NAME} ${TORA_LOKI_LIB}) IF (WANT_INTERNAL_QSCINTILLA) - TARGET_LINK_LIBRARIES(${EXE_NAME} ${TORA_QSCINTILLA_LIB}) + TARGET_LINK_LIBRARIES(${EXE_NAME} ${TORA_QSCINTILLA_LIB} ${QT_LIBRARIES}) ENDIF (WANT_INTERNAL_QSCINTILLA) +# prevent opening the cmd.exe window +IF (WIN32) + TARGET_LINK_LIBRARIES(${EXE_NAME} "-mwindows") +ENDIF (WIN32) -INSTALL (TARGETS - ${EXE_NAME} - RUNTIME DESTINATION - bin -#${CMAKE_INSTALL_PREFIX}/bin - ) +IF (WIN32) + INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION .) +ELSE (WIN32) + INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib) +ENDIF (WIN32) + Modified: branches/tora-1.4/tora/src/tobrowser.cpp =================================================================== --- branches/tora-1.4/tora/src/tobrowser.cpp 2007-12-15 20:31:54 UTC (rev 2342) +++ branches/tora-1.4/tora/src/tobrowser.cpp 2007-12-15 22:19:14 UTC (rev 2343) @@ -109,10 +109,10 @@ #include "icons/tobrowser.xpm" #include "icons/view.xpm" #include "icons/trash.xpm" -#ifndef TO_NO_ORACLE +//#ifndef TO_NO_ORACLE #include "icons/offline.xpm" #include "icons/online.xpm" -#endif +//#endif #ifdef TOEXTENDED_MYSQL #include "icons/new.xpm" #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-16 04:23:36
|
Revision: 2344 http://tora.svn.sourceforge.net/tora/?rev=2344&view=rev Author: mrjohnson0 Date: 2007-12-15 20:23:39 -0800 (Sat, 15 Dec 2007) Log Message: ----------- don't show results half of splitter until there's something to show. Modified Paths: -------------- branches/tora-1.4/tora/src/toworksheet.cpp branches/tora-1.4/tora/src/toworksheet.h Modified: branches/tora-1.4/tora/src/toworksheet.cpp =================================================================== --- branches/tora-1.4/tora/src/toworksheet.cpp 2007-12-15 22:19:14 UTC (rev 2343) +++ branches/tora-1.4/tora/src/toworksheet.cpp 2007-12-16 04:23:39 UTC (rev 2344) @@ -88,8 +88,8 @@ #include <qtoolbutton.h> #include <qtooltip.h> #include <qworkspace.h> -//Added by qt3to4: -#include <Q3ValueList> + +#include <QList> #include <QKeyEvent> #include <Q3CString> @@ -416,15 +416,11 @@ LastLine = LastOffset = -1; LastID = 0; - QSplitter *splitter = new QSplitter(Qt::Vertical, this); + EditSplitter = new QSplitter(Qt::Vertical, this); - Editor = new toWorksheetText(this, splitter); + Editor = new toWorksheetText(this, EditSplitter); - Q3ValueList<int> list; - list.append(75); - splitter->setSizes(list); - - ResultTab = new toTabWidget(splitter); + ResultTab = new toTabWidget(EditSplitter); Q3VBox *box = new Q3VBox(ResultTab); ResultTab->addTab(box, tr("&Result")); @@ -467,7 +463,7 @@ stattool->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum)); - splitter = new QSplitter(Qt::Horizontal, StatTab); + QSplitter *splitter = new QSplitter(Qt::Horizontal, StatTab); Statistics = new toResultStats(true, splitter); Statistics->setTabWidget(ResultTab); WaitChart = new toResultBar(splitter); @@ -550,6 +546,13 @@ connect(&Poll, SIGNAL(timeout()), this, SLOT(poll())); setFocusProxy(Editor); + + // don't show results yet + + QList<int> list; + list.append(1); + list.append(0); + EditSplitter->setSizes(list); } toWorksheet::toWorksheet(QWidget *main, toConnection &connection, bool autoLoad) @@ -563,7 +566,7 @@ // private for toworksheetwidget toWorksheet::toWorksheet(QWidget *main, const char *name, toConnection &connection) : toToolWidget(WorksheetTool, "worksheetlight.html", main, connection, name) { -// setup(false); + createActions(); } @@ -684,6 +687,7 @@ Result->stop(); return Q3VBox::close(true); } + return false; } @@ -1126,8 +1130,18 @@ Editor->setSelection(line, pos, endLine, endCol); t = t.mid(i); } - if (t.trimmed().length()) + + if (t.trimmed().length()) { + // move splitter if currently hidden + QList<int> list = EditSplitter->sizes(); + if(list[1] == 0) { + list[0] = 1; + list[1] = 1; + } + EditSplitter->setSizes(list); + query(t, type); + } } void toWorksheet::execute() { Modified: branches/tora-1.4/tora/src/toworksheet.h =================================================================== --- branches/tora-1.4/tora/src/toworksheet.h 2007-12-15 22:19:14 UTC (rev 2343) +++ branches/tora-1.4/tora/src/toworksheet.h 2007-12-16 04:23:39 UTC (rev 2344) @@ -81,26 +81,27 @@ friend class toWorksheetWidget; toHighlightedText *Editor; - toTabWidget *ResultTab; - toResultLong *Result; - toResultPlan *Plan; - QWidget *CurrentTab; - QString QueryString; - toResultItem *Resources; - toResultStats *Statistics; - toResultBar *WaitChart; - toResultBar *IOChart; - toListView *Logging; - QSplitter *ResourceSplitter; - toResultLong *LongOps; - toVisualize *Visualize; - Q3ListViewItem *LastLogItem; - QWidget *StatTab; - bool TryStrip; - toResultCols *Columns; - QComboBox *Refresh; - QLabel *Started; - toResultCombo *Schema; + toTabWidget *ResultTab; + toResultLong *Result; + toResultPlan *Plan; + QWidget *CurrentTab; + QString QueryString; + toResultItem *Resources; + toResultStats *Statistics; + toResultBar *WaitChart; + toResultBar *IOChart; + toListView *Logging; + QSplitter *EditSplitter; + QSplitter *ResourceSplitter; + toResultLong *LongOps; + toVisualize *Visualize; + Q3ListViewItem *LastLogItem; + QWidget *StatTab; + bool TryStrip; + toResultCols *Columns; + QComboBox *Refresh; + QLabel *Started; + toResultCombo *Schema; int RefreshSeconds; QTimer RefreshTimer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-17 09:29:44
|
Revision: 2347 http://tora.svn.sourceforge.net/tora/?rev=2347&view=rev Author: mrjohnson0 Date: 2007-12-17 01:29:47 -0800 (Mon, 17 Dec 2007) Log Message: ----------- qt4 port Modified Paths: -------------- branches/tora-1.4/tora/src/toanalyze.cpp branches/tora-1.4/tora/src/toanalyze.h branches/tora-1.4/tora/src/toworksheetstatistic.cpp branches/tora-1.4/tora/src/toworksheetstatistic.h Modified: branches/tora-1.4/tora/src/toanalyze.cpp =================================================================== --- branches/tora-1.4/tora/src/toanalyze.cpp 2007-12-16 20:56:24 UTC (rev 2346) +++ branches/tora-1.4/tora/src/toanalyze.cpp 2007-12-17 09:29:47 UTC (rev 2347) @@ -1,39 +1,39 @@ /***** -* -* TOra - An Oracle Toolkit for DBA's and developers -* Copyright (C) 2003-2005 Quest Software, Inc -* Portions Copyright (C) 2005 Other Contributors -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; only version 2 of -* the License is valid for this program. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* -* As a special exception, you have permission to link this program -* with the Oracle Client libraries and distribute executables, as long -* as you follow the requirements of the GNU GPL in regard to all of the -* software in the executable aside from Oracle client libraries. -* -* Specifically you are not permitted to link this program with the -* Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. -* And you are not permitted to distribute binaries compiled against -* these libraries without written consent from Quest Software, Inc. -* Observe that this does not disallow linking to the Qt Free Edition. -* -* You may link this product with any GPL'd Qt library such as Qt/Free -* -* All trademarks belong to their respective owners. -* -*****/ + * + * TOra - An Oracle Toolkit for DBA's and developers + * Copyright (C) 2003-2005 Quest Software, Inc + * Portions Copyright (C) 2005 Other Contributors + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; only version 2 of + * the License is valid for this program. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * As a special exception, you have permission to link this program + * with the Oracle Client libraries and distribute executables, as long + * as you follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from Oracle client libraries. + * + * Specifically you are not permitted to link this program with the + * Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. + * And you are not permitted to distribute binaries compiled against + * these libraries without written consent from Quest Software, Inc. + * Observe that this does not disallow linking to the Qt Free Edition. + * + * You may link this product with any GPL'd Qt library such as Qt/Free + * + * All trademarks belong to their respective owners. + * + *****/ #include "utils.h" @@ -58,11 +58,10 @@ #include <qsplitter.h> #include <qtabwidget.h> #include <qtimer.h> -#include <q3toolbar.h> #include <qtoolbutton.h> -#include <qworkspace.h> -//Added by qt3to4: + #include <QPixmap> +#include <QVBoxLayout> #include "icons/execute.xpm" #include "icons/refresh.xpm" @@ -70,33 +69,28 @@ #include "icons/stop.xpm" #include "icons/toanalyze.xpm" -class toAnalyzeTool : public toTool -{ - virtual const char **pictureXPM(void) - { +class toAnalyzeTool : public toTool { + virtual const char **pictureXPM(void) { return const_cast<const char**>(toanalyze_xpm); } public: toAnalyzeTool() - : toTool(320, "Statistics Manager") - { } + : toTool(320, "Statistics Manager") { } - virtual void closeWindow(toConnection &connection){}; + virtual void closeWindow(toConnection &connection) {}; - virtual const char *menuItem() - { + virtual const char *menuItem() { return "Statistics Manager"; } - virtual QWidget *toolWindow(QWidget *parent, toConnection &connection) - { + virtual QWidget *toolWindow(QWidget *parent, toConnection &connection) { return new toAnalyze(parent, connection); } - virtual bool canHandle(toConnection &conn) - { + virtual bool canHandle(toConnection &conn) { return toIsOracle(conn) || toIsMySQL(conn); } }; + static toAnalyzeTool AnalyzeTool; static toSQL SQLListTablesMySQL("toAnalyze:ListTables", @@ -163,47 +157,48 @@ "Display available saved statements. Must have same first " "column and %1"); + toAnalyze::toAnalyze(QWidget *main, toConnection &connection) - : toToolWidget(AnalyzeTool, "analyze.html", main, connection) -{ + : toToolWidget(AnalyzeTool, "analyze.html", main, connection) { + Tabs = new QTabWidget(this); - Q3VBox *box = new Q3VBox(Tabs); - Tabs->addTab(box, tr("Analyze")); + QWidget *container = new QWidget(Tabs); + QVBoxLayout *box = new QVBoxLayout; + Tabs->addTab(container, tr("Analyze")); - QToolBar *toolbar = toAllocBar(box, tr("Statistics Manager")); + QToolBar *toolbar = toAllocBar(container, tr("Statistics Manager")); + box->addWidget(toolbar); - new QToolButton(QPixmap(const_cast<const char**>(refresh_xpm)), - tr("Refresh"), - tr("Refresh"), - this, SLOT(refresh()), - toolbar); + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(refresh_xpm))), + tr("Refresh"), + this, + SLOT(refresh())); toolbar->addSeparator(); - if (toIsOracle(connection)) - { + + Analyzed = NULL; + if(toIsOracle(connection)) { Analyzed = new QComboBox(toolbar, TO_TOOLBAR_WIDGET_NAME); Analyzed->insertItem(tr("All")); Analyzed->insertItem(tr("Not analyzed")); Analyzed->insertItem(tr("Analyzed")); + toolbar->addWidget(Analyzed); } - else - Analyzed = NULL; Schema = new toResultCombo(toolbar, TO_TOOLBAR_WIDGET_NAME); Schema->setSelected(tr("All")); Schema->additionalItem(tr("All")); - try - { + toolbar->addWidget(Schema); + try { Schema->query(toSQL::sql(toSQL::TOSQL_USERLIST)); } - TOCATCH + TOCATCH; - - if (toIsOracle(connection)) - { + if (toIsOracle(connection)) { Type = new QComboBox(toolbar, TO_TOOLBAR_WIDGET_NAME); Type->insertItem(tr("Tables")); Type->insertItem(tr("Indexes")); + toolbar->addWidget(Type); toolbar->addSeparator(); @@ -212,54 +207,74 @@ Operation->insertItem(tr("Estimate statistics")); Operation->insertItem(tr("Delete statistics")); Operation->insertItem(tr("Validate references")); - connect(Operation, SIGNAL(activated(int)), - this, SLOT(changeOperation(int))); + toolbar->addWidget(Operation); + connect(Operation, + SIGNAL(activated(int)), + this, + SLOT(changeOperation(int))); - new QLabel(" " + tr("for") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME); + toolbar->addWidget( + new QLabel(" " + tr("for") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME)); + For = new QComboBox(toolbar, TO_TOOLBAR_WIDGET_NAME); For->insertItem(tr("All")); For->insertItem(tr("Table")); For->insertItem(tr("Indexed columns")); For->insertItem(tr("Local indexes")); + toolbar->addWidget(For); + toolbar->addSeparator(); - new QLabel(tr("Sample") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME); + + toolbar->addWidget(new QLabel(tr("Sample") + " ", + toolbar, + TO_TOOLBAR_WIDGET_NAME)); + Sample = new QSpinBox(1, 100, 1, toolbar, TO_TOOLBAR_WIDGET_NAME); Sample->setValue(100); Sample->setSuffix(" " + tr("%")); Sample->setEnabled(false); + toolbar->addWidget(Sample); } - else - { + else { Operation = new QComboBox(toolbar, TO_TOOLBAR_WIDGET_NAME); Operation->insertItem(tr("Analyze table")); Operation->insertItem(tr("Optimize table")); - connect(Operation, SIGNAL(activated(int)), - this, SLOT(changeOperation(int))); + toolbar->addWidget(Operation); + connect(Operation, + SIGNAL(activated(int)), + this, + SLOT(changeOperation(int))); - Type = NULL; + Type = NULL; Sample = NULL; - For = NULL; + For = NULL; } toolbar->addSeparator(); - new QLabel(tr("Parallel") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME); + + toolbar->addWidget(new QLabel(tr("Parallel") + " ", + toolbar, + TO_TOOLBAR_WIDGET_NAME)); Parallel = new QSpinBox(1, 100, 1, toolbar, TO_TOOLBAR_WIDGET_NAME); + toolbar->addWidget(Parallel); + toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(execute_xpm)), - tr("Start analyzing"), - tr("Start analyzing"), - this, SLOT(execute()), - toolbar); - new QToolButton(QPixmap(const_cast<const char**>(sql_xpm)), - tr("Display SQL"), - tr("Display SQL"), - this, SLOT(displaySQL()), - toolbar); + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(execute_xpm))), + tr("Start analyzing"), + this, + SLOT(execute())); + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(sql_xpm))), + tr("Display SQL"), + this, + SLOT(displaySQL())); + Current = new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME); Current->setAlignment(Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs); -// toolbar->setStretchableWidget(Current); + toolbar->addWidget(Current); + Current->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, + QSizePolicy::Minimum)); Stop = new QToolButton(QPixmap(const_cast<const char**>(stop_xpm)), tr("Stop current run"), @@ -267,12 +282,17 @@ this, SLOT(stop()), toolbar); Stop->setEnabled(false); + toolbar->addWidget(Stop); - Statistics = new toResultLong(true, false, toQuery::Background, box); + Statistics = new toResultLong(true, false, toQuery::Background, container); Statistics->setSelectionMode(Q3ListView::Extended); Statistics->setReadAll(true); + box->addWidget(Statistics); connect(Statistics, SIGNAL(done()), this, SLOT(fillOwner())); - connect(Statistics, SIGNAL(displayMenu(Q3PopupMenu *)), this, SLOT(displayMenu(Q3PopupMenu *))); + connect(Statistics, + SIGNAL(displayMenu(Q3PopupMenu *)), + this, + SLOT(displayMenu(Q3PopupMenu *))); if (Analyzed) connect(Analyzed, SIGNAL(activated(int)), this, SLOT(refresh())); @@ -280,110 +300,93 @@ if (Type) connect(Type, SIGNAL(activated(int)), this, SLOT(refresh())); - ToolMenu = NULL; - connect(toMainWidget()->workspace(), SIGNAL(windowActivated(QWidget *)), - this, SLOT(windowActivated(QWidget *))); - connect(&Poll, SIGNAL(timeout()), this, SLOT(poll())); - if (toIsOracle(connection)) - { - box = new Q3VBox(Tabs); - toolbar = toAllocBar(box, tr("Explain plans")); + box->setSpacing(0); + box->setContentsMargins(0, 0, 0, 0); + container->setLayout(box); - Tabs->addTab(box, tr("Explain plans")); - QSplitter *splitter = new QSplitter(Qt::Horizontal, box); + if (toIsOracle(connection)) { + container = new QWidget(Tabs); + box = new QVBoxLayout; + toolbar = toAllocBar(container, tr("Explain plans")); + box->addWidget(toolbar); + + Tabs->addTab(container, tr("Explain plans")); + QSplitter *splitter = new QSplitter(Qt::Horizontal, container); + box->addWidget(splitter); Plans = new toResultLong(false, false, toQuery::Background, splitter); Plans->setSelectionMode(Q3ListView::Single); - try - { - Plans->query(toSQL::string(SQLListPlans, - connection).arg(toConfigurationSingle::Instance().globalConfig(CONF_PLAN_TABLE, - DEFAULT_PLAN_TABLE))); + try { + Plans->query(toSQL::string(SQLListPlans, connection).arg( + toConfigurationSingle::Instance().globalConfig( + CONF_PLAN_TABLE, + DEFAULT_PLAN_TABLE))); } - TOCATCH + TOCATCH; - connect(Plans, SIGNAL(selectionChanged()), - this, SLOT(selectPlan())); - new QToolButton(QPixmap(const_cast<const char**>(refresh_xpm)), - tr("Refresh"), - tr("Refresh"), - Plans, SLOT(refresh()), - toolbar); -// toolbar->setStretchableWidget(new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME)); + connect(Plans, + SIGNAL(selectionChanged()), + this, + SLOT(selectPlan())); + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(refresh_xpm))), + tr("Refresh"), + Plans, + SLOT(refresh())); + + QLabel *s = new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME); + s->setAlignment(Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs); + s->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, + QSizePolicy::Minimum)); + toolbar->addWidget(s); + CurrentPlan = new toResultPlan(splitter); Worksheet = new toWorksheetStatistic(Tabs); Tabs->addTab(Worksheet, tr("Worksheet statistics")); + + box->setSpacing(0); + box->setContentsMargins(0, 0, 0, 0); + container->setLayout(box); } - else - { - Plans = NULL; + else { + Plans = NULL; CurrentPlan = NULL; - Worksheet = NULL; + Worksheet = NULL; } refresh(); setFocusProxy(Tabs); } -void toAnalyze::fillOwner(void) -{ - for (Q3ListViewItem *item = Statistics->firstChild();item;item = item->nextSibling()) - { +void toAnalyze::fillOwner(void) { + for (Q3ListViewItem *item = Statistics->firstChild();item;item = item->nextSibling()) { if (toUnnull(item->text(0)).isNull()) item->setText(0, Schema->selected()); } } -void toAnalyze::selectPlan(void) -{ +void toAnalyze::selectPlan(void) { Q3ListViewItem *item = Plans->selectedItem(); if (item) CurrentPlan->query("SAVED:" + item->text(0)); } -void toAnalyze::windowActivated(QWidget *widget) -{ - if (widget == this) - { - if (!ToolMenu) - { -#if 0 // todo - ToolMenu = new Q3PopupMenu(this); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(refresh_xpm)), tr("&Refresh"), - this, SLOT(refresh(void)), toKeySequence(tr("F5", "Statistics|Refresh"))); - - toMainWidget()->menuBar()->insertItem(tr("&Statistics"), ToolMenu, -1, toToolMenuIndex()); -#endif - } - } - else - { - delete ToolMenu; - ToolMenu = NULL; - } -} - -toWorksheetStatistic *toAnalyze::worksheet(void) -{ +toWorksheetStatistic *toAnalyze::worksheet(void) { Tabs->showPage(Worksheet); return Worksheet; } -void toAnalyze::changeOperation(int op) -{ +void toAnalyze::changeOperation(int op) { if (Sample) Sample->setEnabled(op == 1); if (For) For->setEnabled(op == 0 || op == 1); } -void toAnalyze::refresh(void) -{ - try - { +void toAnalyze::refresh(void) { + try { Statistics->setSQL(QString::null); toQList par; QString sql; @@ -391,8 +394,7 @@ sql = toSQL::string(SQLListTables, connection()); else sql = toSQL::string(SQLListIndex, connection()); - if (Schema->selected() != tr("All")) - { + if (Schema->selected() != tr("All")) { par.insert(par.end(), Schema->selected()); if (toIsOracle(connection())) sql += "\n AND owner = :own<char[100]>"; @@ -401,10 +403,8 @@ } else if (toIsMySQL(connection())) sql += " FROM :f1<alldatabases>"; - if (Analyzed) - { - switch (Analyzed->currentItem()) - { + if (Analyzed) { + switch (Analyzed->currentItem()) { default: break; case 1: @@ -418,47 +418,37 @@ Statistics->query(sql, (const toQList &)par); } - TOCATCH + TOCATCH; } -void toAnalyze::poll(void) -{ - try - { +void toAnalyze::poll(void) { + try { int running = 0; - for (std::list<toNoBlockQuery *>::iterator i = Running.begin();i != Running.end();i++) - { + for (std::list<toNoBlockQuery *>::iterator i = Running.begin();i != Running.end();i++) { bool eof = false; - try - { - if ((*i)->poll()) - { + try { + if ((*i)->poll()) { int cols = (*i)->describe().size(); for (int j = 0;j < cols;j++) (*i)->readValueNull(); // Eat the output if any. } - try - { + try { eof = (*i)->eof(); } - catch (const QString &) - { + catch (const QString &) { eof = true; } } - catch (const QString &err) - { + catch (const QString &err) { toStatusMessage(err); eof = true; } - if (eof) - { + if (eof) { QString sql = toShift(Pending); - if (!sql.isEmpty()) - { - delete (*i); + if (!sql.isEmpty()) { + delete(*i); toQList par; (*i) = new toNoBlockQuery(connection(), sql, par); running++; @@ -467,8 +457,7 @@ else running++; } - if (!running) - { + if (!running) { Poll.stop(); refresh(); stop(); @@ -476,24 +465,18 @@ else Current->setText(tr("Running %1 Pending %2").arg(running).arg(Pending.size())); } - TOCATCH + TOCATCH; } -std::list<QString> toAnalyze::getSQL(void) -{ +std::list<QString> toAnalyze::getSQL(void) { std::list<QString> ret; - for (Q3ListViewItem *item = Statistics->firstChild();item;item = item->nextSibling()) - { - if (item->isSelected()) - { - if (toIsOracle(connection())) - { + for (Q3ListViewItem *item = Statistics->firstChild();item;item = item->nextSibling()) { + if (item->isSelected()) { + if (toIsOracle(connection())) { QString sql = QString::fromLatin1("ANALYZE %3 %1.%2 "); QString forc; - if (item->text(0) == QString::fromLatin1("TABLE")) - { - switch (For->currentItem()) - { + if (item->text(0) == QString::fromLatin1("TABLE")) { + switch (For->currentItem()) { case 0: forc = QString::null; break; @@ -509,8 +492,7 @@ } } - switch (Operation->currentItem()) - { + switch (Operation->currentItem()) { case 0: sql += QString::fromLatin1("COMPUTE STATISTICS"); sql += forc; @@ -530,11 +512,9 @@ toPush(ret, sql.arg(item->text(1)).arg(item->text(2)).arg(item->text(0))); } - else - { + else { QString sql; - switch (Operation->currentItem()) - { + switch (Operation->currentItem()) { case 0: sql = QString::fromLatin1("ANALYZE TABLE %1.%2 "); break; @@ -552,8 +532,7 @@ return ret; } -void toAnalyze::displaySQL(void) -{ +void toAnalyze::displaySQL(void) { QString txt; std::list<QString> sql = getSQL(); for (std::list<QString>::iterator i = sql.begin();i != sql.end();i++) @@ -561,19 +540,16 @@ new toMemoEditor(this, txt, -1, -1, true); } -void toAnalyze::execute(void) -{ +void toAnalyze::execute(void) { stop(); std::list<QString> sql = getSQL(); for (std::list<QString>::iterator i = sql.begin();i != sql.end();i++) toPush(Pending, *i); - try - { + try { toQList par; - for (int i = 0;i < Parallel->value();i++) - { + for (int i = 0;i < Parallel->value();i++) { QString sql = toShift(Pending); if (!sql.isEmpty()) toPush(Running, new toNoBlockQuery(connection(), sql, par)); @@ -582,38 +558,31 @@ Stop->setEnabled(true); poll(); } - TOCATCH + TOCATCH; } -void toAnalyze::stop(void) -{ - try - { +void toAnalyze::stop(void) { + try { for_each(Running.begin(), Running.end(), DeleteObject()); Running.clear(); Pending.clear(); Stop->setEnabled(false); Current->setText(QString::null); - if (!connection().needCommit()) - { - try - { + if (!connection().needCommit()) { + try { connection().rollback(); } - catch (...) - { } + catch (...) { } } } - TOCATCH + TOCATCH; } -void toAnalyze::createTool(void) -{ +void toAnalyze::createTool(void) { AnalyzeTool.createWindow(); } -void toAnalyze::displayMenu(Q3PopupMenu *menu) -{ +void toAnalyze::displayMenu(Q3PopupMenu *menu) { menu->insertSeparator(0); menu->insertItem(QPixmap(const_cast<const char**>(sql_xpm)), tr("Display SQL"), this, SLOT(displaySQL()), 0, 0, 0); menu->insertItem(QPixmap(const_cast<const char**>(execute_xpm)), tr("Execute"), this, SLOT(execute()), 0, 0, 0); Modified: branches/tora-1.4/tora/src/toanalyze.h =================================================================== --- branches/tora-1.4/tora/src/toanalyze.h 2007-12-16 20:56:24 UTC (rev 2346) +++ branches/tora-1.4/tora/src/toanalyze.h 2007-12-17 09:29:47 UTC (rev 2347) @@ -44,7 +44,8 @@ #include "totool.h" #include <list> -//Added by qt3to4: + +#include <QAction> #include <Q3PopupMenu> #include <QLabel> @@ -59,31 +60,30 @@ class toResultView; class toWorksheetStatistic; -class toAnalyze : public toToolWidget -{ - Q_OBJECT +class toAnalyze : public toToolWidget { + Q_OBJECT; - QTabWidget *Tabs; - toResultView *Statistics; - QComboBox *Analyzed; - toResultCombo *Schema; - QComboBox *Type; - QComboBox *Operation; - QComboBox *For; - QSpinBox *Sample; - QSpinBox *Parallel; - QLabel *Current; - QToolButton *Stop; - toBackground Poll; - toResultView *Plans; - toResultPlan *CurrentPlan; + QTabWidget *Tabs; + toResultView *Statistics; + QComboBox *Analyzed; + toResultCombo *Schema; + QComboBox *Type; + QComboBox *Operation; + QComboBox *For; + QSpinBox *Sample; + QSpinBox *Parallel; + QLabel *Current; + QToolButton *Stop; + toBackground Poll; + toResultView *Plans; + toResultPlan *CurrentPlan; toWorksheetStatistic *Worksheet; std::list<toNoBlockQuery *> Running; std::list<QString> Pending; - Q3PopupMenu *ToolMenu; std::list<QString> getSQL(void); + public: toAnalyze(QWidget *parent, toConnection &connection); @@ -98,7 +98,6 @@ virtual void poll(void); virtual void stop(void); virtual void refresh(void); - virtual void windowActivated(QWidget *widget); virtual void selectPlan(void); virtual void fillOwner(void); virtual void displayMenu(Q3PopupMenu *); Modified: branches/tora-1.4/tora/src/toworksheetstatistic.cpp =================================================================== --- branches/tora-1.4/tora/src/toworksheetstatistic.cpp 2007-12-16 20:56:24 UTC (rev 2346) +++ branches/tora-1.4/tora/src/toworksheetstatistic.cpp 2007-12-17 09:29:47 UTC (rev 2347) @@ -45,15 +45,16 @@ #include <qcheckbox.h> #include <qlabel.h> -#include <q3popupmenu.h> #include <qsplitter.h> #include <qtoolbar.h> #include <qtoolbutton.h> #include <qtooltip.h> -//Added by qt3to4: + #include <Q3CString> -#include <Q3ValueList> +#include <QList> #include <QPixmap> +#include <QMenu> +#include <QVBoxLayout> #include "icons/fileopen.xpm" #include "icons/filesave.xpm" @@ -64,162 +65,179 @@ toAnalyze *toWorksheetStatistic::Widget; toWorksheetStatistic::toWorksheetStatistic(QWidget *parent) - : Q3VBox(parent) -{ + : QWidget(parent) { + + QVBoxLayout *vlayout = new QVBoxLayout; + vlayout->setSpacing(0); + vlayout->setContentsMargins(0, 0, 0, 0); + QToolBar *toolbar = toAllocBar(this, tr("Server Tuning")); + vlayout->addWidget(toolbar); - new QToolButton(QPixmap(const_cast<const char**>(fileopen_xpm)), - tr("Load statistics from file"), - tr("Load statistics from file"), - this, SLOT(load(void)), - toolbar); + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(fileopen_xpm))), + tr("Load statistics from file"), + this, + SLOT(load(void))); - QToolButton *button = new toPopupButton(QPixmap(const_cast<const char**>(filesave_xpm)), - tr("Save statistics to file"), - tr("Save statistics to file"), - toolbar); - SaveMenu = new Q3PopupMenu(button); - button->setPopup(SaveMenu); + SaveMenu = new QMenu(toolbar); + SaveMenu->setIcon(QPixmap(const_cast<const char**>(filesave_xpm))); + SaveMenu->setTitle(tr("Save statistics to file")); + toolbar->addAction(SaveMenu->menuAction()); connect(SaveMenu, SIGNAL(aboutToShow()), this, SLOT(displayMenu())); connect(SaveMenu, SIGNAL(activated(int)), this, SLOT(save(int))); toolbar->addSeparator(); - button = new toPopupButton(QPixmap(const_cast<const char**>(trash_xpm)), - tr("Remove statistics"), - tr("Remove statistics"), - toolbar); - RemoveMenu = new Q3PopupMenu(button); - button->setPopup(RemoveMenu); - connect(RemoveMenu, SIGNAL(aboutToShow()), this, SLOT(displayMenu())); - connect(RemoveMenu, SIGNAL(activated(int)), this, SLOT(remove - (int))); + QMenu *remove = new QMenu(toolbar); + remove->setIcon(QPixmap(const_cast<const char**>(trash_xpm))); + remove->setTitle(tr("Remove statistics")); + toolbar->addAction(remove->menuAction()); + connect(remove, SIGNAL(aboutToShow()), this, SLOT(displayMenu())); + connect(remove, SIGNAL(activated(int)), this, SLOT(remove(int))); Splitter = new QSplitter(Qt::Vertical, this); + vlayout->addWidget(Splitter); toolbar->addSeparator(); ShowCharts = new QToolButton(toolbar); - ShowCharts->setToggleButton(true); - ShowCharts->setIconSet(QIcon(QPixmap(const_cast<const char**>(grid_xpm)))); - QToolTip::add - (ShowCharts, tr("Display charts")); - ShowCharts->setOn(true); + ShowCharts->setCheckable(true); + ShowCharts->setIcon(QIcon(QPixmap(const_cast<const char**>(grid_xpm)))); + ShowCharts->setToolTip(tr("Display charts")); + ShowCharts->setChecked(true); connect(ShowCharts, SIGNAL(toggled(bool)), this, SLOT(showCharts(bool))); + toolbar->addWidget(ShowCharts); ShowPlans = new QToolButton(toolbar); - ShowPlans->setToggleButton(true); - ShowPlans->setIconSet(QIcon(QPixmap(const_cast<const char**>(tree_xpm)))); - QToolTip::add - (ShowPlans, tr("Display execution plans")); - ShowPlans->setOn(true); + ShowPlans->setCheckable(true); + ShowPlans->setIcon(QIcon(QPixmap(const_cast<const char**>(tree_xpm)))); + ShowPlans->setToolTip(tr("Display execution plans")); + ShowPlans->setChecked(true); connect(ShowPlans, SIGNAL(toggled(bool)), this, SLOT(showPlans(bool))); + toolbar->addWidget(ShowPlans); -// toolbar->setStretchableWidget(new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME)); + QWidget *w = new QWidget(toolbar); + toolbar->addWidget(w); + w->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, + QSizePolicy::Minimum)); Dummy = new QWidget(Splitter); - try - { + try { Tool = dynamic_cast<toAnalyze *>(toCurrentTool(this)); if (!Widget) Widget = Tool; } - TOCATCH + TOCATCH; + + setLayout(vlayout); } -toWorksheetStatistic::~toWorksheetStatistic() -{ +toWorksheetStatistic::~toWorksheetStatistic() { if (Widget == Tool) Widget = NULL; } -void toWorksheetStatistic::saveStatistics(std::map<Q3CString, QString> &stats) -{ +void toWorksheetStatistic::saveStatistics(std::map<Q3CString, QString> &stats) { if (!Widget) toAnalyze::createTool(); if (Widget) Widget->worksheet()->addStatistics(stats); } -void toWorksheetStatistic::addStatistics(std::map<Q3CString, QString> &stats) -{ +void toWorksheetStatistic::addStatistics(std::map<Q3CString, QString> &stats) { data cur; - cur.Top = new Q3VBox(Splitter); - Q3HBox *box = new Q3HBox(cur.Top); - box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - cur.Label = new QLabel(stats["Description"], box); + cur.Top = new QWidget(Splitter); + QVBoxLayout *vbox = new QVBoxLayout; + vbox->setSpacing(0); + vbox->setContentsMargins(0, 0, 0, 0); + + QWidget *hcontainer = new QWidget(cur.Top); + QHBoxLayout *box = new QHBoxLayout; + box->setSpacing(0); + box->setContentsMargins(0, 0, 0, 0); + hcontainer->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, + QSizePolicy::Fixed)); + vbox->addWidget(hcontainer); + + cur.Label = new QLabel(stats["Description"], hcontainer); cur.Label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred)); - QCheckBox *check = new QCheckBox(tr("Hide"), box); - cur.Charts = new toHideSplitter(Qt::Horizontal, cur.Top, this); - connect(check, SIGNAL(toggled(bool)), cur.Charts, SLOT(setHidden(bool))); + box->addWidget(cur.Label); + + QCheckBox *check = new QCheckBox(tr("Hide"), hcontainer); + check->setCheckState(Qt::Unchecked); + box->addWidget(check); + + cur.Charts = new QSplitter(Qt::Horizontal, cur.Top); + vbox->addWidget(cur.Charts); + cur.Statistics = new toListView(cur.Charts); cur.Statistics->importData(stats, "Stat"); + cur.Wait = new toBarChart(cur.Charts); cur.Wait->importData(stats, "Wait"); + cur.IO = new toBarChart(cur.Charts); cur.IO->importData(stats, "IO"); + cur.Plan = new toListView(cur.Charts); cur.Plan->importData(stats, "Plan"); - Q3ValueList<int> sizes; + connect(check, SIGNAL(toggled(bool)), cur.Charts, SLOT(setHidden(bool))); + + cur.Top->setLayout(vbox); + hcontainer->setLayout(box); + + QList<int> sizes; sizes << 1 << 1 << 1 << 1; cur.Charts->setSizes(sizes); - if (!cur.Plan->firstChild()) - { + if (!cur.Plan->firstChild()) { delete cur.Plan; cur.Plan = NULL; } - else if (!ShowPlans->isOn()) + else if (!ShowPlans->isChecked()) cur.Plan->hide(); - if (!ShowCharts->isOn()) - { + + if (!ShowCharts->isChecked()) { cur.Statistics->hide(); cur.Wait->hide(); cur.IO->hide(); } + cur.Top->show(); + hcontainer->show(); + cur.Charts->show(); setFocus(); Open.insert(Open.end(), cur); - if (Dummy) - { + if (Dummy) { delete Dummy; Dummy = NULL; } } -void toWorksheetStatistic::showPlans(bool show) -{ - for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) - { - if ((*i).Plan) - { - if (show) - { +void toWorksheetStatistic::showPlans(bool show) { + for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) { + if ((*i).Plan) { + if (show) { (*i).Plan->show(); } - else - { + else { (*i).Plan->hide(); } } } } -void toWorksheetStatistic::showCharts(bool show) -{ - for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) - { - if (show) - { +void toWorksheetStatistic::showCharts(bool show) { + for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) { + if (show) { (*i).Statistics->show(); (*i).Wait->show(); (*i).IO->show(); } - else - { + else { (*i).Statistics->hide(); (*i).Wait->hide(); (*i).IO->hide(); @@ -227,16 +245,12 @@ } } -void toWorksheetStatistic::save(int selid) -{ +void toWorksheetStatistic::save(int selid) { int id = 1; - for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) - { - if (selid == id) - { + for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) { + if (selid == id) { QString fn = toSaveFilename(QString::null, QString::fromLatin1("*.stat"), this); - if (!fn.isEmpty()) - { + if (!fn.isEmpty()) { std::map<Q3CString, QString> stat; (*i).Statistics->exportData(stat, "Stat"); (*i).IO->exportData(stat, "IO"); @@ -244,8 +258,7 @@ if ((*i).Plan) (*i).Plan->exportData(stat, "Plan"); stat["Description"] = (*i).Label->text(); - try - { + try { toConfigurationSingle::Instance().saveMap(fn, stat); } TOCATCH @@ -256,17 +269,12 @@ } } -void toWorksheetStatistic::remove -(int selid) -{ +void toWorksheetStatistic::remove(int selid) { int id = 1; - for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) - { - if (selid == id) - { - delete (*i).Top; - if (Open.size() == 1) - { + for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) { + if (selid == id) { + delete(*i).Top; + if (Open.size() == 1) { Dummy = new QWidget(Splitter); Dummy->show(); } @@ -277,13 +285,10 @@ } } -void toWorksheetStatistic::load(void) -{ +void toWorksheetStatistic::load(void) { QString filename = toOpenFilename(QString::null, QString::fromLatin1("*.stat"), this); - if (!filename.isEmpty()) - { - try - { + if (!filename.isEmpty()) { + try { std::map<Q3CString, QString> ret; toConfigurationSingle::Instance().loadMap(filename, ret); addStatistics(ret); @@ -292,40 +297,13 @@ } } -void toWorksheetStatistic::displayMenu(void) -{ +void toWorksheetStatistic::displayMenu(void) { SaveMenu->clear(); RemoveMenu->clear(); int id = 1; - for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) - { + for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) { SaveMenu->insertItem((*i).Label->text(), id); RemoveMenu->insertItem((*i).Label->text(), id); id++; } } - -void toWorksheetStatistic::updateSplitter(void) -{ - Q3ValueList<int> sizes = Splitter->sizes(); - - int id = 0; - for (std::list<data>::iterator i = Open.begin();i != Open.end();i++) - { - if ((*i).Charts->isHidden()) - sizes[id] = 0; - else - sizes[id] = (*i).Charts->height(); - id++; - } - Splitter->setSizes(sizes); -} - -void toHideSplitter::setHidden(bool hid) -{ - if (hid) - hide(); - else - show(); - StatList->updateSplitter(); -} Modified: branches/tora-1.4/tora/src/toworksheetstatistic.h =================================================================== --- branches/tora-1.4/tora/src/toworksheetstatistic.h 2007-12-16 20:56:24 UTC (rev 2346) +++ branches/tora-1.4/tora/src/toworksheetstatistic.h 2007-12-17 09:29:47 UTC (rev 2347) @@ -44,42 +44,27 @@ #include <map> #include <qsplitter.h> -#include <q3vbox.h> -//Added by qt3to4: -#include <Q3PopupMenu> + +#include <QMenu> #include <Q3CString> #include <QLabel> #include <QToolButton> class QLabel; -class Q3PopupMenu; class QSplitter; class toAnalyze; class toBarChart; class toListView; class toWorksheetStatistic; -class toHideSplitter : public QSplitter -{ - Q_OBJECT - toWorksheetStatistic *StatList; -public: - toHideSplitter(Qt::Orientation o, QWidget *parent, toWorksheetStatistic *statlist) - : QSplitter(o, parent), StatList(statlist) - { } -public slots: - void setHidden(bool hid); -}; -class toWorksheetStatistic : public Q3VBox -{ - Q_OBJECT +class toWorksheetStatistic : public QWidget { + Q_OBJECT; - struct data - { - Q3VBox *Top; - QLabel *Label; - QSplitter *Charts; + struct data { + QWidget *Top; + QLabel *Label; + QSplitter *Charts; toListView *Statistics; toBarChart *Wait; toBarChart *IO; @@ -88,16 +73,17 @@ std::list<data> Open; - Q3PopupMenu *SaveMenu; - Q3PopupMenu *RemoveMenu; + QMenu *SaveMenu; + QMenu *RemoveMenu; static toAnalyze *Widget; - toAnalyze *Tool; - QSplitter *Splitter; - QWidget *Dummy; + toAnalyze *Tool; + QSplitter *Splitter; + QWidget *Dummy; QToolButton *ShowPlans; QToolButton *ShowCharts; + public: toWorksheetStatistic(QWidget *parent); ~toWorksheetStatistic(); @@ -106,15 +92,13 @@ void addStatistics(std::map<Q3CString, QString> &stats); - void updateSplitter(void); -public slots: + public slots: virtual void showPlans(bool); virtual void showCharts(bool); virtual void save(int); - virtual void remove - (int); + virtual void remove(int); virtual void load(void); virtual void displayMenu(void); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-18 04:54:48
|
Revision: 2351 http://tora.svn.sourceforge.net/tora/?rev=2351&view=rev Author: mrjohnson0 Date: 2007-12-17 20:54:51 -0800 (Mon, 17 Dec 2007) Log Message: ----------- simple class to replace copy-n-paste code for creating a toolbar widget that'll resize horizontally. Modified Paths: -------------- branches/tora-1.4/tora/src/utils.cpp branches/tora-1.4/tora/src/utils.h Modified: branches/tora-1.4/tora/src/utils.cpp =================================================================== --- branches/tora-1.4/tora/src/utils.cpp 2007-12-18 04:53:51 UTC (rev 2350) +++ branches/tora-1.4/tora/src/utils.cpp 2007-12-18 04:54:51 UTC (rev 2351) @@ -1242,3 +1242,8 @@ return found; } + +toSpacer::toSpacer(QWidget *parent) : QWidget(parent) { + setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, + QSizePolicy::Minimum)); +} Modified: branches/tora-1.4/tora/src/utils.h =================================================================== --- branches/tora-1.4/tora/src/utils.h 2007-12-18 04:53:51 UTC (rev 2350) +++ branches/tora-1.4/tora/src/utils.h 2007-12-18 04:54:51 UTC (rev 2351) @@ -476,13 +476,20 @@ * std::min name collisions on windows/cygwin * */ -//#ifdef Q_OS_WIN32 -//# define TO_MIN min -//#else -//# define TO_MIN std::min -//#endif #define TO_MIN qMin #define QTRANS(x,y) (qApp?qApp->translate(x,y):QString::fromLatin1(y)) +/** + * simple class to provide an empty widget that will resize horizontally + */ +class toSpacer : public QWidget { + Q_OBJECT; + +public: + toSpacer(QWidget *parent = NULL); + ~toSpacer(void) { + } +}; + #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-18 04:55:45
|
Revision: 2352 http://tora.svn.sourceforge.net/tora/?rev=2352&view=rev Author: mrjohnson0 Date: 2007-12-17 20:55:49 -0800 (Mon, 17 Dec 2007) Log Message: ----------- qt4 port. removed tool menu, it's pointless to have a whole menu for one item that's also on the toolbar... Modified Paths: -------------- branches/tora-1.4/tora/src/toinvalid.cpp branches/tora-1.4/tora/src/toinvalid.h Modified: branches/tora-1.4/tora/src/toinvalid.cpp =================================================================== --- branches/tora-1.4/tora/src/toinvalid.cpp 2007-12-18 04:54:51 UTC (rev 2351) +++ branches/tora-1.4/tora/src/toinvalid.cpp 2007-12-18 04:55:49 UTC (rev 2352) @@ -1,39 +1,39 @@ /***** -* -* TOra - An Oracle Toolkit for DBA's and developers -* Copyright (C) 2003-2005 Quest Software, Inc -* Portions Copyright (C) 2005 Other Contributors -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; only version 2 of -* the License is valid for this program. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* -* As a special exception, you have permission to link this program -* with the Oracle Client libraries and distribute executables, as long -* as you follow the requirements of the GNU GPL in regard to all of the -* software in the executable aside from Oracle client libraries. -* -* Specifically you are not permitted to link this program with the -* Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. -* And you are not permitted to distribute binaries compiled against -* these libraries without written consent from Quest Software, Inc. -* Observe that this does not disallow linking to the Qt Free Edition. -* -* You may link this product with any GPL'd Qt library such as Qt/Free -* -* All trademarks belong to their respective owners. -* -*****/ + * + * TOra - An Oracle Toolkit for DBA's and developers + * Copyright (C) 2003-2005 Quest Software, Inc + * Portions Copyright (C) 2005 Other Contributors + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; only version 2 of + * the License is valid for this program. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * As a special exception, you have permission to link this program + * with the Oracle Client libraries and distribute executables, as long + * as you follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from Oracle client libraries. + * + * Specifically you are not permitted to link this program with the + * Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. + * And you are not permitted to distribute binaries compiled against + * these libraries without written consent from Quest Software, Inc. + * Observe that this does not disallow linking to the Qt Free Edition. + * + * You may link this product with any GPL'd Qt library such as Qt/Free + * + * All trademarks belong to their respective owners. + * + *****/ #include "utils.h" @@ -50,18 +50,14 @@ #include "tosql.h" #include "totool.h" -#include <qlabel.h> -#include <qlineedit.h> -#include <qmenubar.h> -#include <q3popupmenu.h> -#include <q3progressdialog.h> #include <qsplitter.h> #include <qtoolbar.h> #include <qtoolbutton.h> #include <qworkspace.h> -//Added by qt3to4: -#include <Q3ValueList> + #include <QPixmap> +#include <QProgressDialog> +#include <QList> #include "icons/refresh.xpm" #include "icons/toinvalid.xpm" @@ -86,47 +82,47 @@ " ORDER BY Type,Line", "Get lines with errors in object (Observe first line 0)"); -class toInvalidTool : public toTool -{ - virtual const char **pictureXPM(void) - { + +class toInvalidTool : public toTool { + virtual const char **pictureXPM(void) { return const_cast<const char**>(toinvalid_xpm); } public: toInvalidTool() - : toTool(130, "Invalid Objects") - { } - virtual const char *menuItem() - { + : toTool(130, "Invalid Objects") { } + virtual const char *menuItem() { return "Invalid Objects"; } - virtual QWidget *toolWindow(QWidget *parent, toConnection &connection) - { + virtual QWidget *toolWindow(QWidget *parent, toConnection &connection) { return new toInvalid(parent, connection); } - virtual void closeWindow(toConnection &connection){}; + virtual void closeWindow(toConnection &connection) {}; }; + static toInvalidTool InvalidTool; + toInvalid::toInvalid(QWidget *main, toConnection &connection) - : toToolWidget(InvalidTool, "invalid.html", main, connection) -{ + : toToolWidget(InvalidTool, "invalid.html", main, connection) { + QToolBar *toolbar = toAllocBar(this, tr("Invalid Objects")); - new QToolButton(QPixmap(const_cast<const char**>(refresh_xpm)), - tr("Refresh list"), - tr("Refresh list"), - this, SLOT(refresh()), - toolbar); + QAction *refreshAct = + toolbar->addAction( + QIcon(QPixmap(const_cast<const char**>(refresh_xpm))), + tr("Refresh list"), + this, + SLOT(refresh())); + refreshAct->setShortcut(QKeySequence::Refresh); - new QToolButton(QPixmap(const_cast<const char**>(compile_xpm)), - tr("Recompile all invalid"), - tr("Recompile all invalid"), - this, SLOT(recompileSelected()), - toolbar); + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(compile_xpm))), + tr("Recompile all invalid"), + this, + SLOT(recompileSelected())); -// toolbar->setStretchableWidget(new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME)); + toolbar->addWidget(new toSpacer()); + new toChangeConnection(toolbar, TO_TOOLBAR_WIDGET_NAME); QSplitter *splitter = new QSplitter(Qt::Horizontal, this); @@ -142,97 +138,81 @@ connect(Source, SIGNAL(executed()), this, SLOT(refresh())); - ToolMenu = NULL; - connect(toMainWidget()->workspace(), SIGNAL(windowActivated(QWidget *)), - this, SLOT(windowActivated(QWidget *))); - refresh(); setFocusProxy(Objects); } -void toInvalid::recompileSelected(void) -{ - Q3ProgressDialog progress(tr("Recompiling all invalid"), - tr("Cancel"), Objects->childCount(), this, "progress", true); +void toInvalid::recompileSelected(void) { + QProgressDialog progress(tr("Recompiling all invalid"), + tr("Cancel"), + 0, + Objects->childCount(), + this); progress.setCaption("Recompiling"); progress.show(); + for(Q3ListViewItem *item = Objects->firstChild(); + item; + item = item->nextSibling()) { - for (Q3ListViewItem *item = Objects->firstChild();item;item = item->nextSibling()) - { toResultViewItem * ci = dynamic_cast<toResultViewItem *>(item); - if (ci) - { + if(ci) { toConnection &conn = connection(); - progress.setLabelText("Recompiling " + ci->allText(1) + "." + ci->allText(2)); - progress.setProgress(progress.progress() + 1); + progress.setLabelText("Recompiling " + ci->allText(1) + + "." + ci->allText(2)); + progress.setValue(progress.value() + 1); + qApp->processEvents(); - if (progress.wasCancelled()) + + if(progress.wasCanceled()) break; + QString type = ci->allText(2); QString sql; if (type == "INDEX") - sql = "ALTER " + ci->allText(2) + " " + conn.quote(ci->allText(0)) + "." + conn.quote(ci->allText(1)) + " REBUILD"; + sql = "ALTER " + ci->allText(2) + " " + + conn.quote(ci->allText(0)) + "." + + conn.quote(ci->allText(1)) + " REBUILD"; else if (type == "PACKAGE BODY") - sql = "ALTER PACKAGE " + conn.quote(ci->allText(0)) + "." + conn.quote(ci->allText(1)) + " COMPILE BODY"; + sql = "ALTER PACKAGE " + conn.quote(ci->allText(0)) + "." + + conn.quote(ci->allText(1)) + " COMPILE BODY"; else - sql = "ALTER " + ci->allText(2) + " " + conn.quote(ci->allText(0)) + "." + conn.quote(ci->allText(1)) + " COMPILE"; - try - { + sql = "ALTER " + ci->allText(2) + " " + + conn.quote(ci->allText(0)) + "." + + conn.quote(ci->allText(1)) + " COMPILE"; + + try { conn.execute(sql); } - catch (...) - {} + catch(...) + {} } } - if (progress.isVisible()) + + if(progress.isVisible()) progress.close(); + qApp->processEvents(); this->refresh(); } -void toInvalid::windowActivated(QWidget *widget) -{ - if (widget == this) - { - if (!ToolMenu) - { -#if 0 // todo - ToolMenu = new Q3PopupMenu(this); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(refresh_xpm)), tr("&Refresh"), - this, SLOT(refresh(void)), - toKeySequence(tr("F5", "Invalid|Refresh"))); - - toMainWidget()->menuBar()->insertItem(tr("&Invalid"), ToolMenu, -1, toToolMenuIndex()); -#endif - } - } - else - { - delete ToolMenu; - ToolMenu = NULL; - } -} - -void toInvalid::refresh(void) -{ +void toInvalid::refresh(void) { Q3ListViewItem *item = Objects->selectedItem(); QString owner; QString object; QString type; - if (item) - { + if (item) { owner = item->text(0); object = item->text(1); type = item->text(2); } Objects->refresh(); - if (item) - { - for (item = Objects->firstChild();item;item = item->nextSibling()) - { - if (item->text(0) == owner && item->text(1) == object && item->text(2) == type) - { + if (item) { + for (item = Objects->firstChild();item;item = item->nextSibling()) { + if (item->text(0) == owner && + item->text(1) == object && + item->text(2) == type) { + Objects->setSelected(item, true); break; } @@ -241,19 +221,19 @@ } } -void toInvalid::changeSelection(void) -{ - try - { +void toInvalid::changeSelection(void) { + try { Q3ListViewItem *item = Objects->selectedItem(); - if (item) - { + if (item) { Source->changeParams(item->text(0), item->text(1), item->text(2)); std::map<int, QString> Errors; - toQuery errors(connection(), SQLReadErrors, item->text(0), item->text(1), item->text(2)); - while (!errors.eof()) - { + toQuery errors(connection(), + SQLReadErrors, + item->text(0), + item->text(1), + item->text(2)); + while (!errors.eof()) { int line = errors.readValue().toInt(); Errors[line] += QString::fromLatin1(" "); Errors[line] += errors.readValue(); @@ -261,5 +241,5 @@ Source->editor()->setErrors(Errors); } } - TOCATCH + TOCATCH; } Modified: branches/tora-1.4/tora/src/toinvalid.h =================================================================== --- branches/tora-1.4/tora/src/toinvalid.h 2007-12-18 04:54:51 UTC (rev 2351) +++ branches/tora-1.4/tora/src/toinvalid.h 2007-12-18 04:55:49 UTC (rev 2352) @@ -41,21 +41,15 @@ #include "config.h" #include "totool.h" -#include <list> -//Added by qt3to4: -#include <Q3PopupMenu> - -class Q3PopupMenu; class toResultExtract; class toResultView; -class toInvalid : public toToolWidget -{ - Q_OBJECT +class toInvalid : public toToolWidget { + Q_OBJECT; toResultView *Objects; toResultExtract *Source; - Q3PopupMenu *ToolMenu; + public: toInvalid(QWidget *parent, toConnection &connection); @@ -63,7 +57,6 @@ virtual void changeSelection(void); virtual void refresh(void); virtual void recompileSelected(void); - virtual void windowActivated(QWidget *widget); }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-18 06:21:26
|
Revision: 2355 http://tora.svn.sourceforge.net/tora/?rev=2355&view=rev Author: mrjohnson0 Date: 2007-12-17 22:21:30 -0800 (Mon, 17 Dec 2007) Log Message: ----------- qt4 ported Modified Paths: -------------- branches/tora-1.4/tora/src/tosession.cpp branches/tora-1.4/tora/src/tosession.h Modified: branches/tora-1.4/tora/src/tosession.cpp =================================================================== --- branches/tora-1.4/tora/src/tosession.cpp 2007-12-18 05:44:41 UTC (rev 2354) +++ branches/tora-1.4/tora/src/tosession.cpp 2007-12-18 06:21:30 UTC (rev 2355) @@ -1,39 +1,39 @@ /***** -* -* TOra - An Oracle Toolkit for DBA's and developers -* Copyright (C) 2003-2005 Quest Software, Inc -* Portions Copyright (C) 2005 Other Contributors -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; only version 2 of -* the License is valid for this program. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* -* As a special exception, you have permission to link this program -* with the Oracle Client libraries and distribute executables, as long -* as you follow the requirements of the GNU GPL in regard to all of the -* software in the executable aside from Oracle client libraries. -* -* Specifically you are not permitted to link this program with the -* Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. -* And you are not permitted to distribute binaries compiled against -* these libraries without written consent from Quest Software, Inc. -* Observe that this does not disallow linking to the Qt Free Edition. -* -* You may link this product with any GPL'd Qt library such as Qt/Free -* -* All trademarks belong to their respective owners. -* -*****/ + * + * TOra - An Oracle Toolkit for DBA's and developers + * Copyright (C) 2003-2005 Quest Software, Inc + * Portions Copyright (C) 2005 Other Contributors + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; only version 2 of + * the License is valid for this program. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * As a special exception, you have permission to link this program + * with the Oracle Client libraries and distribute executables, as long + * as you follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from Oracle client libraries. + * + * Specifically you are not permitted to link this program with the + * Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. + * And you are not permitted to distribute binaries compiled against + * these libraries without written consent from Quest Software, Inc. + * Observe that this does not disallow linking to the Qt Free Edition. + * + * You may link this product with any GPL'd Qt library such as Qt/Free + * + * All trademarks belong to their respective owners. + * + *****/ #include "utils.h" @@ -79,23 +79,18 @@ #include "icons/tosession.xpm" #include "icons/filter.xpm" -class toSessionTool : public toTool -{ +class toSessionTool : public toTool { protected: - virtual const char **pictureXPM(void) - { + virtual const char **pictureXPM(void) { return const_cast<const char**>(tosession_xpm); } public: toSessionTool() - : toTool(210, "Sessions") - { } - virtual const char *menuItem() - { + : toTool(210, "Sessions") { } + virtual const char *menuItem() { return "Sessions"; } - virtual QWidget *toolWindow(QWidget *parent, toConnection &connection) - { + virtual QWidget *toolWindow(QWidget *parent, toConnection &connection) { if (toIsOracle(connection)) return new toSession(parent, connection); #ifdef TOSESSIONMYSQL_H @@ -106,15 +101,14 @@ return NULL; } - virtual bool canHandle(toConnection &conn) - { + virtual bool canHandle(toConnection &conn) { return toIsOracle(conn) #ifdef TOSESSIONMYSQL_H - || toIsMySQL(conn) + || toIsMySQL(conn) #endif - ; + ; } - virtual void closeWindow(toConnection &connection){}; + virtual void closeWindow(toConnection &connection) {}; }; static toSessionTool SessionTool; @@ -223,16 +217,20 @@ "List sessions, must have same number of culumns and the first and last 2 must be the same"); toSession::toSession(QWidget *main, toConnection &connection) - : toToolWidget(SessionTool, "session.html", main, connection) + : toToolWidget(SessionTool, "session.html", main, connection) { QToolBar *toolbar = toAllocBar(this, tr("Session manager")); - new QToolButton(QPixmap(const_cast<const char**>(refresh_xpm)), - tr("Update sessionlist"), - tr("Update sessionlist"), - this, SLOT(refresh(void)), - toolbar); + refreshAct = + toolbar->addAction( + QIcon(QPixmap(const_cast<const char**>(refresh_xpm))), + tr("Update sessionlist"), + this, + SLOT(refresh(void))); + refreshAct->setShortcut(QKeySequence::Refresh); + toolbar->addSeparator(); + Select = new toResultCombo(toolbar, TO_TOOLBAR_WIDGET_NAME); Select->setSelected(tr("Only active users")); Select->additionalItem(tr("Only active users")); @@ -240,57 +238,77 @@ Select->additionalItem(tr("No background")); Select->additionalItem(tr("No system")); Select->query(toSQL::sql(toSQL::TOSQL_USERLIST)); + toolbar->addWidget(Select); connect(Select, SIGNAL(activated(int)), this, SLOT(refresh())); toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(clock_xpm)), - tr("Enable timed statistics"), - tr("Enable timed statistics"), - this, SLOT(enableStatistics(void)), - toolbar); - new QToolButton(QPixmap(const_cast<const char**>(noclock_xpm)), - tr("Disable timed statistics"), - tr("Disable timed statistics"), - this, SLOT(disableStatistics(void)), - toolbar); + + enableTimedAct = + toolbar->addAction( + QIcon(QPixmap(const_cast<const char**>(clock_xpm))), + tr("Enable timed statistics"), + this, + SLOT(enableStatistics(void))); + + disableTimedAct = + toolbar->addAction( + QIcon(QPixmap(const_cast<const char**>(noclock_xpm))), + tr("Disable timed statistics"), + this, + SLOT(disableStatistics(void))); + toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(kill_xpm)), - tr("Disconnect selected session"), - tr("Disconnect selected session"), - this, SLOT(disconnectSession(void)), - toolbar); + + disconnectAct = + toolbar->addAction( + QIcon(QPixmap(const_cast<const char**>(kill_xpm))), + tr("Disconnect selected session"), + this, + SLOT(disconnectSession(void))); + toolbar->addSeparator(); - new QLabel(tr("Refresh") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME); - connect(Refresh = toRefreshCreate(toolbar, TO_TOOLBAR_WIDGET_NAME), SIGNAL(activated(const QString &)), this, SLOT(changeRefresh(const QString &))); + + toolbar->addWidget( + new QLabel(tr("Refresh") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME)); + + Refresh = toRefreshCreate(toolbar, TO_TOOLBAR_WIDGET_NAME); + connect(Refresh, + SIGNAL(activated(const QString &)), + this, SLOT(changeRefresh(const QString &))); + toolbar->addWidget(Refresh); + toolbar->addSeparator(); QToolButton *btn = new QToolButton(toolbar); - btn->setToggleButton(true); + btn->setCheckable(true); btn->setIconSet(QPixmap(const_cast<const char**>(filter_xpm))); connect(btn, SIGNAL(toggled(bool)), this, SLOT(excludeSelection(bool))); - QToolTip::add - (btn, tr("Exclude selected sessions")); - new QToolButton(QPixmap(const_cast<const char**>(add_xpm)), - tr("Select all sessions"), - tr("Select all sessions"), - this, SLOT(selectAll(void)), - toolbar); - new QToolButton(QPixmap(const_cast<const char**>(minus_xpm)), - tr("Deselect all sessions"), - tr("Deselect all sessions"), - this, SLOT(selectNone(void)), - toolbar); + btn->setToolTip(tr("Exclude selected sessions")); + toolbar->addWidget(btn); -// toolbar->setStretchableWidget(Total = new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME)); + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(add_xpm))), + tr("Select all sessions"), + this, + SLOT(selectAll(void))); + + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(minus_xpm))), + tr("Deselect all sessions"), + this, + SLOT(selectNone(void))); + + toolbar->addWidget(new toSpacer()); + Total = new QLabel(toolbar); Total->setAlignment(Qt::AlignRight | Qt::AlignVCenter/* | Qt::ExpandTabs*/); + toolbar->addWidget(Total); + new toChangeConnection(toolbar, TO_TOOLBAR_WIDGET_NAME); QSplitter *splitter = new QSplitter(Qt::Vertical, this); Sessions = new toSessionList(splitter); - Q3ValueList<int> list; + QList<int> list; list.append(75); splitter->setSizes(list); @@ -353,12 +371,12 @@ connect(ResultTab, SIGNAL(currentChanged(QWidget *)), this, SLOT(changeTab(QWidget *))); - try - { + try { connect(timer(), SIGNAL(timeout(void)), this, SLOT(refreshTabs(void))); toRefreshParse(timer()); } - TOCATCH + TOCATCH; + CurrentTab = StatisticSplitter; ToolMenu = NULL; @@ -369,43 +387,38 @@ setFocusProxy(Sessions); } -bool toSession::canHandle(toConnection &conn) -{ +bool toSession::canHandle(toConnection &conn) { return toIsOracle(conn); } -void toSession::excludeSelection(bool tgl) -{ - toSessionList::sessionFilter *filt = dynamic_cast<toSessionList::sessionFilter *>(Sessions->filter()); - if (filt) - { +void toSession::excludeSelection(bool tgl) { + toSessionList::sessionFilter *filt = + dynamic_cast<toSessionList::sessionFilter *>(Sessions->filter()); + if (filt) { filt->setShow(!tgl); refresh(); } } -void toSession::selectAll(void) -{ - for (Q3ListViewItem *item = Sessions->firstChild();item;item = item->nextSibling()) - { +void toSession::selectAll(void) { + for (Q3ListViewItem *item = Sessions->firstChild(); + item; + item = item->nextSibling()) { toResultViewCheck * chk = dynamic_cast<toResultViewCheck *>(item); if (chk) chk->setOn(true); } } -void toSession::selectNone(void) -{ - for (Q3ListViewItem *item = Sessions->firstChild();item;item = item->nextSibling()) - { +void toSession::selectNone(void) { + for (Q3ListViewItem *item = Sessions->firstChild();item;item = item->nextSibling()) { toResultViewCheck * chk = dynamic_cast<toResultViewCheck *>(item); if (chk) chk->setOn(false); } } -Q3ListViewItem *toSessionList::createItem(Q3ListViewItem *last, const QString &str) -{ +Q3ListViewItem *toSessionList::createItem(Q3ListViewItem *last, const QString &str) { sessionFilter *filt = dynamic_cast<sessionFilter *>(filter()); if (filt && filt->show()) return new toResultViewCheck(this, last, str, Q3CheckListItem::CheckBox); @@ -413,19 +426,15 @@ return new toResultViewItem(this, last, str); } -void toSessionList::updateFilter() -{ +void toSessionList::updateFilter() { sessionFilter *filt = dynamic_cast<sessionFilter *>(filter()); if (filt) filt->updateList(this); } -bool toSessionList::sessionFilter::check(const Q3ListViewItem *item) -{ - if (!OnlyDatabase.isEmpty()) - { - if (OnlyDatabase == "/") - { +bool toSessionList::sessionFilter::check(const Q3ListViewItem *item) { + if (!OnlyDatabase.isEmpty()) { + if (OnlyDatabase == "/") { if (item->text(4) == "Sleep") return false; } @@ -436,30 +445,24 @@ sessionID serial(item->text(0).toInt(), item->text(1).toInt()); bool checked = false; for (std::list<sessionID>::iterator i = Serials.begin();i != Serials.end();i++) - if ((*i) == serial) - { + if ((*i) == serial) { checked = true; break; } const toResultViewCheck *chk = dynamic_cast<const toResultViewCheck *>(item); - if (chk) - { + if (chk) { const_cast<toResultViewCheck *>(chk)->setOn(checked); return true; } return !checked; } -void toSessionList::sessionFilter::updateList(toResultLong *lst) -{ +void toSessionList::sessionFilter::updateList(toResultLong *lst) { bool first = true; - for (Q3ListViewItem *item = lst->firstChild();item;item = item->nextSibling()) - { + for (Q3ListViewItem *item = lst->firstChild();item;item = item->nextSibling()) { toResultViewCheck * chk = dynamic_cast<toResultViewCheck *>(item); - if (chk) - { - if (first) - { + if (chk) { + if (first) { Serials.clear(); first = false; } @@ -469,46 +472,37 @@ } } -void toSession::windowActivated(QWidget *widget) -{ - if (widget == this) - { - if (!ToolMenu) - { -#if 0 // todo - ToolMenu = new Q3PopupMenu(this); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(refresh_xpm)), tr("&Refresh"), - this, SLOT(refresh(void)), - toKeySequence(tr("F5", "Session|Refresh"))); +void toSession::windowActivated(QWidget *widget) { + if (widget == this) { + if (!ToolMenu) { + ToolMenu = new QMenu(tr("&Session"), this); + + ToolMenu->addAction(refreshAct); + ToolMenu->insertSeparator(); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(clock_xpm)), tr("Enable timed statistics"), - this, SLOT(enableStatistics(void))); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(noclock_xpm)), tr("Disable timed statistics"), - this, SLOT(disableStatistics(void))); + + ToolMenu->addAction(enableTimedAct); + ToolMenu->addAction(disableTimedAct); + ToolMenu->insertSeparator(); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(kill_xpm)), tr("Disconnect session"), - this, SLOT(disconnectSession(void))); + + ToolMenu->addAction(disconnectAct); + ToolMenu->insertSeparator(); - ToolMenu->insertItem(tr("&Change Refresh"), Refresh, SLOT(setFocus(void)), - toKeySequence(tr("Alt+R", "Session|Change refresh"))); - toMainWidget()->menuBar()->insertItem(tr("&Session"), ToolMenu, -1, toToolMenuIndex()); -#endif + + toMainWidget()->addCustomMenu(ToolMenu); } } - else - { + else { delete ToolMenu; ToolMenu = NULL; } } -void toSession::refresh(void) -{ - try - { +void toSession::refresh(void) { + try { Q3ListViewItem *item = Sessions->selectedItem(); - if (item) - { + if (item) { Session = item->text(0); Serial = item->text(1); } @@ -529,17 +523,17 @@ Sessions->setSQL(sql.arg(extra)); Sessions->refresh(); } - TOCATCH + TOCATCH; } -void toSession::done(void) -{ +void toSession::done(void) { int system = 0, total = 0, active = 0; - for (Q3ListViewItem *item = Sessions->firstChild();item;item = item->nextSibling()) + for (Q3ListViewItem *item = Sessions->firstChild(); + item; + item = item->nextSibling()) { if (item->text(0) == Session && - item->text(1) == Serial) - { + item->text(1) == Serial) { Sessions->setSelected(item, true); } total++; @@ -548,60 +542,49 @@ else if (item->text(3) == "ACTIVE") active++; } - Total->setText(QString("Total <B>%1</B> (Active <B>%3</B>, System <B>%2</B>)").arg(total).arg(system).arg(active)); + Total->setText(QString("Total <B>%1</B> (Active <B>%3</B>, System <B>%2</B>)") + .arg(total).arg(system).arg(active)); } -void toSession::enableStatistics(bool enable) -{ +void toSession::enableStatistics(bool enable) { QString sql; if (enable) sql = QString::fromLatin1("ALTER SYSTEM SET TIMED_STATISTICS = TRUE"); else sql = QString::fromLatin1("ALTER SYSTEM SET TIMED_STATISTICS = FALSE"); - try - { + try { connection().execute(sql); } - catch (...) - { + catch (...) { toStatusMessage(tr("No access to timed statistics flags")); } } -void toSession::changeTab(QWidget *tab) -{ - if (tab != CurrentTab) - { +void toSession::changeTab(QWidget *tab) { + if (tab != CurrentTab) { CurrentTab = tab; Q3ListViewItem *item = Sessions->selectedItem(); - if (item) - { - if (CurrentTab == StatisticSplitter) - { + if (item) { + if (CurrentTab == StatisticSplitter) { int ses = item->text(0).toInt(); - try - { + try { SessionStatistics->changeSession(ses); } - TOCATCH + TOCATCH; } - else if (CurrentTab == ConnectInfo) - { + else if (CurrentTab == ConnectInfo) { ConnectInfo->clearParams(); ConnectInfo->changeParams(item->text(0)); } - else if (CurrentTab == LongOps) - { + else if (CurrentTab == LongOps) { LongOps->clearParams(); LongOps->changeParams(item->text(0), item->text(1)); } - else if (CurrentTab == PendingLocks) - { + else if (CurrentTab == PendingLocks) { PendingLocks->clearParams(); PendingLocks->query(item->text(0)); } - else if (CurrentTab == OpenSplitter) - { + else if (CurrentTab == OpenSplitter) { Q3ListViewItem *openitem = OpenCursors->currentItem(); QString address; if (openitem) @@ -610,55 +593,52 @@ OpenCursors->changeParams(item->text(0)); if (!address.isEmpty()) for (openitem = OpenCursors->firstChild(); - openitem;openitem = openitem->nextSibling()) - if (address == openitem->text(2)) - { + openitem;openitem = openitem->nextSibling()) + if (address == openitem->text(2)) { OpenCursors->setSelected(item, true); break; } } - else if (CurrentTab == CurrentStatement) - { + else if (CurrentTab == CurrentStatement) { CurrentStatement->changeAddress(item->text(Sessions->columns() + 0)); } - else if (CurrentTab == AccessedObjects) - { + else if (CurrentTab == AccessedObjects) { AccessedObjects->clearParams(); AccessedObjects->changeParams(item->text(0)); } - else if (CurrentTab == LockedObjects) - { + else if (CurrentTab == LockedObjects) { LockedObjects->clearParams(); LockedObjects->changeParams(item->text(0)); } - else if (CurrentTab == PreviousStatement) - { + else if (CurrentTab == PreviousStatement) { PreviousStatement->changeAddress(item->text(Sessions->columns() + 1)); } } } } -void toSession::changeCursor(Q3ListViewItem *item) -{ +void toSession::changeCursor(Q3ListViewItem *item) { if (item) OpenStatement->changeAddress(item->text(2)); } -void toSession::disconnectSession(void) -{ +void toSession::disconnectSession(void) { Q3ListViewItem *item = Sessions->selectedItem(); - if (item) - { + if (item) { QString sess = QString::fromLatin1("'"); sess.append(item->text(0)); sess.append(QString::fromLatin1(",")); sess.append(item->text(1)); sess.append(QString::fromLatin1("'")); - QString str(tr("Let current transaction finish before disconnecting session?")); + QString str(tr("Let current transaction finish before " + "disconnecting this session?")); QString sql; - switch (TOMessageBox::warning(this, tr("Commit work?"), str, tr("&Yes"), tr("&No"), tr("Cancel"))) - { + switch(TOMessageBox::warning(this, + tr("Commit work?"), + str, + tr("&Yes"), + tr("&No"), + tr("Cancel"))) { case 0: sql = QString::fromLatin1("ALTER SYSTEM DISCONNECT SESSION "); sql.append(sess); @@ -671,29 +651,23 @@ case 2: return ; } - try - { + try { connection().execute(sql); } - TOCATCH + TOCATCH; } } -void toSession::changeRefresh(const QString &str) -{ - try - { +void toSession::changeRefresh(const QString &str) { + try { toRefreshParse(timer(), str); } - TOCATCH + TOCATCH; } -void toSession::changeItem(Q3ListViewItem *item) -{ - if (item && LastSession != item->text(0)) - { - if (!item->text(0).isEmpty()) - { +void toSession::changeItem(Q3ListViewItem *item) { + if (item && LastSession != item->text(0)) { + if (!item->text(0).isEmpty()) { WaitBar->changeParams(item->text(0)); IOBar->changeParams(item->text(0)); Waits->setSession(item->text(0).toInt()); @@ -705,8 +679,7 @@ changeTab(t); } -void toSession::refreshTabs(void) -{ +void toSession::refreshTabs(void) { Q3ListViewItem *item = Sessions->selectedItem(); if (item) changeItem(item); Modified: branches/tora-1.4/tora/src/tosession.h =================================================================== --- branches/tora-1.4/tora/src/tosession.h 2007-12-18 05:44:41 UTC (rev 2354) +++ branches/tora-1.4/tora/src/tosession.h 2007-12-18 06:21:30 UTC (rev 2355) @@ -43,9 +43,9 @@ #include "toresultlong.h" #include <list> -//Added by qt3to4: #include <QLabel> -#include <Q3PopupMenu> +#include <QMenu> +#include <QAction> class QComboBox; class Q3ListViewItem; @@ -53,7 +53,6 @@ class QTabWidget; class toConnection; class toMain; -class toPopupMenu; class toResultBar; class toResultCombo; class toResultLock; @@ -69,17 +68,14 @@ public: class sessionFilter : public toResultFilter { - struct sessionID - { + struct sessionID { int Session; int Serial; - sessionID(int session, int serial) - { + sessionID(int session, int serial) { Session = session; Serial = serial; } - bool operator == (const sessionID &ses) const - { + bool operator == (const sessionID &ses) const { return Session == ses.Session && Serial == ses.Serial; } }; @@ -88,43 +84,35 @@ QString OnlyDatabase; public: - sessionFilter() - { + sessionFilter() { Show = true; } - sessionFilter(const std::list<sessionID> &serials, bool show) - { + sessionFilter(const std::list<sessionID> &serials, bool show) { Serials = serials; Show = show; } virtual bool check(const Q3ListViewItem *item); - virtual toResultFilter *clone(void) - { + virtual toResultFilter *clone(void) { return new sessionFilter(Serials, Show); } - void setShow(bool show) - { + void setShow(bool show) { Show = show; } - bool show() - { + bool show() { return Show; } - void onlyDatabase(const QString &db) - { + void onlyDatabase(const QString &db) { OnlyDatabase = db; } void updateList(toResultLong *lst); }; toSessionList(QWidget *parent) - : toResultLong(false, false, toQuery::Background, parent) - { + : toResultLong(false, false, toQuery::Background, parent) { setFilter(new sessionFilter); } virtual Q3ListViewItem *createItem(Q3ListViewItem *last, const QString &str); void updateFilter(void); - virtual void refresh(void) - { + virtual void refresh(void) { updateFilter(); toResultLong::refresh(); } @@ -143,24 +131,29 @@ toSGAStatement *CurrentStatement; toSGAStatement *PreviousStatement; - toResultStats *SessionStatistics; - toResultLong *LongOps; - toResultLong *ConnectInfo; - toResultLong *LockedObjects; - toResultLock *PendingLocks; - toResultLong *AccessedObjects; - toResultBar *WaitBar; - toResultBar *IOBar; - toWaitEvents *Waits; - QSplitter *OpenSplitter; - QSplitter *StatisticSplitter; + toResultStats *SessionStatistics; + toResultLong *LongOps; + toResultLong *ConnectInfo; + toResultLong *LockedObjects; + toResultLock *PendingLocks; + toResultLong *AccessedObjects; + toResultBar *WaitBar; + toResultBar *IOBar; + toWaitEvents *Waits; + QSplitter *OpenSplitter; + QSplitter *StatisticSplitter; toSGAStatement *OpenStatement; - toResultLong *OpenCursors; - QString LastSession; - Q3PopupMenu *ToolMenu; - QComboBox *Refresh; - QLabel *Total; + toResultLong *OpenCursors; + QString LastSession; + QMenu *ToolMenu; + QComboBox *Refresh; + QLabel *Total; + QAction *refreshAct; + QAction *enableTimedAct; + QAction *disableTimedAct; + QAction *disconnectAct; + QString Session; QString Serial; @@ -178,12 +171,10 @@ void changeRefresh(const QString &str); void refresh(void); void refreshTabs(void); - void enableStatistics(void) - { + void enableStatistics(void) { enableStatistics(true); } - void disableStatistics(void) - { + void disableStatistics(void) { enableStatistics(false); } void disconnectSession(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-19 05:41:03
|
Revision: 2357 http://tora.svn.sourceforge.net/tora/?rev=2357&view=rev Author: mrjohnson0 Date: 2007-12-18 21:41:07 -0800 (Tue, 18 Dec 2007) Log Message: ----------- override closeEvent to nice shutdown tooutput as running sql from detor is causing a crash. Modified Paths: -------------- branches/tora-1.4/tora/src/todebug.cpp branches/tora-1.4/tora/src/todebug.h branches/tora-1.4/tora/src/tooutput.cpp branches/tora-1.4/tora/src/tooutput.h Modified: branches/tora-1.4/tora/src/todebug.cpp =================================================================== --- branches/tora-1.4/tora/src/todebug.cpp 2007-12-18 15:26:04 UTC (rev 2356) +++ branches/tora-1.4/tora/src/todebug.cpp 2007-12-19 05:41:07 UTC (rev 2357) @@ -389,6 +389,10 @@ } } } + + virtual void closeEvent(QCloseEvent *event) { + toOutput::closeEvent(event); + } }; @@ -2034,7 +2038,7 @@ TargetLog, tr("&Ok")); } - close(false); + close(); return ; } try @@ -2198,13 +2202,24 @@ return true; } -bool toDebug::close(bool del) +bool toDebug::close() { - if (checkCompile()) - return Q3VBox::close(del); + if (checkCompile()) { + bool ret = Q3VBox::close(true); + if(ret && Output) + Output->close(); + return ret; + } return false; } +void toDebug::closeEvent(QCloseEvent *e) { + if(close()) + e->accept(); + else + e->ignore(); +} + void toDebug::updateCurrent() { try Modified: branches/tora-1.4/tora/src/todebug.h =================================================================== --- branches/tora-1.4/tora/src/todebug.h 2007-12-18 15:26:04 UTC (rev 2356) +++ branches/tora-1.4/tora/src/todebug.h 2007-12-19 05:41:07 UTC (rev 2357) @@ -163,17 +163,17 @@ // End of lock stuff toTimer StartTimer; -class targetTask : public toTask + class targetTask : public toTask { toDebug &Parent; public: - targetTask(toDebug &parent) - : Parent(parent) + targetTask(toDebug &parent) + : Parent(parent) { } virtual void run(void); }; - virtual bool close(bool del); + virtual bool close(void); int continueExecution(int stopon); @@ -201,6 +201,9 @@ bool checkStop(void); void closeEditor(toDebugText* &editor); +protected: + virtual void closeEvent(QCloseEvent *); + private slots: void startTarget(void); public: Modified: branches/tora-1.4/tora/src/tooutput.cpp =================================================================== --- branches/tora-1.4/tora/src/tooutput.cpp 2007-12-18 15:26:04 UTC (rev 2356) +++ branches/tora-1.4/tora/src/tooutput.cpp 2007-12-19 05:41:07 UTC (rev 2357) @@ -295,16 +295,21 @@ } } -toOutput::~toOutput() -{ - try - { +toOutput::~toOutput() { +} + + +void toOutput::closeEvent(QCloseEvent *event) { + try { disable(true); OutputTool.closeWindow(connection()); } - TOCATCH + TOCATCH; + + event->accept(); } + static toSQL SQLLines("toOutput:Poll", "BEGIN\n" " SYS.DBMS_OUTPUT.GET_LINE(:lines<char[1000],out>,\n" Modified: branches/tora-1.4/tora/src/tooutput.h =================================================================== --- branches/tora-1.4/tora/src/tooutput.h 2007-12-18 15:26:04 UTC (rev 2356) +++ branches/tora-1.4/tora/src/tooutput.h 2007-12-19 05:41:07 UTC (rev 2357) @@ -41,15 +41,15 @@ #include "config.h" #include "totool.h" #include "tomarkedtext.h" -//Added by qt3to4: + #include <Q3PopupMenu> +#include <QCloseEvent> class QComboBox; class Q3PopupMenu; class QToolBar; class QToolButton; class toConnection; -// class toMarkedText; class toResultView; class toOutput : public toToolWidget @@ -63,6 +63,10 @@ QToolBar *ToolBar; void poll(void); + +protected: + virtual void closeEvent(QCloseEvent *); + public: toOutput(QWidget *parent, toConnection &connection, bool enabled = true); virtual ~toOutput(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-19 06:43:38
|
Revision: 2359 http://tora.svn.sourceforge.net/tora/?rev=2359&view=rev Author: mrjohnson0 Date: 2007-12-18 22:43:35 -0800 (Tue, 18 Dec 2007) Log Message: ----------- widget doesn't have EditSplitter. Set null and check before sizing Modified Paths: -------------- branches/tora-1.4/tora/src/toworksheet.cpp branches/tora-1.4/tora/src/toworksheetwidget.cpp Modified: branches/tora-1.4/tora/src/toworksheet.cpp =================================================================== --- branches/tora-1.4/tora/src/toworksheet.cpp 2007-12-19 06:28:04 UTC (rev 2358) +++ branches/tora-1.4/tora/src/toworksheet.cpp 2007-12-19 06:43:35 UTC (rev 2359) @@ -1154,7 +1154,7 @@ t = t.mid(i); } - if (t.trimmed().length()) { + if (t.trimmed().length() && EditSplitter) { // move splitter if currently hidden QList<int> list = EditSplitter->sizes(); if(list[1] == 0) { Modified: branches/tora-1.4/tora/src/toworksheetwidget.cpp =================================================================== --- branches/tora-1.4/tora/src/toworksheetwidget.cpp 2007-12-19 06:28:04 UTC (rev 2358) +++ branches/tora-1.4/tora/src/toworksheetwidget.cpp 2007-12-19 06:43:35 UTC (rev 2359) @@ -83,19 +83,21 @@ const QString &, const toConnection::exception &, bool))); - ResultTab = NULL; - Plan = NULL; - CurrentTab = NULL; - Resources = NULL; - Statistics = NULL; - Logging = NULL; - LastLogItem = NULL; - StatTab = NULL; - Columns = NULL; - Refresh = NULL; - ToolMenu = NULL; - Visualize = NULL; - WaitChart = IOChart = NULL; + ResultTab = NULL; + Plan = NULL; + CurrentTab = NULL; + Resources = NULL; + Statistics = NULL; + Logging = NULL; + LastLogItem = NULL; + StatTab = NULL; + Columns = NULL; + Refresh = NULL; + ToolMenu = NULL; + Visualize = NULL; + WaitChart = NULL; + IOChart = NULL; + EditSplitter = NULL; workToolbar->addSeparator(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-20 22:44:54
|
Revision: 2366 http://tora.svn.sourceforge.net/tora/?rev=2366&view=rev Author: mrjohnson0 Date: 2007-12-20 14:44:51 -0800 (Thu, 20 Dec 2007) Log Message: ----------- qt4 toolbar Modified Paths: -------------- branches/tora-1.4/tora/src/tooutput.cpp branches/tora-1.4/tora/src/tooutput.h Modified: branches/tora-1.4/tora/src/tooutput.cpp =================================================================== --- branches/tora-1.4/tora/src/tooutput.cpp 2007-12-20 22:21:45 UTC (rev 2365) +++ branches/tora-1.4/tora/src/tooutput.cpp 2007-12-20 22:44:51 UTC (rev 2366) @@ -1,39 +1,39 @@ /***** -* -* TOra - An Oracle Toolkit for DBA's and developers -* Copyright (C) 2003-2005 Quest Software, Inc -* Portions Copyright (C) 2005 Other Contributors -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; only version 2 of -* the License is valid for this program. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* -* As a special exception, you have permission to link this program -* with the Oracle Client libraries and distribute executables, as long -* as you follow the requirements of the GNU GPL in regard to all of the -* software in the executable aside from Oracle client libraries. -* -* Specifically you are not permitted to link this program with the -* Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. -* And you are not permitted to distribute binaries compiled against -* these libraries without written consent from Quest Software, Inc. -* Observe that this does not disallow linking to the Qt Free Edition. -* -* You may link this product with any GPL'd Qt library such as Qt/Free -* -* All trademarks belong to their respective owners. -* -*****/ + * + * TOra - An Oracle Toolkit for DBA's and developers + * Copyright (C) 2003-2005 Quest Software, Inc + * Portions Copyright (C) 2005 Other Contributors + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; only version 2 of + * the License is valid for this program. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * As a special exception, you have permission to link this program + * with the Oracle Client libraries and distribute executables, as long + * as you follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from Oracle client libraries. + * + * Specifically you are not permitted to link this program with the + * Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. + * And you are not permitted to distribute binaries compiled against + * these libraries without written consent from Quest Software, Inc. + * Observe that this does not disallow linking to the Qt Free Edition. + * + * You may link this product with any GPL'd Qt library such as Qt/Free + * + * All trademarks belong to their respective owners. + * + *****/ #include "utils.h" @@ -57,9 +57,8 @@ #include <qtimer.h> #include <qtoolbar.h> #include <qtoolbutton.h> -#include <qtooltip.h> #include <qworkspace.h> -//Added by qt3to4: + #include <QPixmap> #include "tooutput.h" @@ -79,8 +78,7 @@ #define CONF_LOG_USER "LogUser" #define DEFAULT_LOG_USER "ULOG" -class toOutputPrefs : public Q3GroupBox, public toSettingTab -{ +class toOutputPrefs : public Q3GroupBox, public toSettingTab { QComboBox *AutoPolling; QComboBox *Type; QLineEdit *User; @@ -88,78 +86,87 @@ public: toOutputPrefs(toTool *tool, QWidget* parent = 0, const char* name = 0) - : Q3GroupBox(1, Qt::Horizontal, parent, name), toSettingTab("output.html"), Tool(tool) - { + : Q3GroupBox(1, Qt::Horizontal, parent, name), + toSettingTab("output.html"), Tool(tool) { + setTitle(qApp->translate("toOutputPrefs", "SQL Output")); - QLabel *label = new QLabel(qApp->translate("toOutputPrefs", "&Polling timeout"), this); + QLabel *label = new QLabel(qApp->translate("toOutputPrefs", + "&Polling timeout"), + this); label->setGeometry(QRect(20, 30, 100, 20)); - QToolTip::add - (label, qApp->translate("toOutputPrefs", "Time between trying to poll for output.")); + label->setToolTip(qApp->translate("toOutputPrefs", + "Time between trying to poll for output.")); - AutoPolling = toRefreshCreate(this, TO_TOOLBAR_WIDGET_NAME, Tool->config(CONF_POLLING, DEFAULT_POLLING)); + AutoPolling = toRefreshCreate( + this, + TO_TOOLBAR_WIDGET_NAME, + Tool->config(CONF_POLLING, DEFAULT_POLLING)); label->setBuddy(AutoPolling); - label = new QLabel(qApp->translate("toOutputPrefs", "Default &source"), this); + label = new QLabel(qApp->translate("toOutputPrefs", + "Default &source"), + this); Type = new QComboBox(this); Type->insertItem(qApp->translate("toLogOutput", "SQL Output")); Type->insertItem(qApp->translate("toLogOutput", "Log4PL/SQL")); - Type->setCurrentItem(Tool->config(CONF_LOG_TYPE, DEFAULT_LOG_TYPE).toInt()); + Type->setCurrentItem(Tool->config(CONF_LOG_TYPE, + DEFAULT_LOG_TYPE).toInt()); label->setBuddy(Type); - label = new QLabel(qApp->translate("toOutputPrefs", "Log4PL/SQL &User"), this); - User = new QLineEdit(Tool->config(CONF_LOG_USER, DEFAULT_LOG_USER), this); + label = new QLabel(qApp->translate("toOutputPrefs", + "Log4PL/SQL &User"), + this); + User = new QLineEdit(Tool->config(CONF_LOG_USER, + DEFAULT_LOG_USER), + this); label->setBuddy(User); } - virtual void saveSetting(void) - { + virtual void saveSetting(void) { Tool->setConfig(CONF_POLLING, AutoPolling->currentText()); Tool->setConfig(CONF_LOG_TYPE, QString::number(Type->currentItem())); Tool->setConfig(CONF_LOG_USER, User->text()); } }; -class toOutputTool : public toTool -{ +class toOutputTool : public toTool { protected: std::map<toConnection *, QWidget *> Windows; - virtual const char **pictureXPM(void) - { + virtual const char **pictureXPM(void) { return const_cast<const char**>(tooutput_xpm); } + public: toOutputTool() - : toTool(340, "SQL Output") - { } - virtual const char *menuItem() - { + : toTool(340, "SQL Output") { + } + + virtual const char *menuItem() { return "SQL Output"; } - virtual QWidget *toolWindow(QWidget *parent, toConnection &connection) - { + + virtual QWidget *toolWindow(QWidget *parent, toConnection &connection) { std::map<toConnection *, QWidget *>::iterator i = Windows.find(&connection); - if (i != Windows.end()) - { + if (i != Windows.end()) { (*i).second->raise(); (*i).second->setFocus(); return NULL; } - else - { + else { QWidget *window = new toLogOutput(parent, connection); Windows[&connection] = window; return window; } } - void closeWindow(toConnection &connection) - { + + void closeWindow(toConnection &connection) { std::map<toConnection *, QWidget *>::iterator i = Windows.find(&connection); if (i != Windows.end()) Windows.erase(i); } - virtual QWidget *configurationTab(QWidget *parent) - { + + virtual QWidget *configurationTab(QWidget *parent) { return new toOutputPrefs(this, parent); } }; @@ -167,89 +174,97 @@ static toOutputTool OutputTool; toOutput::toOutput(QWidget *main, toConnection &connection, bool enabled) - : toToolWidget(OutputTool, "output.html", main, connection) -{ - ToolBar = toAllocBar(this, tr("SQL Output")); + : toToolWidget(OutputTool, "output.html", main, connection) { - new QToolButton(QPixmap(const_cast<const char**>(refresh_xpm)), - tr("Poll for output now"), - tr("Poll for output now"), - this, SLOT(refresh(void)), - ToolBar); - ToolBar->addSeparator(); - DisableButton = new QToolButton(ToolBar); - DisableButton->setToggleButton(true); + QToolBar *Toolbar = toAllocBar(this, tr("SQL Output")); + refreshAct = new QAction(QPixmap(const_cast<const char**>(refresh_xpm)), + tr("Poll for output now"), + this); + refreshAct->setShortcut(QKeySequence::Refresh); + connect(refreshAct, SIGNAL(triggered()), this, SLOT(refresh(void))); + Toolbar->addAction(refreshAct); + + Toolbar->addSeparator(); + + enableAct = new QAction(tr("Output enabled"), this); + enableAct->setShortcut(Qt::Key_F4); + enableAct->setCheckable(true); QIcon iconset; - iconset.setPixmap(QPixmap(const_cast<const char**>(online_xpm)), QIcon::Automatic, QIcon::Normal, QIcon::Off); - iconset.setPixmap(QPixmap(const_cast<const char**>(offline_xpm)), QIcon::Automatic, QIcon::Normal, QIcon::On); - DisableButton->setIconSet(iconset); + iconset.setPixmap(QPixmap(const_cast<const char**>(online_xpm)), + QIcon::Automatic, + QIcon::Normal, + QIcon::Off); + iconset.setPixmap(QPixmap(const_cast<const char**>(offline_xpm)), + QIcon::Automatic, + QIcon::Normal, + QIcon::On); + enableAct->setIconSet(iconset); + connect(enableAct, SIGNAL(triggered()), this, SLOT(toggleMenu(void))); - DisableButton->setOn(!enabled); - connect(DisableButton, SIGNAL(toggled(bool)), this, SLOT(disable(bool))); - QToolTip::add - (DisableButton, tr("Enable or disable getting SQL output.")); + clearAct = new QAction(QIcon(QPixmap(const_cast<const char**>(eraselog_xpm))), + tr("Clear output"), + this); + clearAct->setShortcut(Qt::CTRL + Qt::Key_Backspace); + connect(clearAct, SIGNAL(triggered()), this, SLOT(clear(void))); + Toolbar->addAction(clearAct); - new QToolButton(QPixmap(const_cast<const char**>(eraselog_xpm)), - tr("Clear output"), - tr("Clear output"), - this, SLOT(clear()), - ToolBar); - ToolBar->addSeparator(); - new QLabel(tr("Refresh") + " ", ToolBar, TO_TOOLBAR_WIDGET_NAME); - connect(Refresh = toRefreshCreate(ToolBar, TO_TOOLBAR_WIDGET_NAME, OutputTool.config(CONF_POLLING, DEFAULT_POLLING)), - SIGNAL(activated(const QString &)), this, SLOT(changeRefresh(const QString &))); -// ToolBar->setStretchableWidget(new QLabel(ToolBar, TO_TOOLBAR_WIDGET_NAME)); + Toolbar->addSeparator(); + Toolbar->addWidget( + new QLabel(tr("Refresh") + " ", Toolbar, TO_TOOLBAR_WIDGET_NAME)); + + + Refresh = toRefreshCreate(Toolbar, + TO_TOOLBAR_WIDGET_NAME, + OutputTool.config(CONF_POLLING, + DEFAULT_POLLING)); + Toolbar->addWidget(Refresh); + connect(Refresh, + SIGNAL(activated(const QString &)), + this, + SLOT(changeRefresh(const QString &))); + + Toolbar->addWidget(new toSpacer()); + Output = new toMarkedText(this); ToolMenu = NULL; - connect(toMainWidget()->workspace(), SIGNAL(windowActivated(QWidget *)), - this, SLOT(windowActivated(QWidget *))); + connect(toMainWidget()->workspace(), + SIGNAL(windowActivated(QWidget *)), + this, + SLOT(windowActivated(QWidget *))); - try - { + try { connect(timer(), SIGNAL(timeout(void)), this, SLOT(refresh(void))); - toRefreshParse(timer(), OutputTool.config(CONF_POLLING, DEFAULT_POLLING)); + toRefreshParse(timer(), OutputTool.config(CONF_POLLING, + DEFAULT_POLLING)); } - TOCATCH - if (enabled) + TOCATCH; + + if(enabled) disable(false); setFocusProxy(Output); } -#define TO_ID_TOGGLE (toMain::TO_TOOL_MENU_ID+ 0) -void toOutput::windowActivated(QWidget *widget) -{ - if (widget == this) - { - if (!ToolMenu) - { -#if 0 // todo - ToolMenu = new Q3PopupMenu(this); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(refresh_xpm)), tr("&Refresh"), - this, SLOT(refresh(void)), - toKeySequence(tr("F5", "Output|Refresh"))); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(tr("Output enabled"), - this, SLOT(toggleMenu()), - toKeySequence(tr("F4", "Output|Enable")), TO_ID_TOGGLE); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(eraselog_xpm)), tr("Clear output"), - this, SLOT(clear()), - toKeySequence(tr("Ctrl+Backspace", "Output|Clear output"))); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(tr("&Change Refresh"), Refresh, SLOT(setFocus(void)), - toKeySequence(tr("Alt+R", "Output|Change refresh"))); +void toOutput::windowActivated(QWidget *widget) { + if(widget == this) { + if(!ToolMenu) { + ToolMenu = new QMenu(tr("&Output"), this); - toMainWidget()->menuBar()->insertItem(tr("&Output"), ToolMenu, -1, toToolMenuIndex()); - ToolMenu->setItemChecked(TO_ID_TOGGLE, !DisableButton->isOn()); -#endif + ToolMenu->addAction(refreshAct); + + ToolMenu->addSeparator(); + + ToolMenu->addAction(enableAct); + ToolMenu->addAction(clearAct); + + toMainWidget()->addCustomMenu(ToolMenu); } } - else - { + else { delete ToolMenu; ToolMenu = NULL; } @@ -266,15 +281,12 @@ "END;", "Disable output collection"); -void toOutput::toggleMenu() -{ - DisableButton->setOn(!DisableButton->isOn()); +void toOutput::toggleMenu() { + enableAct->setChecked(!enableAct->isChecked()); } -void toOutput::disable(bool dis) -{ - try - { +void toOutput::disable(bool dis) { + try { if (dis) connection().allExecute(SQLDisable); else @@ -289,8 +301,7 @@ ToolMenu->setItemChecked(TO_ID_TOGGLE, !DisableButton->isOn()); #endif } - catch (...) - { + catch (...) { toStatusMessage(tr("Couldn't enable/disable output for session")); } } @@ -318,23 +329,18 @@ "END;", "Get lines from SQL Output, must use same bindings"); -void toOutput::poll() -{ - try - { +void toOutput::poll() { + try { bool any; - do - { + do { toQList params; toQuery query(connection(), toQuery::All, SQLLines, params); any = false; - while (!query.eof()) - { + while (!query.eof()) { QString line = query.readValueNull(); int status = query.readValueNull().toInt(); - if (status == 0) - { + if (status == 0) { any = true; if (!line.isNull()) insertLine(line); } @@ -342,31 +348,26 @@ } while (any); } - TOCATCH + TOCATCH; } -void toOutput::refresh(void) -{ +void toOutput::refresh(void) { poll(); } -void toOutput::clear(void) -{ +void toOutput::clear(void) { Output->clear(); } -void toOutput::changeRefresh(const QString &str) -{ - try - { +void toOutput::changeRefresh(const QString &str) { + try { toRefreshParse(timer(), str); } - TOCATCH + TOCATCH; } -bool toOutput::enabled(void) -{ - return !DisableButton->isOn(); +bool toOutput::enabled(void) { + return !enableAct->isChecked(); } static toSQL SQLLog("toLogOutput:Poll", @@ -386,8 +387,7 @@ "Poll data from PL/SQL log table"); toLogOutput::toLogOutput(QWidget *parent, toConnection &connection) - : toOutput(parent, connection) -{ + : toOutput(parent, connection) { Type = new QComboBox(toolBar(), TO_TOOLBAR_WIDGET_NAME); Type->insertItem(tr("SQL Output")); Type->insertItem(tr("Log4PL/SQL")); @@ -398,26 +398,23 @@ changeType(); } -void toLogOutput::refresh(void) -{ - if (Type->currentItem() == 1) - { +void toLogOutput::refresh(void) { + if (Type->currentItem() == 1) { Log->setSQL(QString::null); - Log->query(SQLLog(connection()).arg(OutputTool.config(CONF_LOG_USER, DEFAULT_LOG_USER))); + Log->query(SQLLog(connection()).arg(OutputTool.config( + CONF_LOG_USER, + DEFAULT_LOG_USER))); } toOutput::refresh(); } -void toLogOutput::changeType(void) -{ - if (Type->currentItem() == 1) - { +void toLogOutput::changeType(void) { + if (Type->currentItem() == 1) { output()->hide(); Log->show(); refresh(); } - else - { + else { output()->show(); Log->hide(); } Modified: branches/tora-1.4/tora/src/tooutput.h =================================================================== --- branches/tora-1.4/tora/src/tooutput.h 2007-12-20 22:21:45 UTC (rev 2365) +++ branches/tora-1.4/tora/src/tooutput.h 2007-12-20 22:44:51 UTC (rev 2366) @@ -44,23 +44,24 @@ #include <Q3PopupMenu> #include <QCloseEvent> +#include <QAction> +#include <QMenu> +#include <QToolBar> class QComboBox; -class Q3PopupMenu; -class QToolBar; -class QToolButton; class toConnection; class toResultView; -class toOutput : public toToolWidget -{ - Q_OBJECT +class toOutput : public toToolWidget { + Q_OBJECT; toMarkedText *Output; - Q3PopupMenu *ToolMenu; - QToolButton *DisableButton; - QComboBox *Refresh; - QToolBar *ToolBar; + QMenu *ToolMenu; + QComboBox *Refresh; + QToolBar *Toolbar; + QAction *refreshAct; + QAction *enableAct; + QAction *clearAct; void poll(void); @@ -70,19 +71,20 @@ public: toOutput(QWidget *parent, toConnection &connection, bool enabled = true); virtual ~toOutput(); - void insertLine(const QString &str) - { + bool enabled(void); + + void insertLine(const QString &str) { Output->append(str); } - bool enabled(void); - QToolBar *toolBar(void) - { - return ToolBar; - } - toMarkedText *output(void) - { + + toMarkedText *output(void) { return Output; } + + QToolBar *toolBar(void) { + return Toolbar; + } + public slots: void clear(void); virtual void refresh(void); @@ -92,14 +94,15 @@ void toggleMenu(); }; -class toLogOutput : public toOutput -{ - Q_OBJECT +class toLogOutput : public toOutput { + Q_OBJECT; QComboBox *Type; toResultView *Log; + public: toLogOutput(QWidget *parent, toConnection &connection); + public slots: virtual void refresh(void); void changeType(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-21 00:54:26
|
Revision: 2367 http://tora.svn.sourceforge.net/tora/?rev=2367&view=rev Author: mrjohnson0 Date: 2007-12-20 16:54:24 -0800 (Thu, 20 Dec 2007) Log Message: ----------- no more q3cstring. most of this port uses qstring except where qbytearray made more sense. Modified Paths: -------------- branches/tora-1.4/tora/src/main.cpp branches/tora-1.4/tora/src/tobrowser.cpp branches/tora-1.4/tora/src/tobrowser.h branches/tora-1.4/tora/src/tochartmanager.cpp branches/tora-1.4/tora/src/toconfiguration.cpp branches/tora-1.4/tora/src/toconfiguration.h branches/tora-1.4/tora/src/toconnection.cpp branches/tora-1.4/tora/src/toconnection.h branches/tora-1.4/tora/src/todebug.cpp branches/tora-1.4/tora/src/todebug.h branches/tora-1.4/tora/src/todebugtext.cpp branches/tora-1.4/tora/src/todebugtext.h branches/tora-1.4/tora/src/toextract.cpp branches/tora-1.4/tora/src/toextract.h branches/tora-1.4/tora/src/tofyracleconnection.cpp branches/tora-1.4/tora/src/toglobalsetting.cpp branches/tora-1.4/tora/src/tohelp.cpp branches/tora-1.4/tora/src/tohighlightedtext.h branches/tora-1.4/tora/src/tohtml.cpp branches/tora-1.4/tora/src/tohtml.h branches/tora-1.4/tora/src/tolinechart.cpp branches/tora-1.4/tora/src/tolinechart.h branches/tora-1.4/tora/src/tolistviewformattersql.cpp branches/tora-1.4/tora/src/tomain.cpp branches/tora-1.4/tora/src/tomain.h branches/tora-1.4/tora/src/tomarkedtext.cpp branches/tora-1.4/tora/src/tomarkedtext.h branches/tora-1.4/tora/src/tonewconnection.cpp branches/tora-1.4/tora/src/tooracleconnection.cpp branches/tora-1.4/tora/src/tooraclepreload.cpp branches/tora-1.4/tora/src/topreferences.cpp branches/tora-1.4/tora/src/toproject.cpp branches/tora-1.4/tora/src/toproject.h branches/tora-1.4/tora/src/toqsqlconnection.cpp branches/tora-1.4/tora/src/toqvalue.h branches/tora-1.4/tora/src/toresultcontent.cpp branches/tora-1.4/tora/src/toresultcontent.h branches/tora-1.4/tora/src/toresultview.cpp branches/tora-1.4/tora/src/toresultview.h branches/tora-1.4/tora/src/toscript.cpp branches/tora-1.4/tora/src/tosql.cpp branches/tora-1.4/tora/src/tosql.h branches/tora-1.4/tora/src/tosqledit.cpp branches/tora-1.4/tora/src/tosqledit.h branches/tora-1.4/tora/src/tosqlparse.cpp branches/tora-1.4/tora/src/tosyntaxsetup.cpp branches/tora-1.4/tora/src/tosyntaxsetup.h branches/tora-1.4/tora/src/totemplate.cpp branches/tora-1.4/tora/src/totemplate.h branches/tora-1.4/tora/src/totemplateprovider.cpp branches/tora-1.4/tora/src/totool.cpp branches/tora-1.4/tora/src/totool.h branches/tora-1.4/tora/src/totuning.cpp branches/tora-1.4/tora/src/totuning.h branches/tora-1.4/tora/src/towaitevents.cpp branches/tora-1.4/tora/src/towaitevents.h branches/tora-1.4/tora/src/toworksheet.cpp branches/tora-1.4/tora/src/toworksheet.h branches/tora-1.4/tora/src/toworksheetstatistic.cpp branches/tora-1.4/tora/src/toworksheetstatistic.h branches/tora-1.4/tora/src/utils.cpp branches/tora-1.4/tora/src/utils.h Modified: branches/tora-1.4/tora/src/main.cpp =================================================================== --- branches/tora-1.4/tora/src/main.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/main.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -63,7 +63,7 @@ #include <qmessagebox.h> #include <qtextcodec.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <QTranslator> #ifndef TOMONOLITHIC @@ -198,7 +198,7 @@ toConnectionProvider::initializeAll(); { - Q3CString nls = getenv("NLS_LANG"); + QString nls = getenv("NLS_LANG"); if (nls.isEmpty()) nls = "american_america.UTF8"; else Modified: branches/tora-1.4/tora/src/tobrowser.cpp =================================================================== --- branches/tora-1.4/tora/src/tobrowser.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tobrowser.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -90,7 +90,7 @@ #include <qworkspace.h> //Added by qt3to4: #include <QPixmap> -#include <Q3CString> +#include <QString> #include "icons/addindex.xpm" #include "icons/addtable.xpm" @@ -263,7 +263,7 @@ Type = QString(BrowserTool.config(CONF_FILTER_TYPE, "0")).toInt(); TablespaceType = QString(BrowserTool.config(CONF_FILTER_TABLESPACE_TYPE, "0")).toInt(); } - virtual void exportData(std::map<Q3CString, QString> &data, const Q3CString &prefix) { + virtual void exportData(std::map<QString, QString> &data, const QString &prefix) { data[prefix + ":Type"] = QString::number(Type); if (IgnoreCase) data[prefix + ":Ignore"] = "Yes"; @@ -277,7 +277,7 @@ if (OnlyOwnSchema) data[prefix + ":OwnlyOwnSchema"] = "Yes"; } - virtual void importData(std::map<Q3CString, QString> &data, const Q3CString &prefix) { + virtual void importData(std::map<QString, QString> &data, const QString &prefix) { Type = data[prefix + ":Type"].toInt(); OnlyOwnSchema = !data[prefix + ":OnlyOwnSchema"].isEmpty(); TablespaceType = data[prefix + ":SpaceType"].toInt(); @@ -289,7 +289,7 @@ Match.setCaseSensitive(IgnoreCase); } int id = 1; - std::map<Q3CString, QString>::iterator i; + std::map<QString, QString>::iterator i; Tablespaces.clear(); while ((i = data.find(prefix + ":Space:" + QString::number(id).latin1())) != data.end()) { Tablespaces.insert(Tablespaces.end(), (*i).second); @@ -1064,7 +1064,7 @@ disconnect(FilterButton, SIGNAL(toggled(bool)), this, SLOT(defineFilter())); FilterButton->setOn(filter); connect(FilterButton, SIGNAL(toggled(bool)), this, SLOT(defineFilter())); - for (std::map<Q3CString, toResultView *>::iterator i = Map.begin();i != Map.end();i++) + for (std::map<QString, toResultView *>::iterator i = Map.begin();i != Map.end();i++) (*i).second->setFilter(Filter->clone()); refresh(); } @@ -2224,12 +2224,12 @@ return toToolWidget::close(); } -void toBrowser::exportData(std::map<Q3CString, QString> &data, const Q3CString &prefix) +void toBrowser::exportData(std::map<QString, QString> &data, const QString &prefix) { data[prefix + ":Schema"] = Schema->selected(); data[prefix + ":FirstTab"] = TopTab->currentPage()->name(); data[prefix + ":SecondText"] = SecondText; - for (std::map<Q3CString, toResult *>::iterator i = SecondMap.begin();i != SecondMap.end();i++) { + for (std::map<QString, toResult *>::iterator i = SecondMap.begin();i != SecondMap.end();i++) { if ((*i).second == SecondTab && Map.find((*i).first) == Map.end()) { data[prefix + ":SecondTab"] = (*i).first; break; @@ -2244,7 +2244,7 @@ Filter->exportData(data, prefix + ":Filter"); } -void toBrowser::importData(std::map<Q3CString, QString> &data, const Q3CString &prefix) +void toBrowser::importData(std::map<QString, QString> &data, const QString &prefix) { disconnect(Schema, SIGNAL(activated(int)), this, SLOT(changeSchema(int))); @@ -2789,7 +2789,7 @@ TOCATCH } -void toBrowseTemplate::importData(std::map<Q3CString, QString> &data, const Q3CString &prefix) +void toBrowseTemplate::importData(std::map<QString, QString> &data, const QString &prefix) { if (data.find(prefix + ":Filter:Type") != data.end()) { Filter = new toBrowserFilter; @@ -2797,7 +2797,7 @@ } } -void toBrowseTemplate::exportData(std::map<Q3CString, QString> &data, const Q3CString &prefix) +void toBrowseTemplate::exportData(std::map<QString, QString> &data, const QString &prefix) { if (Filter) Filter->exportData(data, prefix + ":Filter"); Modified: branches/tora-1.4/tora/src/tobrowser.h =================================================================== --- branches/tora-1.4/tora/src/tobrowser.h 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tobrowser.h 2007-12-21 00:54:24 UTC (rev 2367) @@ -43,7 +43,7 @@ #include "totool.h" #include <map> -#include <Q3CString> +#include <QString> #include <Q3PopupMenu> #include <QAction> @@ -80,8 +80,8 @@ toResultContent *TableContent; toResultContent *AccessContent; - std::map<Q3CString, toResultView *> Map; - std::map<Q3CString, toResult *> SecondMap; + std::map<QString, toResultView *> Map; + std::map<QString, toResult *> SecondMap; void setNewFilter(toBrowserFilter *filter); QTimer Poll; @@ -112,10 +112,10 @@ virtual bool canHandle(toConnection &conn); - virtual void exportData(std::map<Q3CString, QString> &data, - const Q3CString &prefix); - virtual void importData(std::map<Q3CString, QString> &data, - const Q3CString &prefix); + virtual void exportData(std::map<QString, QString> &data, + const QString &prefix); + virtual void importData(std::map<QString, QString> &data, + const QString &prefix); virtual bool close(); @@ -183,10 +183,10 @@ toBrowserFilter *filter(void) { return Filter; } - virtual void exportData(std::map<Q3CString, QString> &data, - const Q3CString &prefix); - virtual void importData(std::map<Q3CString, QString> &data, - const Q3CString &prefix); + virtual void exportData(std::map<QString, QString> &data, + const QString &prefix); + virtual void importData(std::map<QString, QString> &data, + const QString &prefix); public slots: void addDatabase(const QString &); Modified: branches/tora-1.4/tora/src/tochartmanager.cpp =================================================================== --- branches/tora-1.4/tora/src/tochartmanager.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tochartmanager.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -61,7 +61,7 @@ #include <qvalidator.h> #include <qworkspace.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <QPixmap> #include "ui_tochartalarmui.h" @@ -728,7 +728,7 @@ if ((*i).second.Persistent) { num++; - Q3CString name = Q3CString("Files:") + QString::number(num).latin1(); + QString name = QString("Files:") + QString::number(num).latin1(); ChartTool.setConfig(name + ":Name", (*i).first); ChartTool.setConfig(name + ":Spec", (*i).second.File.name()); } @@ -745,7 +745,7 @@ if ((*j).Persistent) { num++; - Q3CString name = Q3CString("Alarms:") + QString::number(num).latin1(); + QString name = QString("Alarms:") + QString::number(num).latin1(); ChartTool.setConfig(name + ":Name", (*i).first); ChartTool.setConfig(name + ":Spec", (*j).toString()); } @@ -761,7 +761,7 @@ { for (int num = ChartTool.config("FilesCount", "0").toInt();num > 0;num--) { - Q3CString name = Q3CString("Files:") + QString::number(num).latin1(); + QString name = QString("Files:") + QString::number(num).latin1(); QString t = ChartTool.config(name + ":Name", ""); QString s = ChartTool.config(name + ":Spec", ""); if (!t.isEmpty() && !s.isEmpty()) @@ -771,7 +771,7 @@ { for (int num = ChartTool.config("AlarmCount", "0").toInt();num > 0;num--) { - Q3CString name = Q3CString("Alarms:") + QString::number(num).latin1(); + QString name = QString("Alarms:") + QString::number(num).latin1(); QString t = ChartTool.config(name + ":Name", ""); QString s = ChartTool.config(name + ":Spec", ""); if (!t.isEmpty() && !s.isEmpty()) @@ -822,7 +822,7 @@ if (file.isOpen()) { static QRegExp quote(QString::fromLatin1("\"")); - Q3CString out = "\""; + QString out = "\""; if (header) { QString t = chart->title(); @@ -852,9 +852,9 @@ } } -static QString ReadCSV(const Q3CString &data, unsigned int &pos, bool &nl) +static QString ReadCSV(const QString &data, int &pos, bool &nl) { - Q3CString ret; + QString ret; if (data.at(pos) != '\"') throw qApp->translate("toChartManager", "Initial value didn't start with \" in CSV file"); pos++; @@ -871,13 +871,13 @@ throw qApp->translate("toChartManager", "Missing closing \" in CSV file"); pos++; nl = false; - while (pos < data.length() && (isspace(data.at(pos)) || data.at(pos) == ',' || data.at(pos) == ';')) + while (pos < data.length() && (data.at(pos).isSpace() || data.at(pos) == ',' || data.at(pos) == ';')) { if (data.at(pos) == '\n') nl = true; pos++; } - return QString::fromUtf8(ret); + return ret; } void toChartManager::openChart(void) @@ -887,8 +887,8 @@ { try { - Q3CString data = toReadFile(name); - unsigned int pos = 0; + QString data = toReadFile(name); + int pos = 0; toLineChart *chart; switch (TOMessageBox::information(toMainWidget(), Modified: branches/tora-1.4/tora/src/toconfiguration.cpp =================================================================== --- branches/tora-1.4/tora/src/toconfiguration.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/toconfiguration.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -2,8 +2,6 @@ #include <qapplication.h> #include <qregexp.h> -//Added by qt3to4: -#include <Q3CString> #include "utils.h" @@ -85,9 +83,9 @@ #endif } -void toConfiguration::loadMap(const QString &filename, std::map<Q3CString, QString> &pairs) +void toConfiguration::loadMap(const QString &filename, std::map<QString, QString> &pairs) { - Q3CString data = toReadFile(filename); + QByteArray data = toReadFile(filename); int pos = 0; int bol = 0; @@ -103,8 +101,8 @@ if (endtag == -1) throw QT_TRANSLATE_NOOP("toTool", "Malformed tag in config file. Missing = on row. (%1)").arg(QString(data.mid(bol, wpos - bol))); { - Q3CString tag = ((const char *)data) + bol; - Q3CString val = ((const char *)data) + endtag + 1; + QString tag = ((const char *)data) + bol; + QString val = ((const char *)data) + endtag + 1; pairs[tag] = QString::fromUtf8(val); } bol = pos + 1; @@ -152,11 +150,11 @@ try { #ifdef Q_OS_WIN32 - for (std::map<Q3CString, QString>::iterator i = Configuration.begin(); + for (std::map<QString, QString>::iterator i = Configuration.begin(); i != Configuration.end(); i++) { - Q3CString path = (*i).first; + QString path = (*i).first; QString value = (*i).second; path.prepend(APPLICATION_NAME); path.replace(':', '\\'); @@ -204,7 +202,7 @@ #else if (Configuration.empty()) return; - Q3CString conf; + QString conf; if (getenv("HOME")) { conf = getenv("HOME"); @@ -216,18 +214,18 @@ TOCATCH } -bool toConfiguration::saveMap(const QString &file, std::map<Q3CString, QString> &pairs) +bool toConfiguration::saveMap(const QString &file, std::map<QString, QString> &pairs) { - Q3CString data; + QString data; { // qt4 QRegExp newline(QString::fromLatin1("\n")); // qt4 QRegExp backslash(QString::fromLatin1("\\")); char* newline = "\n"; char* backslash = "\\"; - for (std::map<Q3CString, QString>::iterator i = pairs.begin();i != pairs.end();i++) + for (std::map<QString, QString>::iterator i = pairs.begin();i != pairs.end();i++) { - Q3CString str = (*i).first; + QString str = (*i).first; str.append(QString::fromLatin1("=")); str.replace(backslash, QString::fromLatin1("\\\\")); str.replace(newline, QString::fromLatin1("\\n")); @@ -242,18 +240,18 @@ return toWriteFile(file, data); } -const QString &toConfiguration::globalConfig(const Q3CString &tag, const Q3CString &def) +const QString &toConfiguration::globalConfig(const QString &tag, const QString &def) { if (Configuration.empty()) loadConfig(); - std::map<Q3CString, QString>::iterator i = Configuration.find(tag); + std::map<QString, QString>::iterator i = Configuration.find(tag); if (i == Configuration.end()) { #if defined(Q_OS_WIN32) - Q3CString path = tag; + QString path = tag; path.prepend(APPLICATION_NAME); path.replace(':', '\\'); LONG siz = 1024; @@ -305,42 +303,42 @@ -const QString& toConfiguration::config(const Q3CString &tag, const Q3CString &def, const Q3CString &name) +const QString& toConfiguration::config(const QString &tag, const QString &def, const QString &name) { - Q3CString str = name; + QString str = name; str.append(":"); str.append(tag); return globalConfig(str, def); } -void toConfiguration::eraseConfig(const Q3CString &tag, const Q3CString &name) +void toConfiguration::eraseConfig(const QString &tag, const QString &name) { - Q3CString str = name; + QString str = name; str.append(":"); str.append(tag); globalEraseConfig(str); } -void toConfiguration::setConfig(const Q3CString &tag, const QString &def, const Q3CString name) +void toConfiguration::setConfig(const QString &tag, const QString &def, const QString name) { - Q3CString str = name; + QString str = name; str.append(":"); str.append(tag); globalSetConfig(str, def); } -void toConfiguration::globalEraseConfig(const Q3CString &tag) +void toConfiguration::globalEraseConfig(const QString &tag) { if (Configuration.empty()) loadConfig(); - std::map<Q3CString, QString>::iterator i = Configuration.find(tag); + std::map<QString, QString>::iterator i = Configuration.find(tag); if (i != Configuration.end()) { Configuration.erase(i); #if defined(Q_OS_WIN32) - Q3CString path = tag; + QString path = tag; path.prepend(APPLICATION_NAME); path.replace(':', '\\'); RegDeleteKeyA(HKEY_CURRENT_USER, path); // Don't really care if it works. @@ -349,7 +347,7 @@ } } -void toConfiguration::globalSetConfig(const Q3CString &tag, const QString &value) +void toConfiguration::globalSetConfig(const QString &tag, const QString &value) { if ( Configuration.empty() ) loadConfig(); Modified: branches/tora-1.4/tora/src/toconfiguration.h =================================================================== --- branches/tora-1.4/tora/src/toconfiguration.h 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/toconfiguration.h 2007-12-21 00:54:24 UTC (rev 2367) @@ -12,8 +12,7 @@ #include <qstring.h> #include <qapplication.h> -//Added by qt3to4: -#include <Q3CString> + // // A little magic to get lrefresh to work and get a check on qApp @@ -47,14 +46,14 @@ * @param tag The name of the configuration setting. * @param def Default value of the setting, if it is not available. */ - const QString &globalConfig(const Q3CString &tag, const Q3CString &def); + const QString &globalConfig(const QString &tag, const QString &def); /** * Load a string to string map from file saved by the @ref saveMap function. * @param filename Filename to load * @param map Reference to the map to fill with the new values. */ - void loadMap(const QString &filename, std::map<Q3CString, QString> &map); + void loadMap(const QString &filename, std::map<QString, QString> &map); /** * A map containing the available configuration settings. By convention the @@ -65,7 +64,7 @@ * @see config * @see setConfig */ - bool saveMap(const QString &file, std::map<Q3CString, QString> &pairs); + bool saveMap(const QString &file, std::map<QString, QString> &pairs); /** * Change a setting. Depending on the implementation this can change the @@ -78,12 +77,12 @@ * @param tag The name of the configuration setting. * @param def Contents of this setting. */ - void globalSetConfig(const Q3CString &tag, const QString &value); + void globalSetConfig(const QString &tag, const QString &value); /** * Remove a setting. Can be usefull for removing sensetive information. * @param tag The name of the configuration setting to remove. */ - void globalEraseConfig(const Q3CString &tag); + void globalEraseConfig(const QString &tag); /** * Get tool specific settings. @@ -95,7 +94,7 @@ * @param tag The name of the configuration setting. * @param def Contents of this setting. */ - const QString &config(const Q3CString &tag, const Q3CString &def, const Q3CString &name); + const QString &config(const QString &tag, const QString &def, const QString &name); /** * Change toolspecific setting. Depending on the implementation this can change the * contents on disk or not. @@ -107,15 +106,15 @@ * @param tag The name of the configuration setting. * @param def Default value of the setting, if it is not available. */ - void setConfig(const Q3CString &tag, const QString &value, const Q3CString name = ""); + void setConfig(const QString &tag, const QString &value, const QString name = ""); /** * Remove a toolspecific setting. Can be usefull for removing sensetive information. * @param tag The name of the configuration setting to remove. */ - void eraseConfig(const Q3CString &tag, const Q3CString& name); + void eraseConfig(const QString &tag, const QString& name); private : - std::map<Q3CString, QString> Configuration; + std::map<QString, QString> Configuration; }; typedef Loki::SingletonHolder<toConfiguration> toConfigurationSingle; Modified: branches/tora-1.4/tora/src/toconnection.cpp =================================================================== --- branches/tora-1.4/tora/src/toconnection.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/toconnection.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -53,7 +53,7 @@ #include <q3textstream.h> #include <qwidget.h> -#include <Q3CString> +#include <QString> #include <QDateTime> #include <QPointer> @@ -64,41 +64,41 @@ // Connection provider implementation -std::map<Q3CString, toConnectionProvider *> *toConnectionProvider::Providers; -std::map<Q3CString, toConnectionProvider *> *toConnectionProvider::Types; +std::map<QString, toConnectionProvider *> *toConnectionProvider::Providers; +std::map<QString, toConnectionProvider *> *toConnectionProvider::Types; static int NumberFormat; static int NumberDecimals; void toConnectionProvider::checkAlloc(void) { if (!Providers) - Providers = new std::map<Q3CString, toConnectionProvider *>; + Providers = new std::map<QString, toConnectionProvider *>; } -void toConnectionProvider::addProvider(const Q3CString &provider) { +void toConnectionProvider::addProvider(const QString &provider) { checkAlloc(); Provider = provider; (*Providers)[Provider] = this; } -toConnectionProvider::toConnectionProvider(const Q3CString &provider, bool add +toConnectionProvider::toConnectionProvider(const QString &provider, bool add ) { Provider = provider; if (add ) addProvider(provider); if (!Types) - Types = new std::map<Q3CString, toConnectionProvider *>; + Types = new std::map<QString, toConnectionProvider *>; (*Types)[provider] = this; } -std::list<QString> toConnectionProvider::providedOptions(const Q3CString &) { +std::list<QString> toConnectionProvider::providedOptions(const QString &) { std::list<QString> ret; return ret; } -void toConnectionProvider::removeProvider(const Q3CString &provider) { - std::map<Q3CString, toConnectionProvider *>::iterator i = Providers->find(provider); +void toConnectionProvider::removeProvider(const QString &provider) { + std::map<QString, toConnectionProvider *>::iterator i = Providers->find(provider); if (i != Providers->end()) Providers->erase(i); } @@ -107,79 +107,79 @@ try { if (!Provider.isEmpty()) removeProvider(Provider); - std::map<Q3CString, toConnectionProvider *>::iterator i = Types->find(Provider); + std::map<QString, toConnectionProvider *>::iterator i = Types->find(Provider); if (i != Types->end()) Types->erase(i); } catch (...) {} } -std::list<QString> toConnectionProvider::providedHosts(const Q3CString &) { +std::list<QString> toConnectionProvider::providedHosts(const QString &) { std::list<QString> ret; return ret; } -std::list<Q3CString> toConnectionProvider::providers() { - std::list<Q3CString> ret; +std::list<QString> toConnectionProvider::providers() { + std::list<QString> ret; if (!Providers) return ret; - for (std::map<Q3CString, toConnectionProvider *>::iterator i = Providers->begin();i != Providers->end();i++) + for (std::map<QString, toConnectionProvider *>::iterator i = Providers->begin();i != Providers->end();i++) ret.insert(ret.end(), (*i).first); return ret; } void toConnectionProvider::initializeAll(void) { if (Types) - for (std::map<Q3CString, toConnectionProvider *>::iterator i = Types->begin(); + for (std::map<QString, toConnectionProvider *>::iterator i = Types->begin(); i != Types->end();i++) (*i).second->initialize(); } -toConnectionProvider &toConnectionProvider::fetchProvider(const Q3CString &provider) { +toConnectionProvider &toConnectionProvider::fetchProvider(const QString &provider) { checkAlloc(); - std::map<Q3CString, toConnectionProvider *>::iterator i = Providers->find(provider); + std::map<QString, toConnectionProvider *>::iterator i = Providers->find(provider); if (i == Providers->end()) throw QT_TRANSLATE_NOOP("toConnectionProvider", "Tried to fetch unknown provider %1").arg(QString(provider)); return *((*i).second); } -std::list<QString> toConnectionProvider::options(const Q3CString &provider) { +std::list<QString> toConnectionProvider::options(const QString &provider) { return fetchProvider(provider).providedOptions(provider); } -QWidget *toConnectionProvider::configurationTab(const Q3CString &provider, QWidget *parent) { +QWidget *toConnectionProvider::configurationTab(const QString &provider, QWidget *parent) { return fetchProvider(provider).providerConfigurationTab(provider, parent); } -toConnection::connectionImpl *toConnectionProvider::connection(const Q3CString &provider, +toConnection::connectionImpl *toConnectionProvider::connection(const QString &provider, toConnection *conn) { return fetchProvider(provider).provideConnection(provider, conn); } -std::list<QString> toConnectionProvider::hosts(const Q3CString &provider) { +std::list<QString> toConnectionProvider::hosts(const QString &provider) { return fetchProvider(provider).providedHosts(provider); } -std::list<QString> toConnectionProvider::databases(const Q3CString &provider, const QString &host, +std::list<QString> toConnectionProvider::databases(const QString &provider, const QString &host, const QString &user, const QString &pwd) { return fetchProvider(provider).providedDatabases(provider, host, user, pwd); } -const QString &toConnectionProvider::config(const Q3CString &tag, const Q3CString &def) { - Q3CString str = Provider; +const QString &toConnectionProvider::config(const QString &tag, const QString &def) { + QString str = Provider; str.append(":"); str.append(tag); return toConfigurationSingle::Instance().globalConfig(str, def); } -void toConnectionProvider::setConfig(const Q3CString &tag, const Q3CString &def) { - Q3CString str = Provider; +void toConnectionProvider::setConfig(const QString &tag, const QString &def) { + QString str = Provider; str.append(":"); str.append(tag); toConfigurationSingle::Instance().globalSetConfig(str, def); } -QWidget *toConnectionProvider::providerConfigurationTab(const Q3CString &, QWidget *) { +QWidget *toConnectionProvider::providerConfigurationTab(const QString &, QWidget *) { return NULL; } @@ -309,19 +309,19 @@ static char HexString[] = "0123456789ABCDEF"; -Q3CString toQValue::utf8(void) const { +QString toQValue::utf8(void) const { switch (Type) { case nullType: { - Q3CString ret; + QString ret; return ret; } case intType: { - Q3CString ret; + QString ret; ret.setNum(Value.Int); return ret; } case doubleType: { - Q3CString ret; + QString ret; if (Value.Double != int(Value.Double)) { ret.setNum(Value.Double); return ret; @@ -345,7 +345,7 @@ case stringType: return Value.String->utf8(); case binaryType: { - Q3CString ret(Value.Array->size()*2 + 1); + QString ret(Value.Array->size()*2 + 1); for (int i = 0;i < Value.Array->size();i++) { unsigned char c = (unsigned char)Value.Array->at(i); // ret.at(i*2) = HexString[(c / 16) % 16]; @@ -432,7 +432,7 @@ return ret; } -toQValue toQValue::createFromHex(const Q3CString &hex) { +toQValue toQValue::createFromHex(const QByteArray &hex) { QByteArray arr((hex.length() + 1) / 2); for (int i = 0;i < hex.length();i += 2) { int num; @@ -957,7 +957,7 @@ } } -toConnection::toConnection(const Q3CString &provider, +toConnection::toConnection(const QString &provider, const QString &user, const QString &password, const QString &host, const QString &database, const std::set<QString> &options, bool cache) @@ -1498,7 +1498,7 @@ } } -const Q3CString &toConnection::provider(void) const { +const QString &toConnection::provider(void) const { return Provider; } @@ -1921,7 +1921,7 @@ } void toConnection::connectionImpl::parse(toConnectionSub *, - const Q3CString &) { + const QString &) { throw qApp->translate( "toConnection", "Parse only not implemented for this type of connection"); Modified: branches/tora-1.4/tora/src/toconnection.h =================================================================== --- branches/tora-1.4/tora/src/toconnection.h 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/toconnection.h 2007-12-21 00:54:24 UTC (rev 2367) @@ -47,7 +47,7 @@ #include <set> #include <QString> -#include <Q3CString> +#include <QString> #include <QPointer> class QWidget; @@ -203,7 +203,7 @@ toConnection &Connection; toConnectionSub *ConnectionSub; std::list<toQValue> Params; - Q3CString SQL; + QString SQL; queryMode Mode; queryImpl *Query; @@ -301,7 +301,7 @@ } /** SQL to run. Observe that this string is in UTF8 format. */ - Q3CString sql(void) + QString sql(void) { return SQL; } @@ -446,12 +446,12 @@ */ class toConnection { - Q3CString Provider; + QString Provider; QString User; QString Password; QString Host; QString Database; - Q3CString Version; + QString Version; std::list<QPointer<QWidget> > Widgets; std::list<QString> InitStrings; std::set @@ -578,7 +578,7 @@ /** Get the version of the database connected to. */ - virtual Q3CString version(toConnectionSub *) = 0; + virtual QString version(toConnectionSub *) = 0; /** Return a string representation to address an object. * @param name The name to be quoted. @@ -633,13 +633,13 @@ * @param sql SQL to execute. * @param params Parameters to pass to query. */ - virtual void execute(toConnectionSub *conn, const Q3CString &sql, toQList ¶ms) = 0; + virtual void execute(toConnectionSub *conn, const QString &sql, toQList ¶ms) = 0; /** Parse a query on an actual connection and report any syntax problems encountered. * Defaults to not implemented. * @param conn Connection to execute on. * @param sql SQL to parse */ - virtual void parse(toConnectionSub *conn, const Q3CString &sql); + virtual void parse(toConnectionSub *conn, const QString &sql); }; private: @@ -688,7 +688,7 @@ * @param options Options used to connect to the database with. * @param cache Enable object cache for this connection. */ - toConnection(const Q3CString &provider, const QString &user, const QString &password, + toConnection(const QString &provider, const QString &user, const QString &password, const QString &host, const QString &database, const std::set <QString> &options, bool cache = true); @@ -743,13 +743,13 @@ } /** Get version of connection. */ - const Q3CString &version() const + const QString &version() const { return Version; } /** Get provider of connection. */ - const Q3CString &provider() const; + const QString &provider() const; /** Change the current database. Observe that this only changes the record of what is the current database. You will still need * to change the database oppinion on what database is the current one. @@ -996,28 +996,28 @@ class toConnectionProvider { - static std::map<Q3CString, toConnectionProvider *> *Providers; - static std::map<Q3CString, toConnectionProvider *> *Types; - Q3CString Provider; + static std::map<QString, toConnectionProvider *> *Providers; + static std::map<QString, toConnectionProvider *> *Types; + QString Provider; static void checkAlloc(void); /** Get the provider object for a given provider name. * @param provider Name of provider. * @return Reference to provider object. */ - static toConnectionProvider &fetchProvider(const Q3CString &provider); + static toConnectionProvider &fetchProvider(const QString &provider); protected: /** Add a provider to the list that this provider can handle. */ - void addProvider(const Q3CString &provider); + void addProvider(const QString &provider); /** Remove a provider from the list that this provider can handle. */ - void removeProvider(const Q3CString &provider); + void removeProvider(const QString &provider); public: /** Create a new provider with the specified name. * @param provider Name of the provider. */ - toConnectionProvider(const Q3CString &provider, bool add + toConnectionProvider(const QString &provider, bool add = true); /** Destructor. */ @@ -1028,19 +1028,19 @@ * @param conn The connection object to use the created connection. * @return A connection implementation created with new. */ - virtual toConnection::connectionImpl *provideConnection(const Q3CString &provider, + virtual toConnection::connectionImpl *provideConnection(const QString &provider, toConnection *conn) = 0; /** List the available hosts this database provider knows about. * @return A list of hosts. */ - virtual std::list<QString> providedHosts(const Q3CString &provider); + virtual std::list<QString> providedHosts(const QString &provider); /** List the available databases this provider knows about for a given host. * @param host Host to return connections for. * @param user That might be needed. * @param password That might be needed. * @return A list of databases available for a given host. */ - virtual std::list<QString> providedDatabases(const Q3CString &provider, + virtual std::list<QString> providedDatabases(const QString &provider, const QString &host, const QString &user, const QString &pwd) = 0; @@ -1055,7 +1055,7 @@ * options. An option preceeded by "*" means selected by default. The * shoul be stripped before * before passing it to the connection call. */ - virtual std::list<QString> providedOptions(const Q3CString &provider); + virtual std::list<QString> providedOptions(const QString &provider); /** * Create and return configuration tab for this connectiontype. The returned widget should also @@ -1064,25 +1064,25 @@ * @return A pointer to the widget containing the setup tab for this tool or NULL of * no settings are available. */ - virtual QWidget *providerConfigurationTab(const Q3CString &provider, QWidget *parent); + virtual QWidget *providerConfigurationTab(const QString &provider, QWidget *parent); /** Get a list of names for providers. */ - static QWidget *configurationTab(const Q3CString &provider, QWidget *parent); + static QWidget *configurationTab(const QString &provider, QWidget *parent); /** Get a list of names for providers. */ - static std::list<Q3CString> providers(); + static std::list<QString> providers(); /** Get a list of options for a given provider. */ - static std::list<QString> options(const Q3CString &provider); + static std::list<QString> options(const QString &provider); /** Implement a connection for a given provider. * @param provider Provider to implement. * @param conn Connection to create implementation for. */ - static toConnection::connectionImpl *connection(const Q3CString &provider, toConnection *conn); + static toConnection::connectionImpl *connection(const QString &provider, toConnection *conn); /** Get a list of hosts this provider knows about. */ - static std::list<QString> hosts(const Q3CString &provider); + static std::list<QString> hosts(const QString &provider); /** Get a list of databases for a given provider and host. * @param provider Provider to fetch databases for. * @param host Host to fetch databases for. @@ -1090,7 +1090,7 @@ * @param password That might be needed. * @return List of known databases. */ - static std::list<QString> databases(const Q3CString &provider, const QString &host, + static std::list<QString> databases(const QString &provider, const QString &host, const QString &user, const QString &pwd); /** * Get connection specific settings. @@ -1103,7 +1103,7 @@ * @param tag The name of the configuration setting. * @param def Contents of this setting. */ - const QString &config(const Q3CString &tag, const Q3CString &def); + const QString &config(const QString &tag, const QString &def); /** * Change connectionspecific setting. Depending on the implementation this can change the * contents on disk or not. @@ -1116,7 +1116,7 @@ * @param tag The name of the configuration setting. * @param def Default value of the setting, if it is not available. */ - void setConfig(const Q3CString &tag, const Q3CString &value); + void setConfig(const QString &tag, const QString &value); /** Call all initializers */ Modified: branches/tora-1.4/tora/src/todebug.cpp =================================================================== --- branches/tora-1.4/tora/src/todebug.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/todebug.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -77,7 +77,7 @@ //Added by qt3to4: #include <QPixmap> #include <Q3ValueList> -#include <Q3CString> +#include <QString> #include <Q3PopupMenu> #include "icons/addwatch.xpm" @@ -2779,13 +2779,13 @@ } } -void toDebug::exportData(std::map<Q3CString, QString> &data, const Q3CString &prefix) +void toDebug::exportData(std::map<QString, QString> &data, const QString &prefix) { data[prefix + ":Editors"] = Editors->count(); for (int i = 0;i < Editors->count();i++) { toHighlightedText *editor = dynamic_cast<toHighlightedText *>(Editors->page(i)); - Q3CString num; + QString num; num.setNum(i); editor->exportData(data, prefix + ":Editor:" + num); } @@ -2798,7 +2798,7 @@ if (point) { - Q3CString key = prefix + ":Breaks:" + QString::number(id).latin1(); + QString key = prefix + ":Breaks:" + QString::number(id).latin1(); data[key + ":Schema"] = point->text(2); data[key + ":Object"] = point->text(0); @@ -2816,7 +2816,7 @@ toResultViewItem * item = dynamic_cast<toResultViewItem *>(qitem); if (item) { - Q3CString key = prefix + ":Watch:" + QString::number(id).latin1(); + QString key = prefix + ":Watch:" + QString::number(id).latin1(); data[key + ":Schema"] = item->allText(0); data[key + ":Object"] = item->allText(1); data[key + ":Item"] = item->allText(2); @@ -2830,7 +2830,7 @@ toToolWidget::exportData(data, prefix); } -void toDebug::importData(std::map<Q3CString, QString> &data, const Q3CString &prefix) +void toDebug::importData(std::map<QString, QString> &data, const QString &prefix) { QString str = data[prefix + ":Schema"]; { @@ -2849,18 +2849,18 @@ toDebugText *text = new toDebugText(Breakpoints, Editors, this); connect(text, SIGNAL(insertedLines(int, int)), this, SLOT(reorderContent(int, int))); - Q3CString num; + QString num; num.setNum(j); text->importData(data, prefix + ":Editor:" + num); Editors->addTab(text, editorName(text)); } int id = 1; - std::map<Q3CString, QString>::iterator i; + std::map<QString, QString>::iterator i; toBreakpointItem *debug = NULL; while ((i = data.find(prefix + ":Breaks:" + QString::number(id).latin1() + ":Line")) != data.end()) { - Q3CString key = prefix + ":Breaks:" + QString::number(id).latin1(); + QString key = prefix + ":Breaks:" + QString::number(id).latin1(); int line = (*i).second.toInt(); debug = new toBreakpointItem(Breakpoints, debug, data[key + ":Schema"], @@ -2875,7 +2875,7 @@ toResultViewItem *item = NULL; while ((i = data.find(prefix + ":Watch:" + QString::number(id).latin1() + ":Item")) != data.end()) { - Q3CString key = prefix + ":Watch:" + QString::number(id).latin1(); + QString key = prefix + ":Watch:" + QString::number(id).latin1(); item = new toResultViewItem(Watch, NULL, data[key + ":Schema"]); item->setText(1, data[key + ":Object"]); item->setText(2, data[key + ":Item"]); Modified: branches/tora-1.4/tora/src/todebug.h =================================================================== --- branches/tora-1.4/tora/src/todebug.h 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/todebug.h 2007-12-21 00:54:24 UTC (rev 2367) @@ -49,7 +49,7 @@ #include <qtimer.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <Q3PopupMenu> #define TO_SUCCESS 0 @@ -223,8 +223,8 @@ QString checkWatch(const QString &name); - virtual void exportData(std::map<Q3CString, QString> &data, const Q3CString &prefix); - virtual void importData(std::map<Q3CString, QString> &data, const Q3CString &prefix); + virtual void exportData(std::map<QString, QString> &data, const QString &prefix); + virtual void importData(std::map<QString, QString> &data, const QString &prefix); public slots: void stop(void); void compile(void); Modified: branches/tora-1.4/tora/src/todebugtext.cpp =================================================================== --- branches/tora-1.4/tora/src/todebugtext.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/todebugtext.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -46,7 +46,7 @@ #include <qpainter.h> #include <qpixmap.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <QMouseEvent> #include "icons/breakpoint.xpm" @@ -434,7 +434,7 @@ } -void toDebugText::exportData(std::map<Q3CString, QString> &data, const Q3CString &prefix) +void toDebugText::exportData(std::map<QString, QString> &data, const QString &prefix) { toHighlightedText::exportData(data, prefix); data[prefix + ":Schema"] = Schema; @@ -442,7 +442,7 @@ data[prefix + ":Type"] = Type; } -void toDebugText::importData(std::map<Q3CString, QString> &data, const Q3CString &prefix) +void toDebugText::importData(std::map<QString, QString> &data, const QString &prefix) { toHighlightedText::importData(data, prefix); Schema = data[prefix + ":Schema"]; Modified: branches/tora-1.4/tora/src/todebugtext.h =================================================================== --- branches/tora-1.4/tora/src/todebugtext.h 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/todebugtext.h 2007-12-21 00:54:24 UTC (rev 2367) @@ -43,7 +43,7 @@ #include <q3listview.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <QMouseEvent> #include <algorithm> @@ -121,8 +121,8 @@ bool readErrors(toConnection &connection); bool compile(void); - virtual void exportData(std::map<Q3CString, QString> &data, const Q3CString &prefix); - virtual void importData(std::map<Q3CString, QString> &data, const Q3CString &prefix); + virtual void exportData(std::map<QString, QString> &data, const QString &prefix); + virtual void importData(std::map<QString, QString> &data, const QString &prefix); protected slots: virtual void toggleBreakpoint(int margin, int line, Qt::ButtonState state); protected: Modified: branches/tora-1.4/tora/src/toextract.cpp =================================================================== --- branches/tora-1.4/tora/src/toextract.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/toextract.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -48,7 +48,7 @@ #include <q3progressdialog.h> #include <qdatetime.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #ifdef Q_OS_WIN32 #include <winsock2.h> #endif @@ -188,12 +188,12 @@ BlockSize = 8192; } -void toExtract::setState(const Q3CString &name, const QVariant &val) +void toExtract::setState(const QString &name, const QVariant &val) { Context[name] = val; } -QVariant toExtract::state(const Q3CString &name) +QVariant toExtract::state(const QString &name) { return Context[name]; } Modified: branches/tora-1.4/tora/src/toextract.h =================================================================== --- branches/tora-1.4/tora/src/toextract.h 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/toextract.h 2007-12-21 00:54:24 UTC (rev 2367) @@ -48,7 +48,7 @@ #include <q3textstream.h> #include <qvariant.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> class QWidget; class toConnection; @@ -270,7 +270,7 @@ std::list<QString> Limit; // Context, can be used by the extractor to save context - std::map<Q3CString, QVariant> Context; + std::map<QString, QVariant> Context; // Stuff to handle extractors static std::map<QString, extractor *> *Extractors; @@ -421,12 +421,12 @@ * @param name Name of this context * @param val Value of this context */ - void setState(const Q3CString &name, const QVariant &val); + void setState(const QString &name, const QVariant &val); /** Get the value of a context for the current extractor. * @param name Name of the context to extract. * @return The value of the context. */ - QVariant state(const Q3CString &name); + QVariant state(const QString &name); /** Set the schema of the extraction. * @param schema Specify the schema of the output script or description. If empty Modified: branches/tora-1.4/tora/src/tofyracleconnection.cpp =================================================================== --- branches/tora-1.4/tora/src/tofyracleconnection.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tofyracleconnection.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -35,7 +35,7 @@ #include <qfile.h> #include <qregexp.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #ifdef Q_OS_WIN32 #include <winsock.h> @@ -477,7 +477,7 @@ return new fyracleQuery(query, sub); } - virtual void execute(toConnectionSub *sub, const Q3CString &sql, toQList ¶ms) + virtual void execute(toConnectionSub *sub, const QString &sql, toQList ¶ms) { } }; @@ -545,7 +545,7 @@ dpb[i] = *pwd++; // combine host and database path - Q3CString path; + QString path; if ( connection().host().isEmpty() ) { path = connection().database().utf8(); Modified: branches/tora-1.4/tora/src/toglobalsetting.cpp =================================================================== --- branches/tora-1.4/tora/src/toglobalsetting.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/toglobalsetting.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -64,7 +64,7 @@ #include <q3whatsthis.h> #include <qcolordialog.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <QFileDialog> @@ -354,11 +354,11 @@ { setupUi(this); - std::map<Q3CString, toTool *> &tools = toTool::tools(); + std::map<QString, toTool *> &tools = toTool::tools(); QString first; Enabled->setSorting(0); - for (std::map<Q3CString, toTool *>::iterator i = tools.begin();i != tools.end();i++) + for (std::map<QString, toTool *>::iterator i = tools.begin();i != tools.end();i++) { if ((*i).second->menuItem()) { @@ -372,7 +372,7 @@ for (Q3ListViewItem *item = Enabled->firstChild();item;item = item->nextSibling()) { - Q3CString tmp = item->text(2).latin1(); + QString tmp = item->text(2).latin1(); tmp += CONF_TOOL_ENABLE; if (!toConfigurationSingle::Instance().globalConfig(tmp, "Yes").isEmpty()) item->setSelected(true); @@ -406,7 +406,7 @@ { for (Q3ListViewItem *item = Enabled->firstChild();item;item = item->nextSibling()) { - Q3CString str = item->text(2).latin1(); + QString str = item->text(2).latin1(); str += CONF_TOOL_ENABLE; toConfigurationSingle::Instance().globalSetConfig(str, item->isSelected() ? "Yes" : ""); Modified: branches/tora-1.4/tora/src/tohelp.cpp =================================================================== --- branches/tora-1.4/tora/src/tohelp.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tohelp.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -66,7 +66,7 @@ #include <qtooltip.h> #include <q3vbox.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <Q3VBoxLayout> #include <QToolBar> @@ -283,7 +283,7 @@ toHtml file(toReadFile(filename)); bool inA = false; QString dsc; - Q3CString href; + QString href; QTreeWidgetItem * last = NULL; while (!file.eof()) { @@ -474,8 +474,8 @@ std::list<QString> Context; bool inDsc = false; bool aRestart = true; - Q3CString dsc; - Q3CString href; + QString dsc; + QString href; while (!file.eof()) { file.nextToken(); @@ -523,7 +523,7 @@ bool incl = true; { - for (size_t i = 0;i < words.count();i++) + for (int i = 0;i < words.count();i++) if (!tmp.contains(words[i], false)) { incl = false; Modified: branches/tora-1.4/tora/src/tohighlightedtext.h =================================================================== --- branches/tora-1.4/tora/src/tohighlightedtext.h 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tohighlightedtext.h 2007-12-21 00:54:24 UTC (rev 2367) @@ -45,7 +45,7 @@ #include <Qsci/qscilexer.h> #include <Qsci/qsciapis.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <QKeyEvent> #include <list> @@ -127,12 +127,12 @@ * @param typ @ref infoType to get string for. * @return Description of infotype. */ - static Q3CString typeString(infoType typ); + static QString typeString(infoType typ); /** Get an @ref infoType from a string representation of it. * @param str Description of @ref infoType. * @return @ref infoType described by string. */ - static infoType typeString(const Q3CString &str); + static infoType typeString(const QString &str); /** Update configuration settings from this class color values. */ void updateSettings(void); Modified: branches/tora-1.4/tora/src/tohtml.cpp =================================================================== --- branches/tora-1.4/tora/src/tohtml.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tohtml.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -47,9 +47,9 @@ #include <qapplication.h> #include <qregexp.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> -toHtml::toHtml(const Q3CString &data) +toHtml::toHtml(const QString &data) { Length = strlen(data); Data = new char[Length + 1]; @@ -213,7 +213,7 @@ } } -const char *toHtml::value(const Q3CString &q) +const char *toHtml::value(const QString &q) { for (int i = 0;i < QualifierNum;i++) { @@ -223,9 +223,9 @@ return NULL; } -Q3CString toHtml::text() +QString toHtml::text() { - Q3CString ret; + QString ret; for (const char *cur = Text;*cur;cur++) { char c = *cur; @@ -234,7 +234,7 @@ const char *start = cur + 1; while (*cur && *cur != ';') cur++; - Q3CString tmp(start, cur - start); + QString tmp(QByteArray(start, cur - start)); if (tmp[0] == '#') { tmp = tmp.right(tmp.length() - 1); @@ -269,9 +269,9 @@ return Data + start; } -bool toHtml::search(const Q3CString &all, const QString &str) +bool toHtml::search(const QString &all, const QString &str) { - Q3CString data(str.lower().latin1()); + QString data(str.lower().latin1()); enum { beginning, @@ -280,10 +280,10 @@ inWord } lastState = beginning, state = beginning; int pos = 0; - char endString = 0; + QChar endString = 0; for (int i = 0;i < all.length();i++) { - char c = tolower(all.at(i)); + QChar c = all.at(i).toLower(); if (c == '\'' || c == '\"') { endString = c; @@ -312,7 +312,7 @@ pos++; if (pos >= data.length()) { - if (i + 1 >= all.length() || !isalnum(all.at(i + 1))) + if (i + 1 >= all.length() || !all.at(i + 1).isLetterOrNumber()) return true; pos = 0; } @@ -320,7 +320,7 @@ } // Intentionally no break here case inWord: - if (!isalnum(c)) + if(!c.isLetterOrNumber()) state = beginning; break; case inTag: Modified: branches/tora-1.4/tora/src/tohtml.h =================================================================== --- branches/tora-1.4/tora/src/tohtml.h 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tohtml.h 2007-12-21 00:54:24 UTC (rev 2367) @@ -43,7 +43,6 @@ #include <map> #include <qstring.h> -#include <q3cstring.h> #define TO_HTML_MAX_QUAL 100 @@ -126,7 +125,7 @@ /** Create a HTML parser. * @param data Data to parse. */ - toHtml(const Q3CString &data); + toHtml(const QString &data); ~toHtml(); /** Read the next token which can be either a open tag, close tag or text. @@ -142,7 +141,7 @@ * @param name Name of qualifier in lowercase. * @return Value of qualifier or NULL. */ - const char *value(const Q3CString &name); + const char *value(const QString &name); /** Return true if current token is a tag. * @return True if tag. */ @@ -163,7 +162,7 @@ * @return The parsed text. */ - Q3CString text(void); + QString text(void); /** Get name of tag in lowercase. Only valid if @ref isTag returns true. * @return Name of tag (Excluding / if close tag). @@ -182,7 +181,7 @@ * @param data Data to search. * @param str Substring to search for in data. */ - static bool search(const Q3CString &data, const QString &str); + static bool search(const QString &data, const QString &str); /** Escape text to be HTML. */ Modified: branches/tora-1.4/tora/src/tolinechart.cpp =================================================================== --- branches/tora-1.4/tora/src/tolinechart.cpp 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tolinechart.cpp 2007-12-21 00:54:24 UTC (rev 2367) @@ -58,7 +58,7 @@ #include <qvalidator.h> #include <qworkspace.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <QPixmap> #include <QMouseEvent> #include <QPaintEvent> @@ -893,7 +893,7 @@ toMainWidget()->addChart(this); } -void toLineChart::exportData(std::map<Q3CString, QString> &ret, const Q3CString &prefix) +void toLineChart::exportData(std::map<QString, QString> &ret, const QString &prefix) { int id = 0; { @@ -928,10 +928,10 @@ ret[prefix + ":Title"] = Title; } -void toLineChart::importData(std::map<Q3CString, QString> &ret, const Q3CString &prefix) +void toLineChart::importData(std::map<QString, QString> &ret, const QString &prefix) { int id; - std::map<Q3CString, QString>::iterator i; + std::map<QString, QString>::iterator i; id = 1; Labels.clear(); Modified: branches/tora-1.4/tora/src/tolinechart.h =================================================================== --- branches/tora-1.4/tora/src/tolinechart.h 2007-12-20 22:44:51 UTC (rev 2366) +++ branches/tora-1.4/tora/src/tolinechart.h 2007-12-21 00:54:24 UTC (rev 2367) @@ -46,7 +46,7 @@ #include <qwidget.h> //Added by qt3to4: -#include <Q3CString> +#include <QString> #include <QPaintEvent> #include <QMouseEvent> #include <Q3PopupMenu> @@ -316,12 +316,12 @@ * @param data A map that can be used to recreate the data of a chart. * @param prefix Prefix to add to the map. */ - virtual void exportData(std::map<Q3CString, QString> &data, const Q3CString &prefix); + virtual void exportData(std::map<QString, QString> &data, const QString &prefix); /** Import data * @param data Data to read from a map. * @param prefix Prefix to read data from. */ - virtual void importData(std::map<Q3CString, QString> &data, const Q3CString &prefix); + virtual void importData(std::map<QString, QString> &data, const QString &prefix); /** Get enabled datavalues. Values in this list with false are not drawn in the chart. * Could be an empty list if everything is enabled. Modified: branches/tora-1.4/tora/src/tolist... [truncated message content] |
From: <su...@us...> - 2007-12-21 12:27:27
|
Revision: 2368 http://tora.svn.sourceforge.net/tora/?rev=2368&view=rev Author: subik Date: 2007-12-21 04:27:04 -0800 (Fri, 21 Dec 2007) Log Message: ----------- variable renaming for MSVC compilation. Modified Paths: -------------- branches/tora-1.4/tora/src/tobrowserindex.cpp branches/tora-1.4/tora/src/tobrowsertable.cpp branches/tora-1.4/tora/src/toreport.cpp Modified: branches/tora-1.4/tora/src/tobrowserindex.cpp =================================================================== --- branches/tora-1.4/tora/src/tobrowserindex.cpp 2007-12-21 00:54:24 UTC (rev 2367) +++ branches/tora-1.4/tora/src/tobrowserindex.cpp 2007-12-21 12:27:04 UTC (rev 2368) @@ -91,11 +91,11 @@ for (std::list<toSQLParse::statement>::iterator i = statements.begin();i != statements.end();i++) { QString sql = toSQLParse::indentStatement(*i, connection()); - int i = sql.length() - 1; - while (i >= 0 && (sql.at(i) == ';' || sql.at(i).isSpace())) - i--; - if (i >= 0) - connection().execute(sql.mid(0, i + 1)); + int l = sql.length() - 1; + while (l >= 0 && (sql.at(l) == ';' || sql.at(l).isSpace())) + l--; + if (l >= 0) + connection().execute(sql.mid(0, l + 1)); qApp->processEvents(); if (prog.wasCancelled()) throw tr("Cancelled ongoing index modification, indexes might be corrupt"); Modified: branches/tora-1.4/tora/src/tobrowsertable.cpp =================================================================== --- branches/tora-1.4/tora/src/tobrowsertable.cpp 2007-12-21 00:54:24 UTC (rev 2367) +++ branches/tora-1.4/tora/src/tobrowsertable.cpp 2007-12-21 12:27:04 UTC (rev 2368) @@ -80,11 +80,11 @@ for (std::list<toSQLParse::statement>::iterator i = statements.begin();i != statements.end();i++) { QString sql = toSQLParse::indentStatement(*i, conn); - int i = sql.length() - 1; - while (i >= 0 && (sql.at(i) == ';' || sql.at(i).isSpace())) - i--; - if (i >= 0) - conn.execute(sql.mid(0, i + 1)); + int l = sql.length() - 1; + while (l >= 0 && (sql.at(l) == ';' || sql.at(l).isSpace())) + l--; + if (l >= 0) + conn.execute(sql.mid(0, l + 1)); qApp->processEvents(); if (prog.wasCancelled()) throw tr("Cancelled ongoing table modification, table might be corrupt"); Modified: branches/tora-1.4/tora/src/toreport.cpp =================================================================== --- branches/tora-1.4/tora/src/toreport.cpp 2007-12-21 00:54:24 UTC (rev 2367) +++ branches/tora-1.4/tora/src/toreport.cpp 2007-12-21 12:27:04 UTC (rev 2368) @@ -178,7 +178,7 @@ if (extra == QString::fromLatin1("ORDER")) { cols[col].Order = toExtract::partDescribe(*i, level + 2); - maxCol = std::max(maxCol, cols[col].Order.toInt()); + maxCol = qMax(maxCol, cols[col].Order.toInt()); } else if (extra == QString::fromLatin1("COMMENT")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-24 22:22:23
|
Revision: 2370 http://tora.svn.sourceforge.net/tora/?rev=2370&view=rev Author: mrjohnson0 Date: 2007-12-24 14:22:25 -0800 (Mon, 24 Dec 2007) Log Message: ----------- toolbar port Modified Paths: -------------- branches/tora-1.4/tora/src/todebug.cpp branches/tora-1.4/tora/src/todebug.h branches/tora-1.4/tora/src/todebugtext.cpp branches/tora-1.4/tora/src/todebugtext.h Modified: branches/tora-1.4/tora/src/todebug.cpp =================================================================== --- branches/tora-1.4/tora/src/todebug.cpp 2007-12-22 11:04:38 UTC (rev 2369) +++ branches/tora-1.4/tora/src/todebug.cpp 2007-12-24 22:22:25 UTC (rev 2370) @@ -54,31 +54,23 @@ #include <stack> -#include <q3buttongroup.h> #include <qcheckbox.h> #include <qcombobox.h> -#include <q3groupbox.h> #include <qlabel.h> -#include <qmenubar.h> -#include <qmessagebox.h> -#include <qnamespace.h> -#include <qradiobutton.h> #include <qregexp.h> #include <qsizepolicy.h> -#include <qspinbox.h> #include <qsplitter.h> -#include <qstring.h> #include <qtabwidget.h> -#include <qtimer.h> #include <qtoolbar.h> #include <qtoolbutton.h> -#include <qtooltip.h> -#include <qworkspace.h> -//Added by qt3to4: + #include <QPixmap> #include <Q3ValueList> #include <QString> -#include <Q3PopupMenu> +#include <QMenu> +#include <QAction> +#include <QWorkspace> +#include <QMessageBox> #include "icons/addwatch.xpm" #include "icons/changewatch.xpm" @@ -99,22 +91,6 @@ #include "icons/togglebreak.xpm" #include "icons/toworksheet.xpm" -#if 0 // todo -#define TO_ID_NEW_SHEET (toMain::TO_TOOL_MENU_ID+ 0) -#define TO_ID_SCAN_SOURCE (toMain::TO_TOOL_MENU_ID+ 1) -#define TO_ID_COMPILE (toMain::TO_TOOL_MENU_ID+ 2) -#define TO_ID_EXECUTE (toMain::TO_TOOL_MENU_ID+ 3) -#define TO_ID_STOP (toMain::TO_TOOL_MENU_ID+ 4) -#define TO_ID_STEP_INTO (toMain::TO_TOOL_MENU_ID+ 5) -#define TO_ID_STEP_OVER (toMain::TO_TOOL_MENU_ID+ 6) -#define TO_ID_RETURN_FROM (toMain::TO_TOOL_MENU_ID+ 7) -#define TO_ID_HEAD_TOGGLE (toMain::TO_TOOL_MENU_ID+ 8) -#define TO_ID_DEBUG_PANE (toMain::TO_TOOL_MENU_ID+ 9) -#define TO_ID_DEL_WATCH (toMain::TO_TOOL_MENU_ID+10) -#define TO_ID_CHANGE_WATCH (toMain::TO_TOOL_MENU_ID+11) -#define TO_ID_CLOSE_EDITOR (toMain::TO_TOOL_MENU_ID+12) -#define TO_ID_CLOSE_ALL_EDITOR (toMain::TO_TOOL_MENU_ID+14) -#endif class toDebugTool : public toTool { @@ -385,7 +361,9 @@ } catch (...) { - toStatusMessage(qApp->translate("toDebugOutput", "Couldn't enable/disable output for session")); + toStatusMessage(qApp->translate( + "toDebugOutput", + "Couldn't enable/disable output for session")); } } } @@ -1246,7 +1224,6 @@ void toDebug::updateState(int reason) { -#if 0 // todo switch (reason) { case TO_REASON_EXIT: @@ -1254,18 +1231,11 @@ ChildSemaphore.down(); // Intentionally no break here case TO_REASON_NO_SESSION: - StopButton->setEnabled(false); - StepOverButton->setEnabled(false); - StepIntoButton->setEnabled(false); - ReturnButton->setEnabled(false); - if (ToolMenu) + stopAct->setEnabled(false); + stepAct->setEnabled(false); + nextAct->setEnabled(false); + returnAct->setEnabled(false); { - ToolMenu->setItemEnabled(TO_ID_STOP, false); - ToolMenu->setItemEnabled(TO_ID_STEP_INTO, false); - ToolMenu->setItemEnabled(TO_ID_STEP_OVER, false); - ToolMenu->setItemEnabled(TO_ID_RETURN_FROM, false); - } - { for (int i = 0;i < Editors->count();i++) { toDebugText *editor = dynamic_cast<toDebugText *>(Editors->page(i)); @@ -1326,18 +1296,11 @@ } break; default: - DebugButton->setOn(true); - StopButton->setEnabled(true); - StepOverButton->setEnabled(true); - StepIntoButton->setEnabled(true); - ReturnButton->setEnabled(true); - if (ToolMenu) - { - ToolMenu->setItemEnabled(TO_ID_STOP, true); - ToolMenu->setItemEnabled(TO_ID_STEP_INTO, true); - ToolMenu->setItemEnabled(TO_ID_STEP_OVER, true); - ToolMenu->setItemEnabled(TO_ID_RETURN_FROM, true); - } + debugPaneAct->setChecked(true); + stopAct->setEnabled(true); + stepAct->setEnabled(true); + nextAct->setEnabled(true); + returnAct->setEnabled(true); try { toQuery info(connection(), SQLRuntimeInfo); @@ -1539,7 +1502,6 @@ } selectedWatch(); readLog(); -#endif } #if 0 // Not used yet @@ -1640,8 +1602,9 @@ if (!editor) { editor = new toDebugText(Breakpoints, Editors, this); - connect(editor, SIGNAL(insertedLines(int, int)), - this, SLOT(reorderContent(int, int))); + // signal removed with qscintilla port. +// connect(editor, SIGNAL(insertedLines(int, int)), +// this, SLOT(reorderContent(int, int))); Editors->addTab(editor, editorName(editor)); } else @@ -1771,122 +1734,63 @@ } toDebug::toDebug(QWidget *main, toConnection &connection) - : toToolWidget(DebugTool, "debugger.html", main, connection), TargetThread() -{ + : toToolWidget(DebugTool, "debugger.html", main, connection), + TargetThread() { + + createActions(); QToolBar *toolbar = toAllocBar(this, tr("Debugger")); - new QToolButton(QPixmap(const_cast<const char**>(refresh_xpm)), - tr("Update object list"), - tr("Update object list"), - this, SLOT(refresh(void)), - toolbar); + toolbar->addAction(refreshAct); + toolbar->addSeparator(); + Schema = new QComboBox(toolbar, TO_TOOLBAR_WIDGET_NAME); - connect(Schema, SIGNAL(activated(int)), - this, SLOT(changeSchema(int))); + toolbar->addWidget(Schema); + connect(Schema, + SIGNAL(activated(int)), + this, + SLOT(changeSchema(int))); toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(toworksheet_xpm)), - tr("New sheet"), - tr("New sheet"), - this, SLOT(newSheet(void)), - toolbar); - new QToolButton(QPixmap(const_cast<const char**>(scansource_xpm)), - tr("Rescan source"), - tr("Rescan source"), - this, SLOT(scanSource(void)), - toolbar); - new QToolButton(QPixmap(const_cast<const char**>(compile_xpm)), - tr("Compile"), - tr("Compile"), - this, SLOT(compile(void)), - toolbar); + + toolbar->addAction(newSheetAct); + toolbar->addAction(scanSourceAct); + toolbar->addAction(compileAct); + toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(execute_xpm)), - tr("Execute or continue execution"), - tr("Execute or continue execution"), - this, SLOT(execute(void)), - toolbar); - StopButton = new QToolButton(QPixmap(const_cast<const char**>(stop_xpm)), - tr("Stop running"), - tr("Stop running"), - this, SLOT(stop(void)), - toolbar); - StopButton->setEnabled(false); + + toolbar->addAction(executeAct); + toolbar->addAction(stopAct); + toolbar->addSeparator(); - StepIntoButton = new QToolButton(QPixmap(const_cast<const char**>(stepinto_xpm)), - tr("Step into procedure or function"), - tr("Step into procedure or function"), - this, SLOT(stepInto(void)), - toolbar); - StepIntoButton->setEnabled(false); - StepOverButton = new QToolButton(QPixmap(const_cast<const char**>(stepover_xpm)), - tr("Step over procedure or function"), - tr("Step over procedure or function"), - this, SLOT(stepOver(void)), - toolbar); - StepOverButton->setEnabled(false); - ReturnButton = new QToolButton(QPixmap(const_cast<const char**>(returnfrom_xpm)), - tr("Return from procedure or function"), - tr("Return from procedure or function"), - this, SLOT(returnFrom(void)), - toolbar); - ReturnButton->setEnabled(false); + toolbar->addAction(stepAct); + toolbar->addAction(nextAct); + toolbar->addAction(returnAct); + toolbar->addSeparator(); - DebugButton = new QToolButton(toolbar); - DebugButton->setToggleButton(true); - DebugButton->setIconSet(QIcon(QPixmap(const_cast<const char**>(todebug_xpm)))); - connect(DebugButton, SIGNAL(toggled(bool)), this, SLOT(showDebug(bool))); - QToolTip::add - (DebugButton, tr("Show/hide debug info pane.")); + toolbar->addAction(debugPaneAct); toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(nextbug_xpm)), - tr("Go to next error"), - tr("Go to next error"), - this, SLOT(nextError(void)), - toolbar); - new QToolButton(QPixmap(const_cast<const char**>(prevbug_xpm)), - tr("Go to previous error"), - tr("Go to previous error"), - this, SLOT(prevError(void)), - toolbar); + toolbar->addAction(nextErrorAct); + toolbar->addAction(previousErrorAct); + toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(togglebreak_xpm)), - tr("Toggle breakpoint on current line"), - tr("Toggle breakpoint on current line"), - this, SLOT(toggleBreak(void)), - toolbar); - new QToolButton(QPixmap(const_cast<const char**>(enablebreak_xpm)), - tr("Enable/disable breakpoint on current line"), - tr("Enable/disable breakpoint on current line"), - this, SLOT(toggleEnable(void)), - toolbar); + toolbar->addAction(toggleBreakAct); + toolbar->addAction(disableBreakAct); + toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(addwatch_xpm)), - tr("Add new variable watch"), - tr("Add new variable watch"), - this, SLOT(addWatch(void)), - toolbar); - DelWatchButton = new QToolButton(QPixmap(const_cast<const char**>(delwatch_xpm)), - tr("Delete variable watch"), - tr("Delete variable watch"), - this, SLOT(deleteWatch(void)), - toolbar); - ChangeWatchButton = new QToolButton(QPixmap(const_cast<const char**>(changewatch_xpm)), - tr("Change value of watched variable"), - tr("Change value of watched variable"), - this, SLOT(changeWatch(void)), - toolbar); - DelWatchButton->setEnabled(false); - ChangeWatchButton->setEnabled(false); -// toolbar->setStretchableWidget(new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME)); + toolbar->addAction(addWatchAct); + toolbar->addAction(deleteWatchAct); + toolbar->addAction(changeWatchAct); + + toolbar->addWidget(new toSpacer()); + QSplitter *splitter = new QSplitter(Qt::Vertical, this); QSplitter *hsplitter = new QSplitter(Qt::Horizontal, splitter); DebugTabs = new QTabWidget(splitter); @@ -2003,6 +1907,205 @@ StartTimer.start(1, true); } + +void toDebug::createActions(void) { + refreshAct = new QAction(QIcon(QPixmap(const_cast<const char**>(refresh_xpm))), + tr("Refresh"), + this); + connect(refreshAct, + SIGNAL(triggered()), + this, + SLOT(refresh()), + Qt::QueuedConnection); + refreshAct->setShortcut(QKeySequence::Refresh); + + newSheetAct = new QAction(QIcon(QPixmap(const_cast<const char**>(toworksheet_xpm))), + tr("&New Sheet"), + this); + connect(newSheetAct, + SIGNAL(triggered()), + this, + SLOT(newSheet()), + Qt::QueuedConnection); + + scanSourceAct = new QAction(QIcon(QPixmap(const_cast<const char**>(scansource_xpm))), + tr("S&can Source"), + this); + connect(scanSourceAct, + SIGNAL(triggered()), + this, + SLOT(scanSource()), + Qt::QueuedConnection); + scanSourceAct->setShortcut(Qt::CTRL + Qt::Key_F9); + + compileAct= new QAction(QIcon(QPixmap(const_cast<const char**>(compile_xpm))), + tr("&Compile"), + this); + connect(compileAct, + SIGNAL(triggered()), + this, + SLOT(compile()), + Qt::QueuedConnection); + compileAct->setShortcut(Qt::Key_F9); + + closeAct = new QAction(QIcon(QPixmap(const_cast<const char**>(close_xpm))), + tr("Close"), + this); + connect(closeAct, + SIGNAL(triggered()), + this, + SLOT(closeEditor()), + Qt::QueuedConnection); + + closeAllAct = new QAction(tr("Close All"), + this); + connect(closeAllAct, + SIGNAL(triggered()), + this, + SLOT(closeAllEditor()), + Qt::QueuedConnection); + + executeAct = new QAction(QIcon(QPixmap(const_cast<const char**>(execute_xpm))), + tr("&Execute or continue"), + this); + connect(executeAct, + SIGNAL(triggered()), + this, + SLOT(execute()), + Qt::QueuedConnection); + executeAct->setShortcut(Qt::CTRL + Qt::Key_Return); + + stopAct = new QAction(QIcon(QPixmap(const_cast<const char**>(stop_xpm))), + tr("&Stop"), + this); + connect(stopAct, + SIGNAL(triggered()), + this, + SLOT(stop()), + Qt::QueuedConnection); + stopAct->setShortcut(Qt::Key_F12); + + stepAct = new QAction(QIcon(QPixmap(const_cast<const char**>(stepinto_xpm))), + tr("Step &Into"), + this); + connect(stepAct, + SIGNAL(triggered()), + this, + SLOT(stepInto()), + Qt::QueuedConnection); + stepAct->setShortcut(Qt::Key_F7); + + nextAct = new QAction(QIcon(QPixmap(const_cast<const char**>(stepover_xpm))), + tr("&Next Line"), + this); + connect(nextAct, + SIGNAL(triggered()), + this, + SLOT(stepOver()), + Qt::QueuedConnection); + nextAct->setShortcut(Qt::Key_F8); + + returnAct = new QAction(QIcon(QPixmap(const_cast<const char**>(returnfrom_xpm))), + tr("&Return From"), + this); + connect(returnAct, + SIGNAL(triggered()), + this, + SLOT(returnFrom()), + Qt::QueuedConnection); + returnAct->setShortcut(Qt::Key_F6); + + debugPaneAct = new QAction(tr("&Debug Pane"), this); + debugPaneAct->setIconSet(QIcon(QPixmap(const_cast<const char**>(todebug_xpm)))); + debugPaneAct->setCheckable(true); + connect(debugPaneAct, + SIGNAL(toggled(bool)), + this, + SLOT(showDebug(bool)), + Qt::QueuedConnection); + debugPaneAct->setShortcut(Qt::Key_F11); + + nextErrorAct = new QAction(QIcon(QPixmap(const_cast<const char**>(nextbug_xpm))), + tr("Next &Error"), + this); + connect(nextErrorAct, + SIGNAL(triggered()), + this, + SLOT(nextError()), + Qt::QueuedConnection); + nextErrorAct->setShortcut(Qt::CTRL + Qt::Key_N); + + previousErrorAct = new QAction(QIcon(QPixmap(const_cast<const char**>(prevbug_xpm))), + tr("Pre&vious Error"), + this); + connect(previousErrorAct, + SIGNAL(triggered()), + this, + SLOT(prevError()), + Qt::QueuedConnection); + previousErrorAct->setShortcut(Qt::CTRL + Qt::Key_P); + + toggleBreakAct = new QAction(QIcon(QPixmap(const_cast<const char**>(togglebreak_xpm))), + tr("&Toggle Breakpoint"), + this); + connect(toggleBreakAct, + SIGNAL(triggered()), + this, + SLOT(toggleBreak()), + Qt::QueuedConnection); + toggleBreakAct->setShortcut(Qt::CTRL + Qt::Key_F5); + + disableBreakAct = new QAction(QIcon(QPixmap(const_cast<const char**>(enablebreak_xpm))), + tr("D&isable Breakpoint"), + this); + connect(disableBreakAct, + SIGNAL(triggered()), + this, + SLOT(toggleEnable()), + Qt::QueuedConnection); + disableBreakAct->setShortcut(Qt::CTRL + Qt::Key_F6); + + addWatchAct = new QAction(QIcon(QPixmap(const_cast<const char**>(addwatch_xpm))), + tr("&Add Watch..."), + this); + connect(addWatchAct, + SIGNAL(triggered()), + this, + SLOT(addWatch()), + Qt::QueuedConnection); + addWatchAct->setShortcut(Qt::Key_F4); + + deleteWatchAct = new QAction(QIcon(QPixmap(const_cast<const char**>(delwatch_xpm))), + tr("Delete &Watch"), + this); + deleteWatchAct->setEnabled(false); + connect(deleteWatchAct, + SIGNAL(triggered()), + this, + SLOT(deleteWatch()), + Qt::QueuedConnection); + deleteWatchAct->setShortcut(Qt::CTRL + Qt::Key_Delete); + + changeWatchAct = new QAction(QIcon(QPixmap(const_cast<const char**>(changewatch_xpm))), + tr("Chan&ge Watch..."), + this); + changeWatchAct->setEnabled(false); + connect(changeWatchAct, + SIGNAL(triggered()), + this, + SLOT(changeWatch()), + Qt::QueuedConnection); + changeWatchAct->setShortcut(Qt::CTRL + Qt::Key_F4); + + eraseLogAct = new QAction(tr("Erase Runtime &Log"), this); + connect(eraseLogAct, + SIGNAL(triggered()), + this, + SLOT(clearLog()), + Qt::QueuedConnection); +} + + static toSQL SQLAttach("toDebug:Attach", "DECLARE\n" " timeout BINARY_INTEGER;\n" @@ -2214,8 +2317,31 @@ } void toDebug::closeEvent(QCloseEvent *e) { - if(close()) + if(close()) { + try { + Lock.lock(); + if (DebuggerStarted) { + Lock.unlock(); + stop(); { + toLocker lock (Lock); + TargetSQL = ""; + TargetSemaphore.up(); + } + + ChildSemaphore.down(); + } + else + Lock.unlock(); + } + TOCATCH; + + try { + DebugTool.closeWindow(connection()); + } + TOCATCH; + e->accept(); + } else e->ignore(); } @@ -2254,10 +2380,8 @@ DebugTabs->show(); else DebugTabs->hide(); -#if 0 // todo - if (ToolMenu) - ToolMenu->setItemChecked(TO_ID_DEBUG_PANE, show); -#endif + + debugPaneAct->setChecked(show); } bool toDebugText::compile(void) @@ -2387,32 +2511,7 @@ scanSource(); } -toDebug::~toDebug() -{ - try - { - Lock.lock(); - if (DebuggerStarted) - { - Lock.unlock(); - stop(); - { - toLocker lock (Lock) - ; - TargetSQL = ""; - TargetSemaphore.up(); - } - ChildSemaphore.down(); - } - else - Lock.unlock(); - } - TOCATCH - try - { - DebugTool.closeWindow(connection()); - } - TOCATCH +toDebug::~toDebug() { } void toDebug::prevError(void) @@ -2463,8 +2562,9 @@ void toDebug::newSheet(void) { toDebugText *text = new toDebugText(Breakpoints, Editors, this); - connect(text, SIGNAL(insertedLines(int, int)), - this, SLOT(reorderContent(int, int))); + // signal removed with qscintilla port. +// connect(text, SIGNAL(insertedLines(int, int)), +// this, SLOT(reorderContent(int, int))); if (!Schema->currentText().isEmpty()) text->setSchema(Schema->currentText()); else @@ -2502,152 +2602,73 @@ } } -void toDebug::windowActivated(QWidget *widget) -{ - if (widget == this) - { - if (!ToolMenu) - { -#if 0 // todo - ToolMenu = new Q3PopupMenu(this); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(toworksheet_xpm)), - tr("&New Sheet"), this, SLOT(newSheet(void)), - 0, TO_ID_NEW_SHEET); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(scansource_xpm)), - tr("S&can Source"), this, SLOT(scanSource(void)), - toKeySequence(tr("Ctrl+F9", "Debug|Scan source")), TO_ID_SCAN_SOURCE); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(compile_xpm)), - tr("&Compile"), this, SLOT(compile(void)), - toKeySequence(tr("F9", "Debug|Compile")), TO_ID_COMPILE); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(close_xpm)), - tr("Close"), this, SLOT(closeEditor(void)), - 0, TO_ID_CLOSE_EDITOR); - ToolMenu->insertItem(tr("CloseAll"), this, SLOT(closeAllEditor(void)), - 0, TO_ID_CLOSE_ALL_EDITOR); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(execute_xpm)), - tr("&Execute or continue"), this, SLOT(execute(void)), - toKeySequence(tr("Ctrl+Return", "Debug|Execute")), TO_ID_EXECUTE); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(stop_xpm)), - tr("&Stop"), this, SLOT(stop(void)), - toKeySequence(tr("F12", "Debug|Stop")), TO_ID_STOP); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(stepinto_xpm)), - tr("Step &Into"), this, SLOT(stepInto(void)), - toKeySequence(tr("F7", "Debug|Step into")), TO_ID_STEP_INTO); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(stepover_xpm)), - tr("&Next Line"), this, SLOT(stepOver(void)), - toKeySequence(tr("F8", "Debug|Stop over")), TO_ID_STEP_OVER); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(returnfrom_xpm)), - tr("&Return From"), this, SLOT(returnFrom(void)), - toKeySequence(tr("F6", "Debug|Return from")), TO_ID_RETURN_FROM); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(tr("&Debug Pane"), this, SLOT(toggleDebug(void)), - toKeySequence(tr("F11", "Debug|Debug pane")), TO_ID_DEBUG_PANE); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(nextbug_xpm)), - tr("Next &Error"), this, SLOT(nextError(void)), - toKeySequence(tr("Ctrl+N", "Debug|Next error"))); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(prevbug_xpm)), - tr("Pre&vious Error"), this, SLOT(prevError(void)), - toKeySequence(tr("Ctrl+P", "Debug|Previous error"))); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(togglebreak_xpm)), - tr("&Toggle Breakpoint"), this, SLOT(toggleBreak(void)), - toKeySequence(tr("Ctrl+F5", "Debug|Toggle breakpoint"))); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(enablebreak_xpm)), - tr("D&isable Breakpoint"), - this, SLOT(toggleEnable(void)), - toKeySequence(tr("Ctrl+F6", "Debug|Disable breakpoint"))); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(addwatch_xpm)), - tr("&Add Watch..."), this, SLOT(addWatch(void)), - toKeySequence(tr("F4", "Debug|Add watch"))); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(delwatch_xpm)), - tr("Delete &Watch"), this, SLOT(deleteWatch(void)), - toKeySequence(tr("Ctrl+Delete", "Debug|Delete watch")), TO_ID_DEL_WATCH); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(changewatch_xpm)), - tr("Chan&ge Watch..."), this, SLOT(changeWatch(void)), - toKeySequence(tr("Ctrl+F4", "Debug|Change watch")), TO_ID_CHANGE_WATCH); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(tr("Refresh Object List"), this, SLOT(refresh()), - toKeySequence(tr("F5", "Debug|Refresh objectlist"))); - ToolMenu->insertItem(tr("Select Schema"), Schema, SLOT(setFocus(void)), - toKeySequence(tr("Alt+S", "Debug|Select schema"))); - ToolMenu->insertItem(tr("Erase Runtime &Log"), this, SLOT(clearLog(void))); +void toDebug::windowActivated(QWidget *widget) { + if (widget == this) { + if (!ToolMenu) { + ToolMenu = new QMenu(tr("&Debug"), this); - toMainWidget()->menuBar()->insertItem(tr("&Debug"), ToolMenu, -1, toToolMenuIndex()); - if (!isRunning()) - { - ToolMenu->setItemEnabled(TO_ID_STOP, false); - ToolMenu->setItemEnabled(TO_ID_STEP_INTO, false); - ToolMenu->setItemEnabled(TO_ID_STEP_OVER, false); - ToolMenu->setItemEnabled(TO_ID_RETURN_FROM, false); - } - if (!DebugTabs->isHidden()) - ToolMenu->setItemChecked(TO_ID_DEBUG_PANE, true); + ToolMenu->addAction(newSheetAct); + ToolMenu->addAction(scanSourceAct); + ToolMenu->addAction(compileAct); + ToolMenu->addAction(closeAct); + ToolMenu->addAction(closeAllAct); - if (!DelWatchButton->isEnabled()) - ToolMenu->setItemEnabled(TO_ID_DEL_WATCH, false); - if (!ChangeWatchButton->isEnabled()) - ToolMenu->setItemEnabled(TO_ID_CHANGE_WATCH, false); -#endif + ToolMenu->addSeparator(); + + ToolMenu->addAction(executeAct); + ToolMenu->addAction(stopAct); + ToolMenu->addAction(stepAct); + ToolMenu->addAction(nextAct); + ToolMenu->addAction(returnAct); + + ToolMenu->addSeparator(); + + ToolMenu->addAction(nextErrorAct); + ToolMenu->addAction(previousErrorAct); + + ToolMenu->addSeparator(); + + ToolMenu->addAction(toggleBreakAct); + ToolMenu->addAction(disableBreakAct); + + ToolMenu->addSeparator(); + + ToolMenu->addAction(addWatchAct); + ToolMenu->addAction(deleteWatchAct); + ToolMenu->addAction(changeWatchAct); + + ToolMenu->addSeparator(); + + ToolMenu->addAction(refreshAct); + ToolMenu->addAction(eraseLogAct); + + toMainWidget()->addCustomMenu(ToolMenu); } } - else - { + else { delete ToolMenu; ToolMenu = NULL; } } -void toDebug::toggleDebug(void) -{ - DebugButton->setOn(!DebugButton->isOn()); -} - -void toDebug::selectedWatch() -{ -#if 0 // todo +void toDebug::selectedWatch() { Q3ListViewItem *item = Watch->selectedItem(); - if (item) - { - if (!item->text(5).isEmpty() && item->text(5) != QString::fromLatin1("LIST") && item->text(5) != QString::fromLatin1("NULL")) + if(item) { + if (!item->text(5).isEmpty() && + item->text(5) != QString::fromLatin1("LIST") && + item->text(5) != QString::fromLatin1("NULL")) { - DelWatchButton->setEnabled(false); - if (ToolMenu) - ToolMenu->setItemEnabled(TO_ID_DEL_WATCH, false); + deleteWatchAct->setEnabled(false); } else - { - DelWatchButton->setEnabled(true); - if (ToolMenu) - ToolMenu->setItemEnabled(TO_ID_DEL_WATCH, true); - } - if (item->text(4).isEmpty()) - { - ChangeWatchButton->setEnabled(true); - if (ToolMenu) - ToolMenu->setItemEnabled(TO_ID_CHANGE_WATCH, true); - } - else - { - ChangeWatchButton->setEnabled(false); - if (ToolMenu) - ToolMenu->setItemEnabled(TO_ID_CHANGE_WATCH, false); - } + deleteWatchAct->setEnabled(true); + + changeWatchAct->setEnabled(item->text(4).isEmpty()); } - else - { - DelWatchButton->setEnabled(false); - ChangeWatchButton->setEnabled(false); - if (ToolMenu) - { - ToolMenu->setItemEnabled(TO_ID_DEL_WATCH, false); - ToolMenu->setItemEnabled(TO_ID_CHANGE_WATCH, false); - } + else { + deleteWatchAct->setEnabled(false); + changeWatchAct->setEnabled(false); } -#endif } void toDebug::deleteWatch(void) @@ -2824,7 +2845,7 @@ } id++; } - if (DebugButton->isOn()) + if (debugPaneAct->isChecked()) data[prefix + ":Debug"] = QString::fromLatin1("Show"); toToolWidget::exportData(data, prefix); @@ -2847,8 +2868,9 @@ for (int j = 0;j < count;j++) { toDebugText *text = new toDebugText(Breakpoints, Editors, this); - connect(text, SIGNAL(insertedLines(int, int)), - this, SLOT(reorderContent(int, int))); + // signal removed with qscintilla port. +// connect(text, SIGNAL(insertedLines(int, int)), +// this, SLOT(reorderContent(int, int))); QString num; num.setNum(j); text->importData(data, prefix + ":Editor:" + num); @@ -2886,7 +2908,7 @@ } scanSource(); - DebugButton->setOn(data[prefix + ":Debug"] == QString::fromLatin1("Show")); + debugPaneAct->setChecked(data[prefix + ":Debug"] == QString::fromLatin1("Show")); toToolWidget::importData(data, prefix); } Modified: branches/tora-1.4/tora/src/todebug.h =================================================================== --- branches/tora-1.4/tora/src/todebug.h 2007-12-22 11:04:38 UTC (rev 2369) +++ branches/tora-1.4/tora/src/todebug.h 2007-12-24 22:22:25 UTC (rev 2370) @@ -47,10 +47,9 @@ #include "tothread.h" #include "totool.h" -#include <qtimer.h> -//Added by qt3to4: #include <QString> -#include <Q3PopupMenu> +#include <QMenu> +#include <QAction> #define TO_SUCCESS 0 #define TO_NO_SUCH_BREAKPOINT 13 @@ -88,7 +87,6 @@ class QComboBox; class Q3ListView; class Q3ListViewItem; -class Q3PopupMenu; class QTabWidget; class QToolButton; class toConnection; @@ -98,7 +96,7 @@ class toDebug : public toToolWidget { - Q_OBJECT + Q_OBJECT; struct debugParam { @@ -116,17 +114,32 @@ std::list<debugParam> CurrentParams; // Toolbar + void createActions(void); + QComboBox *Schema; - QToolButton *StopButton; - QToolButton *StepOverButton; - QToolButton *StepIntoButton; - QToolButton *ReturnButton; - QToolButton *DebugButton; - QToolButton *DelWatchButton; - QToolButton *ChangeWatchButton; + QAction *refreshAct; + QAction *newSheetAct; + QAction *scanSourceAct; + QAction *compileAct; + QAction *closeAct; + QAction *closeAllAct; + QAction *executeAct; + QAction *stopAct; + QAction *stepAct; + QAction *nextAct; + QAction *returnAct; + QAction *debugPaneAct; + QAction *nextErrorAct; + QAction *previousErrorAct; + QAction *toggleBreakAct; + QAction *disableBreakAct; + QAction *addWatchAct; + QAction *deleteWatchAct; + QAction *changeWatchAct; + QAction *eraseLogAct; // Extra menu - Q3PopupMenu *ToolMenu; + QMenu *ToolMenu; // Content pane Q3ListView *Objects; @@ -180,22 +193,30 @@ bool checkCompile(toDebugText *edit); bool checkCompile(void); void updateCurrent(void); - QString editorName(const QString &schema, const QString &object, const QString &type); + QString editorName(const QString &schema, + const QString &object, + const QString &type); QString editorName(toDebugText *text); int sync(void); bool hasMembers(const QString &str); void readLog(void); void updateState(int reason); - void updateArguments(toSQLParse::statement &statements, Q3ListViewItem *parent); - void updateContent(toSQLParse::statement &statements, Q3ListViewItem *parent, const QString &id = QString::null); + void updateArguments(toSQLParse::statement &statements, + Q3ListViewItem *parent); + void updateContent(toSQLParse::statement &statements, + Q3ListViewItem *parent, + const QString &id = QString::null); void updateContent(toDebugText *editor); void updateContent(void) { updateContent(currentEditor()); } void reorderContent(Q3ListViewItem *item, int, int); - bool viewSource(const QString &schema, const QString &name, const QString &type, - int line, bool current = false); + bool viewSource(const QString &schema, + const QString &name, + const QString &type, + int line, + bool current = false); void setDeferedBreakpoints(void); bool checkStop(void); @@ -223,8 +244,12 @@ QString checkWatch(const QString &name); - virtual void exportData(std::map<QString, QString> &data, const QString &prefix); - virtual void importData(std::map<QString, QString> &data, const QString &prefix); + virtual void exportData(std::map<QString, + QString> &data, + const QString &prefix); + virtual void importData(std::map<QString, + QString> &data, + const QString &prefix); public slots: void stop(void); void compile(void); @@ -256,7 +281,6 @@ continueExecution(TO_BREAK_ANY_RETURN); } void windowActivated(QWidget *w); - void toggleDebug(void); void selectedWatch(void); void deleteWatch(void); void clearLog(void); Modified: branches/tora-1.4/tora/src/todebugtext.cpp =================================================================== --- branches/tora-1.4/tora/src/todebugtext.cpp 2007-12-22 11:04:38 UTC (rev 2369) +++ branches/tora-1.4/tora/src/todebugtext.cpp 2007-12-24 22:22:25 UTC (rev 2370) @@ -272,7 +272,10 @@ setMarginSensitivity(1, true); CurrentItem = FirstItem = NULL; NoBreakpoints = false; - connect(this, SIGNAL(marginClicked(int, int, Qt::ButtonState)), this, SLOT(toggleBreakpoint(int, int, Qt::ButtonState))); + connect(this, + SIGNAL(marginClicked(int, int, Qt::KeyboardModifiers)), + this, + SLOT(toggleBreakpoint(int, int, Qt::KeyboardModifiers))); // breakMarker=markerDefine(new QPixmap(const_cast<const char**>(breakpoint_xpm))); // disabledBreakMarker=markerDefine(new QPixmap(const_cast<const char**>(disbreakpoint_xpm))); breakMarker = markerDefine(QPixmap(breakpoint_xpm)); @@ -427,7 +430,7 @@ } -void toDebugText::toggleBreakpoint(int margin, int line, Qt::ButtonState state) +void toDebugText::toggleBreakpoint(int margin, int line, Qt::KeyboardModifiers state) { if (margin <= 1) toggleBreakpoint(line); Modified: branches/tora-1.4/tora/src/todebugtext.h =================================================================== --- branches/tora-1.4/tora/src/todebugtext.h 2007-12-22 11:04:38 UTC (rev 2369) +++ branches/tora-1.4/tora/src/todebugtext.h 2007-12-24 22:22:25 UTC (rev 2370) @@ -124,7 +124,7 @@ virtual void exportData(std::map<QString, QString> &data, const QString &prefix); virtual void importData(std::map<QString, QString> &data, const QString &prefix); protected slots: - virtual void toggleBreakpoint(int margin, int line, Qt::ButtonState state); + virtual void toggleBreakpoint(int margin, int line, Qt::KeyboardModifiers state); protected: virtual void mouseMoveEvent (QMouseEvent *me); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-25 21:56:36
|
Revision: 2371 http://tora.svn.sourceforge.net/tora/?rev=2371&view=rev Author: mrjohnson0 Date: 2007-12-25 13:56:40 -0800 (Tue, 25 Dec 2007) Log Message: ----------- keep naming convention... `make clean' broken Modified Paths: -------------- branches/tora-1.4/tora/src/CMakeLists.txt branches/tora-1.4/tora/src/Makefile.am Added Paths: ----------- branches/tora-1.4/tora/src/tohelpui.ui Removed Paths: ------------- branches/tora-1.4/tora/src/tohelp.ui Modified: branches/tora-1.4/tora/src/CMakeLists.txt =================================================================== --- branches/tora-1.4/tora/src/CMakeLists.txt 2007-12-24 22:22:25 UTC (rev 2370) +++ branches/tora-1.4/tora/src/CMakeLists.txt 2007-12-25 21:56:40 UTC (rev 2371) @@ -22,7 +22,7 @@ toeditextensionsetupui.ui toglobalsettingui.ui tohelpaddfileui.ui - tohelp.ui + tohelpui.ui tohelpsetupui.ui tochartalarmui.ui tochartsetupui.ui Modified: branches/tora-1.4/tora/src/Makefile.am =================================================================== --- branches/tora-1.4/tora/src/Makefile.am 2007-12-24 22:22:25 UTC (rev 2370) +++ branches/tora-1.4/tora/src/Makefile.am 2007-12-25 21:56:40 UTC (rev 2371) @@ -240,7 +240,7 @@ toglobalsettingui.ui \ tosecurityroleui.ui \ toworksheetsetupui.ui \ - tohelp.ui \ + tohelpui.ui \ tohelpaddfileui.ui \ tosecurityuserui.ui \ tohelpsetupui.ui \ Deleted: branches/tora-1.4/tora/src/tohelp.ui =================================================================== --- branches/tora-1.4/tora/src/tohelp.ui 2007-12-24 22:22:25 UTC (rev 2370) +++ branches/tora-1.4/tora/src/tohelp.ui 2007-12-25 21:56:40 UTC (rev 2371) @@ -1,151 +0,0 @@ -<ui version="4.0" > - <class>toHelp</class> - <widget class="QDialog" name="toHelp" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>678</width> - <height>452</height> - </rect> - </property> - <property name="windowTitle" > - <string>Help Browser</string> - </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QToolButton" name="backButton" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="toolTip" > - <string>Backward one help page</string> - </property> - <property name="arrowType" > - <enum>Qt::LeftArrow</enum> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QToolButton" name="forwardButton" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="toolTip" > - <string>Forward one help page</string> - </property> - <property name="arrowType" > - <enum>Qt::RightArrow</enum> - </property> - </widget> - </item> - <item row="0" column="2" > - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>271</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0" colspan="3" > - <widget class="QSplitter" name="splitter" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <widget class="QTabWidget" name="tabs" > - <property name="currentIndex" > - <number>0</number> - </property> - <widget class="QWidget" name="tab" > - <attribute name="title" > - <string>Contents</string> - </attribute> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QTreeWidget" name="Sections" > - <property name="alternatingRowColors" > - <bool>true</bool> - </property> - <column> - <property name="text" > - <string>Contents</string> - </property> - </column> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_2" > - <attribute name="title" > - <string>Search</string> - </attribute> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="label" > - <property name="text" > - <string>Search:</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QLineEdit" name="SearchLine" /> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_2" > - <property name="text" > - <string>Manuals:</string> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QComboBox" name="Manuals" > - <item> - <property name="text" > - <string>All manuals</string> - </property> - </item> - </widget> - </item> - <item row="2" column="0" colspan="2" > - <widget class="QTreeWidget" name="Result" > - <property name="alternatingRowColors" > - <bool>true</bool> - </property> - <column> - <property name="text" > - <string>Result</string> - </property> - </column> - <column> - <property name="text" > - <string>Manual</string> - </property> - </column> - </widget> - </item> - </layout> - </widget> - </widget> - <widget class="QTextBrowser" name="Help" /> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>tabs</tabstop> - <tabstop>backButton</tabstop> - <tabstop>forwardButton</tabstop> - <tabstop>Sections</tabstop> - <tabstop>SearchLine</tabstop> - <tabstop>Manuals</tabstop> - <tabstop>Result</tabstop> - <tabstop>Help</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> Copied: branches/tora-1.4/tora/src/tohelpui.ui (from rev 2367, branches/tora-1.4/tora/src/tohelp.ui) =================================================================== --- branches/tora-1.4/tora/src/tohelpui.ui (rev 0) +++ branches/tora-1.4/tora/src/tohelpui.ui 2007-12-25 21:56:40 UTC (rev 2371) @@ -0,0 +1,151 @@ +<ui version="4.0" > + <class>toHelp</class> + <widget class="QDialog" name="toHelp" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>678</width> + <height>452</height> + </rect> + </property> + <property name="windowTitle" > + <string>Help Browser</string> + </property> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QToolButton" name="backButton" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="toolTip" > + <string>Backward one help page</string> + </property> + <property name="arrowType" > + <enum>Qt::LeftArrow</enum> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QToolButton" name="forwardButton" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="toolTip" > + <string>Forward one help page</string> + </property> + <property name="arrowType" > + <enum>Qt::RightArrow</enum> + </property> + </widget> + </item> + <item row="0" column="2" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>271</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0" colspan="3" > + <widget class="QSplitter" name="splitter" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <widget class="QTabWidget" name="tabs" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="tab" > + <attribute name="title" > + <string>Contents</string> + </attribute> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QTreeWidget" name="Sections" > + <property name="alternatingRowColors" > + <bool>true</bool> + </property> + <column> + <property name="text" > + <string>Contents</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2" > + <attribute name="title" > + <string>Search</string> + </attribute> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="label" > + <property name="text" > + <string>Search:</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="SearchLine" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Manuals:</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QComboBox" name="Manuals" > + <item> + <property name="text" > + <string>All manuals</string> + </property> + </item> + </widget> + </item> + <item row="2" column="0" colspan="2" > + <widget class="QTreeWidget" name="Result" > + <property name="alternatingRowColors" > + <bool>true</bool> + </property> + <column> + <property name="text" > + <string>Result</string> + </property> + </column> + <column> + <property name="text" > + <string>Manual</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> + </widget> + <widget class="QTextBrowser" name="Help" /> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>tabs</tabstop> + <tabstop>backButton</tabstop> + <tabstop>forwardButton</tabstop> + <tabstop>Sections</tabstop> + <tabstop>SearchLine</tabstop> + <tabstop>Manuals</tabstop> + <tabstop>Result</tabstop> + <tabstop>Help</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-26 02:08:02
|
Revision: 2375 http://tora.svn.sourceforge.net/tora/?rev=2375&view=rev Author: mrjohnson0 Date: 2007-12-25 18:08:02 -0800 (Tue, 25 Dec 2007) Log Message: ----------- toolbar port Modified Paths: -------------- branches/tora-1.4/tora/src/totemporary.cpp branches/tora-1.4/tora/src/totemporary.h Modified: branches/tora-1.4/tora/src/totemporary.cpp =================================================================== --- branches/tora-1.4/tora/src/totemporary.cpp 2007-12-26 02:07:25 UTC (rev 2374) +++ branches/tora-1.4/tora/src/totemporary.cpp 2007-12-26 02:08:02 UTC (rev 2375) @@ -141,13 +141,14 @@ { QToolBar *toolbar = toAllocBar(this, tr("Temporary Objects")); - new QToolButton(QPixmap(const_cast<const char**>(refresh_xpm)), - tr("Refresh list"), - tr("Refresh list"), - this, SLOT(refresh()), - toolbar); + refreshAct = + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(refresh_xpm))), + tr("Refresh list"), + this, + SLOT(refresh())); -// toolbar->setStretchableWidget(new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME)); + toolbar->addWidget(new toSpacer()); + new toChangeConnection(toolbar, TO_TOOLBAR_WIDGET_NAME); QSplitter *splitter = new QSplitter(Qt::Vertical, this); @@ -178,24 +179,16 @@ } -void toTemporary::windowActivated(QWidget *widget) -{ - if (widget == this) - { - if (!ToolMenu) - { -#if 0 // todo - ToolMenu = new Q3PopupMenu(this); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(refresh_xpm)), tr("&Refresh"), - this, SLOT(refresh(void)), - toKeySequence(tr("F5", "Temporary|Refresh"))); +void toTemporary::windowActivated(QWidget *widget) { + if (widget == this) { + if (!ToolMenu) { + ToolMenu = new QMenu(tr("&Temporary"), this); + ToolMenu->addAction(refreshAct); - toMainWidget()->menuBar()->insertItem(tr("&Temporary"), ToolMenu, -1, toToolMenuIndex()); -#endif + toMainWidget()->addCustomMenu(ToolMenu); } } - else - { + else { delete ToolMenu; ToolMenu = NULL; } Modified: branches/tora-1.4/tora/src/totemporary.h =================================================================== --- branches/tora-1.4/tora/src/totemporary.h 2007-12-26 02:07:25 UTC (rev 2374) +++ branches/tora-1.4/tora/src/totemporary.h 2007-12-26 02:08:02 UTC (rev 2375) @@ -41,21 +41,22 @@ #include "config.h" #include "totool.h" #include <list> -//Added by qt3to4: -#include <Q3PopupMenu> + +#include <QMenu> #include <Q3ListViewItem> -class Q3PopupMenu; class toResultView; class toTask; class toSGAStatement; -class toTemporary : public toToolWidget -{ - Q_OBJECT - toResultView *Objects; +class toTemporary : public toToolWidget { + Q_OBJECT; + + toResultView *Objects; toSGAStatement *Statement; - Q3PopupMenu *ToolMenu; + QMenu *ToolMenu; + QAction *refreshAct; + public: toTemporary(QWidget *parent, toConnection &connection); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-26 02:09:21
|
Revision: 2376 http://tora.svn.sourceforge.net/tora/?rev=2376&view=rev Author: mrjohnson0 Date: 2007-12-25 18:09:25 -0800 (Tue, 25 Dec 2007) Log Message: ----------- toolbar port. add qscrollarea for tabs. this needs to be reworked so it scrolls just the tab's content and not the whole tab widget, but i'll have to figure that out later Modified Paths: -------------- branches/tora-1.4/tora/src/toscript.cpp branches/tora-1.4/tora/src/toscript.h Modified: branches/tora-1.4/tora/src/toscript.cpp =================================================================== --- branches/tora-1.4/tora/src/toscript.cpp 2007-12-26 02:08:02 UTC (rev 2375) +++ branches/tora-1.4/tora/src/toscript.cpp 2007-12-26 02:09:25 UTC (rev 2376) @@ -50,31 +50,27 @@ #include "totool.h" #include "toworksheet.h" -#ifdef TO_HAS_KPRINT -#include <kfiledialog.h> -#endif - #include <qcheckbox.h> #include <qcombobox.h> #include <qdir.h> #include <q3filedialog.h> #include <qlabel.h> -#include <qlayout.h> #include <qlineedit.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qradiobutton.h> #include <qregexp.h> -#include <qspinbox.h> #include <qsplitter.h> #include <qtabwidget.h> #include <q3textview.h> #include <qtoolbar.h> #include <qtoolbutton.h> -//Added by qt3to4: + #include <Q3GridLayout> +#include <QGridLayout> #include <QPixmap> #include <QFileDialog> +#include <QScrollArea> #include "icons/execute.xpm" @@ -227,16 +223,21 @@ { QToolBar *toolbar = toAllocBar(this, tr("Extraction and Compare")); - new QToolButton(QPixmap(const_cast<const char**>(execute_xpm)), - tr("Perform defined extraction"), - tr("Perform defined extraction"), - this, SLOT(execute(void)), - toolbar); -// toolbar->setStretchableWidget(new QLabel(toolbar, TO_TOOLBAR_WIDGET_NAME)); + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(execute_xpm))), + tr("Perform defined extraction"), + this, + SLOT(execute(void))); - QWidget widget; + toolbar->addWidget(new toSpacer()); + + QScrollArea *sa = new QScrollArea(this); + QWidget *w = new QWidget(sa); ScriptUI = new Ui::toScriptUI(); - ScriptUI->setupUi(&widget); + ScriptUI->setupUi(w); + sa->setWidget(w); + sa->setWidgetResizable(true); + sa->setSizePolicy(QSizePolicy::MinimumExpanding, + QSizePolicy::MinimumExpanding); QSplitter *hsplitter = new QSplitter(Qt::Horizontal, ScriptUI->DifferenceTab); Q3VBox *box = new Q3VBox(ScriptUI->ResultTab); @@ -356,6 +357,13 @@ toScript::~toScript() {} +void toScript::closeEvent(QCloseEvent *event) { + if(Worksheet && Worksheet->close()) + event->accept(); + else + event->ignore(); +} + std::list<QString> toScript::createObjectList(Q3ListView *source) { std::list<QString> lst; Modified: branches/tora-1.4/tora/src/toscript.h =================================================================== --- branches/tora-1.4/tora/src/toscript.h 2007-12-26 02:08:02 UTC (rev 2375) +++ branches/tora-1.4/tora/src/toscript.h 2007-12-26 02:09:25 UTC (rev 2376) @@ -52,9 +52,8 @@ class toScriptUI; class toWorksheet; -class toScript : public toToolWidget -{ - Q_OBJECT +class toScript : public toToolWidget { + Q_OBJECT; Ui::toScriptUI *ScriptUI; toWorksheet *Worksheet; @@ -80,6 +79,9 @@ QString _s; }; +protected: + void closeEvent(QCloseEvent *event); + public: toScript(QWidget *parent, toConnection &connection); virtual ~toScript(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-26 02:49:16
|
Revision: 2377 http://tora.svn.sourceforge.net/tora/?rev=2377&view=rev Author: mrjohnson0 Date: 2007-12-25 18:49:16 -0800 (Tue, 25 Dec 2007) Log Message: ----------- port me yo-yo master! port me! Modified Paths: -------------- branches/tora-1.4/tora/src/toalert.cpp branches/tora-1.4/tora/src/toalert.h Modified: branches/tora-1.4/tora/src/toalert.cpp =================================================================== --- branches/tora-1.4/tora/src/toalert.cpp 2007-12-26 02:09:25 UTC (rev 2376) +++ branches/tora-1.4/tora/src/toalert.cpp 2007-12-26 02:49:16 UTC (rev 2377) @@ -137,52 +137,67 @@ {} def += connection.user(); - new QLabel(tr("Registered") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME); + toolbar->addWidget( + new QLabel(tr("Registered") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME)); + Registered = new QComboBox(toolbar, TO_TOOLBAR_WIDGET_NAME); Registered->insertItem(def); Registered->setEditable(true); Registered->setDuplicatesEnabled(false); Registered->setCurrentItem(0); - connect(Registered, SIGNAL(activated(int)), this, SLOT(add - ())); + connect(Registered, SIGNAL(activated(int)), this, SLOT(add())); + toolbar->addWidget(Registered); AddNames.insert(AddNames.end(), def); - new QToolButton(QPixmap(const_cast<const char**>(commit_xpm)), - tr("Register current"), - tr("Register current"), - this, SLOT(add - ()), - toolbar); + addAct = + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(commit_xpm))), + tr("Register current"), + this, + SLOT(add())); + addAct->setShortcut(Qt::ALT + Qt::Key_R); - new QToolButton(QPixmap(const_cast<const char**>(trash_xpm)), - tr("Remove registered"), - tr("Remove registered"), - this, SLOT(remove - ()), - toolbar); + removeAct = + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(trash_xpm))), + tr("Remove registered"), + this, + SLOT(remove())); + removeAct->setShortcut(Qt::CTRL + Qt::Key_Backspace); toolbar->addSeparator(); - new QLabel(tr("Name") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME); - Name = new QLineEdit(toolbar, TO_TOOLBAR_WIDGET_NAME); + toolbar->addWidget( + new QLabel(tr("Name") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME)); + + toolbar->addWidget( + Name = new QLineEdit(toolbar, TO_TOOLBAR_WIDGET_NAME)); Name->setText(def); connect(Name, SIGNAL(returnPressed()), this, SLOT(send())); - new QLabel(tr("Message") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME); + + toolbar->addWidget( + new QLabel(tr("Message") + " ", toolbar, TO_TOOLBAR_WIDGET_NAME)); + Message = new QLineEdit(toolbar, TO_TOOLBAR_WIDGET_NAME); connect(Message, SIGNAL(returnPressed()), this, SLOT(send())); - new QToolButton(QPixmap(const_cast<const char**>(toworksheet_xpm)), - tr("Edit message in memo"), - tr("Edit message in memo"), - this, SLOT(memo()), - toolbar); -// todo toolbar->setStretchableWidget(Message); - new QToolButton(QPixmap(const_cast<const char**>(return_xpm)), - tr("Send alert"), - tr("Send alert"), - this, SLOT(send()), - toolbar); + Message->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, + QSizePolicy::Minimum)); + toolbar->addWidget(Message); + + memoEditAct = + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(toworksheet_xpm))), + tr("Edit message in memo"), + this, + SLOT(memo())); + memoEditAct->setShortcut(Qt::CTRL + Qt::Key_M); + + sendAct = + toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(return_xpm))), + tr("Send alert"), + this, + SLOT(send())); + sendAct->setShortcut(Qt::CTRL + Qt::Key_Return); + connect(&Timer, SIGNAL(timeout()), this, SLOT(poll())); Timer.start(TIMEOUT*1000); @@ -196,58 +211,48 @@ this, SLOT(windowActivated(QWidget *))); State = Started; - try - { + try { toThread *thread = new toThread(new pollTask(*this)); thread->start(); } - catch (...) - { - toStatusMessage(tr("Failed to start polling thread, try closing some other tools and restart Alert Messenger")); + catch(...) { + toStatusMessage(tr("Failed to start polling thread, try closing " + "some other tools and restart Alert Messenger")); } setFocusProxy(Message); } -void toAlert::windowActivated(QWidget *widget) -{ - if (widget == this) - { - if (!ToolMenu) - { -#if 0 // todo - ToolMenu = new Q3PopupMenu(this); - ToolMenu->insertItem(tr("&Add name"), Registered, SLOT(setFocus()), toKeySequence(tr("Alt+R", "Alert|Add Name"))); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(trash_xpm)), tr("&Remove name"), - this, SLOT(remove - (void)), toKeySequence(tr("Ctrl+Backspace", "Alert|Remove name"))); - ToolMenu->insertSeparator(); - ToolMenu->insertItem(tr("Edit &name"), Name, SLOT(setFocus()), toKeySequence(tr("Alt+N", "Alert|Edit name"))); - ToolMenu->insertItem(tr("Edit &message"), Message, SLOT(setFocus()), toKeySequence(tr("Alt+M", "Alert|Message"))); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(toworksheet_xpm)), tr("&Message in memo..."), - this, SLOT(memo(void)), toKeySequence(tr("Ctrl+M", "Alert|Message in memo"))); - ToolMenu->insertItem(QPixmap(const_cast<const char**>(return_xpm)), tr("&Send alert"), - this, SLOT(send(void)), toKeySequence(tr("Ctrl+Return", "Alert|Send alert"))); +void toAlert::windowActivated(QWidget *widget) { + if(widget == this) { + if(!ToolMenu) { + ToolMenu = new QMenu(tr("&Alert"), this); - toMainWidget()->menuBar()->insertItem(tr("&Alert"), ToolMenu, -1, toToolMenuIndex()); -#endif + ToolMenu->addAction(addAct); + ToolMenu->addAction(removeAct); + + ToolMenu->addSeparator(); + + ToolMenu->addAction(memoEditAct); + ToolMenu->addAction(sendAct); + + toMainWidget()->addCustomMenu(ToolMenu); } } - else - { + else { delete ToolMenu; ToolMenu = NULL; } } -toAlert::~toAlert() -{ - try - { +toAlert::~toAlert() { +} + +void toAlert::closeEvent(QCloseEvent *event) { + try { Lock.lock(); State = Quit; - while (State != Done) - { + while(State != Done) { Lock.unlock(); Semaphore.down(); Lock.lock(); @@ -255,7 +260,7 @@ Lock.unlock(); AlertTool.closeWindow(connection()); } - TOCATCH + TOCATCH; } static toSQL SQLRegister("toAlert:Register", @@ -270,7 +275,7 @@ static toSQL SQLPoll("toAlert:PollAlert", "BEGIN\n" " SYS.DBMS_ALERT.WAITANY(:name<char[4000],out>,:msg<char[4000],out>,\n" - " :stat<in,out>,:tim<char[10],in>);\n" + " :stat<int,out>,:tim<char[10],in>);\n" "END;", "Poll for alert, must have same binds"); static toSQL SQLSignal("toAlert:Signal", @@ -354,13 +359,11 @@ { Parent.Lock.unlock(); #ifndef Q_OS_WIN32 - sleep(TIMEOUT); #else Sleep(TIMEOUT*1000); #endif - } } catch (const QString &str) Modified: branches/tora-1.4/tora/src/toalert.h =================================================================== --- branches/tora-1.4/tora/src/toalert.h 2007-12-26 02:09:25 UTC (rev 2376) +++ branches/tora-1.4/tora/src/toalert.h 2007-12-26 02:49:16 UTC (rev 2377) @@ -43,8 +43,7 @@ #include <list> #include <qtimer.h> -//Added by qt3to4: -#include <Q3PopupMenu> +#include <QMenu> #include "toconnection.h" #include "totool.h" @@ -54,35 +53,40 @@ class Q3PopupMenu; class toListView; -class toAlert : public toToolWidget -{ - Q_OBJECT +class toAlert : public toToolWidget { + Q_OBJECT; -class pollTask : public toTask + class pollTask : public toTask { toAlert &Parent; + public: - pollTask(toAlert &parent) - : Parent(parent) + pollTask(toAlert &parent) : Parent(parent) { } + virtual void run(void); }; - toListView *Alerts; - QComboBox *Registered; - QLineEdit *Name; - QLineEdit *Message; - QTimer Timer; - toConnection Connection; + toListView *Alerts; + QComboBox *Registered; + QLineEdit *Name; + QLineEdit *Message; + QTimer Timer; + toConnection Connection; toConnection *SendConnection; - Q3PopupMenu *ToolMenu; - toLock Lock; - toSemaphore Semaphore; + QMenu *ToolMenu; + QAction *addAct; + QAction *removeAct; + QAction *memoEditAct; + QAction *sendAct; + + toLock Lock; + toSemaphore Semaphore; std::list<QString> AddNames; std::list<QString> DelNames; std::list<QString> Names; - QString Error; + QString Error; std::list<QString> NewAlerts; std::list<QString> NewMessages; @@ -90,26 +94,28 @@ std::list<QString> SendAlerts; std::list<QString> SendMessages; - enum - { + enum { Started, Quit, Done } State; + +protected: + void closeEvent(QCloseEvent *event); + public: toAlert(QWidget *parent, toConnection &connection); virtual ~toAlert(); friend class pollTask; + public slots: virtual void poll(void); virtual void send(void); virtual void memo(void); virtual void changeMessage(int, int, const QString &str); - virtual void add - (void); - virtual void remove - (void); + virtual void add(void); + virtual void remove(void); virtual void windowActivated(QWidget *widget); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mrj...@us...> - 2007-12-26 21:44:35
|
Revision: 2380 http://tora.svn.sourceforge.net/tora/?rev=2380&view=rev Author: mrjohnson0 Date: 2007-12-26 13:44:39 -0800 (Wed, 26 Dec 2007) Log Message: ----------- make toConnection and toQuery qobjects and use qpointer when referencing Connection. resolves crasher during close. toConnection instances can be deleted at any time and toQuery was still trying to access member lists on toConnection. Modified Paths: -------------- branches/tora-1.4/tora/src/toconnection.cpp branches/tora-1.4/tora/src/toconnection.h Modified: branches/tora-1.4/tora/src/toconnection.cpp =================================================================== --- branches/tora-1.4/tora/src/toconnection.cpp 2007-12-26 03:00:04 UTC (rev 2379) +++ branches/tora-1.4/tora/src/toconnection.cpp 2007-12-26 21:44:39 UTC (rev 2380) @@ -508,13 +508,21 @@ // toQuery implementation -toQuery::toQuery(toConnection &conn, const toSQL &sql, - const QString &arg1, const QString &arg2, - const QString &arg3, const QString &arg4, - const QString &arg5, const QString &arg6, - const QString &arg7, const QString &arg8, +toQuery::toQuery(toConnection &conn, + const toSQL &sql, + const QString &arg1, + const QString &arg2, + const QString &arg3, + const QString &arg4, + const QString &arg5, + const QString &arg6, + const QString &arg7, + const QString &arg8, const QString &arg9) - : Connection(conn), ConnectionSub(conn.mainConnection()), SQL(sql(Connection).toAscii()) { + : Connection(QPointer<toConnection>(&conn)), + ConnectionSub(conn.mainConnection()), + SQL(sql(*Connection).toAscii()) +{ Mode = Normal; int numArgs; if (!arg9.isNull()) @@ -566,19 +574,27 @@ catch (...) { delete Query; Query = NULL; - Connection.freeConnection(ConnectionSub); + Connection->freeConnection(ConnectionSub); throw; } ConnectionSub->setQuery(this); } -toQuery::toQuery(toConnection &conn, const QString &sql, - const QString &arg1, const QString &arg2, - const QString &arg3, const QString &arg4, - const QString &arg5, const QString &arg6, - const QString &arg7, const QString &arg8, +toQuery::toQuery(toConnection &conn, + const QString &sql, + const QString &arg1, + const QString &arg2, + const QString &arg3, + const QString &arg4, + const QString &arg5, + const QString &arg6, + const QString &arg7, + const QString &arg8, const QString &arg9) - : Connection(conn), ConnectionSub(conn.mainConnection()), SQL(sql.utf8()) { + : Connection(QPointer<toConnection>(&conn)), + ConnectionSub(conn.mainConnection()), + SQL(sql.utf8()) +{ Mode = Normal; int numArgs; if (!arg9.isNull()) @@ -630,14 +646,18 @@ catch (...) { delete Query; Query = NULL; - Connection.freeConnection(ConnectionSub); + Connection->freeConnection(ConnectionSub); throw; } ConnectionSub->setQuery(this); } toQuery::toQuery(toConnection &conn, const toSQL &sql, const toQList ¶ms) - : Connection(conn), ConnectionSub(conn.mainConnection()), Params(params), SQL(sql(conn).toAscii()) { + : Connection(QPointer<toConnection>(&conn)), + ConnectionSub(conn.mainConnection()), + Params(params), + SQL(sql(conn).toAscii()) +{ Mode = Normal; toBusy busy; try { @@ -648,14 +668,18 @@ catch (...) { delete Query; Query = NULL; - Connection.freeConnection(ConnectionSub); + Connection->freeConnection(ConnectionSub); throw; } ConnectionSub->setQuery(this); } toQuery::toQuery(toConnection &conn, const QString &sql, const toQList ¶ms) - : Connection(conn), ConnectionSub(conn.mainConnection()), Params(params), SQL(sql.utf8()) { + : Connection(QPointer<toConnection>(&conn)), + ConnectionSub(conn.mainConnection()), + Params(params), + SQL(sql.utf8()) +{ Mode = Normal; toBusy busy; try { @@ -666,16 +690,19 @@ catch (...) { delete Query; Query = NULL; - Connection.freeConnection(ConnectionSub); + Connection->freeConnection(ConnectionSub); throw; } ConnectionSub->setQuery(this); } -toQuery::toQuery(toConnection &conn, queryMode mode, const toSQL &sql, const toQList ¶ms) - : Connection(conn), - Params(params), - SQL(sql(conn).toAscii()) { +toQuery::toQuery(toConnection &conn, + queryMode mode, + const toSQL &sql, + const toQList ¶ms) + : Connection(QPointer<toConnection>(&conn)), + Params(params), + SQL(sql(conn).toAscii()) { Mode = mode; switch (Mode) { @@ -700,16 +727,20 @@ catch (...) { delete Query; Query = NULL; - Connection.freeConnection(ConnectionSub); + Connection->freeConnection(ConnectionSub); throw; } ConnectionSub->setQuery(this); } -toQuery::toQuery(toConnection &conn, queryMode mode, const QString &sql, const toQList ¶ms) - : Connection(conn), - Params(params), - SQL(sql.utf8()) { +toQuery::toQuery(toConnection &conn, + queryMode mode, + const QString &sql, + const toQList ¶ms) + : Connection(QPointer<toConnection>(&conn)), + Params(params), + SQL(sql.utf8()) +{ Mode = mode; switch (Mode) { @@ -734,14 +765,15 @@ catch (...) { delete Query; Query = NULL; - Connection.freeConnection(ConnectionSub); + Connection->freeConnection(ConnectionSub); throw; } ConnectionSub->setQuery(this); } toQuery::toQuery(toConnection &conn, queryMode mode) - : Connection(conn) { + : Connection(QPointer<toConnection>(&conn)) +{ Mode = mode; switch (Mode) { @@ -772,7 +804,7 @@ void toQuery::execute(const toSQL &sql, const toQList ¶ms) { toBusy busy; - SQL = sql(Connection); + SQL = sql(*Connection); Params = params; Query->execute(); } @@ -790,7 +822,8 @@ try { if (ConnectionSub->query() == this) ConnectionSub->setQuery(NULL); - Connection.freeConnection(ConnectionSub); + if(Connection) + Connection->freeConnection(ConnectionSub); } catch (...) {} } @@ -798,27 +831,27 @@ bool toQuery::eof(void) { if (Mode == All) { if (Query->eof()) { - Connection.Lock.lock(); + Connection->Lock.lock(); bool found = false; try { - std::list<toConnectionSub *> &cons = Connection.connections(); + std::list<toConnectionSub *> &cons = Connection->connections(); for (std::list<toConnectionSub *>::iterator i = cons.begin();i != cons.end();i++) { if (*i == ConnectionSub) { i++; if (i != cons.end()) { ConnectionSub = *i; - Connection.Lock.unlock(); + Connection->Lock.unlock(); found = true; delete Query; Query = NULL; Query = connection().Connection->createQuery(this, ConnectionSub); Query->execute(); - Connection.Lock.lock(); + Connection->Lock.lock(); } break; } } - Connection.Lock.unlock(); + Connection->Lock.unlock(); } catch (...) {} } @@ -920,7 +953,7 @@ toQValue toQuery::readValue(void) { toBusy busy; - if (Connection.Abort) + if (Connection->Abort) throw qApp->translate("toQuery", "Query aborted"); if (Mode == All) eof(); @@ -929,7 +962,7 @@ toQValue toQuery::readValueNull(void) { toBusy busy; - if (Connection.Abort) + if (Connection->Abort) throw qApp->translate("toQuery", "Query aborted"); if (Mode == All) eof(); @@ -1189,7 +1222,7 @@ // make double sure destroy flag is set (*i)->setAttribute(Qt::WA_DeleteOnClose); - if(!(*i)->close(true)) + if(!(*i)->close()) return false; } Modified: branches/tora-1.4/tora/src/toconnection.h =================================================================== --- branches/tora-1.4/tora/src/toconnection.h 2007-12-26 03:00:04 UTC (rev 2379) +++ branches/tora-1.4/tora/src/toconnection.h 2007-12-26 21:44:39 UTC (rev 2380) @@ -100,8 +100,9 @@ /** This class is used to perform a query on a database connection. */ -class toQuery -{ +class toQuery : QObject { + Q_OBJECT; + public: /** Represent different modes to run a query in. */ @@ -200,7 +201,7 @@ }; private: - toConnection &Connection; + QPointer<toConnection> Connection; toConnectionSub *ConnectionSub; std::list<toQValue> Params; QString SQL; @@ -214,34 +215,50 @@ * @param sql SQL to run. * @param params Parameters to pass to query. */ - toQuery(toConnection &conn, const toSQL &sql, const std::list<toQValue> ¶ms); + toQuery(toConnection &conn, + const toSQL &sql, + const std::list<toQValue> ¶ms); + /** Create a normal query. * @param conn Connection to create query on. * @param sql SQL to run. * @param params Parameters to pass to query. */ - toQuery(toConnection &conn, const QString &sql, const std::list<toQValue> ¶ms); + toQuery(toConnection &conn, + const QString &sql, + const std::list<toQValue> ¶ms); + /** Create a normal query. * @param conn Connection to create query on. * @param sql SQL to run. * @param arg1 Arguments to pass to query. */ - toQuery(toConnection &conn, const toSQL &sql, - const QString &arg1 = QString::null, const QString &arg2 = QString::null, - const QString &arg3 = QString::null, const QString &arg4 = QString::null, - const QString &arg5 = QString::null, const QString &arg6 = QString::null, - const QString &arg7 = QString::null, const QString &arg8 = QString::null, + toQuery(toConnection &conn, + const toSQL &sql, + const QString &arg1 = QString::null, + const QString &arg2 = QString::null, + const QString &arg3 = QString::null, + const QString &arg4 = QString::null, + const QString &arg5 = QString::null, + const QString &arg6 = QString::null, + const QString &arg7 = QString::null, + const QString &arg8 = QString::null, const QString &arg9 = QString::null); /** Create a normal query. * @param conn Connection to create query on. * @param sql SQL to run. * @param arg1 Arguments to pass to query. */ - toQuery(toConnection &conn, const QString &sql, - const QString &arg1 = QString::null, const QString &arg2 = QString::null, - const QString &arg3 = QString::null, const QString &arg4 = QString::null, - const QString &arg5 = QString::null, const QString &arg6 = QString::null, - const QString &arg7 = QString::null, const QString &arg8 = QString::null, + toQuery(toConnection &conn, + const QString &sql, + const QString &arg1 = QString::null, + const QString &arg2 = QString::null, + const QString &arg3 = QString::null, + const QString &arg4 = QString::null, + const QString &arg5 = QString::null, + const QString &arg6 = QString::null, + const QString &arg7 = QString::null, + const QString &arg8 = QString::null, const QString &arg9 = QString::null); /** Create a query. @@ -250,14 +267,22 @@ * @param sql SQL to run. * @param params Arguments to pass to query. */ - toQuery(toConnection &conn, queryMode mode, const toSQL &sql, const std::list<toQValue> ¶ms); + toQuery(toConnection &conn, + queryMode mode, + const toSQL &sql, + const std::list<toQValue> ¶ms); + /** Create a query. * @param conn Connection to create query on. * @param mode Mode to run query in. * @param sql SQL to run. * @param params Arguments to pass to query. */ - toQuery(toConnection &conn, queryMode mode, const QString &sql, const std::list<toQValue> ¶ms); + toQuery(toConnection &conn, + queryMode mode, + const QString &sql, + const std::list<toQValue> ¶ms); + /** Create a query. Don't runn any SQL using it yet. Observe though that the @ref * toConnectionSub object is assigned here so you know that all queries run using this * query object will run on the same actual connection to the database (Unless mode is All off @@ -285,7 +310,7 @@ */ toConnection &connection(void) { - return Connection; + return *Connection; } /** Actual database connection that this query is currently using. */ @@ -444,8 +469,9 @@ * connections to the database as queries that ae expected to run a long time are sometimes * executed in their own connection to make sure the interface doesn't lock up for a long time. */ -class toConnection -{ +class toConnection : public QObject { + Q_OBJECT; + QString Provider; QString User; QString Password; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |