Index: trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMLogViewer.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMLogViewer.ui	(revision 7763)
+++ trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMLogViewer.ui	(revision 7784)
@@ -1,224 +1,111 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>VBoxVMLogViewer</class>
-<comment>
-:mode=html:tabSize=4:indentSize=4:noTabs=true:
-:folding=explicit:collapseFolds=1:
-
-     Copyright (C) 2007 innotek GmbH
-    
-     This file is part of VirtualBox Open Source Edition (OSE), as
-     available from http://www.virtualbox.org. This file is free software;
-     you can redistribute it and/or modify it under the terms of the GNU
-     General Public License (GPL) as published by the Free Software
-     Foundation, in version 2 as it comes in the "COPYING" file of the
-     VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-     hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
-</comment>
-<widget class="QMainWindow">
-    <property name="name">
-        <cstring>VBoxVMLogViewer</cstring>
-    </property>
-    <property name="geometry">
-        <rect>
-            <x>0</x>
-            <y>0</y>
-            <width>600</width>
-            <height>480</height>
-        </rect>
-    </property>
-    <property name="caption">
-        <string>Log Viewer</string>
-    </property>
-    <vbox>
-        <property name="name">
-            <cstring>unnamed</cstring>
+<ui version="4.0" >
+ <class>VBoxVMLogViewer</class>
+ <widget class="QMainWindow" name="VBoxVMLogViewer" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>588</width>
+    <height>409</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Log Viewer</string>
+  </property>
+  <property name="windowIcon" >
+   <iconset resource="../VirtualBox.qrc" >:/show_logs_16px.png</iconset>
+  </property>
+  <widget class="QWidget" name="centralwidget" >
+   <layout class="QVBoxLayout" >
+    <item>
+     <widget class="QWidget" native="1" name="mLogsFrame" >
+      <property name="sizePolicy" >
+       <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" >
+      <item>
+       <widget class="QPushButton" name="mBtnHelp" >
+        <property name="text" >
+         <string>Help</string>
         </property>
-        <property name="margin">
-            <number>10</number>
+        <property name="shortcut" >
+         <string>F1</string>
         </property>
-        <property name="spacing">
-            <number>10</number>
+        <property name="autoDefault" >
+         <bool>true</bool>
         </property>
-        <widget class="QFrame">
-            <property name="name">
-                <cstring>mLogsFrame</cstring>
-            </property>
-            <property name="frameShape">
-                <enum>NoFrame</enum>
-            </property>
-            <property name="frameShadow">
-                <enum>Plain</enum>
-            </property>
-        </widget>
-        <widget class="QLayoutWidget">
-            <property name="name">
-                <cstring>layout2</cstring>
-            </property>
-            <hbox>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <widget class="QPushButton">
-                    <property name="name">
-                        <cstring>mHelpButton</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Help</string>
-                    </property>
-                    <property name="accel">
-                        <string>F1</string>
-                    </property>
-                </widget>
-                <spacer>
-                    <property name="name">
-                        <cstring>spacer3</cstring>
-                    </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
-                    </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
-                    </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>270</width>
-                            <height>20</height>
-                        </size>
-                    </property>
-                </spacer>
-                <widget class="QPushButton">
-                    <property name="name">
-                        <cstring>mFindButton</cstring>
-                    </property>
-                    <property name="text">
-                        <string>&amp;Find</string>
-                    </property>
-                </widget>
-                <widget class="QPushButton">
-                    <property name="name">
-                        <cstring>mSaveButton</cstring>
-                    </property>
-                    <property name="text">
-                        <string>&amp;Save</string>
-                    </property>
-                    <property name="autoDefault">
-                        <bool>true</bool>
-                    </property>
-                    <property name="default">
-                        <bool>true</bool>
-                    </property>
-                </widget>
-                <widget class="QPushButton">
-                    <property name="name">
-                        <cstring>mRefreshButton</cstring>
-                    </property>
-                    <property name="text">
-                        <string>&amp;Refresh</string>
-                    </property>
-                </widget>
-                <widget class="QPushButton">
-                    <property name="name">
-                        <cstring>mCloseButton</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Close</string>
-                    </property>
-                </widget>
-            </hbox>
-        </widget>
-    </vbox>
-</widget>
-<toolbars>
-</toolbars>
-<connections>
-    <connection>
-        <sender>mHelpButton</sender>
-        <signal>clicked()</signal>
-        <receiver>&amp;vboxProblem()</receiver>
-        <slot>showHelpHelpDialog()</slot>
-    </connection>
-    <connection>
-        <sender>mFindButton</sender>
-        <signal>clicked()</signal>
-        <receiver>VBoxVMLogViewer</receiver>
-        <slot>search()</slot>
-    </connection>
-    <connection>
-        <sender>mSaveButton</sender>
-        <signal>clicked()</signal>
-        <receiver>VBoxVMLogViewer</receiver>
-        <slot>save()</slot>
-    </connection>
-    <connection>
-        <sender>mRefreshButton</sender>
-        <signal>clicked()</signal>
-        <receiver>VBoxVMLogViewer</receiver>
-        <slot>refresh()</slot>
-    </connection>
-    <connection>
-        <sender>mCloseButton</sender>
-        <signal>clicked()</signal>
-        <receiver>VBoxVMLogViewer</receiver>
-        <slot>close()</slot>
-    </connection>
-</connections>
-<includes>
-    <include location="local" impldecl="in declaration">VBoxGlobal.h</include>
-    <include location="local" impldecl="in implementation">VBoxProblemReporter.h</include>
-    <include location="global" impldecl="in implementation">qsizegrip.h</include>
-    <include location="global" impldecl="in implementation">qstatusbar.h</include>
-    <include location="global" impldecl="in implementation">qtabwidget.h</include>
-    <include location="global" impldecl="in implementation">qtextbrowser.h</include>
-    <include location="global" impldecl="in implementation">qdir.h</include>
-    <include location="global" impldecl="in implementation">qfiledialog.h</include>
-    <include location="global" impldecl="in implementation">qdatetime.h</include>
-    <include location="global" impldecl="in implementation">qobjectlist.h</include>
-    <include location="global" impldecl="in implementation">qcheckbox.h</include>
-    <include location="global" impldecl="in implementation">qlabel.h</include>
-    <include location="global" impldecl="in implementation">qlineedit.h</include>
-    <include location="global" impldecl="in implementation">qtoolbutton.h</include>
-    <include location="global" impldecl="in implementation">qmessagebox.h</include>
-</includes>
-<forwards>
-    <forward>class QSizeGrip</forward>
-    <forward>class QTabWidget</forward>
-    <forward>class QTextBrowser</forward>
-    <forward>class VBoxLogSearchPanel</forward>
-</forwards>
-<variables>
-    <variable access="private">typedef QMap &lt;QString, VBoxVMLogViewer*&gt; LogViewersMap;</variable>
-    <variable access="private">static LogViewersMap mSelfArray;</variable>
-    <variable access="private">bool mFirstRun;</variable>
-    <variable access="private">bool mIsPolished;</variable>
-    <variable access="private">QSizeGrip *mSizeGrip;</variable>
-    <variable access="private">CMachine mMachine;</variable>
-    <variable access="private">QTabWidget *mLogList;</variable>
-    <variable access="private">QStringList mLogFilesList;</variable>
-    <variable access="private">QPushButton *mDefaultButton;</variable>
-    <variable access="private">VBoxLogSearchPanel *mSearchPanel;</variable>
-</variables>
-<slots>
-    <slot access="pritave">refresh()</slot>
-    <slot access="private">save()</slot>
-    <slot access="private">search()</slot>
-</slots>
-<functions>
-    <function specifier="static">createLogViewer( CMachine&amp; )</function>
-    <function access="private">init()</function>
-    <function access="private">destroy()</function>
-    <function>setup( CMachine &amp; )</function>
-    <function returnType="const CMachine&amp;">machine()</function>
-    <function access="pritave">languageChangeImp()</function>
-    <function access="pritave" returnType="QPushButton*">searchDefaultButton()</function>
-    <function access="protected" returnType="bool">eventFilter( QObject*, QEvent* )</function>
-    <function access="protected" returnType="bool">event( QEvent* )</function>
-    <function access="protected">keyPressEvent( QKeyEvent* )</function>
-    <function access="protected">showEvent( QShowEvent* )</function>
-    <function access="protected">resizeEvent( QResizeEvent* )</function>
-    <function access="pritave">loadLogFile( const QString &amp; )</function>
-    <function access="pritave" returnType="QTextBrowser*">createLogPage( const QString &amp; )</function>
-    <function returnType="QTextBrowser*">currentLogPage()</function>
-</functions>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+       </widget>
+      </item>
+      <item>
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" >
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mBtnFind" >
+        <property name="text" >
+         <string>&amp;Find</string>
+        </property>
+        <property name="autoDefault" >
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mBtnSave" >
+        <property name="text" >
+         <string>&amp;Save</string>
+        </property>
+        <property name="autoDefault" >
+         <bool>true</bool>
+        </property>
+        <property name="default" >
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mBtnRefresh" >
+        <property name="text" >
+         <string>&amp;Refresh</string>
+        </property>
+        <property name="autoDefault" >
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mBtnClose" >
+        <property name="text" >
+         <string>&amp;Close</string>
+        </property>
+        <property name="autoDefault" >
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QStatusBar" name="statusbar" />
+ </widget>
+ <resources>
+  <include location="../VirtualBox.qrc" />
+ </resources>
+ <connections/>
+</ui>
Index: trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMLogViewer.ui.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMLogViewer.ui.h	(revision 7763)
+++ 	(revision )
@@ -1,697 +1,0 @@
-//Added by qt3to4:
-#include <Q3HBoxLayout>
-#include <QKeyEvent>
-#include <QLabel>
-#include <QPixmap>
-#include <q3mimefactory.h>
-#include <QHideEvent>
-#include <QResizeEvent>
-#include <QEvent>
-#include <Q3VBoxLayout>
-#include <QShowEvent>
-#include <QToolTip>
-/**
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * "Virtual Log Viewer" dialog UI include (Qt Designer)
- */
-
-/*
- * Copyright (C) 2006 innotek GmbH
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you wish to add, delete or rename functions or slots use
-** Qt Designer which will update this file, preserving your code. Create an
-** init() function in place of a constructor, and a destroy() function in
-** place of a destructor.
-*****************************************************************************/
-
-
-class VBoxLogSearchPanel : public QWidget
-{
-    Q_OBJECT
-
-public:
-
-    VBoxLogSearchPanel (QWidget *aParent,
-                        VBoxVMLogViewer *aViewer,
-                        const char *aName)
-        : QWidget (aParent, aName)
-        , mViewer (aViewer)
-        , mButtonClose (0)
-        , mSearchName (0), mSearchString (0)
-        , mButtonPrev (0), mButtonNext (0)
-        , mCaseSensitive (0)
-        , mWarningSpacer (0), mWarningIcon (0), mWarningString (0)
-    {
-        mButtonClose = new QToolButton (this);
-        mButtonClose->setAutoRaise (true);
-        mButtonClose->setFocusPolicy (Qt::TabFocus);
-        mButtonClose->setAccel (QKeySequence (Qt::Key_Escape));
-        connect (mButtonClose, SIGNAL (clicked()), this, SLOT (hide()));
-        mButtonClose->setIconSet (VBoxGlobal::iconSet (":/delete_16px.png",
-                                                       ":/delete_dis_16px.png"));
-
-        mSearchName = new QLabel (this);
-        mSearchString = new QLineEdit (this);
-        mSearchString->setSizePolicy (QSizePolicy::Preferred,
-                                      QSizePolicy::Fixed);
-        connect (mSearchString, SIGNAL (textChanged (const QString &)),
-                 this, SLOT (findCurrent (const QString &)));
-
-        mButtonNext = new QToolButton (this);
-        mButtonNext->setEnabled (false);
-        mButtonNext->setAutoRaise (true);
-        mButtonNext->setFocusPolicy (Qt::TabFocus);
-        mButtonNext->setUsesTextLabel (true);
-        mButtonNext->setTextPosition (QToolButton::BesideIcon);
-        connect (mButtonNext, SIGNAL (clicked()), this, SLOT (findNext()));
-        mButtonNext->setIconSet (VBoxGlobal::iconSet (":/list_movedown_16px.png",
-                                                      ":/list_movedown_disabled_16px.png"));
-
-        mButtonPrev = new QToolButton (this);
-        mButtonPrev->setEnabled (false);
-        mButtonPrev->setAutoRaise (true);
-        mButtonPrev->setFocusPolicy (Qt::TabFocus);
-        mButtonPrev->setUsesTextLabel (true);
-        mButtonPrev->setTextPosition (QToolButton::BesideIcon);
-        connect (mButtonPrev, SIGNAL (clicked()), this, SLOT (findBack()));
-        mButtonPrev->setIconSet (VBoxGlobal::iconSet (":/list_moveup_16px.png",
-                                                      ":/list_moveup_disabled_16px.png"));
-
-        mCaseSensitive = new QCheckBox (this);
-
-        mWarningSpacer = new QSpacerItem (0, 0, QSizePolicy::Fixed,
-                                                QSizePolicy::Minimum);
-        mWarningIcon = new QLabel (this);
-        mWarningIcon->hide();
-        QImage img = QMessageBox::standardIcon (QMessageBox::Warning).
-                                                convertToImage();
-        if (!img.isNull())
-        {
-            img = img.smoothScale (16, 16);
-            QPixmap pixmap;
-            pixmap.convertFromImage (img);
-            mWarningIcon->setPixmap (pixmap);
-        }
-        mWarningString = new QLabel (this);
-        mWarningString->hide();
-
-        QSpacerItem *spacer = new QSpacerItem (0, 0, QSizePolicy::Expanding,
-                                                     QSizePolicy::Minimum);
-
-        Q3HBoxLayout *mainLayout = new Q3HBoxLayout (this, 5, 5);
-        mainLayout->addWidget (mButtonClose);
-        mainLayout->addWidget (mSearchName);
-        mainLayout->addWidget (mSearchString);
-        mainLayout->addWidget (mButtonNext);
-        mainLayout->addWidget (mButtonPrev);
-        mainLayout->addWidget (mCaseSensitive);
-        mainLayout->addItem   (mWarningSpacer);
-        mainLayout->addWidget (mWarningIcon);
-        mainLayout->addWidget (mWarningString);
-        mainLayout->addItem   (spacer);
-
-        setFocusProxy (mCaseSensitive);
-        topLevelWidget()->installEventFilter (this);
-
-        languageChange();
-    }
-
-    void languageChange()
-    {
-        QKeySequence accel;
-
-        QToolTip::add (mButtonClose, tr ("Close the search panel"));
-
-        mSearchName->setText (tr ("Find "));
-        QToolTip::add (mSearchString, tr ("Enter a search string here"));
-
-        VBoxGlobal::setTextLabel (mButtonPrev, tr ("&Previous"));
-        QToolTip::add (mButtonPrev,
-            tr ("Search for the previous occurrence of the string"));
-
-        VBoxGlobal::setTextLabel (mButtonNext, tr ("&Next"));
-        QToolTip::add (mButtonNext,
-            tr ("Search for the next occurrence of the string"));
-
-        mCaseSensitive->setText (tr ("C&ase Sensitive"));
-        QToolTip::add (mCaseSensitive,
-            tr ("Perform case sensitive search (when checked)"));
-
-        mWarningString->setText (tr ("String not found"));
-    }
-
-private slots:
-
-    void findNext()
-    {
-        search (true);
-    }
-
-    void findBack()
-    {
-        search (false);
-    }
-
-    void findCurrent (const QString &aSearchString)
-    {
-        mButtonNext->setEnabled (aSearchString.length());
-        mButtonPrev->setEnabled (aSearchString.length());
-        toggleWarning (!aSearchString.length());
-        if (aSearchString.length())
-            search (true, true);
-        else
-            mViewer->currentLogPage()->removeSelection();
-    }
-
-private:
-
-    void search (bool aForward, bool aStartCurrent = false)
-    {
-        Q3TextBrowser *browser = mViewer->currentLogPage();
-        if (!browser) return;
-
-        int startPrg = 0, endPrg = 0;
-        int startInd = 0, endInd = 0;
-        if (browser->hasSelectedText())
-            browser->getSelection (&startPrg, &startInd, &endPrg, &endInd);
-
-        bool found = false;
-        int increment = aForward ? 1 : -1;
-        int border = aForward ? browser->paragraphs() : -1;
-        int startFrom = aStartCurrent ? startInd : startInd + increment;
-        int paragraph = startFrom < 0 ? startPrg + increment : startPrg;
-        for (; paragraph != border; paragraph += increment)
-        {
-            QString text = browser->text (paragraph);
-            int res = aForward ?
-                text.find (mSearchString->text(), startFrom,
-                           mCaseSensitive->isChecked()) :
-                text.findRev (mSearchString->text(), startFrom,
-                              mCaseSensitive->isChecked());
-            if (res != -1)
-            {
-                found = true;
-                browser->setSelection (paragraph, res, paragraph,
-                                       res + mSearchString->text().length());
-                /* ensures the selected word visible */
-                int curPrg = 0, curInd = 0;
-                browser->getCursorPosition (&curPrg, &curInd);
-                QRect rect = browser->paragraphRect (curPrg);
-                QString string = browser->text (curPrg);
-                string.truncate (curInd);
-                int x = rect.x() + browser->fontMetrics().width (string);
-                int y = rect.y() + browser->pointSize() / 2;
-                browser->setContentsPos (0, browser->contentsY());
-                browser->ensureVisible (x, y, 40, 40);
-                break;
-            }
-            startFrom = aForward ? 0 : -1;
-        }
-
-        toggleWarning (found);
-        if (!found)
-            browser->setSelection (startPrg, startInd, endPrg, endInd);
-    }
-
-    bool eventFilter (QObject *aObject, QEvent *aEvent)
-    {
-        switch (aEvent->type())
-        {
-            case QEvent::KeyPress:
-            {
-                QKeyEvent *e = static_cast<QKeyEvent*> (aEvent);
-
-                /* handle the Enter keypress for mSearchString
-                 * widget as a search next string action */
-                if (aObject == mSearchString &&
-                    (e->state() == 0 || e->state() & Qt::Keypad) &&
-                    (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return))
-                {
-                    findNext();
-                    return true;
-                }
-                /* handle other search next/previous shortcuts */
-                else if (e->key() == Qt::Key_F3)
-                {
-                    if (e->state() == 0)
-                        findNext();
-                    else if (e->state() == Qt::ShiftButton)
-                        findBack();
-                    return true;
-                }
-                /* handle ctrl-f key combination as a shortcut to
-                 * move to the search field */
-                else if (e->state() == Qt::ControlButton && e->key() == Qt::Key_F)
-                {
-                    if (mViewer->currentLogPage())
-                    {
-                        if (isHidden()) show();
-                        mSearchString->setFocus();
-                        return true;
-                    }
-                }
-                /* handle alpha-numeric keys to implement the
-                 * "find as you type" feature */
-                else if ((e->state() & ~Qt::ShiftButton) == 0 &&
-                         e->key() >= Qt::Key_Exclam &&
-                         e->key() <= Qt::Key_AsciiTilde)
-                {
-                    if (mViewer->currentLogPage())
-                    {
-                        if (isHidden()) show();
-                        mSearchString->setFocus();
-                        mSearchString->insert (e->text());
-                        return true;
-                    }
-                }
-
-                break;
-            }
-            default:
-                break;
-        }
-        return false;
-    }
-
-    void showEvent (QShowEvent *aEvent)
-    {
-        QWidget::showEvent (aEvent);
-        mSearchString->setFocus();
-        mSearchString->selectAll();
-    }
-
-    void hideEvent (QHideEvent *aEvent)
-    {
-#warning port me
-//        if (focusData()->focusWidget()->parent() == this)
-//           focusNextPrevChild (true);
-        QWidget::hideEvent (aEvent);
-    }
-
-    void toggleWarning (bool aHide)
-    {
-        mWarningSpacer->changeSize (aHide ? 0 : 16, 0, QSizePolicy::Fixed,
-                                                       QSizePolicy::Minimum);
-        mWarningIcon->setHidden (aHide);
-        mWarningString->setHidden (aHide);
-    }
-
-    VBoxVMLogViewer *mViewer;
-    QToolButton     *mButtonClose;
-    QLabel          *mSearchName;
-    QLineEdit       *mSearchString;
-    QToolButton     *mButtonPrev;
-    QToolButton     *mButtonNext;
-    QCheckBox       *mCaseSensitive;
-    QSpacerItem     *mWarningSpacer;
-    QLabel          *mWarningIcon;
-    QLabel          *mWarningString;
-};
-
-
-VBoxVMLogViewer::LogViewersMap VBoxVMLogViewer::mSelfArray = LogViewersMap();
-
-void VBoxVMLogViewer::createLogViewer (CMachine &aMachine)
-{
-    if (mSelfArray.find (aMachine.GetName()) == mSelfArray.end())
-    {
-        /* creating new log viewer if there is no one existing */
-        mSelfArray [aMachine.GetName()] = new VBoxVMLogViewer (0,
-            "VBoxVMLogViewer", Qt::WType_TopLevel | Qt::WDestructiveClose);
-        /* read new machine data for this log viewer */
-        mSelfArray [aMachine.GetName()]->setup (aMachine);
-    }
-
-    VBoxVMLogViewer *viewer = mSelfArray [aMachine.GetName()];
-    viewer->show();
-    viewer->setWindowState (viewer->windowState() & ~Qt::WindowMinimized);
-    viewer->setActiveWindow();
-}
-
-
-void VBoxVMLogViewer::init()
-{
-    /* prepare dialog to first run */
-    mFirstRun = true;
-
-    /* dialog initially is not polished */
-    mIsPolished = false;
-
-    /* search the default button */
-    mDefaultButton = searchDefaultButton();
-    topLevelWidget()->installEventFilter (this);
-
-    /* setup a dialog icon */
-    setIcon (QPixmap (":/show_logs_16px.png"));
-
-    /* statusbar initially disabled */
-    statusBar()->setHidden (true);
-
-    /* setup size grip */
-    mSizeGrip = new QSizeGrip (centralWidget(), "mSizeGrip");
-    mSizeGrip->resize (mSizeGrip->sizeHint());
-    mSizeGrip->stackUnder (mCloseButton);
-
-    /* logs list creation */
-    mLogList = new QTabWidget (mLogsFrame, "mLogList");
-    Q3VBoxLayout *logsFrameLayout = new Q3VBoxLayout (mLogsFrame);
-    logsFrameLayout->addWidget (mLogList);
-
-    /* search panel creation */
-    mSearchPanel = new VBoxLogSearchPanel (mLogsFrame, this,
-                                           "VBoxLogSearchPanel");
-    logsFrameLayout->addWidget (mSearchPanel);
-    mSearchPanel->hide();
-
-    /* fix the tab order to ensure the dialog keys are always the last */
-    setTabOrder (mSearchPanel->focusProxy(), mHelpButton);
-    setTabOrder (mHelpButton, mFindButton);
-    setTabOrder (mFindButton, mSaveButton);
-    setTabOrder (mSaveButton, mRefreshButton);
-    setTabOrder (mRefreshButton, mCloseButton);
-    setTabOrder (mCloseButton, mLogList);
-
-    /* make the [Save] button focused by default */
-    mSaveButton->setFocus();
-
-    /* applying language settings */
-    languageChangeImp();
-}
-
-
-void VBoxVMLogViewer::destroy()
-{
-    mSelfArray.erase (mMachine.GetName());
-}
-
-
-void VBoxVMLogViewer::setup (CMachine &aMachine)
-{
-    /* saving related machine */
-    mMachine = aMachine;
-
-    /* reading log files */
-    refresh();
-
-    /* loading language constants */
-    languageChangeImp();
-}
-
-
-const CMachine& VBoxVMLogViewer::machine()
-{
-    return mMachine;
-}
-
-
-void VBoxVMLogViewer::languageChangeImp()
-{
-    /* setup a dialog caption */
-    if (!mMachine.isNull())
-        setCaption (tr ("%1 - VirtualBox Log Viewer").arg (mMachine.GetName()));
-    /* translate a search panel */
-    if (mSearchPanel)
-        mSearchPanel->languageChange();
-}
-
-
-QPushButton* VBoxVMLogViewer::searchDefaultButton()
-{
-    /* this mechanism is used for searching the default dialog button
-     * and similar the same mechanism in Qt::QDialog inner source */
-    QPushButton *button = 0;
-    QObjectList list = queryList ("QPushButton");
-    foreach (QObject *obj, list)
-    {
-        button = qobject_cast<QPushButton*> (obj);
-        if (button->isDefault())
-            break;
-    }
-    return button;
-}
-
-
-bool VBoxVMLogViewer::eventFilter (QObject *aObject, QEvent *aEvent)
-{
-    switch (aEvent->type())
-    {
-        /* auto-default button focus-in processor used to move the "default"
-         * button property into the currently focused button */
-        case QEvent::FocusIn:
-        {
-            if (aObject->inherits ("QPushButton") &&
-                aObject->parent() == centralWidget())
-            {
-                ((QPushButton*)aObject)->setDefault (aObject != mDefaultButton);
-                if (mDefaultButton)
-                    mDefaultButton->setDefault (aObject == mDefaultButton);
-            }
-            break;
-        }
-        /* auto-default button focus-out processor used to remove the "default"
-         * button property from the previously focused button */
-        case QEvent::FocusOut:
-        {
-            if (aObject->inherits ("QPushButton") &&
-                aObject->parent() == centralWidget())
-            {
-                if (mDefaultButton)
-                    mDefaultButton->setDefault (aObject != mDefaultButton);
-                ((QPushButton*)aObject)->setDefault (aObject == mDefaultButton);
-            }
-            break;
-        }
-        default:
-            break;
-    }
-    return Q3MainWindow::eventFilter (aObject, aEvent);
-}
-
-
-bool VBoxVMLogViewer::event (QEvent *aEvent)
-{
-    bool result = Q3MainWindow::event (aEvent);
-    switch (aEvent->type())
-    {
-        case QEvent::LanguageChange:
-        {
-            languageChangeImp();
-            break;
-        }
-        default:
-            break;
-    }
-    return result;
-}
-
-
-void VBoxVMLogViewer::keyPressEvent (QKeyEvent *aEvent)
-{
-    if (aEvent->state() == 0 ||
-        (aEvent->state() & Qt::KeypadModifier && aEvent->key() == Qt::Key_Enter))
-    {
-        switch (aEvent->key())
-        {
-            /* processing the return keypress for the auto-default button */
-            case Qt::Key_Enter:
-            case Qt::Key_Return:
-            {
-                QPushButton *currentDefault = searchDefaultButton();
-                if (currentDefault)
-                    currentDefault->animateClick();
-                break;
-            }
-            /* processing the escape keypress as the close dialog action */
-            case Qt::Key_Escape:
-            {
-                mCloseButton->animateClick();
-                break;
-            }
-        }
-    }
-    else
-        aEvent->ignore();
-}
-
-
-void VBoxVMLogViewer::showEvent (QShowEvent *aEvent)
-{
-    Q3MainWindow::showEvent (aEvent);
-
-    /* one may think that QWidget::polish() is the right place to do things
-     * below, but apparently, by the time when QWidget::polish() is called,
-     * the widget style & layout are not fully done, at least the minimum
-     * size hint is not properly calculated. Since this is sometimes necessary,
-     * we provide our own "polish" implementation. */
-
-    if (mIsPolished)
-        return;
-
-    mIsPolished = true;
-
-    VBoxGlobal::centerWidget (this, parentWidget());
-}
-
-
-void VBoxVMLogViewer::resizeEvent (QResizeEvent*)
-{
-    /* adjust the size-grip location for the current resize event */
-    mSizeGrip->move (centralWidget()->rect().bottomRight() -
-                     QPoint (mSizeGrip->rect().width() - 1,
-                     mSizeGrip->rect().height() - 1));
-}
-
-
-void VBoxVMLogViewer::refresh()
-{
-    /* clearing old data if any */
-    mLogFilesList.clear();
-    mLogList->setEnabled (true);
-    while (mLogList->count())
-    {
-        QWidget *logPage = mLogList->page (0);
-        mLogList->removePage (logPage);
-        delete logPage;
-    }
-
-    bool isAnyLogPresent = false;
-
-    /* entering log files folder */
-    QString logFilesPath = mMachine.GetLogFolder();
-    QDir logFilesDir (logFilesPath);
-    if (logFilesDir.exists())
-    {
-        /* reading log files folder */
-        logFilesDir.setNameFilter ("*.log *.log.*");
-        QStringList logList = logFilesDir.entryList (QDir::Files);
-        if (!logList.empty()) isAnyLogPresent = true;
-        for (QStringList::Iterator it = logList.begin(); it != logList.end(); ++it)
-            loadLogFile (logFilesDir.filePath (*it));
-    }
-
-    /* create an empty log page if there are no logs at all */
-    if (!isAnyLogPresent)
-    {
-        Q3TextBrowser *dummyLog = createLogPage ("VBox.log");
-        dummyLog->setTextFormat (Qt::RichText);
-        dummyLog->setWordWrap (Q3TextEdit::WidgetWidth);
-        dummyLog->setText (tr ("<p>No log files found. Press the <b>Refresh</b> "
-            "button to rescan the log folder <nobr><b>%1</b></nobr>.</p>")
-            .arg (logFilesPath));
-        /* we don't want it to remain white */
-        dummyLog->setPaper (backgroundBrush());
-    }
-
-    /* restore previous tab-widget margin which was reseted when
-     * the tab widget's children was removed */
-    mLogList->setMargin (10);
-
-    /* show the first tab widget's page after the refresh */
-    mLogList->showPage (mLogList->page(0));
-
-    /* enable/disable save button & tab widget according log presence */
-    mFindButton->setEnabled (isAnyLogPresent);
-    mSaveButton->setEnabled (isAnyLogPresent);
-    mLogList->setEnabled (isAnyLogPresent);
-
-    if (mFirstRun)
-    {
-        /* resize the whole log-viewer to fit 80 symbols in text-browser for
-         * the first time started */
-        Q3TextBrowser *firstPage = static_cast <Q3TextBrowser *> (mLogList->page(0));
-        int fullWidth = firstPage->fontMetrics().width (QChar ('x')) * 80 +
-                        firstPage->verticalScrollBar()->width() +
-                        firstPage->frameWidth() * 2 +
-                        5 + 4 /* left text margin + QTabWidget frame width */ +
-                        mLogList->margin() * 2 +
-                        centralWidget()->layout()->margin() * 2;
-        resize (fullWidth, height());
-        mFirstRun = false;
-    }
-}
-
-
-void VBoxVMLogViewer::loadLogFile (const QString &aFileName)
-{
-    /* prepare log file */
-    QFile logFile (aFileName);
-    if (!logFile.exists() || !logFile.open (QIODevice::ReadOnly))
-        return;
-
-    /* read log file and write it into the log page */
-    Q3TextBrowser *logViewer = createLogPage (QFileInfo (aFileName).fileName());
-    logViewer->setText (logFile.readAll());
-
-    mLogFilesList << aFileName;
-}
-
-
-Q3TextBrowser* VBoxVMLogViewer::createLogPage (const QString &aName)
-{
-    Q3TextBrowser *logViewer = new Q3TextBrowser();
-    logViewer->setTextFormat (Qt::PlainText);
-    QFont font = logViewer->currentFont();
-    font.setFamily ("Courier New,courier");
-    logViewer->setFont (font);
-    logViewer->setWordWrap (Q3TextEdit::NoWrap);
-    logViewer->setVScrollBarMode (Q3ScrollView::AlwaysOn);
-    mLogList->addTab (logViewer, aName);
-    return logViewer;
-}
-
-
-Q3TextBrowser* VBoxVMLogViewer::currentLogPage()
-{
-    return mLogList->isEnabled() ?
-        static_cast<Q3TextBrowser*> (mLogList->currentPage()) : 0;
-}
-
-
-void VBoxVMLogViewer::save()
-{
-    /* prepare "save as" dialog */
-    QFileInfo fileInfo (mLogFilesList [mLogList->currentPageIndex()]);
-    QDateTime dtInfo = fileInfo.lastModified();
-    QString dtString = dtInfo.toString ("yyyy-MM-dd-hh-mm-ss");
-    QString defaultFileName = QString ("%1-%2.log")
-        .arg (mMachine.GetName()).arg (dtString);
-    QString defaultFullName = QDir::convertSeparators (QDir::home().absPath() +
-                                                       "/" + defaultFileName);
-
-    QString newFileName = Q3FileDialog::getSaveFileName (defaultFullName,
-        QString::null, this, "SaveLogAsDialog", tr ("Save VirtualBox Log As"));
-
-    /* save new log into the file */
-    if (!newFileName.isEmpty())
-    {
-        /* reread log data */
-        QFile oldFile (mLogFilesList [mLogList->currentPageIndex()]);
-        QFile newFile (newFileName);
-        if (!oldFile.open (QIODevice::ReadOnly) || !newFile.open (QIODevice::WriteOnly))
-            return;
-
-        /* save log data into the new file */
-        newFile.writeBlock (oldFile.readAll());
-    }
-}
-
-void VBoxVMLogViewer::search()
-{
-    mSearchPanel->isHidden() ? mSearchPanel->show() : mSearchPanel->hide();
-}
-
-#include "VBoxVMLogViewer.ui.moc"
-
