diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index 20ec8963d..61e47600f 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -163,7 +163,6 @@ set(Gui_MOC_HDRS Control.h Clipping.h DemoMode.h - DownloadDialog.h DownloadItem.h DownloadManager.h DlgActionsImp.h @@ -197,7 +196,6 @@ set(Gui_MOC_HDRS DlgSettingsImageImp.h DlgSettingsMacroImp.h DlgSettingsUnitsImp.h - DlgTipOfTheDayImp.h DlgCheckableMessageBox.h DlgToolbarsImp.h DlgWorkbenchesImp.h @@ -216,7 +214,6 @@ set(Gui_MOC_HDRS GraphvizView.h GuiApplication.h GuiApplicationNativeEventAware.h - HelpView.h InputVector.h MainWindow.h ManualAlignment.h @@ -309,7 +306,6 @@ SET(Gui_UIC_SRCS DlgSettingsImage.ui DlgSettingsMacro.ui DlgCheckableMessageBox.ui - DlgTipOfTheDay.ui DlgToolbars.ui DlgWorkbenches.ui DlgTreeWidget.ui @@ -377,7 +373,6 @@ SET(Dialog_CPP_SRCS DlgProjectInformationImp.cpp DlgProjectUtility.cpp DlgPropertyLink.cpp - DlgTipOfTheDayImp.cpp DlgExpressionInput.cpp TaskDlgRelocation.cpp DlgCheckableMessageBox.cpp @@ -389,7 +384,6 @@ SET(Dialog_CPP_SRCS SceneInspector.cpp TextureMapping.cpp Transform.cpp - DownloadDialog.cpp DownloadItem.cpp DownloadManager.cpp DocumentRecovery.cpp @@ -412,7 +406,6 @@ SET(Dialog_HPP_SRCS DlgProjectUtility.h DlgPropertyLink.h DlgCheckableMessageBox.h - DlgTipOfTheDayImp.h DlgExpressionInput.h TaskDlgRelocation.h TaskCSysDragger.h @@ -423,7 +416,6 @@ SET(Dialog_HPP_SRCS SceneInspector.h TextureMapping.h Transform.h - DownloadDialog.h DownloadItem.h DownloadManager.h DocumentRecovery.h @@ -450,7 +442,6 @@ SET(Dialog_SRCS DlgProjectInformation.ui DlgProjectUtility.ui DlgPropertyLink.ui - DlgTipOfTheDay.ui DlgCheckableMessageBox.ui DlgTreeWidget.ui DlgExpressionInput.ui @@ -552,7 +543,6 @@ SOURCE_GROUP("Dialog\\Settings" FILES ${Dialog_Settings_SRCS}) SET(Dock_Windows_CPP_SRCS CombiView.cpp DockWindow.cpp - HelpView.cpp PropertyView.cpp ReportView.cpp SelectionView.cpp @@ -569,7 +559,6 @@ SET(Dock_Windows_CPP_SRCS SET(Dock_Windows_HPP_SRCS CombiView.h DockWindow.h - HelpView.h PropertyView.h ReportView.h SelectionView.h diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 38fab4327..414deb135 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -39,7 +39,6 @@ #include "Application.h" #include "Document.h" #include "Selection.h" -#include "HelpView.h" #include "Macro.h" #include "MainWindow.h" #include "DlgUndoRedo.h" diff --git a/src/Gui/DlgTipOfTheDay.ui b/src/Gui/DlgTipOfTheDay.ui deleted file mode 100644 index ca99542f6..000000000 --- a/src/Gui/DlgTipOfTheDay.ui +++ /dev/null @@ -1,1277 +0,0 @@ - - - - - Gui::Dialog::DlgTipOfTheDay - - - - 0 - 0 - 411 - 270 - - - - Tip of the day - - - true - - - - 9 - - - 6 - - - - - - - - 0 - 0 - 0 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 241 - 239 - 226 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 134 - 132 - 127 - - - 113 - 111 - 100 - - - 49 - 106 - 197 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 0 - 0 - 0 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 241 - 239 - 226 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 134 - 132 - 127 - - - 113 - 111 - 100 - - - 236 - 233 - 216 - - - 0 - 0 - 0 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 118 - 116 - 108 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 245 - 244 - 235 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 118 - 116 - 108 - - - 255 - 255 - 255 - - - 118 - 116 - 108 - - - 134 - 132 - 127 - - - 134 - 132 - 127 - - - 0 - 0 - 0 - - - 49 - 106 - 197 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - - true - - - - - - - 0 - - - 1 - - - - - Qt::Vertical - - - - 30 - 51 - - - - - - - - - 40 - 46 - - - - - 40 - 32767 - - - - - - - 0 - 0 - 0 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 241 - 239 - 226 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 134 - 132 - 127 - - - 113 - 111 - 100 - - - 49 - 106 - 197 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 0 - 0 - 0 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 241 - 239 - 226 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 134 - 132 - 127 - - - 113 - 111 - 100 - - - 236 - 233 - 216 - - - 0 - 0 - 0 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 118 - 116 - 108 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 245 - 244 - 235 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 118 - 116 - 108 - - - 255 - 255 - 255 - - - 118 - 116 - 108 - - - 134 - 132 - 127 - - - 134 - 132 - 127 - - - 0 - 0 - 0 - - - 49 - 106 - 197 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - - :/icons/bulb.xpm - - - false - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - - - - 0 - 0 - 0 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 241 - 239 - 226 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 113 - 111 - 100 - - - 49 - 106 - 197 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 0 - 0 - 0 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 241 - 239 - 226 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 113 - 111 - 100 - - - 236 - 233 - 216 - - - 0 - 0 - 0 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 118 - 116 - 108 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 245 - 244 - 235 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 118 - 116 - 108 - - - 255 - 255 - 255 - - - 118 - 116 - 108 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 49 - 106 - 197 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - - - MS Shell Dlg 2 - 10 - 50 - false - false - false - false - - - - true - - - Tip of the day - - - Qt::AlignVCenter - - - true - - - 5 - - - - - - - - 32767 - 50 - - - - - - - 0 - 0 - 0 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 241 - 239 - 226 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 113 - 111 - 100 - - - 49 - 106 - 197 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 0 - 0 - 0 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 241 - 239 - 226 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 113 - 111 - 100 - - - 236 - 233 - 216 - - - 0 - 0 - 0 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - 118 - 116 - 108 - - - 236 - 233 - 216 - - - 255 - 255 - 255 - - - 245 - 244 - 235 - - - 172 - 168 - 153 - - - 157 - 155 - 144 - - - 118 - 116 - 108 - - - 255 - 255 - 255 - - - 118 - 116 - 108 - - - 255 - 255 - 255 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 49 - 106 - 197 - - - 255 - 255 - 255 - - - 0 - 0 - 255 - - - 255 - 0 - 255 - - - 232 - 232 - 232 - - - - - - true - - - <b><font face="Times New Roman"><font size="+3">Did you know...</font></font></b> - - - Qt::AlignVCenter - - - - - - - - - - 0 - - - 6 - - - - - &Show tips at start up - - - Alt+S - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 21 - - - - - - - - &Next Tip - - - Alt+N - - - true - - - - - - - &Close - - - Alt+C - - - - - - - - - - - - - - - buttonClose - clicked() - Gui::Dialog::DlgTipOfTheDay - close() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/src/Gui/DlgTipOfTheDayImp.cpp b/src/Gui/DlgTipOfTheDayImp.cpp deleted file mode 100644 index 9085faefe..000000000 --- a/src/Gui/DlgTipOfTheDayImp.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2004 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library 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 Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" - -#ifndef _PreComp_ -# include -# include -# include -# include -# include -# include -#endif - -#include "DlgTipOfTheDayImp.h" -#include "Application.h" -#include "MainWindow.h" - -#include -#include - -using namespace Gui::Dialog; - -/* TRANSLATOR Gui::Dialog::DlgTipOfTheDayImp */ - -/** - * Constructs a DlgTipOfTheDayImp which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - * - * The dialog will by default be modeless, unless you set 'modal' to - * true to construct a modal dialog. - */ -DlgTipOfTheDayImp::DlgTipOfTheDayImp( QWidget* parent, Qt::WindowFlags fl ) - : QDialog( parent, fl | Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), - WindowParameter("General") -{ - setupUi(this); - _http = new QHttp; - connect(_http, SIGNAL(done(bool)), this, SLOT(onDone(bool))); - connect(_http, SIGNAL(stateChanged(int)), this, SLOT(onStateChanged(int))); - connect(_http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), - this, SLOT(onResponseHeaderReceived(const QHttpResponseHeader &))); - - bool tips = getWindowParameter()->GetBool("Tipoftheday", true); - checkShowTips->setChecked(tips); - - // Since the resize mode of DlgTipOfTheDayBase does not - // work properly so set this by hand - setMinimumSize(QSize(320, 250)); - layout()->setSizeConstraint( QLayout::SetNoConstraint ); - - reload(); - on_buttonNextTip_clicked(); -} - -/** Destroys the object and frees any allocated resources */ -DlgTipOfTheDayImp::~DlgTipOfTheDayImp() -{ - delete _http; - getWindowParameter()->SetBool("Tipoftheday", checkShowTips->isChecked()); -} - -/** Shows next tip taken from the Tip-of-the-day site. */ -void DlgTipOfTheDayImp::on_buttonNextTip_clicked() -{ - _iCurrentTip = (_iCurrentTip + 1) % _lTips.size(); - textTip->setText(_lTips[_iCurrentTip]); -} - -/** Reloads all tips from Tip-of-the-day site. */ -void DlgTipOfTheDayImp::reload() -{ - // set the host and start the download - _http->setHost(QLatin1String("www.freecadweb.org")); - _http->get(QLatin1String("/wiki/index.php?title=Tip_of_the_day"), 0); - - _iCurrentTip = 0; - _lTips << tr("If you want to learn more about FreeCAD you must go to %1 or press the Help item in the Help menu.") - .arg(QLatin1String("" - "http://www.freecadweb.org/wiki/")); -} - -void DlgTipOfTheDayImp::onResponseHeaderReceived(const QHttpResponseHeader & responseHeader) -{ - if (responseHeader.statusCode() != 200) { - QString msg = tr("Download failed: %1\n").arg(responseHeader.reasonPhrase()); - Base::Console().Log(msg.toLatin1()); - _http->abort(); - } -} - -void DlgTipOfTheDayImp::onDone(bool err) -{ - if (err) - return; - - // get the page and search for the tips section - QString text = QString::fromLatin1(_http->readAll()); - QRegExp rx(QLatin1String("

You find the latest information.+

")); - if (rx.indexIn(text) > -1) { - // the text of interest - text = rx.cap(); - rx.setPattern(QLatin1String("
  • .+
\n")); - rx.setMinimal(true); - _lTips += text.split(rx, QString::SkipEmptyParts); - } -} - -/** - * Prints some status information. - */ -void DlgTipOfTheDayImp::onStateChanged (int state) -{ - switch (state) { - case QHttp::Connecting: - Base::Console().Log("Connecting to host...\n"); - break; - case QHttp::Sending: - Base::Console().Log("Sending to host...\n"); - break; - case QHttp::Reading: - Base::Console().Log("Reading from host...\n"); - break; - case QHttp::Closing: - case QHttp::Unconnected: - Base::Console().Log("%s\n",(const char*)_http->errorString().toLatin1()); - break; - default: - break; - } -} - -#include "moc_DlgTipOfTheDayImp.cpp" diff --git a/src/Gui/DlgTipOfTheDayImp.h b/src/Gui/DlgTipOfTheDayImp.h deleted file mode 100644 index 70860fba0..000000000 --- a/src/Gui/DlgTipOfTheDayImp.h +++ /dev/null @@ -1,80 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2004 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library 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 Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef GUI_DIALOG_DLGTIPOFTHEDAY_IMP_H -#define GUI_DIALOG_DLGTIPOFTHEDAY_IMP_H - -#include "ui_DlgTipOfTheDay.h" -#include "Window.h" - -class QHttpResponseHeader; -class QHttp; - -namespace Gui { -namespace Dialog { - -/** Implementation of the well-known Tip-of-the-day dialog. - * - * All the tips are read from the Tip-of-the-day site located in the documentation - * directory of this installation. - * - * To download the latest online documentation you just have to press - * "Download online help" in the help menu. If you cannot compile these sources it is - * also possible to use the program \a wget specifying the options -r, -k, -E and the - * URL of the homepage of FreeCAD. - * - * For more details have a look at the FreeCAD homepage (http://www.freecadweb.org/wiki/). - * - * You can simply append a new tip by clicking the "EditText" hyperlink - * and writing a text, e.g: "** this is a new tip" - * - * \author Werner Mayer - */ -class DlgTipOfTheDayImp : public QDialog, public Ui_DlgTipOfTheDay, public WindowParameter -{ - Q_OBJECT - -public: - DlgTipOfTheDayImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); - ~DlgTipOfTheDayImp(); - - void reload(); - -public Q_SLOTS: - void on_buttonNextTip_clicked(); - -protected Q_SLOTS: - void onDone(bool); - void onStateChanged (int state); - void onResponseHeaderReceived(const QHttpResponseHeader &); - -private: - QStringList _lTips; - int _iCurrentTip; - QHttp* _http; -}; - -} // namespace Dialog -} // namespace Gui - -#endif // GUI_DIALOG_DLGTIPOFTHEDAY_IMP_H diff --git a/src/Gui/DownloadDialog.cpp b/src/Gui/DownloadDialog.cpp deleted file mode 100644 index 3f669366a..000000000 --- a/src/Gui/DownloadDialog.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library 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 Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -# include -#endif - -#include -#include "DownloadDialog.h" -#include "ui_DlgAuthorization.h" - -using namespace Gui::Dialog; - - -DownloadDialog::DownloadDialog(const QUrl& url, QWidget *parent) - : QDialog(parent), url(url), file(0), httpGetId(0), httpRequestAborted(false) -{ - statusLabel = new QLabel(url.toString()); - progressBar = new QProgressBar(this); - downloadButton = new QPushButton(tr("Download")); - downloadButton->setDefault(true); - cancelButton = new QPushButton(tr("Cancel")); - closeButton = new QPushButton(tr("Close")); - closeButton->setAutoDefault(false); - - - buttonBox = new QDialogButtonBox; - buttonBox->addButton(downloadButton, QDialogButtonBox::ActionRole); - buttonBox->addButton(closeButton, QDialogButtonBox::RejectRole); - buttonBox->addButton(cancelButton, QDialogButtonBox::RejectRole); - cancelButton->hide(); - - http = new QHttp(this); - - connect(http, SIGNAL(requestFinished(int, bool)), - this, SLOT(httpRequestFinished(int, bool))); - connect(http, SIGNAL(dataReadProgress(int, int)), - this, SLOT(updateDataReadProgress(int, int))); - connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), - this, SLOT(readResponseHeader(const QHttpResponseHeader &))); - connect(http, SIGNAL(authenticationRequired(const QString &, quint16, QAuthenticator *)), - this, SLOT(slotAuthenticationRequired(const QString &, quint16, QAuthenticator *))); - connect(downloadButton, SIGNAL(clicked()), this, SLOT(downloadFile())); - connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelDownload())); - connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); - - QHBoxLayout *topLayout = new QHBoxLayout; - topLayout->addWidget(statusLabel); - - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addLayout(topLayout); - mainLayout->addWidget(progressBar); - mainLayout->addWidget(buttonBox); - setLayout(mainLayout); - - setWindowTitle(tr("Download")); -} - -DownloadDialog::~DownloadDialog() -{ -} - -void DownloadDialog::downloadFile() -{ - QFileInfo fileInfo(url.path()); - QString fileName = fileInfo.fileName(); - if (QFile::exists(fileName)) { - if (QMessageBox::question(this, tr("Download"), - tr("There already exists a file called %1 in " - "the current directory. Overwrite?").arg(fileName), - QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::No) - return; - QFile::remove(fileName); - } - - file = new QFile(fileName); - if (!file->open(QIODevice::WriteOnly)) { - QMessageBox::information(this, tr("Download"), - tr("Unable to save the file %1: %2.") - .arg(fileName).arg(file->errorString())); - delete file; - file = 0; - return; - } - - QHttp::ConnectionMode mode = url.scheme().toLower() == QLatin1String("https") - ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp; - http->setHost(url.host(), mode, url.port() == -1 ? 80 : url.port()); - - if (!url.userName().isEmpty()) - http->setUser(url.userName(), url.password()); - - httpRequestAborted = false; - QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/"); - if (path.isEmpty()) - path = "/"; - httpGetId = http->get(QString::fromLatin1(path), file); - - statusLabel->setText(tr("Downloading %1.").arg(fileName)); - downloadButton->setEnabled(false); - cancelButton->show(); - closeButton->hide(); -} - -void DownloadDialog::cancelDownload() -{ - statusLabel->setText(tr("Download canceled.")); - httpRequestAborted = true; - http->abort(); - close(); -} - -void DownloadDialog::httpRequestFinished(int requestId, bool error) -{ - if (requestId != httpGetId) - return; - if (httpRequestAborted) { - if (file) { - file->close(); - file->remove(); - delete file; - file = 0; - } - - progressBar->hide(); - return; - } - - if (requestId != httpGetId) - return; - - progressBar->hide(); - file->close(); - - if (error) { - file->remove(); - QMessageBox::information(this, tr("Download"), - tr("Download failed: %1.") - .arg(http->errorString())); - } - else { - QString fileName = QFileInfo(url.path()).fileName(); - statusLabel->setText(tr("Downloaded %1 to current directory.").arg(fileName)); - } - - downloadButton->setEnabled(true); - cancelButton->hide(); - closeButton->show(); - delete file; - file = 0; -} - -void DownloadDialog::readResponseHeader(const QHttpResponseHeader &responseHeader) -{ - switch (responseHeader.statusCode()) { - case 200: // Ok - case 301: // Moved Permanently - case 302: // Found - case 303: // See Other - case 307: // Temporary Redirect - // these are not error conditions - break; - - default: - QMessageBox::information(this, tr("Download"), - tr("Download failed: %1.") - .arg(responseHeader.reasonPhrase())); - httpRequestAborted = true; - progressBar->hide(); - http->abort(); - } -} - -void DownloadDialog::updateDataReadProgress(int bytesRead, int totalBytes) -{ - if (httpRequestAborted) - return; - - progressBar->setMaximum(totalBytes); - progressBar->setValue(bytesRead); -} - -void DownloadDialog::slotAuthenticationRequired(const QString &hostName, quint16, QAuthenticator *authenticator) -{ - QDialog dlg; - Ui_DlgAuthorization ui; - ui.setupUi(&dlg); - dlg.adjustSize(); - ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(hostName)); - - if (dlg.exec() == QDialog::Accepted) { - authenticator->setUser(ui.username->text()); - authenticator->setPassword(ui.password->text()); - } -} - - -#include "moc_DownloadDialog.cpp" diff --git a/src/Gui/DownloadDialog.h b/src/Gui/DownloadDialog.h deleted file mode 100644 index 45e6b682f..000000000 --- a/src/Gui/DownloadDialog.h +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2011 Jürgen Riegel * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library 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 Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - -#ifndef GUI_DOWNLOADDIALOG_H -#define GUI_DOWNLOADDIALOG_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class QFile; -class QHttpResponseHeader; -class QAuthenticator; - -namespace Gui { -namespace Dialog { - - /** Download a resource (file) from the web to a location on the disk - * - */ - -class GuiExport DownloadDialog : public QDialog -{ - Q_OBJECT - -public: - DownloadDialog(const QUrl& url, QWidget *parent = 0); - ~DownloadDialog(); - -private Q_SLOTS: - void downloadFile(); - void cancelDownload(); - void httpRequestFinished(int requestId, bool error); - void readResponseHeader(const QHttpResponseHeader &responseHeader); - void updateDataReadProgress(int bytesRead, int totalBytes); - void slotAuthenticationRequired(const QString &, quint16, QAuthenticator *); - -private: - QLabel *statusLabel; - QProgressBar *progressBar; - QPushButton *downloadButton; - QPushButton *closeButton; - QPushButton *cancelButton; - QDialogButtonBox *buttonBox; - - QUrl url; - QHttp *http; - QFile *file; - int httpGetId; - bool httpRequestAborted; -}; - -} // namespace Dialog -} // namespace Gui - - -#endif // GUI_DOWNLOADDIALOG_H \ No newline at end of file diff --git a/src/Gui/HelpView.cpp b/src/Gui/HelpView.cpp deleted file mode 100644 index 0a86d3ad1..000000000 --- a/src/Gui/HelpView.cpp +++ /dev/null @@ -1,697 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2004 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library 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 Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" -#ifndef _PreComp_ -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -#include "HelpView.h" -#include "Application.h" -#include "BitmapFactory.h" -#include "FileDialog.h" -#include "WhatsThis.h" -#include "Action.h" -#include "Command.h" - - -using namespace Gui; -using namespace Gui::DockWnd; - -namespace Gui { -namespace DockWnd { - -struct TextBrowserResources -{ - QUrl url; - int type; -}; - -class TextBrowserPrivate -{ -public: - bool bw, fw; - int toolTipId; - QString toolTip; - QHttp* http; - QUrl source; - QList resources; - - TextBrowserPrivate() : bw(false), fw(false), toolTipId(0) - { - http = new QHttp; - } - - ~TextBrowserPrivate() - { - delete http; - } -}; - -} // namespace DockWnd -} // namespace Gui - -/* TRANSLATOR Gui::DockWnd::TextBrowser */ - -TextBrowser::TextBrowser(QWidget * parent) - : QTextBrowser(parent) -{ - d = new TextBrowserPrivate; - - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - setAcceptDrops( true ); - viewport()->setAcceptDrops( true ); - - connect( d->http, SIGNAL(done(bool)), this, SLOT(done(bool))); - connect( d->http, SIGNAL(stateChanged(int)), this, SLOT(onStateChanged(int))); - connect( d->http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), this, SLOT(onResponseHeaderReceived(const QHttpResponseHeader &))); - connect( this, SIGNAL(highlighted(const QString&)), this, SLOT(onHighlighted(const QString&))); - connect( this, SIGNAL(backwardAvailable(bool)), this, SLOT(setBackwardAvailable(bool))); - connect( this, SIGNAL(forwardAvailable (bool)), this, SLOT(setForwardAvailable (bool))); -} - -TextBrowser::~TextBrowser() -{ - delete d; -} - -QString TextBrowser::findUrl(const QUrl &name) const -{ - QString fileName = name.toLocalFile(); - QFileInfo fi(fileName); - if (fi.isAbsolute()) - return fileName; - - QString slash(QLatin1String("/")); - QStringList spaths = searchPaths(); - for (QStringList::ConstIterator it = spaths.begin(); it != spaths.end(); ++it) { - QString path = *it; - if (!path.endsWith(slash)) - path.append(slash); - path.append(fileName); - fi.setFile(path); - if (fi.isReadable()) - return path; - } - - QUrl src = source(); - if (src.isEmpty()) - return fileName; - - QFileInfo path(QFileInfo(src.toLocalFile()).absolutePath(), fileName); - return path.absoluteFilePath(); -} - -/** - * Checks whether the resource data must be downloaded via http or - * it is a file resource on the disk. - */ -QVariant TextBrowser::loadResource ( int type, const QUrl& url ) -{ - QString name = url.toString(); - if (url.scheme() == QLatin1String("http") || - d->source.scheme() == QLatin1String("http")) { - return loadHttpResource(type, url); - } else { // file scheme - return loadFileResource(type, url); - } -} - -/** - * Supports only rendering of local files and resources that can be downloaded over - * the http protocol. In the latter case the download gets started. - */ -void TextBrowser::setSource (const QUrl& url) -{ - bool relativeUrl = url.isRelative(); - if (!relativeUrl) - d->source = url; // last set absolute url - QString name = url.toString(); - if (url.scheme() == QLatin1String("http")) { - // start the download but do not call setSource() of the base - // class because we must wait until the data are available. - // The slot done() is invoked automatically then. - d->http->setHost(url.host()); - d->http->get(url.path(), 0); - } else if (d->source.scheme() == QLatin1String("http")) { - // relative hyperlink in previously downloaded a HTML page - d->source = d->source.resolved(url); - d->http->get(url.path(), 0); - } else { - QUrl resolved = url; -#if defined (Q_OS_WIN) - if (url.scheme() == QLatin1String("file") && !url.isRelative()) { - QString auth = url.authority(); - QString path = url.path(); - //If we click on a hyperlink with a reference to an absolute file name - //then we get a string that cannot be used to open the file. So we try - //to reproduce the original url. - if (!auth.isEmpty() && !path.isEmpty()) { - QString fileName = auth + QLatin1Char(':') + path; - resolved = QUrl::fromLocalFile(fileName); - } - } -#endif - QTextBrowser::setSource(resolved); - } -} - -/** - * The URL \a name must be a local file and its contents is returned to the caller. If the file doesn't exist - * an error message in HTML format or an empty image -- depending on \a type -- is returned to the caller. - */ -QVariant TextBrowser::loadFileResource(int type, const QUrl& name) -{ - QVariant data; - QUrl resolved = name; - if (!QFileInfo(name.toLocalFile()).isAbsolute() && QFileInfo(d->source.toLocalFile()).isAbsolute()) - resolved = d->source.resolved(name); - QString fileName = findUrl(resolved); - QFile file(fileName); - if (file.open(QFile::ReadOnly)) { - data = file.readAll(); - file.close(); - } else if (type == QTextDocument::HtmlResource) { - data = QString::fromLatin1( - "" - "" - "" - "" - "Error" - "" - "" - "

%1

" - "

%2

" - "
" - "").arg(tr("Could not open file.")).arg(tr("You tried to access the address %1 which is currently unavailable. " - "Please make sure that the URL exists and try reloading the page.").arg(name.toString())); - } else if (type == QTextDocument::ImageResource) { - static const char * empty_xpm[] = { - "24 24 1 1", - ". c #C0C0C0", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................"}; - QPixmap px(empty_xpm); - data.setValue(px); - } - - return data; -} - -/** - * Returns the downloaded resource to the caller. In case the resource contains - * references to further resources (e.g. referenced images in HTML text) we store - * the URLs in a list and start the download afterwards. - */ -QVariant TextBrowser::loadHttpResource(int type, const QUrl& name) -{ - QVariant data; - if (type == QTextDocument::ImageResource) { - TextBrowserResources res; - res.url = name; - res.type = type; - d->resources.push_back(res); - - static const char * empty_xpm[] = { - "24 24 1 1", - ". c #C0C0C0", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................", - "........................"}; - QPixmap px(empty_xpm); - data.setValue(px); - return data; - } - - if (d->http->error() == QHttp::NoError) { - return d->http->readAll(); - } else { - if (type == QTextDocument::HtmlResource) { - data = QString::fromLatin1( - "" - "" - "" - "" - "Error" - "" - "" - "

%1

" - "

%2

" - "
" - "").arg(d->http->errorString()).arg(tr("You tried to access the address %1 which is currently unavailable. " - "Please make sure that the URL exists and try reloading the page.").arg(name.toString())); - } - } - - return data; -} - -/** - * The download has finished. We add the resource to the document now. - */ -void TextBrowser::done( bool /*err*/ ) -{ - if (d->resources.isEmpty()/* && d->requestId == d->http->currentId()*/) { - // set the HTML text - QTextBrowser::setSource(d->source); - } else { - // add the referenced resource to the document - TextBrowserResources res = d->resources.front(); - - QVariant data(d->http->readAll()); - document()->addResource(res.type, res.url, data); - viewport()->repaint(); - d->resources.pop_front(); - } - - // if we need to download further resources start a http request - if (!d->resources.isEmpty()) { - TextBrowserResources res = d->resources.front(); - d->http->get(res.url.toString()); - } else { - stateChanged(d->source.toString()); - } -} - -/** - * Prints some status information. - */ -void TextBrowser::onStateChanged ( int state ) -{ - switch (state) { - case QHttp::Connecting: - stateChanged(tr("Connecting to %1").arg(d->source.host())); - break; - case QHttp::Sending: - stateChanged(tr("Sending to %1").arg(d->source.host())); - break; - case QHttp::Reading: - stateChanged(tr("Reading from %1").arg(d->source.host())); - break; - case QHttp::Closing: - case QHttp::Unconnected: - if (d->http->error() == QHttp::NoError) - stateChanged(d->source.toString()); - else - stateChanged(d->http->errorString()); - break; - default: - break; - } -} - -/** - * Checks for the status code and aborts the request if needed. - */ -void TextBrowser::onResponseHeaderReceived(const QHttpResponseHeader &responseHeader) -{ - if (responseHeader.statusCode() != 200) { - stateChanged(tr("Download failed: %1.").arg(responseHeader.reasonPhrase())); - d->http->abort(); - } -} - -void TextBrowser::onHighlighted(const QString& url) -{ - if (url.isEmpty() && d->toolTipId != 0) { - killTimer(d->toolTipId); - d->toolTipId = 0; - } else if (!url.isEmpty()) { - d->toolTip = url; - d->toolTipId = startTimer(1000); - } else { - QToolTip::showText(QCursor::pos(), url, this); - } -} - -void TextBrowser::backward() -{ - QTextBrowser::backward(); - reload(); -} - -void TextBrowser::forward() -{ - QTextBrowser::forward(); - reload(); -} - -void TextBrowser::setBackwardAvailable( bool b ) -{ - d->bw = b; -} - -void TextBrowser::setForwardAvailable( bool b ) -{ - d->fw = b; -} - -void TextBrowser::timerEvent ( QTimerEvent * e ) -{ - if (d->toolTipId == e->timerId()) { - QToolTip::showText(QCursor::pos(), d->toolTip, this); - killTimer(d->toolTipId); - d->toolTipId = 0; - } -} - -void TextBrowser::contextMenuEvent ( QContextMenuEvent * e ) -{ - QMenu* menu = new QMenu(this); - - QAction* prev = menu->addAction(Gui::BitmapFactory().pixmap("back_pixmap"), tr("Previous"), this, SLOT(backward())); - prev->setEnabled(d->bw); - - QAction* next = menu->addAction(Gui::BitmapFactory().pixmap("forward_pixmap"), tr("Forward"), this, SLOT(forward())); - next->setEnabled(d->fw); - - menu->addSeparator(); - menu->addAction(Gui::BitmapFactory().pixmap("home_pixmap"), tr("Home"), this, SLOT(home())); - menu->addAction(tr("Refresh"), this, SLOT(reload())); - menu->addSeparator(); - menu->addAction(tr("Copy"), this, SLOT(copy())); - menu->addAction(tr("Select all"), this, SLOT(selectAll())); - - menu->exec(e->globalPos()); - delete menu; -} - -void TextBrowser::dropEvent(QDropEvent * e) -{ - const QMimeData* mimeData = e->mimeData(); - if ( mimeData->hasFormat(QLatin1String("text/x-action-items")) ) { - QByteArray itemData = mimeData->data(QLatin1String("text/x-action-items")); - QDataStream dataStream(&itemData, QIODevice::ReadOnly); - - int ctActions; dataStream >> ctActions; - - // handle the first item only - QString action; - dataStream >> action; - - CommandManager& rclMan = Application::Instance->commandManager(); - Command* pCmd = rclMan.getCommandByName(action.toLatin1()); - if ( pCmd ) { - QString info = pCmd->getAction()->whatsThis(); - if ( !info.isEmpty() ) { - // cannot show help to this command - info = QString::fromLatin1( - "" - "" - "" - "%1" - "" - "" ).arg( info ); - } else { - info = QString::fromLatin1( - "" - "" - "" - "

" - " %1 '%2'" - "

" - "
" - "" - "" ).arg(tr("No description for")).arg(action); - } - - setHtml( info ); - } - - e->setDropAction(Qt::CopyAction); - e->accept(); - } else if ( mimeData->hasUrls() ) { - QList uri = mimeData->urls(); - QUrl url = uri.front(); - setSource(url); - - e->setDropAction(Qt::CopyAction); - e->accept(); - } else { - e->ignore(); - } -} - -void TextBrowser::dragEnterEvent (QDragEnterEvent * e) -{ - const QMimeData* mimeData = e->mimeData(); - if ( mimeData->hasFormat(QLatin1String("text/x-action-items")) ) - e->accept(); - else if (mimeData->hasUrls()) - e->accept(); - else - e->ignore(); -} - -void TextBrowser::dragMoveEvent( QDragMoveEvent *e ) -{ - const QMimeData* mimeData = e->mimeData(); - if ( mimeData->hasFormat(QLatin1String("text/x-action-items")) ) - e->accept(); - else if (mimeData->hasUrls()) - e->accept(); - else - e->ignore(); -} - - -// -------------------------------------------------------------------- - -/* TRANSLATOR Gui::DockWnd::HelpView */ - -/** - * Constructs a HelpView which is a child of 'parent', with the - * name 'name' and widget flags set to 'f'. \a home is the start page to show. - */ -HelpView::HelpView( const QString& start, QWidget* parent ) - : QWidget(parent) -{ - TextBrowser* browser = new TextBrowser(this); - browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - // set the start page now - if (!start.isEmpty()) - browser->setSource(QUrl::fromLocalFile(start)); - - QHBoxLayout* layout = new QHBoxLayout(); - layout->setAlignment(Qt::AlignTop); - layout->setSpacing(1); - layout->setMargin (1); - - // create the group box for the layout - QGroupBox* groupBox = new QGroupBox(this); - - // the 'Backward' button - QToolButton* back = new QToolButton( groupBox ); - back->setIcon( Gui::BitmapFactory().pixmap("back_pixmap") ); - back->setAutoRaise(true); - back->setToolTip(tr("Previous")); - - // the 'Forward' button - QToolButton* forward = new QToolButton( groupBox ); - forward->setIcon( Gui::BitmapFactory().pixmap("forward_pixmap") ); - forward->setAutoRaise(true); - forward->setToolTip(tr("Next")); - - // the 'Home' button - QToolButton* home = new QToolButton( groupBox ); - home->setIcon( Gui::BitmapFactory().pixmap("home_pixmap") ); - home->setAutoRaise(true); - home->setToolTip(tr("Home")); - - // the 'Open' button - QToolButton* open = new QToolButton( groupBox ); - open->setIcon( Gui::BitmapFactory().pixmap("helpopen") ); - open->setAutoRaise(true); - open->setToolTip(tr("Open")); - - QGridLayout* formLayout = new QGridLayout( this ); - formLayout->setSpacing( 1 ); - formLayout->setMargin ( 1 ); - - // add the buttons and the space - layout->addWidget( back ); - layout->addWidget( forward ); - layout->addWidget( home ); - layout->addWidget( open ); - QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - layout->addItem( spacer ); - groupBox->setLayout(layout); - - label = new QLabel(this); - label->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); - label->setText(start); - - // add the button group with its elements and the browser to the layout - formLayout->addWidget( groupBox, 0, 0 ); - formLayout->addWidget( browser, 1, 0 ); - formLayout->addWidget( label, 2, 0 ); - - connect( this, SIGNAL(setSource( const QUrl& )), browser, SLOT(setSource( const QUrl& ))); - connect( browser, SIGNAL(stateChanged(const QString&)), this, SLOT(onStateChanged(const QString&))); - connect( browser, SIGNAL(backwardAvailable(bool)), back, SLOT(setEnabled(bool))); - connect( browser, SIGNAL(forwardAvailable (bool)), forward, SLOT(setEnabled(bool))); - connect( browser, SIGNAL(startExternalBrowser(const QString&)), - this, SLOT (startExternalBrowser(const QString&))); - connect( back, SIGNAL(clicked()), browser, SLOT(backward())); - connect( browser, SIGNAL(backwardAvailable(bool) ), back, SLOT(setEnabled(bool) ) ); - connect( forward, SIGNAL(clicked()), browser, SLOT(forward())); - connect( browser, SIGNAL(forwardAvailable(bool) ), forward, SLOT(setEnabled(bool) ) ); - connect( home, SIGNAL(clicked()), browser, SLOT(home())); - connect( open, SIGNAL(clicked()), this, SLOT(openHelpFile())); - forward->setEnabled( false ); - back->setEnabled( false ); - qApp->installEventFilter(this); -} - -/** - * Destroys the object and frees any allocated resources - */ -HelpView::~HelpView() -{ - // no need to delete child widgets, Qt does it all for us - qApp->removeEventFilter(this); -} - -/** - * Sets the file source \a src to the help view's text browser. - */ -void HelpView::setFileSource( const QString& src ) -{ - setSource( src ); -} - -/** - * Opens a file dialog to specify a help page to open. - */ -void HelpView::openHelpFile() -{ - QString fn = QFileDialog::getOpenFileName(this, tr("Open file"), QString(), tr("All HTML files (*.html *.htm)")); - if ( !fn.isEmpty() ) - setSource( QUrl::fromLocalFile(fn) ); -} - -/** - * Looks up into preferences to start an external browser to render sites which this class cannot do - * right now. If now browser has been specified so far or the start fails an error message appears. - */ -void HelpView::startExternalBrowser( const QString& url ) -{ - ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/OnlineHelp"); - QString browser = QString::fromUtf8(hGrp->GetASCII( "ExternalBrowser", "" ).c_str()); - - if (browser.isEmpty()) - { - QMessageBox::critical( this, tr("External browser"), tr("No external browser found. Specify in preferences, please") ); - return; - } - - // create the command to execute - QStringList arguments; - arguments << url; - - if (!QProcess::startDetached(browser, arguments)) - { - QMessageBox::critical( this, tr("External browser"), tr("Starting of %1 failed").arg( browser ) ); - } -} - -void HelpView::onStateChanged(const QString& state) -{ - label->setText(state); -} - -bool HelpView::eventFilter ( QObject* o, QEvent* e ) -{ - // Handles What's This click events - if (e->type() == QEvent::WhatsThisClicked) { - QString url = static_cast(e)->href(); - setSource(QUrl::fromLocalFile(url)); - QWhatsThis::hideText(); - return true; - } - - return QWidget::eventFilter( o, e ); -} - -#include "moc_HelpView.cpp" - diff --git a/src/Gui/HelpView.h b/src/Gui/HelpView.h deleted file mode 100644 index 687ba57d5..000000000 --- a/src/Gui/HelpView.h +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2004 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library 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 Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef GUI_DOCKWND_HELP_VIEW_H -#define GUI_DOCKWND_HELP_VIEW_H - -#include -#include "DockWindow.h" -#include "Window.h" - -class QUrl; -class QLabel; -class QHttpResponseHeader; - -namespace Gui { -namespace DockWnd { - -/** - * The TextBrowser class is an extension of Qt's QTextBrowser providing - * a context menu and the possibility to render files via drag and drop. - * @author Werner Mayer - */ -class TextBrowserPrivate; -class TextBrowser : public QTextBrowser -{ - Q_OBJECT - -public: - TextBrowser(QWidget * parent=0); - virtual ~TextBrowser(); - - void setSource (const QUrl& url); - QVariant loadResource (int type, const QUrl& name); - - void backward(); - void forward(); - -Q_SIGNALS: - /// start an external browser to display complex web sites - void startExternalBrowser( const QString& ); - void stateChanged(const QString&); - -protected: - void dropEvent (QDropEvent * e); - void dragEnterEvent (QDragEnterEvent * e); - void dragMoveEvent (QDragMoveEvent * e ); - void contextMenuEvent(QContextMenuEvent * ); - void timerEvent (QTimerEvent * e ); - -private Q_SLOTS: - void setBackwardAvailable( bool b); - void setForwardAvailable( bool b); - void done( bool ); - void onStateChanged ( int state ); - void onResponseHeaderReceived(const QHttpResponseHeader &); - void onHighlighted(const QString&); - -private: - QString findUrl(const QUrl &name) const; - QVariant loadFileResource(int type, const QUrl& name); - QVariant loadHttpResource(int type, const QUrl& name); - -private: - TextBrowserPrivate* d; -}; - -/** - * The help viewer class embeds a textbrowser to render help files. - * @author Wenrer Mayer - */ -class HelpViewViewPrivate; -class GuiExport HelpView : public QWidget -{ - Q_OBJECT - -public: - HelpView( const QString& home_, QWidget* parent = 0 ); - ~HelpView(); - - void setFileSource( const QString& ); - /** - * Filters events if this object has been installed as an event filter for the watched object. - */ - bool eventFilter ( QObject* o, QEvent* e ); - -Q_SIGNALS: - void setSource( const QUrl& ); - -private Q_SLOTS: - void openHelpFile(); - void startExternalBrowser( const QString& ); - void onStateChanged(const QString& state); - -private: - QLabel* label; -}; - -} // namespace DockWnd -} // namespace Gui - -#endif // GUI_DOCKWND_HELP_VIEW_H diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 8917d00a2..123f4b51c 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -67,7 +67,6 @@ #include "MainWindow.h" #include "Application.h" #include "Assistant.h" -#include "DownloadDialog.h" #include "DownloadManager.h" #include "WaitCursor.h" @@ -94,14 +93,12 @@ #include "SelectionView.h" #include "MenuManager.h" //#include "ToolBox.h" -#include "HelpView.h" #include "ReportView.h" #include "CombiView.h" #include "PythonConsole.h" #include "TaskView/TaskView.h" #include "DAGView/DAGView.h" -#include "DlgTipOfTheDayImp.h" #include "DlgUndoRedo.h" #include "DlgOnlineHelpImp.h" @@ -1280,24 +1277,6 @@ QPixmap MainWindow::splashImage() const return splash_image; } -void MainWindow::showTipOfTheDay(bool force) -{ - // tip of the day? - ParameterGrp::handle - hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")-> - GetGroup("Preferences")->GetGroup("General"); - - const std::map& config = App::Application::Config(); - std::map::const_iterator tp = config.find("HideTipOfTheDay"); - bool tip = (tp == config.end()); - - tip = hGrp->GetBool("Tipoftheday", tip); - if (tip || force) { - Gui::Dialog::DlgTipOfTheDayImp dlg(instance); - dlg.exec(); - } -} - /** * Drops the event \a e and tries to open the files. */ diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h index 0409a78e1..bd1c1a151 100644 --- a/src/Gui/MainWindow.h +++ b/src/Gui/MainWindow.h @@ -120,8 +120,6 @@ public: void stopSplasher(void); /* The image of the splash screen of the application. */ QPixmap splashImage() const; - /** Shows the Tip-of-the-day dialog after startup. */ - void showTipOfTheDay(bool force=false); /** Shows the online documentation. */ void showDocumentation(const QString& help); //@} diff --git a/src/Mod/Web/Gui/BrowserView.cpp b/src/Mod/Web/Gui/BrowserView.cpp index abad0ba85..52737ed53 100644 --- a/src/Mod/Web/Gui/BrowserView.cpp +++ b/src/Mod/Web/Gui/BrowserView.cpp @@ -50,6 +50,7 @@ # include # include # include +# include #endif #include "BrowserView.h" @@ -57,7 +58,6 @@ #include #include #include -#include #include #include #include