#include <qmap.h>
#include <qstatusbar.h>
#include <qthread.h>
+#include <qinputdialog.h>
#define OBJECT_BROWSER_WIDTH 300
#define OBJECT_COLUMN_WIDTH 150
createMenu( a, newWinMenu, -1 );
}
- STD_TabDesktop* tab_desk = dynamic_cast<STD_TabDesktop*>( desk );
- if( tab_desk )
- {
- QAction* a = createAction( RenameId, tr( "TOT_RENAME" ), QIconSet(), tr( "MEN_RENAME" ), tr( "PRP_RENAME" ),
- 0, desk, false, tab_desk->workstack(), SLOT( onRenameActive() ) );
- createMenu( a, windowMenu, -1 );
- }
+ createAction( RenameId, tr( "TOT_RENAME" ), QIconSet(), tr( "MEN_RENAME" ), tr( "PRP_RENAME" ),
+ 0, desk, false, this, SLOT( onRenameWindow() ) );
+ createMenu( RenameId, windowMenu, -1 );
connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) );
STD_Application::removeViewManager( vm );
delete vm;
}
+
+/*! rename active window of desktop */
+void LightApp_Application::onRenameWindow()
+{
+ if( !desktop() )
+ return;
+
+ QWidget* w = desktop()->activeWindow();
+ if( !w )
+ return;
+
+ bool ok;
+ QString name = QInputDialog::getText( tr( "TOT_RENAME" ), tr( "PRP_RENAME" ), QLineEdit::Normal, w->caption(), &ok, w );
+ if( ok && !name.isEmpty() )
+ w->setCaption( name );
+}
public:
typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
- enum { NewGLViewId = STD_Application::UserID, NewPlot2dId, NewOCCViewId, NewVTKViewId,
+ enum { NewGLViewId = CAM_Application::UserID, NewPlot2dId, NewOCCViewId, NewVTKViewId,
PreferencesId, MRUId, RenameId, UserID };
public:
LightApp_Application();
void onPreferences();
void onMRUActivated( QString );
void onPreferenceChanged( QString&, QString&, QString& );
+ void onRenameWindow();
protected:
void updateWindows();
QtxWorkstack.h \
QtxResourceEdit.h \
QtxListView.h \
- QtxDirListEditor.h \
- QtxNameDlg.h
+ QtxDirListEditor.h
# .po files to transform in .qm
QtxResourceEdit.cxx \
QtxWorkstack.cxx \
QtxListView.cxx \
- QtxDirListEditor.cxx \
- QtxNameDlg.cxx
+ QtxDirListEditor.cxx
LIB_MOC = \
QtxAction.h \
QtxWorkstack.h \
QtxListView.h \
QtxListResourceEdit.h \
- QtxDirListEditor.h \
- QtxNameDlg.h
+ QtxDirListEditor.h
RESOURCES_FILES = \
+++ /dev/null
-// File : QtxNameDlg.cxx\r
-// Author : Vadim SANDLER\r
-// $Header$\r
-\r
-#include "QtxNameDlg.h"\r
-\r
-#include <qlayout.h>\r
-#include <qgroupbox.h>\r
-#include <qlabel.h>\r
-#include <qlineedit.h>\r
-#include <qpushbutton.h>\r
-\r
-#ifndef WIN32\r
-using namespace std;\r
-#endif\r
-\r
-/*!\r
- Constructor\r
-*/\r
-QtxNameDlg::QtxNameDlg( QWidget* parent )\r
-: QtxDialog( parent ? parent : NULL,//application()->desktop(), \r
- "QtxNameDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )\r
-{\r
- setCaption( tr("TLT_RENAME") );\r
- setSizeGripEnabled( TRUE );\r
-\r
- clearButtonFlags( Help );\r
- setButtonFlags( OKCancel );\r
-\r
- QHBoxLayout* topLayout = new QHBoxLayout( mainFrame(), 0, 5 );\r
-\r
- /***************************************************************/\r
- QLabel* TextLabel = new QLabel( mainFrame(), "TextLabel1" );\r
- TextLabel->setText( tr( "NAME_LBL" ) );\r
- topLayout->addWidget( TextLabel );\r
- \r
- myLineEdit = new QLineEdit( mainFrame(), "LineEdit1" );\r
- myLineEdit->setMinimumSize( 250, 0 );\r
- topLayout->addWidget( myLineEdit );\r
- \r
- /* Move widget on the botton right corner of main widget */\r
- setAlignment( Qt::AlignCenter );\r
-\r
- QPushButton* btn = dynamic_cast<QPushButton*>( button( OK ) );\r
- if( btn )\r
- btn->setAutoDefault( true );\r
-\r
- setFocusProxy( myLineEdit );\r
-}\r
-\r
-/*!\r
- Destructor\r
-*/\r
-QtxNameDlg::~QtxNameDlg()\r
-{\r
-}\r
-\r
-/*!\r
- Sets name\r
-*/\r
-void QtxNameDlg::setName( const QString& name )\r
-{\r
- myLineEdit->setText( name );\r
- myLineEdit->end(false);\r
- myLineEdit->home(true);\r
-}\r
-\r
-/*!\r
- Returns name entered by user\r
-*/\r
-QString QtxNameDlg::name()\r
-{\r
- return myLineEdit->text();\r
-}\r
-\r
-void QtxNameDlg::accept()\r
-{\r
- if ( name().stripWhiteSpace().isEmpty() )\r
- return;\r
- QDialog::accept();\r
-}\r
-\r
-/*!\r
- Creates modal <Rename> dialog and returns name entered [ static ]\r
-*/\r
-QString QtxNameDlg::getName( QWidget* parent, const QString& oldName )\r
-{\r
- QString n;\r
- QtxNameDlg* dlg = new QtxNameDlg( parent );\r
- if ( !oldName.isNull() )\r
- dlg->setName( oldName );\r
- if ( dlg->exec() == QDialog::Accepted ) \r
- n = dlg->name();\r
- delete dlg;\r
- return n;\r
-}\r
+++ /dev/null
-// SALOME SalomeApp : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : QtxNameDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef QTX_NAMEDLG_H
-#define QTX_NAMEDLG_H
-
-#include "Qtx.h"
-#include "QtxDialog.h"
-
-class QLineEdit;
-class QPushButton;
-
-//=================================================================================
-// class : QtxNameDlg
-/*! purpose : Common <Rename> dialog box class*/
-//=================================================================================
-class QTX_EXPORT QtxNameDlg : public QtxDialog
-{
- Q_OBJECT
-
-public:
- QtxNameDlg( QWidget* parent = 0 );
- ~QtxNameDlg();
-
- void setName( const QString& name );
- QString name();
-
- static QString getName( QWidget* parent = 0, const QString& oldName = QString::null );
-
-protected slots:
- void accept();
-
-private:
- QPushButton* myButtonOk;
- QPushButton* myButtonCancel;
- QLineEdit* myLineEdit;
-};
-
-#endif // QTX_NAMEDLG_H
split( Qt::Vertical );
}
-void QtxWorkstack::renameWindow( QWidget* w )
+void QtxWorkstack::onRename()
{
- if ( !w )
+ if ( !myWorkWin )
return;
bool ok = false;
QString newName = QInputDialog::getText( tr( "Rename" ), tr( "Enter new name:" ), QLineEdit::Normal,
- w->caption(), &ok, topLevelWidget() );
- if ( ok )
- w->setCaption( newName );
-}
-
-void QtxWorkstack::onRenameActive()
-{
- renameWindow( activeWindow() );
-}
-
-void QtxWorkstack::onRename()
-{
- renameWindow( myWorkWin );
+ myWorkWin->caption(), &ok, topLevelWidget() );
+ if ( ok && !newName.isEmpty() )
+ myWorkWin->setCaption( newName );
}
QSplitter* QtxWorkstack::wrapSplitter( QtxWorkstackArea* area )
public slots:
void splitVertical();
void splitHorizontal();
- void onRenameActive();
private slots:
void onRename();
QSplitter* wrapSplitter( QtxWorkstackArea* );
void insertWidget( QWidget*, QWidget*, QWidget* );
- void renameWindow( QWidget* );
QtxWorkstackArea* areaAt( const QPoint& ) const;