20 #include <QDialogButtonBox>
22 #include <QListWidget>
23 #include <QMessageBox>
26 #include <QStackedWidget>
32 : QDialog( parent, fl )
33 , mOptsKey( settingsKey )
44 settings.setValue( QString(
"/Windows/%1/geometry" ).arg(
mOptsKey ), saveGeometry() );
45 settings.setValue( QString(
"/Windows/%1/splitState" ).arg(
mOptsKey ),
mOptSplitter->saveState() );
54 if ( title.isEmpty() )
63 layout()->setContentsMargins( 0, 0, 0, 0 );
68 QFrame* optionsFrame = findChild<QFrame*>(
"mOptionsFrame" );
70 mOptSplitter = findChild<QSplitter*>(
"mOptionsSplitter" );
72 QFrame* buttonBoxFrame = findChild<QFrame*>(
"mButtonBoxFrame" );
74 if ( !
mOptListWidget || !mOptStackedWidget || !mOptSplitter || !optionsFrame )
80 int size = settings.value(
"/IconSize", 24 ).toInt();
84 mOptListWidget->setIconSize( QSize( size + iconBuffer, size + iconBuffer ) );
87 optionsFrame->layout()->setContentsMargins( 0, 3, 3, 3 );
88 QVBoxLayout* layout =
static_cast<QVBoxLayout*
>( optionsFrame->layout() );
92 buttonBoxFrame->layout()->setContentsMargins( 0, 0, 0, 0 );
93 layout->insertWidget( layout->count() + 1, buttonBoxFrame );
103 disconnect( mOptButtonBox, SIGNAL( accepted() ),
this, SLOT( accept() ) );
104 connect( mOptButtonBox, SIGNAL( accepted() ),
this, SLOT( accept() ) );
105 disconnect( mOptButtonBox, SIGNAL( rejected() ),
this, SLOT( reject() ) );
106 connect( mOptButtonBox, SIGNAL( rejected() ),
this, SLOT( reject() ) );
125 if ( !title.isEmpty() )
135 restoreGeometry( settings.value( QString(
"/Windows/%1/geometry" ).arg(
mOptsKey ) ).toByteArray() );
139 settings.value( QString(
"/Windows/%1/splitState" ).arg(
mOptsKey ) ).isNull() ? 150 : 16777215 );
140 mOptSplitter->restoreState( settings.value( QString(
"/Windows/%1/splitState" ).arg(
mOptsKey ) ).toByteArray() );
141 int curIndx = settings.value( QString(
"/Windows/%1/tab" ).arg(
mOptsKey ), 0 ).toInt();
196 setWindowTitle( QString(
"%1 | %2" ).arg(
mDialogTitle ).arg( curitem->text() ) );
215 int snapToIconWidth = iconWidth + 32;
218 mIconOnly = ( splitSizes.at( 0 ) <= snapToIconWidth );
221 int newWidth =
mOptListWidget->verticalScrollBar()->isVisible() ? iconWidth + 22 : iconWidth + 9;
229 splitSizes[1] = splitSizes.at( 1 ) - ( splitSizes.at( 0 ) - newWidth );
230 splitSizes[0] = newWidth;
257 QMessageBox::warning( 0,
tr(
"Missing objects" ),
258 tr(
"Base options dialog could not be initialized.\n\n"
259 "Missing some of the .ui template objects:\n" )
260 +
" mOptionsListWidget,\n mOptionsStackedWidget,\n mOptionsSplitter",