diff --git a/kmuddy/dialogs/dlgmxpconsole.cpp b/kmuddy/dialogs/dlgmxpconsole.cpp index 1ae00f8..9e163e5 100644 --- a/kmuddy/dialogs/dlgmxpconsole.cpp +++ b/kmuddy/dialogs/dlgmxpconsole.cpp @@ -1,69 +1,69 @@ // // C++ Implementation: dlgmxpconsole // // Description: // /* Copyright 2004-2011 Tomas Mecir 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; either version 2 of the License, or (at your option) any later version. 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, see . */ #include "dlgmxpconsole.h" #ifdef HAVE_MXP #include #include #include dlgMXPConsole::dlgMXPConsole (QWidget *parent) : QDockWidget (parent) { createDialog (); } dlgMXPConsole::~dlgMXPConsole () { } void dlgMXPConsole::createDialog () { setWindowTitle (i18n ("MXP Console")); viewer = new QTextEdit (this); viewer->setAcceptRichText (false); viewer->setReadOnly (true); setWidget (viewer); //no focus - we don't want this dialog to get focus setFocusPolicy (Qt::NoFocus); viewer->setFocusPolicy (Qt::NoFocus); } void dlgMXPConsole::addLine (const QString &line) { viewer->append (line); QScrollBar *sb = viewer->verticalScrollBar(); sb->setValue (sb->maximum ()); } -QSize dlgObjects::sizeHint() const +QSize dlgMXPConsole::sizeHint() const { return QSize (300, 200); } #endif //HAVE_MXP diff --git a/kmuddy/dialogs/dlgoutputwindow.cpp b/kmuddy/dialogs/dlgoutputwindow.cpp index ffde130..a4f9c3f 100644 --- a/kmuddy/dialogs/dlgoutputwindow.cpp +++ b/kmuddy/dialogs/dlgoutputwindow.cpp @@ -1,92 +1,88 @@ // // C++ Implementation: dlgoutputwindow // // Description: // /* Copyright 2004 Vladimir Lazarenko 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; either version 2 of the License, or (at your option) any later version. 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, see . */ #include "dlgoutputwindow.h" #include "cconsole.h" #include #include #include #include #include dlgOutputWindow::dlgOutputWindow (QWidget *parent) : QDialog(parent) { //initial size setWindowTitle (i18n ("Output window")); //main widget QVBoxLayout *layout = new QVBoxLayout (this); setFocusPolicy (Qt::StrongFocus); owindow = new cConsole(this); - //our window shall also have a status bar - owindow->setVScrollBarMode (Q3ScrollView::AlwaysOn); //no session information yet, will set it when it's available sess = 0; owindow->setSession (0); - KDialog::resizeLayout (this, 0, 5); - KWindowSystem::setType(this->winId(), NET::Utility); layout->setMargin (0); layout->addWidget(owindow); } dlgOutputWindow::~dlgOutputWindow() { } QSize dlgOutputWindow::sizeHint() const { return QSize (250, 300); } void dlgOutputWindow::setSession (int _sess) { sess = _sess; //also inform console about the new session owindow->setSession (sess); } void dlgOutputWindow::addLine (cTextChunk *chunk) { if (owindow) owindow->addLine (chunk); } void dlgOutputWindow::setOutputWindowName(const QString &name) { if(!name.isEmpty()) this->setWindowTitle(name); } void dlgOutputWindow::setFont(QFont font) { owindow->setFont(font); } diff --git a/kmuddy/dialogs/dlgwindows.cpp b/kmuddy/dialogs/dlgwindows.cpp index a9dc7a2..fdb9c68 100644 --- a/kmuddy/dialogs/dlgwindows.cpp +++ b/kmuddy/dialogs/dlgwindows.cpp @@ -1,164 +1,164 @@ // // C++ Implementation: dlgwindows // // Description: // /* Copyright 2004 Vladimir Lazarenko 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; either version 2 of the License, or (at your option) any later version. 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, see . */ #include "dlgwindows.h" #include "cwindowlist.h" #include #include #include -#include +#include +#include #include #include #include dlgWindows::dlgWindows(cWindowList *wlist, QWidget *parent) : QDialog(parent) { wl = wlist->windowList(); winlist = wlist; createDialog(); } dlgWindows::~dlgWindows() { } void dlgWindows::createDialog() { //initial dialog size setWindowTitle (i18n("Output Windows")); - setButtons (KDialog::Ok); //create main dialog's widget - QWidget *page = new QWidget (this); - QGridLayout *layout = new QGridLayout (page); - - setMainWidget (page); - - //change button text - setButtonText (KDialog::Ok, i18n ("Done")); + QGridLayout *layout = new QGridLayout (this); //create widgets - QLabel *label = new QLabel (i18n ("&List of output windows"), page); - box = new QListWidget (page); + QLabel *label = new QLabel (i18n ("&List of output windows"), this); + box = new QListWidget (this); label->setBuddy (box); - QFrame *buttons = new QFrame (page); + QFrame *buttons = new QFrame (this); QVBoxLayout *buttonslayout = new QVBoxLayout (buttons); btshow = new KPushButton (i18n("&Show"), buttons); bthide = new KPushButton (i18n("&Hide"), buttons); btdelete = new KPushButton (i18n("&Delete"), buttons); buttonslayout->setSpacing (5); buttonslayout->addWidget (btshow); buttonslayout->addWidget (bthide); buttonslayout->addWidget (btdelete); buttonslayout->addStretch (10); + QDialogButtonBox *dlgbuttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); + QPushButton *button = dlgbuttons->button (QDialogButtonBox::Ok); + button->setText (i18n ("&Dont")); + connect (dlgbuttons, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect (dlgbuttons, &QDialogButtonBox::rejected, this, &QDialog::reject); + layout->setColumnStretch (0, 10); layout->setRowStretch (1, 10); layout->setSpacing (5); layout->addWidget (label, 0, 0); layout->addWidget (box, 1, 0); layout->addWidget (buttons, 1, 1); updateMe(); connect (btshow, SIGNAL (clicked ()), this, SLOT (wshow ())); connect (bthide, SIGNAL (clicked ()), this, SLOT (whide ())); connect (btdelete, SIGNAL (clicked ()), this, SLOT (remove ())); } QSize dlgWindows::sizeHint() const { return QSize (500, 400); } void dlgWindows::wshow() { if (!box->count()) return; QString name; name = box->currentItem()->text(); if(!winlist->exists(name)) return; if(winlist->isShown(name)) return; winlist->show(name); } void dlgWindows::whide() { if (!box->count()) return; QString name; name = box->currentItem()->text(); if(!winlist->exists(name)) return; if(!winlist->isShown(name)) return; winlist->hide(name); } void dlgWindows::remove() { if (!box->count()) return; QString name; name = box->currentItem()->text(); if(!winlist->exists(name)) return; winlist->remove(name); updateMe(); } void dlgWindows::updateMe () { //remember old index int idx = box->currentRow (); box->clear (); box->addItems(winlist->windowList()); //make one item active, trying to be intelligent... box->setCurrentRow ((idx == -1) ? 0 : idx); if ((box->currentRow () == -1) && (idx != -1)) box->setCurrentRow (idx - 1); if (box->currentRow () == -1) box->setCurrentRow (0); }