00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <qpixmap.h>
00015 #include "optionsDialog.h"
00016 #include "fontDialog.h"
00017
00018 #include <qlabel.h>
00019 #include <qpushbutton.h>
00020 #include <qlineedit.h>
00021 #include <qcombobox.h>
00022
00023 void optionsDialog::initDialog()
00024 {
00025
00026
00027
00028
00029 QGridLayout *layout = new QGridLayout( this );
00030 layout->setSpacing(2);
00031 layout->setMargin(2);
00032
00033 tabWidget = new QTabWidget( this, "tabWidget" );
00034 layout->addMultiCellWidget( tabWidget, 0, 0, 0, 3);
00035
00036 Widget2 = new QWidget( tabWidget, "Widget2" );
00037
00038 QGridLayout *layout2 = new QGridLayout(Widget2 );
00039 layout2->setSpacing(2);
00040 layout2->setMargin(2);
00041
00042
00043
00044 QLabel *downLabel= new QLabel(Widget2,"Label1");
00045 downLabel->setText("Download Directory:");
00046 downLabel->setMaximumHeight(30);
00047
00048 downloadDirEdit = new QLineEdit(Widget2,"downloadDir");
00049
00050
00051
00052
00053
00054
00055 cb_queryExit = new QCheckBox( Widget2, "cb_queryExit" );
00056 cb_queryExit->setText("Query before exit.");
00057
00058 useWordWrap_CheckBox = new QCheckBox( Widget2, "WordWrap_CheckBox" );
00059 useWordWrap_CheckBox->setText("Use Word Wrap");
00060
00061 Ftp_CheckBox = new QCheckBox( Widget2, "Ftp_CheckBox" );
00062 Ftp_CheckBox->setText("Use FTP");
00063 Ftp_CheckBox->hide();
00064
00065 layout2->addMultiCellWidget( downLabel, 0, 0, 0, 2);
00066
00067 layout2->addMultiCellWidget( downloadDirEdit, 1, 1, 0, 0);
00068
00069 layout2->addMultiCellWidget( cb_queryExit, 2, 2, 0, 1);
00070 layout2->addMultiCellWidget( useWordWrap_CheckBox, 3, 3, 0, 1);
00071 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00072 layout2->addItem( spacer, 4, 0 );
00073
00074
00076 tabWidget->insertTab( Widget2, tr( "Main" ) );
00077
00078 Widget3 = new QWidget( tabWidget, "Widget3" );
00079
00080 QGridLayout *layout3 = new QGridLayout(Widget3 );
00081 layout3->setSpacing(2);
00082 layout3->setMargin(4);
00083
00084 TextLabel3 = new QLabel( Widget3, "TextLabel3" );
00085
00086 ftp_QListBox_1 = new QListBox( Widget3, "ftp_QListBox_1" );
00087 ftp_DownloadButton = new QPushButton( Widget3, "ftp_DownloadButton" );
00088
00090 tabWidget->insertTab( Widget3, tr( "FTP" ) );
00091 tab = new QWidget( tabWidget, "tab" );
00092
00093 TextLabel3_3 = new QLabel( tab, "TextLabel3_3" );
00094
00095
00096
00097
00098 PushButton_Browse = new QPushButton( tab, "PushButton_Browse" );
00099
00100 ComboBox1 = new QComboBox( FALSE, tab, "ComboBox1" );
00101
00102 ComboBox1->insertItem( tr( "http://sailor.gutenberg.org" ) );
00103 ComboBox1->insertItem( tr( "http://www.prairienet.org/pg" ) );
00104
00105 http_ListBox1 = new QListBox( tab, "http_ListBox1" );
00106
00108 tabWidget->insertTab( tab, tr( "HTTP" ) );
00109
00110 QGridLayout *layout4 = new QGridLayout(tab );
00111 layout4->setSpacing(2);
00112 layout4->setMargin(2);
00113
00114 fontDlg = new FontDialog( tabWidget,"FontDialog");
00115
00116 tabWidget->insertTab( fontDlg,"Font");
00117
00118
00119
00120 initConnections();
00121
00122 ftp_DownloadButton->setText("New List");
00123 PushButton_Browse->setText("Browse");
00124
00125 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
00126
00127 doOptions();
00128
00129 layout3->addMultiCellWidget( ftp_DownloadButton, 0, 0, 1, 2);
00130 layout3->addMultiCellWidget( TextLabel3, 1, 1, 0, 1);
00131 layout3->addMultiCellWidget( ftp_QListBox_1, 2, 2, 0, 2);
00132
00133 TextLabel3_3->setMaximumHeight(50);
00134 layout4->addMultiCellWidget( PushButton_Browse, 0, 0, 1, 2);
00135 layout4->addMultiCellWidget( TextLabel3_3, 1, 1, 0, 1);
00136 layout4->addMultiCellWidget( http_ListBox1, 2, 3, 0, 2);
00137 layout4->addMultiCellWidget( ComboBox1, 4, 4, 0, 2);
00138 setCaption(tr("Gutenbrowser Options"));
00139 }
00140
00141 void optionsDialog::initConnections() {
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 connect( ftp_DownloadButton, SIGNAL( released() ),this, SLOT( getSite() ));
00155 connect( ftp_QListBox_1, SIGNAL( clicked ( QListBoxItem *)),this, SLOT( getSelection( QListBoxItem *)) );
00156
00157
00158 connect( http_ListBox1, SIGNAL(highlighted ( int)),this, SLOT(select_title(int)) );
00159 connect( PushButton_Browse, SIGNAL( clicked() ), SLOT( BrowseSelected() ) );
00160
00161
00162
00163
00164 connect(cb_queryExit,SIGNAL(clicked()),SLOT( slotQueryExit()) );
00165
00166 connect( useWordWrap_CheckBox,SIGNAL( toggled(bool)),SLOT( slotWordWrap(bool)) );
00167 }
00168
00169 void optionsDialog::listBoxMainSel( int index) {
00170 tabWidget->setCurrentPage( index);
00171 }