remove QT3_SUPPORT macro dependency by Peter Kummel (syntheticpp@gmx.net)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13999 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-06-04 20:49:09 +00:00
parent 8cb28fed33
commit f9f72cfa0c
3 changed files with 33 additions and 13 deletions

View File

@ -12,6 +12,8 @@
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
#undef QT3_SUPPORT
#include <config.h> #include <config.h>
#include "buffer.h" #include "buffer.h"
@ -47,6 +49,7 @@ LyXTextClass const & getTextClass(LyXView const & lv)
return lv.buffer()->params().getLyXTextClass(); return lv.buffer()->params().getLyXTextClass();
} }
/*
/// \todo Remove Qt::Dock getPosition(ToolbarBackend::Flags const & flags) if not needed anymore /// \todo Remove Qt::Dock getPosition(ToolbarBackend::Flags const & flags) if not needed anymore
Qt::Dock getPosition(ToolbarBackend::Flags const & flags) Qt::Dock getPosition(ToolbarBackend::Flags const & flags)
{ {
@ -60,6 +63,7 @@ Qt::Dock getPosition(ToolbarBackend::Flags const & flags)
return Qt::DockRight; return Qt::DockRight;
return Qt::DockTop; return Qt::DockTop;
} }
*/
Qt::ToolBarArea getToolBarPosition(ToolbarBackend::Flags const & flags) Qt::ToolBarArea getToolBarPosition(ToolbarBackend::Flags const & flags)
{ {
@ -101,7 +105,7 @@ void QLayoutBox::set(string const & layout)
int i = 0; int i = 0;
for (; i < combo_->count(); ++i) { for (; i < combo_->count(); ++i) {
if (name == combo_->text(i)) if (name == combo_->itemText(i))
break; break;
} }
@ -111,7 +115,7 @@ void QLayoutBox::set(string const & layout)
return; return;
} }
combo_->setCurrentItem(i); combo_->setCurrentIndex(i);
} }
@ -128,7 +132,7 @@ void QLayoutBox::update()
for (; it != end; ++it) { for (; it != end; ++it) {
// ignore obsolete entries // ignore obsolete entries
if ((*it)->obsoleted_by().empty()) if ((*it)->obsoleted_by().empty())
combo_->insertItem(qt_((*it)->name())); combo_->addItem(qt_((*it)->name()));
} }
// needed to recalculate size hint // needed to recalculate size hint
@ -149,7 +153,7 @@ void QLayoutBox::clear()
void QLayoutBox::open() void QLayoutBox::open()
{ {
combo_->popup(); combo_->showPopup();
} }

View File

@ -10,6 +10,8 @@
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
#undef QT3_SUPPORT
#include <config.h> #include <config.h>
#include "BufferView.h" #include "BufferView.h"
@ -43,8 +45,8 @@
#include <QToolBar> #include <QToolBar>
#include <QCloseEvent> #include <QCloseEvent>
#include <QAction> #include <QAction>
#include <QMenu> //#include <QMenu>
#include <QMenuBar> //#include <QMenuBar>
#include "support/lstrings.h" #include "support/lstrings.h"
@ -73,7 +75,7 @@ QtView::QtView(unsigned int width, unsigned int height)
{ {
resize(width, height); resize(width, height);
qApp->setMainWidget(this); mainWidget_ = this;
// setToolButtonStyle(Qt::ToolButtonIconOnly); // setToolButtonStyle(Qt::ToolButtonIconOnly);
// setIconSize(QSize(12,12)); // setIconSize(QSize(12,12));
@ -95,7 +97,7 @@ QtView::QtView(unsigned int width, unsigned int height)
// since the icon is provided in the application bundle. // since the icon is provided in the application bundle.
string const iconname = libFileSearch("images", "lyx", "xpm"); string const iconname = libFileSearch("images", "lyx", "xpm");
if (!iconname.empty()) if (!iconname.empty())
setIcon(QPixmap(toqstr(iconname))); setWindowIcon(QPixmap(toqstr(iconname)));
#endif #endif
// make sure the buttons are disabled if needed // make sure the buttons are disabled if needed
@ -129,7 +131,7 @@ void QtView::addCommandBuffer(QToolBar * toolbar)
void QtView::message(string const & str) void QtView::message(string const & str)
{ {
statusBar()->message(toqstr(str)); statusBar()->showMessage(toqstr(str));
statusbar_timer_.stop(); statusbar_timer_.stop();
statusbar_timer_.start(statusbar_timer_value); statusbar_timer_.start(statusbar_timer_value);
} }
@ -150,7 +152,7 @@ void QtView::focus_command_widget()
void QtView::update_view_state_qt() void QtView::update_view_state_qt()
{ {
statusBar()->message(toqstr(getLyXFunc().viewStatusMessage())); statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage()));
statusbar_timer_.stop(); statusbar_timer_.stop();
} }
@ -161,7 +163,7 @@ void QtView::update_view_state()
if (statusbar_timer_.isActive()) if (statusbar_timer_.isActive())
return; return;
statusBar()->message(toqstr(getLyXFunc().viewStatusMessage())); statusBar()->showMessage(toqstr(getLyXFunc().viewStatusMessage()));
} }
@ -194,7 +196,7 @@ void QtView::closeEvent(QCloseEvent *)
void QtView::show() void QtView::show()
{ {
setCaption(qt_("LyX")); QMainWindow::setWindowTitle(qt_("LyX"));
QMainWindow::show(); QMainWindow::show();
} }
@ -202,11 +204,19 @@ void QtView::show()
void QtView::busy(bool yes) const void QtView::busy(bool yes) const
{ {
if (yes) if (yes)
QApplication::setOverrideCursor(Qt::waitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
else else
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }
QMainWindow* QtView::mainWidget()
{
return mainWidget_;
}
QMainWindow* QtView::mainWidget_ = 0;
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx

View File

@ -36,6 +36,7 @@ namespace frontend {
class QCommandBuffer; class QCommandBuffer;
QWidget* mainWindow();
/** /**
* QtView - Qt implementation of LyXView * QtView - Qt implementation of LyXView
@ -71,6 +72,8 @@ public:
// returns true if this view has the focus. // returns true if this view has the focus.
virtual bool hasFocus() const; virtual bool hasFocus() const;
static QMainWindow* mainWidget();
public slots: public slots:
/// idle timeout /// idle timeout
void update_view_state_qt(); void update_view_state_qt();
@ -99,6 +102,9 @@ private:
/// command buffer /// command buffer
QCommandBuffer * commandbuffer_; QCommandBuffer * commandbuffer_;
///
static QMainWindow* mainWidget_;
}; };
} // namespace frontend } // namespace frontend