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'
#
# Created: Tue Aug 25 15:21:53 2009
# Created: Tue Aug 25 16:34:16 2009
# by: The PerlQt User Interface Compiler (puic)
#
# WARNING! All changes made in this file will be lost!
@ -17,6 +17,7 @@ use Qt::slots
fileNew => [],
fileOpen => [],
fileSave => [],
fileChangeDir => [],
filePrint => [],
fileExit => [],
editUndo => [],
@ -127,6 +128,7 @@ use Qt::attributes qw(
separatorAction
FileExistCheck
MaualFile
fileChangeDirAction
);
@ -857,6 +859,7 @@ sub NEW
FileExistCheck->setOn( 1 );
MaualFile= Qt::Action(this, "MaualFile");
MaualFile->setToggleAction( 1 );
fileChangeDirAction= Qt::Action(this, "fileChangeDirAction");
toolBar = Qt::ToolBar("", this, &DockTop);
@ -876,6 +879,7 @@ sub NEW
fileMenu = Qt::PopupMenu( this );
fileOpenAction->addTo( fileMenu );
fileSaveAction->addTo( fileMenu );
fileChangeDirAction->addTo( fileMenu );
fileMenu->insertSeparator();
filePrintAction->addTo( fileMenu );
fileMenu->insertSeparator();
@ -927,6 +931,7 @@ sub NEW
Qt::Object::connect(fileNewAction, SIGNAL "activated()", this, SLOT "fileNew()");
Qt::Object::connect(go, SIGNAL "clicked()", this, SLOT "GoFit()");
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(TITLE, FILENAME);
@ -1108,6 +1113,7 @@ sub languageChange
fileOpenAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+O") ) );
fileSaveAction->setText( trUtf8("&Save MSR") );
fileSaveAction->setMenuText( trUtf8("&Save MSR") );
fileSaveAction->setStatusTip( trUtf8("&Save MSRave") );
fileSaveAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+S") ) );
fileSaveAsAction->setText( 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.") );
MaualFile->setText( trUtf8("Maual file selection") );
MaualFile->setMenuText( trUtf8("Maual file selection") );
fileChangeDirAction->setText( trUtf8("Change dir") );
fileChangeDirAction->setMenuText( trUtf8("Change dir") );
toolBar->setLabel( trUtf8("Tools") );
MenuBar->findItem( 3 )->setText( trUtf8("&File") );
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
{
print "MuSRFitform->filePrint(): Not implemented yet.\n";

View File

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