20 #include <QDialogButtonBox>
22 #include <QListWidget>
23 #include <QMessageBox>
25 #include <QStackedWidget>
31 : QDialog( parent, fl )
32 , mOptsKey( settingsKey )
34 , mOptListWidget( NULL )
35 , mOptStackedWidget( NULL )
36 , mOptSplitter( NULL )
37 , mOptButtonBox( NULL )
40 , mSettings( settings )
41 , mDelSettings( false )
49 mSettings->setValue( QString(
"/Windows/%1/geometry" ).arg(
mOptsKey ), saveGeometry() );
76 if ( title.isEmpty() )
85 layout()->setContentsMargins( 0, 0, 0, 0 );
90 QFrame* optionsFrame = findChild<QFrame*>(
"mOptionsFrame" );
92 mOptSplitter = findChild<QSplitter*>(
"mOptionsSplitter" );
94 QFrame* buttonBoxFrame = findChild<QFrame*>(
"mButtonBoxFrame" );
96 if ( !
mOptListWidget || !mOptStackedWidget || !mOptSplitter || !optionsFrame )
105 mOptListWidget->setIconSize( QSize( size + iconBuffer, size + iconBuffer ) );
108 optionsFrame->layout()->setContentsMargins( 0, 3, 3, 3 );
109 QVBoxLayout* layout =
static_cast<QVBoxLayout*
>( optionsFrame->layout() );
111 if ( buttonBoxFrame )
113 buttonBoxFrame->layout()->setContentsMargins( 0, 0, 0, 0 );
114 layout->insertWidget( layout->count() + 1, buttonBoxFrame );
124 disconnect( mOptButtonBox, SIGNAL( accepted() ),
this, SLOT( accept() ) );
125 connect( mOptButtonBox, SIGNAL( accepted() ),
this, SLOT( accept() ) );
126 disconnect( mOptButtonBox, SIGNAL( rejected() ),
this, SLOT( reject() ) );
127 connect( mOptButtonBox, SIGNAL( rejected() ),
this, SLOT( reject() ) );
157 if ( !title.isEmpty() )
166 restoreGeometry(
mSettings->value( QString(
"/Windows/%1/geometry" ).arg(
mOptsKey ) ).toByteArray() );
170 mSettings->value( QString(
"/Windows/%1/splitState" ).arg(
mOptsKey ) ).isNull() ? 150 : 16777215 );
172 int curIndx =
mSettings->value( QString(
"/Windows/%1/tab" ).arg(
mOptsKey ), 0 ).toInt();
227 setWindowTitle( QString(
"%1 | %2" ).arg(
mDialogTitle ).arg( curitem->text() ) );
246 int snapToIconWidth = iconWidth + 32;
249 mIconOnly = ( splitSizes.at( 0 ) <= snapToIconWidth );
252 int newWidth =
mOptListWidget->verticalScrollBar()->isVisible() ? iconWidth + 22 : iconWidth + 9;
260 splitSizes[1] = splitSizes.at( 1 ) - ( splitSizes.at( 0 ) - newWidth );
261 splitSizes[0] = newWidth;
288 QMessageBox::warning( 0,
tr(
"Missing objects" ),
289 tr(
"Base options dialog could not be initialized.\n\n"
290 "Missing some of the .ui template objects:\n" )
291 +
" mOptionsListWidget,\n mOptionsStackedWidget,\n mOptionsSplitter",