[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/utils/gwenrename/src
From: Spiros Georgaras <sngeorgaras () otenet ! gr>
Date: 2009-07-13 21:31:21
Message-ID: 1247520681.321899.24418.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 996134 by sngeorgaras:
adding a couple of tooltips
M +11 -1 multiselecttool.ui
M +108 -86 namepartbase.cpp
M +3 -18 namepartbase.h
M +35 -22 namepartbase.ui
M +4 -4 rename.cpp
M +6 -8 rename.ui
--- trunk/playground/utils/gwenrename/src/multiselecttool.ui #996133:996134
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>432</width>
- <height>280</height>
+ <height>282</height>
</rect>
</property>
<property name="windowTitle">
@@ -123,6 +123,10 @@
</item>
<item>
<widget class="QCheckBox" name="chkInvert">
+ <property name="toolTip">
+ <string><p><b>Invert selection in item \
list</b><br><br> +When checked, only items that do \
<b>not</b> match the search string will be selected<p></string> + \
</property> <property name="whatsThis">
<string><p><b>Invert selection in item \
list</b><br><br> When checked, only items that do \
<b>not</b> match the search string will be selected<p></string> @@ \
-137,6 +141,12 @@ </item>
<item>
<widget class="QCheckBox" name="chkAdd">
+ <property name="toolTip">
+ <string><p><b>Add to &current \
selection</b><br><br> +Normally, this operation will replace your \
current selection.<br><br> +When checked, items selected by this \
operation will be <b>added</b> to the current \
selection.<br><br> +<b>Note</b>: If <i>Invert selection \
in item list</i> is checked, items selected by this operation will be \
<b>removed</b> from the current selection.</p></string> + \
</property> <property name="whatsThis">
<string><p><b>Add to &current \
selection</b><br><br> Normally, this operation will replace your \
current selection.<br><br>
--- trunk/playground/utils/gwenrename/src/namepartbase.cpp #996133:996134
@@ -70,15 +70,15 @@
e->ignore();
}
//================================
-void namePart::startCH( int st ){
+void namePart::startCH( int ){
updateLabel();
}
//================================
-void namePart::lengthCH( int l ){
+void namePart::lengthCH( int ){
updateLabel();
}
//================================
-void namePart::fileChanged( int id ){
+void namePart::fileChanged( int ){
updateLabel();
}
//================================
@@ -88,58 +88,107 @@
QString n1;
QString n2;
if(nameList->currentText().isEmpty()){
- lblSample->setText("");
- return;
- }
-
- if(origName->isChecked() && origName->isEnabled()){
- // Use original name
- lblSample->setText(nameList->currentText());
- lblMatch->setText(nameList->currentText());
- n1=nameList->currentText();
- n="";
- n2="";
- return;
- }else if(search->isEnabled()){
- start=nameList->currentText().indexOf(
- search->currentText());
+ outText.clear();
+ matchedText.clear();
+ lblSample->setText(outText);
+ lblMatch->setText(outText);
+ }else{
+ if(origName->isChecked() && origName->isEnabled()){
+ // Use original name
+ lblSample->setText(nameList->currentText());
+ lblMatch->setText(nameList->currentText());
+ n1=nameList->currentText();
+ matchedText.clear();
+ n2.clear();
+ return;
+ }else if(search->isEnabled()){
+ start=nameList->currentText().indexOf(search->currentText());
+ if(start!=-1){
+ matchedText=search->currentText();
+ start++;
+ length=matchedText.length();
+ }else{
+ matchedText.clear();
+ n1=nameList->currentText();
+ n2.clear();
+ }
+ }else
+ matchedText=nameList->currentText().mid(start-1,length);
+
if(start!=-1){
- n=search->currentText();
- start++;
- length=n.length();
+ n1=nameList->currentText().left(start-1);
+ n2=nameList->currentText().mid(start+length-1,255);
+ }
+ lblMatch->setText(matchedText);
+ if(chkReplace->isEnabled() && chkReplace->isChecked() && !matchedText.isEmpty())
+ matchedText=replace->currentText();
+ if(grpOutOptions->isChecked()){
+ outText=n1+matchedText+n2;
+ lblSample->setText(n1+"<b><font color=\"White\">"+matchedText+"</font></b>"+n2);
}else{
- n="";
- n1=nameList->currentText();
- n2="";
+ lblSample->setText(matchedText);
+ outText=matchedText;
}
- }else
- n=nameList->currentText().mid(start-1,length);
-
- if(start!=-1){
- n1=nameList->currentText().left(start-1);
- n2=nameList->currentText().mid(start+length-1,255);
- }
- lblMatch->setText(n);
- if(chkReplace->isEnabled() && chkReplace->isChecked() && !n.isEmpty())
- n=replace->currentText();
- lblSample->setText(n1+"<b><font color=\"White\">"+n+"</font></b>"+n2);
}
+ // fix buttonOk
+ if( grpOutOptions->isChecked()/* && origName->isChecked()*/ ){
+ buttonOk->setEnabled(true);
+ }else if( ( chkFixed->isChecked() && outText.isEmpty() ) ||
+ ( search->isEnabled() && search->currentText().isEmpty() ) ){
+ buttonOk->setEnabled(false);
+// }else{
+// if(search->isEnabled() && !grpOutOptions->isChecked()){
+// buttonOk->setEnabled(false);
+ }else
+ buttonOk->setEnabled(true);
+}
//================================
void namePart::buttonOkClicked(){
if(!buttonOk->isEnabled())
return;
-// if(chkFixed->isChecked()){
-// outPattern=":S"+n+":";
-// }else{
-// outPattern=QString(":P%1,%2:").arg(startInt->value()).arg(lengthInt->value());
-// }
- if( chkSearchString->isChecked() && chkReplace->isChecked() ){
- // simple search / replace
- outPattern=":S"+search->currentText()+','+replace->currentText()+':';
- }else if( partOfFilename->isChecked() && chkReplace->isChecked() && \
chkFixed->isChecked() )
- outPattern=QString(":P%1,%2,%3:").arg(startInt->value()).arg(lengthInt->value()).arg(replace->currentText());
-// outPattern=":X";//+startInt->value()+","+lengthInt->value()+","+replace->currentText()+":";
+ if(grpOutOptions->isChecked()){
+ // replace is on
+ if(origName->isChecked()){
+ // use original name
+ if(chkFixed->isChecked())
+ // use fixed original name
+ outPattern=":ORIG_NAME_ALL,"+nameList->currentText()+':';
+ else
+ // use each item's original name
+ outPattern=":ORIG_NAME:";
+ }else{
+ // replace str,str
+ if(partOfFilename->isChecked()){
+ if(chkFixed->isChecked()){
+ // search is str
+ if(matchedText.isEmpty()){
+ QDialog::reject();
+ return;
+ }
+ outPattern=":S"+matchedText+','+replace->currentText()+':';
+ }else{
+ // search is x,y
+ outPattern=QString(":P%1,%2,%3:").arg(startInt->value()).arg(lengthInt->value()).arg(replace->currentText());
+ }
+ }else{
+ // search is str
+ // setting use fixed makes no difference here
+ outPattern=":S"+search->currentText()+','+replace->currentText()+':';
+ }
+ }
+ }else{
+ // replace is off
+ if(chkFixed->isChecked()){
+ if(partOfFilename->isChecked())
+ outPattern=":ORIG_NAME_ALL,"+matchedText+':';
+ }else{
+ if(partOfFilename->isChecked())
+ outPattern=QString(":Z%1,%2:").arg(startInt->value()).arg(lengthInt->value());
+ else
+ outPattern=":X"+search->currentText()+':';
+ }
+ }
QDialog::accept();
}
//================================
@@ -150,45 +199,31 @@
lengthInt->setEnabled(state);
if(state){
startInt->setFocus();
- buttonOk->setEnabled(true);
- if( ( chkReplace->isChecked() && chkReplace->isEnabled() ) || \
!grpOutOptions->isEnabled())
- chkFixed->setEnabled(true);
- else
- chkFixed->setEnabled(false);
+// buttonOk->setEnabled(true);
}
+ updateLabel();
}
//================================
void namePart::searchStringToggled(bool state){
search->setEnabled(state);
- if(state){
+ if(state)
search->setFocus();
- if(search->currentText().isEmpty())
- buttonOk->setEnabled(false);
- else
- buttonOk->setEnabled(true);
- if(chkReplace->isChecked() && chkReplace->isEnabled())
- chkFixed->setEnabled(false);
- else
- chkFixed->setEnabled(true);
- }
updateLabel();
}
//================================
void namePart::replaceStringToggled(bool state){
// replace->setEnabled(state);
if(state){
- if(chkSearchString->isChecked() && chkSearchString->isEnabled())
- chkFixed->setEnabled(false);
- else
- chkFixed->setEnabled(true);
- if(chkFixed->isChecked()) nameList->setEnabled(false);
+ if(chkFixed->isChecked())
+ nameList->setEnabled(false);
}else{
- chkFixed->setEnabled(false);
- if(!nameList->isEnabled()) nameList->setEnabled(true);
+ if(!nameList->isEnabled())
+ nameList->setEnabled(true);
}
// fix editing
replace->setEnabled(state);
- if(state) replace->setFocus();
+ if(state)
+ replace->setFocus();
updateLabel();
}
//================================
@@ -196,36 +231,23 @@
KRun::runCommand(QString("khelpcenter \
\"help:/gwenrename/namepart-window.html\""),this); }
//================================
-void namePart::updateLabelTextChaned(){
-// updateLabel(startInt->value(),lengthInt->value());
- if(search->isEnabled()){
- if(search->currentText().isEmpty())
- buttonOk->setEnabled(false);
- else
- buttonOk->setEnabled(true);
- }
- updateLabel();
-}
-//================================
void namePart::grpOutOptionsToggled(bool state){
if(state){
lblSample->setStyleSheet("background-color: #A2C511; color: Green;");
if(origName->isChecked())
origNameToggled(true);
}else{
+ grpMatch->setEnabled(true);
lblSample->setStyleSheet("background-color: #A2C511;");
- origNameToggled(false);
}
+ updateLabel();
}
//================================
void namePart::origNameToggled(bool state){
- if(state){
+ if(state)
grpMatch->setEnabled(false);
- chkFixed->setEnabled(true);
- }else{
+ else
grpMatch->setEnabled(true);
- chkFixed->setEnabled(false);
- }
updateLabel();
}
--- trunk/playground/utils/gwenrename/src/namepartbase.h #996133:996134
@@ -60,26 +60,15 @@
private:
Ui::namePartBase np;
-
- QString n;
- QString textPattern;
- QString outPattern;
+ QString matchedText;
+ QString outText; // filename result after search / replace e.g. 0--0--1
+ QString outPattern; // result pattern
virtual void resizeEvent( QResizeEvent * e );
-// void updateLabel( int start, int length );
// signals:
-// /**
-// * Use this signal to change the content of the statusbar
-// */
-// void signalChangeStatusbar(const QString& text);
//
-// /**
-// * Use this signal to change the content of the caption
-// */
-// void signalChangeCaption(const QString& text);
-//
private slots:
void startCH( int st );
void lengthCH( int l );
@@ -90,12 +79,8 @@
void replaceStringToggled(bool state);
void showHelp();
void updateLabel();
- void updateLabelTextChaned();
void grpOutOptionsToggled(bool state);
void origNameToggled(bool state);
-
-// void switchColors();
-// void settingsChanged();
};
#endif // NAMEPARTBASE_H
--- trunk/playground/utils/gwenrename/src/namepartbase.ui #996133:996134
@@ -115,9 +115,6 @@
</item>
<item>
<widget class="QCheckBox" name="chkFixed">
- <property name="enabled">
- <bool>false</bool>
- </property>
<property name="text">
<string>Use this match</string>
</property>
@@ -574,22 +571,6 @@
</hints>
</connection>
<connection>
- <sender>chkFixed</sender>
- <signal>toggled(bool)</signal>
- <receiver>nameList</receiver>
- <slot>setDisabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>472</x>
- <y>117</y>
- </hint>
- <hint type="destinationlabel">
- <x>268</x>
- <y>78</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>buttonHelp</sender>
<signal>clicked()</signal>
<receiver>namePartBase</receiver>
@@ -609,7 +590,7 @@
<sender>replace</sender>
<signal>editTextChanged(QString)</signal>
<receiver>namePartBase</receiver>
- <slot>updateLabelTextChaned()</slot>
+ <slot>updateLabel()</slot>
<hints>
<hint type="sourcelabel">
<x>207</x>
@@ -625,7 +606,7 @@
<sender>search</sender>
<signal>editTextChanged(QString)</signal>
<receiver>namePartBase</receiver>
- <slot>updateLabelTextChaned()</slot>
+ <slot>updateLabel()</slot>
<hints>
<hint type="sourcelabel">
<x>173</x>
@@ -685,13 +666,45 @@
</hint>
</hints>
</connection>
+ <connection>
+ <sender>chkFixed</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>namePartBase</receiver>
+ <slot>updateLabel()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>440</x>
+ <y>108</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>452</x>
+ <y>4</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>chkFixed</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>nameList</receiver>
+ <slot>setDisabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>412</x>
+ <y>107</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>274</x>
+ <y>78</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
<slots>
<slot>partOfFilenameToggled(bool)</slot>
<slot>searchStringToggled(bool)</slot>
<slot>replaceStringToggled(bool)</slot>
<slot>showHelp()</slot>
- <slot>updateLabelTextChaned()</slot>
+ <slot>updateLabel()</slot>
<slot>grpOutOptionsToggled(bool)</slot>
<slot>origNameToggled(bool)</slot>
</slots>
--- trunk/playground/utils/gwenrename/src/rename.cpp #996133:996134
@@ -1745,7 +1745,7 @@
void GwenRename::AdjustPartName(){
QStringList l;
for(int k=0;k<g.numOfFiles;k++)
- if(g.ren[k].selected)
+// if(g.ren[k].selected)
l<<g.ren[k].oldName;
if(l.size()==0) return;
if(!nPB) nPB=new namePart(this,&ic);
@@ -1757,7 +1757,7 @@
void GwenRename::AdjustPartNameFromSufix(){
QStringList l;
for(int k=0;k<g.numOfFiles;k++)
- if(g.ren[k].selected)
+// if(g.ren[k].selected)
l<<g.ren[k].oldName;
if(l.size()==0) return;
if(!nPB) nPB=new namePart(this,&ic);
@@ -1769,7 +1769,7 @@
void GwenRename::AdjustPartNameFromPrefix(){
QStringList l;
for(int k=0;k<g.numOfFiles;k++)
- if(g.ren[k].selected)
+// if(g.ren[k].selected)
l<<g.ren[k].oldName;
if(l.size()==0) return;
if(!nPB) nPB=new namePart(this,&ic);
@@ -2812,7 +2812,7 @@
-void GwenRename::viewDoubleClicked( QTreeWidgetItem * item , int column ){
+void GwenRename::viewDoubleClicked( QTreeWidgetItem * item , int ){
if(item){
if(item->text(1).isNull()) return;
if(item->text(0).isEmpty()) // not selected items have ' ' as text in column 0
--- trunk/playground/utils/gwenrename/src/rename.ui #996133:996134
@@ -40,11 +40,6 @@
<property name="sortingEnabled">
<bool>true</bool>
</property>
- <column>
- <property name="text">
- <string notr="true">1</string>
- </property>
- </column>
</widget>
</item>
<item>
@@ -662,6 +657,9 @@
<layout class="QVBoxLayout">
<item>
<widget class="QCheckBox" name="sort">
+ <property name="toolTip">
+ <string><p><b>Use numeric \
sorting</b><br><br>When this option is enabled, the original names \
are sorted taking into account their numeric value (when possible)</p></string> \
+ </property> <property name="text">
<string>Use numeric sorting</string>
</property>
@@ -1101,12 +1099,12 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
+ <property name="toolTip">
+ <string><p><b>Use 'relaxed' \
numbering</b><br><br>When this option is enabled, the program will \
find the files that match the renaming cretiria but are not selected for renaming, \
and adjust the starting value of the counter so that the resulting filenames will \
follow the last existing file. This means that the starting value of the counter may \
be different than the one defined by the user.</p></string> + \
</property> <property name="text">
<string>Use 'relaxed' numbering</string>
</property>
- <property name="shortcut">
- <string/>
- </property>
</widget>
</item>
</layout>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic