Added possibility to change working directory

This commit is contained in:
salman 2009-08-25 14:35:06 +00:00
parent 802c2776d0
commit d16278bdc3
3 changed files with 57 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'MuSRFit.ui' # Form implementation generated from reading ui file 'MuSRFit.ui'
# #
# Created: Tue Aug 25 15:21:53 2009 # Created: Tue Aug 25 16:34:16 2009
# by: The PerlQt User Interface Compiler (puic) # by: The PerlQt User Interface Compiler (puic)
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -17,6 +17,7 @@ use Qt::slots
fileNew => [], fileNew => [],
fileOpen => [], fileOpen => [],
fileSave => [], fileSave => [],
fileChangeDir => [],
filePrint => [], filePrint => [],
fileExit => [], fileExit => [],
editUndo => [], editUndo => [],
@ -127,6 +128,7 @@ use Qt::attributes qw(
separatorAction separatorAction
FileExistCheck FileExistCheck
MaualFile MaualFile
fileChangeDirAction
); );
@ -857,6 +859,7 @@ sub NEW
FileExistCheck->setOn( 1 ); FileExistCheck->setOn( 1 );
MaualFile= Qt::Action(this, "MaualFile"); MaualFile= Qt::Action(this, "MaualFile");
MaualFile->setToggleAction( 1 ); MaualFile->setToggleAction( 1 );
fileChangeDirAction= Qt::Action(this, "fileChangeDirAction");
toolBar = Qt::ToolBar("", this, &DockTop); toolBar = Qt::ToolBar("", this, &DockTop);
@ -876,6 +879,7 @@ sub NEW
fileMenu = Qt::PopupMenu( this ); fileMenu = Qt::PopupMenu( this );
fileOpenAction->addTo( fileMenu ); fileOpenAction->addTo( fileMenu );
fileSaveAction->addTo( fileMenu ); fileSaveAction->addTo( fileMenu );
fileChangeDirAction->addTo( fileMenu );
fileMenu->insertSeparator(); fileMenu->insertSeparator();
filePrintAction->addTo( fileMenu ); filePrintAction->addTo( fileMenu );
fileMenu->insertSeparator(); fileMenu->insertSeparator();
@ -927,6 +931,7 @@ sub NEW
Qt::Object::connect(fileNewAction, SIGNAL "activated()", this, SLOT "fileNew()"); Qt::Object::connect(fileNewAction, SIGNAL "activated()", this, SLOT "fileNew()");
Qt::Object::connect(go, SIGNAL "clicked()", this, SLOT "GoFit()"); Qt::Object::connect(go, SIGNAL "clicked()", this, SLOT "GoFit()");
Qt::Object::connect(InitParamTable, SIGNAL "valueChanged(int,int)", this, SLOT "UpdeateTable()"); Qt::Object::connect(InitParamTable, SIGNAL "valueChanged(int,int)", this, SLOT "UpdeateTable()");
Qt::Object::connect(fileChangeDirAction, SIGNAL "activated()", this, SLOT "fileChangeDir()");
setTabOrder(musrfit_tabs, TITLE); setTabOrder(musrfit_tabs, TITLE);
setTabOrder(TITLE, FILENAME); setTabOrder(TITLE, FILENAME);
@ -1108,6 +1113,7 @@ sub languageChange
fileOpenAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+O") ) ); fileOpenAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+O") ) );
fileSaveAction->setText( trUtf8("&Save MSR") ); fileSaveAction->setText( trUtf8("&Save MSR") );
fileSaveAction->setMenuText( trUtf8("&Save MSR") ); fileSaveAction->setMenuText( trUtf8("&Save MSR") );
fileSaveAction->setStatusTip( trUtf8("&Save MSRave") );
fileSaveAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+S") ) ); fileSaveAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+S") ) );
fileSaveAsAction->setText( trUtf8("Save MSR &As...") ); fileSaveAsAction->setText( trUtf8("Save MSR &As...") );
fileSaveAsAction->setMenuText( trUtf8("Save MSR &As...") ); fileSaveAsAction->setMenuText( trUtf8("Save MSR &As...") );
@ -1154,6 +1160,8 @@ sub languageChange
FileExistCheck->setWhatsThis( trUtf8("Enable/Disable checking for MSR files.") ); FileExistCheck->setWhatsThis( trUtf8("Enable/Disable checking for MSR files.") );
MaualFile->setText( trUtf8("Maual file selection") ); MaualFile->setText( trUtf8("Maual file selection") );
MaualFile->setMenuText( trUtf8("Maual file selection") ); MaualFile->setMenuText( trUtf8("Maual file selection") );
fileChangeDirAction->setText( trUtf8("Change dir") );
fileChangeDirAction->setMenuText( trUtf8("Change dir") );
toolBar->setLabel( trUtf8("Tools") ); toolBar->setLabel( trUtf8("Tools") );
MenuBar->findItem( 3 )->setText( trUtf8("&File") ); MenuBar->findItem( 3 )->setText( trUtf8("&File") );
MenuBar->findItem( 4 )->setText( trUtf8("&Edit") ); MenuBar->findItem( 4 )->setText( trUtf8("&Edit") );
@ -1209,6 +1217,19 @@ sub fileSave
} }
sub fileChangeDir
{
my $newdir=Qt::FileDialog::getExistingDirectory(
"",
this,
"get existing directory",
"Choose a directory",
1);
chdir ("$newdir");
}
sub filePrint sub filePrint
{ {
print "MuSRFitform->filePrint(): Not implemented yet.\n"; print "MuSRFitform->filePrint(): Not implemented yet.\n";

View File

@ -1465,6 +1465,7 @@
<item text="&amp;File" name="fileMenu"> <item text="&amp;File" name="fileMenu">
<action name="fileOpenAction"/> <action name="fileOpenAction"/>
<action name="fileSaveAction"/> <action name="fileSaveAction"/>
<action name="fileChangeDirAction"/>
<separator/> <separator/>
<action name="filePrintAction"/> <action name="filePrintAction"/>
<separator/> <separator/>
@ -1556,6 +1557,9 @@
<property name="menuText"> <property name="menuText">
<string>&amp;Save MSR</string> <string>&amp;Save MSR</string>
</property> </property>
<property name="statusTip">
<string>&amp;Save MSRave</string>
</property>
<property name="accel"> <property name="accel">
<string>Ctrl+S</string> <string>Ctrl+S</string>
</property> </property>
@ -1829,6 +1833,17 @@
<string>Maual file selection</string> <string>Maual file selection</string>
</property> </property>
</action> </action>
<action>
<property name="name">
<cstring>fileChangeDirAction</cstring>
</property>
<property name="text">
<string>Change dir</string>
</property>
<property name="menuText">
<string>Change dir</string>
</property>
</action>
</actions> </actions>
<images> <images>
<image name="image0"> <image name="image0">
@ -1962,6 +1977,12 @@
<receiver>MuSRFitform</receiver> <receiver>MuSRFitform</receiver>
<slot>UpdeateTable()</slot> <slot>UpdeateTable()</slot>
</connection> </connection>
<connection>
<sender>fileChangeDirAction</sender>
<signal>activated()</signal>
<receiver>MuSRFitform</receiver>
<slot>fileChangeDir()</slot>
</connection>
</connections> </connections>
<tabstops> <tabstops>
<tabstop>musrfit_tabs</tabstop> <tabstop>musrfit_tabs</tabstop>
@ -2003,6 +2024,7 @@
<slot>fileNew()</slot> <slot>fileNew()</slot>
<slot>fileOpen()</slot> <slot>fileOpen()</slot>
<slot>fileSave()</slot> <slot>fileSave()</slot>
<slot>fileChangeDir()</slot>
<slot>filePrint()</slot> <slot>filePrint()</slot>
<slot>fileExit()</slot> <slot>fileExit()</slot>
<slot>editUndo()</slot> <slot>editUndo()</slot>

View File

@ -71,6 +71,17 @@ void Form1::fileSave()
} }
} }
void MuSRFitform::fileChangeDir()
{
my $newdir=Qt::FileDialog::getExistingDirectory(
"",
this,
"get existing directory",
"Choose a directory",
1);
chdir ("$newdir");
}
void Form1::filePrint() void Form1::filePrint()
{ {
@ -618,3 +629,5 @@ void MuSRFitform::UpdeateTable()
{ {
} }