From: <mrj...@us...> - 2007-12-06 18:05:40
|
Revision: 2302 http://tora.svn.sourceforge.net/tora/?rev=2302&view=rev Author: mrjohnson0 Date: 2007-12-06 10:05:39 -0800 (Thu, 06 Dec 2007) Log Message: ----------- update toolbar Modified Paths: -------------- branches/tora-1.4/tora/src/tomemoeditor.cpp Modified: branches/tora-1.4/tora/src/tomemoeditor.cpp =================================================================== --- branches/tora-1.4/tora/src/tomemoeditor.cpp 2007-12-06 18:05:20 UTC (rev 2301) +++ branches/tora-1.4/tora/src/tomemoeditor.cpp 2007-12-06 18:05:39 UTC (rev 2302) @@ -141,76 +141,93 @@ Editor->setReadOnly(Row < 0 || Col < 0 || listView()); Editor->setFocus(); - QToolButton *btn; - if (Row >= 0 && Col >= 0 && !listView()) - { - new QToolButton(QPixmap(const_cast<const char**>(commit_xpm)), - tr("Save changes"), - tr("Save changes"), - this, SLOT(store(void)), - Toolbar); + if (Row >= 0 && Col >= 0 && !listView()) { + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(commit_xpm))), + tr("Save changes"), + this, + SLOT(store(void))); + Toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(fileopen_xpm)), - tr("Open file"), - tr("Open file"), - this, SLOT(openFile()), Toolbar); - new QToolButton(QPixmap(const_cast<const char**>(filesave_xpm)), - tr("Save file"), - tr("Save file"), - this, SLOT(saveFile()), Toolbar); + + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(fileopen_xpm))), + tr("Open file"), + this, + SLOT(openFile())); + + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(filesave_xpm))), + tr("Save file"), + this, + SLOT(saveFile())); + Toolbar->addSeparator(); - btn = new QToolButton(QPixmap(const_cast<const char**>(cut_xpm)), - tr("Cut to clipboard"), - tr("Cut to clipboard"), - Editor, SLOT(cut()), Toolbar); - connect(Editor, SIGNAL(copyAvailable(bool)), - btn, SLOT(setEnabled(bool))); - btn->setEnabled(false); + + QAction *act = + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(cut_xpm))), + tr("Cut to clipboard"), + Editor, + SLOT(cut())); + + connect(Editor, + SIGNAL(copyAvailable(bool)), + act, + SLOT(setEnabled(bool))); + act->setEnabled(false); } - else - { - new QToolButton(QPixmap(const_cast<const char**>(filesave_xpm)), - tr("Save file"), - tr("Save file"), - this, SLOT(saveFile()), Toolbar); + else { + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(filesave_xpm))), + tr("Save changes"), + this, + SLOT(saveFile(void))); Toolbar->addSeparator(); } - btn = new QToolButton(QPixmap(const_cast<const char**>(copy_xpm)), - tr("Copy to clipboard"), - tr("Copy to clipboard"), - Editor, SLOT(copy()), Toolbar); - connect(Editor, SIGNAL(copyAvailable(bool)), - btn, SLOT(setEnabled(bool))); - btn->setEnabled(false); - if (Row >= 0 && Col >= 0 && !listView()) - new QToolButton(QPixmap(const_cast<const char**>(paste_xpm)), - tr("Paste from clipboard"), - tr("Paste from clipboard"), - Editor, SLOT(paste()), Toolbar); + QAction *act = + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(copy_xpm))), + tr("Copy to clipboard"), + Editor, + SLOT(copy())); + connect(Editor, + SIGNAL(copyAvailable(bool)), + act, + SLOT(setEnabled(bool))); + act->setEnabled(false); + + if (Row >= 0 && Col >= 0 && !listView()) { + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(paste_xpm))), + tr("Paste from clipboard"), + Editor, + SLOT(paste())); + } + toListView *lst = listView(); - if (lst || navigation) - { + if (lst || navigation) { Toolbar->addSeparator(); - new QToolButton(QPixmap(const_cast<const char**>(rewind_xpm)), - tr("First column"), - tr("First column"), - this, SLOT(firstColumn()), Toolbar); - new QToolButton(QPixmap(const_cast<const char**>(previous_xpm)), - tr("Previous column"), - tr("Previous column"), - this, SLOT(previousColumn()), Toolbar); - new QToolButton(QPixmap(const_cast<const char**>(next_xpm)), - tr("Next column"), - tr("Next column"), - this, SLOT(nextColumn()), Toolbar); - new QToolButton(QPixmap(const_cast<const char**>(forward_xpm)), - tr("Last column"), - tr("Last column"), - this, SLOT(lastColumn()), Toolbar); + + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(rewind_xpm))), + tr("First column"), + this, + SLOT(firstColumn())); + + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(previous_xpm))), + tr("Previous column"), + this, + SLOT(previousColumn())); + + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(next_xpm))), + tr("Next column"), + this, + SLOT(nextColumn())); + + Toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(forward_xpm))), + tr("Last column"), + this, + SLOT(lastColumn())); } + Toolbar->addSeparator(); + Null = new QCheckBox(tr("NULL"), Toolbar, TO_TOOLBAR_WIDGET_NAME); + Toolbar->addWidget(Null); connect(Null, SIGNAL(toggled(bool)), this, SLOT(null(bool))); Null->setEnabled(!Editor->isReadOnly()); Null->setFocusPolicy(Qt::StrongFocus); @@ -219,16 +236,19 @@ Label = new QLabel(Toolbar, TO_TOOLBAR_WIDGET_NAME); Label->setAlignment(Qt::AlignRight | Qt::AlignVCenter); -// Toolbar->setStretchableWidget(Label); + Label->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, + QSizePolicy::Minimum)); - if (lst) - { - connect(parent, SIGNAL(currentChanged(Q3ListViewItem *)), - this, SLOT(changeCurrent(Q3ListViewItem *))); + if (lst) { + connect(parent, + SIGNAL(currentChanged(Q3ListViewItem *)), + this, + SLOT(changeCurrent(Q3ListViewItem *))); Label->setText(QString::fromLatin1("<B>") + lst->header()->label(Col) + QString::fromLatin1("</B>")); } + Toolbar->addWidget(Label); if (!modal) show(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |