37
37
#include <QGridLayout>
40
KgStartup::KgStartup( bool first, QWidget* parent ) :
41
KonfiguratorPage( first, parent ), profileCombo( 0 )
40
KgStartup::KgStartup(bool first, QWidget* parent) :
41
KonfiguratorPage(first, parent), profileCombo(0)
43
QWidget *innerWidget = new QFrame( this );
44
setWidget( innerWidget );
45
setWidgetResizable( true );
46
QGridLayout *kgStartupLayout = new QGridLayout( innerWidget );
47
kgStartupLayout->setSpacing( 6 );
49
// --------------------------- PANELS GROUPBOX ----------------------------------
51
QGroupBox *panelsGrp = createFrame( i18n( "General" ), innerWidget );
52
QGridLayout *panelsGrid = createGridLayout( panelsGrp );
54
QString s = "<p><img src='toolbar|kr_profile'></p>" + i18n( "Defines the panel profile used at startup. A panel profile contains:<ul><li>all the tabs paths</li><li>the current tab</li><li>the active panel</li></ul><b><Last session></b> is a special panel profile which is saved automatically when Krusader is closed.");
55
QLabel *label = addLabel( panelsGrid, 0, 0, i18n( "Startup profile:" ), panelsGrp );
56
label->setWhatsThis( s );
57
panelsGrp->setWhatsThis( s );
59
QStringList profileList = ProfileManager::availableProfiles( "Panel" );
60
profileList.push_front( "<" + i18n( "Last session" ) + ">" );
62
KONFIGURATOR_NAME_VALUE_PAIR comboItems[ profileList.count() ];
63
for(int i=0; i != profileList.count(); i++ )
64
comboItems[ i ].text = comboItems[ i ].value = profileList [ i ];
65
comboItems[ 0 ].value = "";
67
profileCombo = createComboBox( "Startup", "Starter Profile Name", comboItems[ 0 ].value, comboItems, profileList.count(), panelsGrp, false, false );
68
profileCombo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed);
69
panelsGrid->addWidget( profileCombo, 0, 1 );
71
//------------------------------------------------
72
panelsGrid->addWidget( createLine( panelsGrp ), 1, 0, 1, 2 );
74
KONFIGURATOR_CHECKBOX_PARAM settings[] =
75
{ // cfg_class cfg_name default text restart tooltip
76
{"Look&Feel","Show splashscreen", _ShowSplashScreen, i18n( "Show splashscreen" ), false, i18n( "Display a splashscreen when starting krusader.") },
77
{"Look&Feel","Single Instance Mode", _SingleInstanceMode, i18n( "Single instance mode" ), false, i18n( "Only one Krusader instance is allowed to run.") }
80
KonfiguratorCheckBoxGroup* cbs = createCheckBoxGroup( 2, 0, settings, 2 /* settings count */, panelsGrp );
81
panelsGrid->addWidget( cbs, 2, 0, 1, 2 );
83
kgStartupLayout->addWidget( panelsGrp, 0, 0 );
85
// ------------------------ USERINTERFACE GROUPBOX ------------------------------
87
QGroupBox *uiGrp = createFrame( i18n( "User Interface" ), innerWidget );
88
QGridLayout *uiGrid = createGridLayout( uiGrp );
90
KONFIGURATOR_CHECKBOX_PARAM uiCheckBoxes[] =
91
{ // cfg_class cfg_name default text restart ToolTip
92
{"Startup","UI Save Settings", _UiSave, i18n( "Save settings on exit" ), false, i18n( "Check the state of the user interface components and restore them to their condition when last shutdown." ) },
93
{"Startup","Show tool bar", _ShowToolBar, i18n( "Show toolbar" ), false, i18n( "Toolbar will be visible after startup." ) },
94
{"Startup","Show status bar", _ShowStatusBar, i18n( "Show statusbar" ), false, i18n( "Statusbar will be visible after startup." ) },
95
{"Startup","Show FN Keys", _ShowFNkeys, i18n( "Show function keys" ), false, i18n( "Function keys will be visible after startup." ) },
96
{"Startup","Show Cmd Line", _ShowCmdline, i18n( "Show command line" ), false, i18n( "Command line will be visible after startup." ) },
97
{"Startup","Show Terminal Emulator",_ShowTerminalEmulator, i18n( "Show terminal emulator" ), false, i18n( "Terminal emulator will be visible after startup." ) },
98
{"Startup","Remember Position", _RememberPos, i18n( "Save last position, size and panel settings" ), false, i18n( "<p>At startup, the main window will resize itself to the size it was when last shutdown. It will also appear in the same location of the screen, having panels sorted and aligned as they were before.</p><p>If this option is disabled, you can use the menu <i>Window -> Save Position</i> option to manually set the main window's size and position at startup.</p>" ) },
99
{"Startup","Start To Tray", _StartToTray, i18n( "Start to tray" ), false, i18n( "Krusader starts to tray (if minimize to tray is set), without showing the main window" ) },
102
uiCbGroup = createCheckBoxGroup( 2, 0, uiCheckBoxes, 8, uiGrp );
103
connect( uiCbGroup->find( "UI Save Settings" ), SIGNAL( stateChanged( int ) ), this, SLOT( slotDisable() ) );
105
uiGrid->addWidget( uiCbGroup, 1, 0 );
109
kgStartupLayout->addWidget( uiGrp, 1, 0 );
43
QWidget *innerWidget = new QFrame(this);
44
setWidget(innerWidget);
45
setWidgetResizable(true);
46
QGridLayout *kgStartupLayout = new QGridLayout(innerWidget);
47
kgStartupLayout->setSpacing(6);
49
// --------------------------- PANELS GROUPBOX ----------------------------------
51
QGroupBox *panelsGrp = createFrame(i18n("General"), innerWidget);
52
QGridLayout *panelsGrid = createGridLayout(panelsGrp);
54
QString s = "<p><img src='toolbar|kr_profile'></p>" + i18n("Defines the panel profile used at startup. A panel profile contains:<ul><li>all the tabs paths</li><li>the current tab</li><li>the active panel</li></ul><b><Last session></b> is a special panel profile which is saved automatically when Krusader is closed.");
55
QLabel *label = addLabel(panelsGrid, 0, 0, i18n("Startup profile:"), panelsGrp);
56
label->setWhatsThis(s);
57
panelsGrp->setWhatsThis(s);
59
QStringList profileList = ProfileManager::availableProfiles("Panel");
60
profileList.push_front(i18n("<Last session>"));
62
const int profileListSize = profileList.size();
63
KONFIGURATOR_NAME_VALUE_PAIR *comboItems = new KONFIGURATOR_NAME_VALUE_PAIR[ profileListSize ];
64
for (int i = 0; i != profileListSize; i++)
65
comboItems[ i ].text = comboItems[ i ].value = profileList [ i ];
66
comboItems[ 0 ].value = "";
68
profileCombo = createComboBox("Startup", "Starter Profile Name", comboItems[ 0 ].value, comboItems, profileListSize, panelsGrp, false, false);
69
profileCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
70
panelsGrid->addWidget(profileCombo, 0, 1);
74
//------------------------------------------------
75
panelsGrid->addWidget(createLine(panelsGrp), 1, 0, 1, 2);
77
KONFIGURATOR_CHECKBOX_PARAM settings[] = { // cfg_class cfg_name default text restart tooltip
78
{"Look&Feel", "Show splashscreen", _ShowSplashScreen, i18n("Show splashscreen"), false, i18n("Display a splashscreen when starting krusader.") },
79
{"Look&Feel", "Single Instance Mode", _SingleInstanceMode, i18n("Single instance mode"), false, i18n("Only one Krusader instance is allowed to run.") }
82
KonfiguratorCheckBoxGroup* cbs = createCheckBoxGroup(2, 0, settings, 2 /* settings count */, panelsGrp);
83
panelsGrid->addWidget(cbs, 2, 0, 1, 2);
85
kgStartupLayout->addWidget(panelsGrp, 0, 0);
87
// ------------------------ USERINTERFACE GROUPBOX ------------------------------
89
QGroupBox *uiGrp = createFrame(i18n("User Interface"), innerWidget);
90
QGridLayout *uiGrid = createGridLayout(uiGrp);
92
KONFIGURATOR_CHECKBOX_PARAM uiCheckBoxes[] = { // cfg_class cfg_name default text restart ToolTip
93
{"Startup", "UI Save Settings", _UiSave, i18n("Save settings on exit"), false, i18n("Check the state of the user interface components and restore them to their condition when last shutdown.") },
94
{"Startup", "Show tool bar", _ShowToolBar, i18n("Show toolbar"), false, i18n("Toolbar will be visible after startup.") },
95
{"Startup", "Show status bar", _ShowStatusBar, i18n("Show statusbar"), false, i18n("Statusbar will be visible after startup.") },
96
{"Startup", "Show FN Keys", _ShowFNkeys, i18n("Show function keys"), false, i18n("Function keys will be visible after startup.") },
97
{"Startup", "Show Cmd Line", _ShowCmdline, i18n("Show command line"), false, i18n("Command line will be visible after startup.") },
98
{"Startup", "Show Terminal Emulator", _ShowTerminalEmulator, i18n("Show terminal emulator"), false, i18n("Terminal emulator will be visible after startup.") },
99
{"Startup", "Remember Position", _RememberPos, i18n("Save last position, size and panel settings"), false, i18n("<p>At startup, the main window will resize itself to the size it was when last shutdown. It will also appear in the same location of the screen, having panels sorted and aligned as they were before.</p><p>If this option is disabled, you can use the menu <i>Window -> Save Position</i> option to manually set the main window's size and position at startup.</p>") },
100
{"Startup", "Start To Tray", _StartToTray, i18n("Start to tray"), false, i18n("Krusader starts to tray (if minimize to tray is set), without showing the main window") },
103
uiCbGroup = createCheckBoxGroup(2, 0, uiCheckBoxes, 8, uiGrp);
104
connect(uiCbGroup->find("UI Save Settings"), SIGNAL(stateChanged(int)), this, SLOT(slotDisable()));
106
uiGrid->addWidget(uiCbGroup, 1, 0);
110
kgStartupLayout->addWidget(uiGrp, 1, 0);
112
113
void KgStartup::slotDisable()
114
bool isUiSave = !uiCbGroup->find( "UI Save Settings" )->isChecked();
115
bool isUiSave = !uiCbGroup->find("UI Save Settings")->isChecked();
117
while( uiCbGroup->find( i ) )
118
uiCbGroup->find( i++ )->setEnabled( isUiSave );
118
while (uiCbGroup->find(i))
119
uiCbGroup->find(i++)->setEnabled(isUiSave);
121
122
#include "kgstartup.moc"