summaryrefslogtreecommitdiff
path: root/noncore
authorllornkcor <llornkcor>2005-08-24 20:22:10 (UTC)
committer llornkcor <llornkcor>2005-08-24 20:22:10 (UTC)
commit65edeafe2dc8689dce7c2ce94e954933b393dcf0 (patch) (unidiff)
tree17d0986ef0bce73f44a4b9900466fcc533954814 /noncore
parentf0bb6c410f19d502cf563254d95158617a32b94e (diff)
downloadopie-65edeafe2dc8689dce7c2ce94e954933b393dcf0.zip
opie-65edeafe2dc8689dce7c2ce94e954933b393dcf0.tar.gz
opie-65edeafe2dc8689dce7c2ce94e954933b393dcf0.tar.bz2
optimize search. fix other things
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp265
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.h15
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp90
3 files changed, 170 insertions, 200 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 58babe9..9858188 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -133,68 +133,89 @@ void LibraryDialog::Newlibrary()
133 133
134void LibraryDialog::Library() { 134void LibraryDialog::Library() {
135 clearItems(); 135 clearItems();
136 136
137 // qDebug( "opening GUTINDEX.ALL file"); 137 // qDebug( "opening GUTINDEX.ALL file");
138 IDontKnowWhy = ""; 138 IDontKnowWhy = "";
139 if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully 139 system("date");
140 if ( indexLib.open( IO_ReadOnly) ) {
141// file opened successfully
140 QTextStream indexStream( &indexLib ); 142 QTextStream indexStream( &indexLib );
141 QString indexLine; 143 QString indexLine;
142 qApp->processEvents(); 144 qApp->processEvents();
143 145
146 bool okToRead = false;
144 while ( !indexStream.eof() ) { 147 while ( !indexStream.eof() ) {
145
146 indexLine = indexStream.readLine(); 148 indexLine = indexStream.readLine();
147 if ( indexLine != "") { 149 if(indexLine == "<==Start GUTINDEX.ALL listings==>")
148 150 okToRead = true;
149 if( (indexLine.mid(4,4)).toInt() ) { 151 if(indexLine == "<==End of GUTINDEX.ALL==>") {
150 152 okToRead = false;
151 year = indexLine.mid(4,4); 153 indexLib.at(indexLib.size());
152 file = indexLine.mid(60,12);
153 if(file.left(1).find("[",0,TRUE) != -1)
154 file.remove(1,1);
155 if( file.find("]",0,TRUE) != -1)
156 file = file.left( file.find("]",0,TRUE));
157
158 if(file.find("?", 0, false) != -1 ) {
159 QString tmpfile = file.replace(QRegExp("[?]"), "8");
160 file = tmpfile;
161 }
162
163 number = indexLine.mid(55,5);
164 title = indexLine.mid( 9, 50 );
165
166 addItems();
167
168 }
169 else if ( indexLine.mid(73,5).toInt() && indexLine.mid(73,5).toInt() > 10000 ) {
170// newer files with numbers > 100000 have new dir structure and need to be parsed differently..
171 number = indexLine.mid(73,5);
172 int num = number.toInt();
173 if(num < 10626)
174 year = "2003";
175 else if(num >= 10626 && num < 14600)
176 year = "2004";
177 else if(num >= 14600)
178 year = "2005";
179
180 file = number;// + ".txt";
181 title = indexLine.mid(0,72);
182
183 addItems();
184 //qDebug("file number is " + number + " title is " + title );
185 }
186 } 154 }
155
156 if(okToRead) {
157 QStringList token = QStringList::split(' ', indexLine);
158 int textNumber;
159 if(( textNumber = token.last().toInt() ))
160 if(textNumber > 10001) {
161// qWarning("Last "+token.last());
162// newer files with numbers > 100000 have new dir structure and need to be parsed differently..
163 if(textNumber < 10626)
164 year = "2003";
165 else if(textNumber >= 10626 && textNumber < 14600)
166 year = "2004";
167 else if(textNumber >= 14600)
168 year = "2005";
169
170 file = token.last();
171 title = indexLine.mid(0,72);
172
173 addItems(); //author and qlistview
174 //qDebug("file number is " + number + " title is " + title );
175
176 } else { //end new etexts
177
178 if(token[1].toInt() && token[1].toInt() > 1969) {
179 year = token[1];
180 file = indexLine.mid(60,12);
181
182 if(file.left(1).find("[",0,TRUE) != -1) {
183 file.remove(1,1);
184 if( file.find("]",0,TRUE) != -1)
185 file = file.left( file.find("]",0,TRUE));
186
187 if(file.find("?", 0, false) != -1 ) {
188 QString tmpfile = file.replace(QRegExp("[?]"), "8");
189 file = tmpfile;
190 }
191 title = indexLine.mid( 9, 50);
192
193 addItems();
194 }
195 } else { // then try new format texts
196 file = token.last();
197 title = indexLine.mid(0,72);
198 year = "1980";
199
200 addItems(); //author and qlistview
201 }
202 } //end old etexts
203
204 } //end okToTRead
187 } 205 }
188 indexLib.close(); 206 indexLib.close();
189 } else { 207 } else {
190 QString sMsg; 208 QString sMsg;
191 209
192 sMsg = ( tr("<p>Error opening library index file. Please download a new one.</P> ")); 210 sMsg = ( tr("<p>Error opening library index file. Please download a new one.</P> "));
193 QMessageBox::message( "Error",sMsg); 211 QMessageBox::message( "Error",sMsg);
194 } 212 }
213 system("date");
214 sortLists(0);
215
195} //end Library() 216} //end Library()
196 217
197 218
198/* 219/*
199 Groks the author out of the title */ 220 Groks the author out of the title */
200bool LibraryDialog::getAuthor() 221bool LibraryDialog::getAuthor()
@@ -300,39 +321,46 @@ bool LibraryDialog::getAuthor()
300 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names 321 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names
301 author = lastName+", "+firstName; 322 author = lastName+", "+firstName;
302 } 323 }
303 return true; 324 return true;
304}////// end getAuthor() 325}////// end getAuthor()
305 326
306void LibraryDialog::addItems() { 327void LibraryDialog::addItems()
328{
307 cleanStrings(); 329 cleanStrings();
308 getAuthor(); // grok author 330 getAuthor(); // grok author
309 if( !number.isEmpty() 331
310 && (title.find( "reserved",0, FALSE) == -1) 332 etext etextStruct;
333 if( /*!number.isEmpty()
334 && */
335 (title.find( "reserved",0, FALSE) == -1)
311 && (file.find( "]",0, true) == -1) 336 && (file.find( "]",0, true) == -1)
312 &&(title.find( "Audio",0, FALSE) == -1)) { 337 &&(title.find( "Audio",0, FALSE) == -1)) {
313 // qDebug("new item "+title); 338 // qDebug("new item "+title);
314 // fill string list or something to be able to sort by Author 339 // fill string list or something to be able to sort by Author
340 etextStruct.title = title;
341 etextStruct.author = author;
342 etextStruct.year = year;
343 etextStruct.file = file;
344
345 etextLibrary.append( etextStruct);
346
315 if( author.isEmpty() ) 347 if( author.isEmpty() )
316 QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); 348 QList_Item5 = new QListViewItem( ListView5, /*number, */author, title, year, file );
317 else { 349 else {
318 if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || 350 if( author.find(QRegExp("[^a-fA-F]")) )
319 (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) 351 QList_Item1 = new QListViewItem( ListView1, /* number,*/author, title, year, file );
320 QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file );
321 352
322 else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || 353 else if(author.find(QRegExp("[^g-mG-M]")) )
323 (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) 354 QList_Item2 = new QListViewItem( ListView2, /* number,*/ author, title,year, file );
324 QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file );
325 355
326 else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || 356 else if(author.find(QRegExp("[^n-rN-R]")) )
327 (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) 357 QList_Item3 = new QListViewItem( ListView3, /* number,*/ author, title, year, file );
328 QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file );
329 358
330 else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || 359 else if(author.find(QRegExp("[^s-zS-Z]")) )
331 (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) 360 QList_Item4 = new QListViewItem( ListView4, /* number,*/ author, title, year, file );
332 QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file );
333 } 361 }
334 } 362 }
335} 363}
336 364
337/* 365/*
338 selected one etext*/ 366 selected one etext*/
@@ -672,92 +700,33 @@ void LibraryDialog::onButtonSearch()
672 700
673 int i_berger = 0; 701 int i_berger = 0;
674 if( searchDlg->exec() != 0 ) { 702 if( searchDlg->exec() != 0 ) {
675 QString searcherStr = searchDlg->get_text(); 703 QString searcherStr = searchDlg->get_text();
676 int fluff = 0; 704 int fluff = 0;
677 705
678 // int tabPage = tabWidget->currentPageIndex();
679 // TODO ititerate here... struct<listViews>??
680
681 QListViewItemIterator it1( ListView1 );
682 QListViewItemIterator it2( ListView2 );
683 QListViewItemIterator it3( ListView3 );
684 QListViewItemIterator it4( ListView4 );
685 QListViewItemIterator it5( ListView5 );
686
687 //// this is really pitiful work,
688 ///////
689 bool cS; 706 bool cS;
690 if( searchDlg->caseSensitiveCheckBox->isChecked()) 707 if( searchDlg->caseSensitiveCheckBox->isChecked())
691 cS=true; //case sensitive 708 cS = true; //case sensitive
692 else 709 else
693 cS=false; 710 cS = false;
694 711
695 if(fluff==0) { 712 etext etextStruct;
696 for ( ; it1.current(); ++it1 ) { 713 QValueList<etext>::Iterator it;
697 resultString = ( it1.current() )->text(0); 714
698 resultString += (" : "); 715 for( it = etextLibrary.begin(); it != etextLibrary.end(); ++it ) {
699 resultString += ( it1.current() )->text(2); 716 QString tempTitle = (*it).title;
700 resultString += (" : "); 717 QString tempAuthor = (*it).author;
701 resultString += ( it1.current() )->text(3); 718 QString tempFile = (*it).file;
702 if( resultString.find( searcherStr, 0, cS) != -1) 719 QString tempYear = (*it).year;
703 { 720 if(tempTitle.find( searcherStr, 0, cS) != -1
704 Searchlist.append( resultString); 721 || tempAuthor.find( searcherStr, 0, cS) != -1) {
705 } 722 qWarning(tempTitle);
706 } 723 Searchlist.append( tempTitle + " : " + tempYear + " : " + tempFile);
707 } 724 }
708 if(fluff==0) {// search routine here 725 }
709 for ( ; it2.current(); ++it2 ) { 726
710 resultString = ( it2.current() )->text(0);
711 resultString += (" : ");
712 resultString += ( it2.current() )->text(2);
713 resultString += (" : ");
714 resultString += ( it2.current() )->text(3);
715 if( resultString.find( searcherStr, 0, cS) != -1) {
716 Searchlist.append( resultString);
717 }
718 }
719 }
720 if(fluff==0) {// search routine here
721 for ( ; it3.current(); ++it3 ) {
722 resultString = ( it3.current() )->text(0);
723 resultString += (" : ");
724 resultString += ( it3.current() )->text(2);
725 resultString += (" : ");
726 resultString += ( it3.current() )->text(3);
727
728 if( resultString.find( searcherStr, 0, cS) != -1) {
729 Searchlist.append( resultString);
730 }
731 }
732 }
733 if(fluff==0) {
734 // search routine here
735 for ( ; it4.current(); ++it4 ) {
736 resultString = ( it4.current() )->text(0);
737 resultString += (" : ");
738 resultString += ( it4.current() )->text(2);
739 resultString += (" : ");
740 resultString += ( it4.current() )->text(3);
741 if( resultString.find( searcherStr, 0, cS) != -1) {
742 Searchlist.append( resultString);
743 }
744 }
745 }
746 if(fluff==0) { // search routine here
747 for ( ; it5.current(); ++it5 ) {
748 resultString = ( it5.current() )->text(0);
749 resultString += (" : ");
750 resultString += ( it5.current() )->text(2);
751 resultString += (" : ");
752 resultString += ( it5.current() )->text(3);
753 if( resultString.find( searcherStr, 0, cS) != -1) {
754 Searchlist.append( resultString);
755 }
756 }
757 }
758 727
759 tabWidget->setCurrentPage( curTab); 728 tabWidget->setCurrentPage( curTab);
760 729
761 Searchlist.sort(); 730 Searchlist.sort();
762 SearchResultsDlg* SearchResultsDialog; 731 SearchResultsDlg* SearchResultsDialog;
763 SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); 732 SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist);
@@ -770,14 +739,12 @@ void LibraryDialog::onButtonSearch()
770 i_berger = 1; 739 i_berger = 1;
771 } else { 740 } else {
772 resultLs.clear(); 741 resultLs.clear();
773 } 742 }
774 Searchlist.clear(); 743 Searchlist.clear();
775 744
776 // if(SearchResultsDialog)
777 // delete SearchResultsDialog;
778 QString tester; 745 QString tester;
779 for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { 746 for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) {
780 texter.sprintf("%s \n",(*it).latin1()); 747 texter.sprintf("%s \n",(*it).latin1());
781 // //odebug << texter << oendl; 748 // //odebug << texter << oendl;
782 if( tester!=texter) 749 if( tester!=texter)
783 parseSearchResults( texter); 750 parseSearchResults( texter);
@@ -817,24 +784,34 @@ void LibraryDialog::parseSearchResults( QString resultStr)
817 cleanStrings(); 784 cleanStrings();
818 785
819 if(DlglistItemFile.left(1) == "/") 786 if(DlglistItemFile.left(1) == "/")
820 DlglistItemFile = DlglistItemFile.right( DlglistItemFile.length() - 1); 787 DlglistItemFile = DlglistItemFile.right( DlglistItemFile.length() - 1);
821 788
822 789
823 if(DlglistItemFile.toInt() > 10000 ) { 790 if(DlglistItemFile.toInt() > 10000 || yearInt == 1980 ) {
824 // new directory sturcture 791 // new directory sturcture
825 download_newEtext(); //) 792 download_newEtext(); //)
826 } else { 793 } else {
827 download_Etext(); //) 794 download_Etext(); //)
828 } 795 }
829 } 796 }
830} 797}
831 798
832void LibraryDialog::sort() 799void LibraryDialog::sortLists(int index)
833{ 800{
834 801
802 ListView1->setSorting(index);
803 ListView2->setSorting(index);
804 ListView3->setSorting(index);
805 ListView4->setSorting(index);
806 ListView5->setSorting(index);
807 ListView1->sort();
808 ListView2->sort();
809 ListView3->sort();
810 ListView4->sort();
811 ListView5->sort();
835} 812}
836 813
837/* 814/*
838 Downloads the current selected listitem*/ 815 Downloads the current selected listitem*/
839bool LibraryDialog::getItem(QListViewItem *it) 816bool LibraryDialog::getItem(QListViewItem *it)
840{ 817{
@@ -1047,13 +1024,13 @@ void LibraryDialog::FindLibrary()
1047 } else { 1024 } else {
1048 newindexLib.setName( old_index); 1025 newindexLib.setName( old_index);
1049 indexLib.setName( old_index); 1026 indexLib.setName( old_index);
1050 //odebug << "new index nameis "+ old_index << oendl; 1027 //odebug << "new index nameis "+ old_index << oendl;
1051 Library(); 1028 Library();
1052 } 1029 }
1053 indexLoaded=true; 1030 indexLoaded =true;
1054 buttonSearch->setEnabled(true); 1031 buttonSearch->setEnabled(true);
1055 moreInfoButton->setEnabled(true); 1032 moreInfoButton->setEnabled(true);
1056 1033
1057 buttonLibrary->setDown(false); 1034 buttonLibrary->setDown(false);
1058 buttonNewList->setText("Download"); 1035 buttonNewList->setText("Download");
1059 qApp->processEvents(); 1036 qApp->processEvents();
@@ -1064,6 +1041,12 @@ void LibraryDialog::cleanStrings() {
1064 year = year.stripWhiteSpace(); 1041 year = year.stripWhiteSpace();
1065 file = file.stripWhiteSpace(); 1042 file = file.stripWhiteSpace();
1066 title = title.stripWhiteSpace(); 1043 title = title.stripWhiteSpace();
1067 number = number.stripWhiteSpace(); 1044 number = number.stripWhiteSpace();
1068 1045
1069} 1046}
1047
1048void LibraryDialog::authBoxClicked()
1049{
1050 qApp->processEvents();
1051 FindLibrary();
1052}
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.h b/noncore/apps/opie-gutenbrowser/LibraryDialog.h
index 8d6352f..95226b2 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.h
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.h
@@ -27,23 +27,32 @@
27#include <qregexp.h> 27#include <qregexp.h>
28#include <qstring.h> 28#include <qstring.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qvaluelist.h>
33 34
34class QVBoxLayout; 35class QVBoxLayout;
35class QHBoxLayout; 36class QHBoxLayout;
36class QGridLayout; 37class QGridLayout;
37class QListView; 38class QListView;
38class QListViewItem; 39class QListViewItem;
39class QPushButton; 40class QPushButton;
40//class QTabWidget; 41//class QTabWidget;
41class QWidget; 42class QWidget;
42//class Gutenbrowser; 43//class Gutenbrowser;
43 44
45typedef struct {
46 QString title;
47 QString author;
48 QString year;
49 QString file;
50} etext;
51
52
44class LibraryDialog : public QDialog { 53class LibraryDialog : public QDialog {
45 Q_OBJECT 54 Q_OBJECT
46 55
47public: 56public:
48 LibraryDialog( QWidget* parent = 0, const char* name = 0 , bool modal = TRUE, WFlags fl = 0 ); 57 LibraryDialog( QWidget* parent = 0, const char* name = 0 , bool modal = TRUE, WFlags fl = 0 );
49 ~LibraryDialog(); 58 ~LibraryDialog();
@@ -96,13 +105,13 @@ public slots:
96 void newList(); 105 void newList();
97 void Newlibrary(); 106 void Newlibrary();
98 void Library(); 107 void Library();
99 bool getAuthor(); 108 bool getAuthor();
100 void select_title(QListViewItem*); 109 void select_title(QListViewItem*);
101 void cancelIt(); 110 void cancelIt();
102 void sort(); 111 void sortLists(int);
103 bool moreInfo(); 112 bool moreInfo();
104// void DownloadEmAll(); 113// void DownloadEmAll();
105 bool httpDownload(); 114 bool httpDownload();
106 bool setTitle(); 115 bool setTitle();
107 void saveConfig(); 116 void saveConfig();
108 bool download_Etext(); 117 bool download_Etext();
@@ -115,19 +124,23 @@ public slots:
115 void comboSelect(int index); 124 void comboSelect(int index);
116protected slots: 125protected slots:
117 126
118 127
119protected: 128protected:
120 129
130 QValueList<etext> etextLibrary;
131
121 void initDialog(); 132 void initDialog();
122 QHBoxLayout *hbox,*hbox1,*hbox2; 133 QHBoxLayout *hbox,*hbox1,*hbox2;
123 QVBoxLayout *vbox; 134 QVBoxLayout *vbox;
124// void search_slot(); 135// void search_slot();
125private: 136private:
126 void addItems(); 137 void addItems();
127 void clearItems(); 138 void clearItems();
128 void cleanStrings(); 139 void cleanStrings();
129 bool getEtext(const QStringList &); 140 bool getEtext(const QStringList &);
141private slots:
142 void authBoxClicked();
130 143
131}; 144};
132 145
133#endif // LIBRARYDIALOG_H 146#endif // LIBRARYDIALOG_H
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp
index 60c1c75..bfbf84d 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp
@@ -69,111 +69,84 @@ void LibraryDialog::initDialog(){
69 69
70 widget_5 = new QWidget( tabWidget, "widget_5" ); 70 widget_5 = new QWidget( tabWidget, "widget_5" );
71 ListView5 = new QListView( widget_5, "ListView5" ); 71 ListView5 = new QListView( widget_5, "ListView5" );
72 QGridLayout *layout5 = new QGridLayout(widget_5 ); 72 QGridLayout *layout5 = new QGridLayout(widget_5 );
73 73
74 74
75 ListView1->addColumn( tr( "Title" ) ); 75 ListView1->addColumn( tr( "Author" ), -1 );
76 ListView1->setColumnWidthMode( 0, QListView::Manual ); 76 ListView1->setColumnAlignment( 1, 1 );
77 ListView1->setColumnWidth(0, 330); 77
78 ListView1->addColumn( tr( "Title" ), -1 );
78 ListView1->setColumnAlignment( 0, 1 ); 79 ListView1->setColumnAlignment( 0, 1 );
79 80
80 ListView1->addColumn( tr( "Author" ) );
81 ListView1->setColumnWidthMode( 1, QListView::Manual );
82 ListView1->setColumnWidth(1, 170);
83 ListView1->setColumnAlignment( 1, 1 );
84 81
85 ListView1->addColumn( tr( "Year" ) ); 82 ListView1->addColumn( tr( "Year" ) );
86 ListView1->setColumnWidthMode( 2, QListView::Manual ); 83 ListView1->setColumnWidthMode( 2, QListView::Manual );
87 ListView1->setColumnWidth(2, 50);
88 ListView1->setColumnAlignment( 2, 1 ); 84 ListView1->setColumnAlignment( 2, 1 );
89 85
90 ListView1->addColumn( tr( "File" ) ); 86 ListView1->addColumn( tr( "File" ), -1 );
91 ListView1->setColumnWidthMode( 2, QListView::Manual ); 87 ListView1->setColumnWidthMode( 2, QListView::Manual );
92 ListView1->setColumnWidth(2, 100);
93 ListView1->setColumnAlignment( 2, 1 );
94 88
95 ListView2->addColumn( tr( "Title" ) ); 89 ListView1->setColumnAlignment( 2, 1 );
96 ListView2->setColumnWidthMode( 0, QListView::Manual );
97 ListView2->setColumnWidth(0, 330);
98 ListView2->setColumnAlignment( 0, 1 );
99 90
100 ListView2->addColumn( tr( "Author" ) ); 91 ListView2->addColumn( tr( "Author" ), -1 );
101 ListView2->setColumnWidthMode( 1, QListView::Manual );
102 ListView2->setColumnWidth(1, 170);
103 ListView2->setColumnAlignment( 1, 1 ); 92 ListView2->setColumnAlignment( 1, 1 );
104 93
105 ListView2->addColumn( tr( "Year" ) ); 94 ListView2->addColumn( tr( "Title" ), -1);
95 ListView2->setColumnAlignment( 0, 1 );
96
97 ListView2->addColumn( tr( "Year" ), -1 );
106 ListView2->setColumnWidthMode( 2, QListView::Manual ); 98 ListView2->setColumnWidthMode( 2, QListView::Manual );
107 ListView2->setColumnWidth(2, 50);
108 ListView2->setColumnAlignment( 2, 1 ); 99 ListView2->setColumnAlignment( 2, 1 );
109 100
110 ListView2->addColumn( tr( "File" ) ); 101 ListView2->addColumn( tr( "File" ), -1 );
111 ListView2->setColumnWidthMode( 3, QListView::Manual ); 102 ListView2->setColumnWidthMode( 3, QListView::Manual );
112 ListView2->setColumnWidth(3, 100);
113 ListView2->setColumnAlignment( 3, 1 ); 103 ListView2->setColumnAlignment( 3, 1 );
114 104
115 ListView3->addColumn( tr( "Title" ) ); 105 ListView3->addColumn( tr( "Author" ), -1 );
116 ListView3->setColumnWidthMode( 0, QListView::Manual ); 106 ListView3->setColumnAlignment( 1, 1 );
117 ListView3->setColumnWidth(0, 330); 107
108 ListView3->addColumn( tr( "Title" ), -1 );
118 ListView3->setColumnAlignment( 0, 1 ); 109 ListView3->setColumnAlignment( 0, 1 );
119 110
120 ListView3->addColumn( tr( "Author" ) );
121 ListView3->setColumnWidthMode( 1, QListView::Manual );
122 ListView3->setColumnWidth(1, 170);
123 ListView3->setColumnAlignment( 1, 1 );
124 111
125 ListView3->addColumn( tr( "Year" ) ); 112 ListView3->addColumn( tr( "Year" ), -1 );
126 ListView3->setColumnWidthMode( 2, QListView::Manual ); 113 ListView3->setColumnWidthMode( 2, QListView::Manual );
127 ListView3->setColumnWidth(2, 50);
128 ListView3->setColumnAlignment( 2, 1 ); 114 ListView3->setColumnAlignment( 2, 1 );
129 115
130 ListView3->addColumn( tr( "File" ) ); 116 ListView3->addColumn( tr( "File" ), -1 );
131 ListView3->setColumnWidthMode( 3, QListView::Manual ); 117 ListView3->setColumnWidthMode( 3, QListView::Manual );
132 ListView3->setColumnWidth(3, 100);
133 ListView3->setColumnAlignment( 3, 1 ); 118 ListView3->setColumnAlignment( 3, 1 );
134 119
135 120
136 ListView4->addColumn( tr( "Title" ) ); 121 ListView4->addColumn( tr( "Author" ), -1 );
137 ListView4->setColumnWidthMode( 0, QListView::Manual );
138 ListView4->setColumnWidth(0, 330);
139 ListView4->setColumnAlignment( 0, 1 );
140
141 ListView4->addColumn( tr( "Author" ) );
142 ListView4->setColumnWidthMode( 1, QListView::Manual );
143 ListView4->setColumnWidth(1, 170);
144 ListView4->setColumnAlignment( 1, 1 ); 122 ListView4->setColumnAlignment( 1, 1 );
123 ListView4->addColumn( tr( "Title" ), -1 );
124 ListView4->setColumnAlignment( 0, 1 );
145 125
146 ListView4->addColumn( tr( "Year" ) ); 126 ListView4->addColumn( tr( "Year" ), -1 );
147 ListView4->setColumnWidthMode( 2, QListView::Manual ); 127 ListView4->setColumnWidthMode( 2, QListView::Manual );
148 ListView4->setColumnWidth(2, 50);
149 ListView4->setColumnAlignment( 2, 1 ); 128 ListView4->setColumnAlignment( 2, 1 );
150 129
151 ListView4->addColumn( tr( "File" ) ); 130 ListView4->addColumn( tr( "File" ), -1 );
152 ListView4->setColumnWidthMode( 3, QListView::Manual ); 131 ListView4->setColumnWidthMode( 3, QListView::Manual );
153 ListView4->setColumnWidth(3, 100);
154 ListView4->setColumnAlignment( 3, 1 ); 132 ListView4->setColumnAlignment( 3, 1 );
155 133
156 ListView5->addColumn( tr( "Title" ) ); 134 ListView5->addColumn( tr( "Author" ), -1 );
157 ListView5->setColumnWidthMode( 0, QListView::Manual ); 135 ListView5->setColumnAlignment( 1, 1 );
158 ListView5->setColumnWidth(0, 330); 136
137 ListView5->addColumn( tr( "Title" ), -1 );
159 ListView5->setColumnAlignment( 0, 1 ); 138 ListView5->setColumnAlignment( 0, 1 );
160 139
161 ListView5->addColumn( tr( "Author" ) );
162 ListView5->setColumnWidthMode( 1, QListView::Manual );
163 ListView5->setColumnWidth(1, 170);
164 ListView5->setColumnAlignment( 1, 1 );
165 140
166 ListView5->addColumn( tr( "Year" ) ); 141 ListView5->addColumn( tr( "Year" ), -1 );
167 ListView5->setColumnWidthMode( 2, QListView::Manual ); 142 ListView5->setColumnWidthMode( 2, QListView::Manual );
168 ListView5->setColumnWidth(2, 50);
169 ListView5->setColumnAlignment( 2, 1 ); 143 ListView5->setColumnAlignment( 2, 1 );
170 144
171 ListView5->addColumn( tr( "File" ) ); 145 ListView5->addColumn( tr( "File" ), -1 );
172 ListView5->setColumnWidthMode( 3, QListView::Manual ); 146 ListView5->setColumnWidthMode( 3, QListView::Manual );
173 ListView5->setColumnWidth(3, 100);
174 ListView5->setColumnAlignment( 3, 1 ); 147 ListView5->setColumnAlignment( 3, 1 );
175 148
176 tabWidget->insertTab( widget_1, tr( "A-F" ) ); 149 tabWidget->insertTab( widget_1, tr( "A-F" ) );
177 tabWidget->insertTab( widget_2, tr( "G-M" ) ); 150 tabWidget->insertTab( widget_2, tr( "G-M" ) );
178 tabWidget->insertTab( widget_3, tr( "N-R" ) ); 151 tabWidget->insertTab( widget_3, tr( "N-R" ) );
179 tabWidget->insertTab( widget_4, tr( "S-Z" ) ); 152 tabWidget->insertTab( widget_4, tr( "S-Z" ) );
@@ -204,14 +177,14 @@ void LibraryDialog::initDialog(){
204 buttonCancel = new QPushButton( widget_6, "buttonCancel" ); 177 buttonCancel = new QPushButton( widget_6, "buttonCancel" );
205 checkBox = new QCheckBox( ( tr("Open Automatically")), widget_6); 178 checkBox = new QCheckBox( ( tr("Open Automatically")), widget_6);
206 checkBox->setChecked( FALSE); 179 checkBox->setChecked( FALSE);
207// httpBox = new QCheckBox( ( tr("Use http")),widget_6); 180// httpBox = new QCheckBox( ( tr("Use http")),widget_6);
208// httpBox->setChecked( FALSE); 181// httpBox->setChecked( FALSE);
209// QToolTip::add( httpBox, ( tr("Use http to download \nproxy users should probably use this.")) ); 182// QToolTip::add( httpBox, ( tr("Use http to download \nproxy users should probably use this.")) );
210 authBox= new QCheckBox( ( tr("Last name first \n(requires library restart)")),widget_6); 183 authBox= new QCheckBox( ( tr("Last name first.")),widget_6);
211 authBox->setChecked( FALSE); 184 authBox->setChecked( true);
212 185
213 layout1->addMultiCellWidget( ListView1, 0, 0, 0, 4); 186 layout1->addMultiCellWidget( ListView1, 0, 0, 0, 4);
214 layout2->addMultiCellWidget( ListView2, 0, 0, 0, 4); 187 layout2->addMultiCellWidget( ListView2, 0, 0, 0, 4);
215 layout3->addMultiCellWidget( ListView3, 0, 0, 0, 4); 188 layout3->addMultiCellWidget( ListView3, 0, 0, 0, 4);
216 layout4->addMultiCellWidget( ListView4, 0, 0, 0, 4); 189 layout4->addMultiCellWidget( ListView4, 0, 0, 0, 4);
217 layout5->addMultiCellWidget( ListView5, 0, 0, 0, 4); 190 layout5->addMultiCellWidget( ListView5, 0, 0, 0, 4);
@@ -269,12 +242,13 @@ void LibraryDialog::initDialog(){
269 connect(ListView3,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); 242 connect(ListView3,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
270 connect(ListView3,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); 243 connect(ListView3,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
271 connect(ListView4,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); 244 connect(ListView4,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
272 connect(ListView4,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); 245 connect(ListView4,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
273 connect(ListView5,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); 246 connect(ListView5,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
274 connect(ListView5,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); 247 connect(ListView5,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
248 connect(authBox,SIGNAL(clicked()),this,SLOT(authBoxClicked()));
275 249
276 connect(sortingCombo,SIGNAL(activated(int)),SLOT(comboSelect(int))); 250 connect(sortingCombo,SIGNAL(activated(int)),SLOT(comboSelect(int)));
277 251
278} 252}
279 253
280void LibraryDialog::doListView() { 254void LibraryDialog::doListView() {