~ubuntu-branches/ubuntu/vivid/krusader/vivid-proposed

« back to all changes in this revision

Viewing changes to krusader/Konfigurator/kgstartup.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-05-05 22:26:37 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505222637-ydv3cwjwy365on2r
Tags: 1:2.1.0~beta1-1ubuntu1
* Merge from Debian Unstable.  Remaining changes:
  - Retain Kubuntu doc path

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include <QGridLayout>
38
38
#include <QLabel>
39
39
 
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)
42
42
{
43
 
  QWidget *innerWidget = new QFrame( this );
44
 
  setWidget( innerWidget );
45
 
  setWidgetResizable( true );
46
 
  QGridLayout *kgStartupLayout = new QGridLayout( innerWidget );
47
 
  kgStartupLayout->setSpacing( 6 );
48
 
 
49
 
  //  --------------------------- PANELS GROUPBOX ----------------------------------
50
 
 
51
 
  QGroupBox *panelsGrp = createFrame( i18n( "General" ), innerWidget );
52
 
  QGridLayout *panelsGrid = createGridLayout( panelsGrp );
53
 
 
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>&lt;Last session&gt;</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 );
58
 
 
59
 
  QStringList profileList = ProfileManager::availableProfiles( "Panel" );
60
 
  profileList.push_front( "<" + i18n( "Last session" ) + ">" );
61
 
 
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 = "";
66
 
 
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 );
70
 
 
71
 
  //------------------------------------------------
72
 
  panelsGrid->addWidget( createLine( panelsGrp ), 1, 0, 1, 2 );
73
 
 
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.") }
78
 
    };
79
 
 
80
 
  KonfiguratorCheckBoxGroup* cbs = createCheckBoxGroup( 2, 0, settings, 2 /* settings count */, panelsGrp );
81
 
  panelsGrid->addWidget( cbs, 2, 0, 1, 2 );
82
 
 
83
 
  kgStartupLayout->addWidget( panelsGrp, 0, 0 );
84
 
 
85
 
  //  ------------------------ USERINTERFACE GROUPBOX ------------------------------
86
 
 
87
 
  QGroupBox *uiGrp = createFrame( i18n( "User Interface" ), innerWidget );
88
 
  QGridLayout *uiGrid = createGridLayout( uiGrp );
89
 
 
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" ) },
100
 
    };
101
 
 
102
 
  uiCbGroup = createCheckBoxGroup( 2, 0, uiCheckBoxes, 8, uiGrp );
103
 
  connect( uiCbGroup->find( "UI Save Settings" ), SIGNAL( stateChanged( int ) ), this, SLOT( slotDisable() ) );
104
 
 
105
 
  uiGrid->addWidget( uiCbGroup, 1, 0 );
106
 
 
107
 
  slotDisable();
108
 
 
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);
 
48
 
 
49
    //  --------------------------- PANELS GROUPBOX ----------------------------------
 
50
 
 
51
    QGroupBox *panelsGrp = createFrame(i18n("General"), innerWidget);
 
52
    QGridLayout *panelsGrid = createGridLayout(panelsGrp);
 
53
 
 
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>&lt;Last session&gt;</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);
 
58
 
 
59
    QStringList profileList = ProfileManager::availableProfiles("Panel");
 
60
    profileList.push_front(i18n("<Last session>"));
 
61
 
 
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 = "";
 
67
 
 
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);
 
71
 
 
72
    delete [] comboItems;
 
73
 
 
74
    //------------------------------------------------
 
75
    panelsGrid->addWidget(createLine(panelsGrp), 1, 0, 1, 2);
 
76
 
 
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.") }
 
80
    };
 
81
 
 
82
    KonfiguratorCheckBoxGroup* cbs = createCheckBoxGroup(2, 0, settings, 2 /* settings count */, panelsGrp);
 
83
    panelsGrid->addWidget(cbs, 2, 0, 1, 2);
 
84
 
 
85
    kgStartupLayout->addWidget(panelsGrp, 0, 0);
 
86
 
 
87
    //  ------------------------ USERINTERFACE GROUPBOX ------------------------------
 
88
 
 
89
    QGroupBox *uiGrp = createFrame(i18n("User Interface"), innerWidget);
 
90
    QGridLayout *uiGrid = createGridLayout(uiGrp);
 
91
 
 
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") },
 
101
    };
 
102
 
 
103
    uiCbGroup = createCheckBoxGroup(2, 0, uiCheckBoxes, 8, uiGrp);
 
104
    connect(uiCbGroup->find("UI Save Settings"), SIGNAL(stateChanged(int)), this, SLOT(slotDisable()));
 
105
 
 
106
    uiGrid->addWidget(uiCbGroup, 1, 0);
 
107
 
 
108
    slotDisable();
 
109
 
 
110
    kgStartupLayout->addWidget(uiGrp, 1, 0);
110
111
}
111
112
 
112
113
void KgStartup::slotDisable()
113
114
{
114
 
  bool isUiSave   = !uiCbGroup->find( "UI Save Settings" )->isChecked();
 
115
    bool isUiSave   = !uiCbGroup->find("UI Save Settings")->isChecked();
115
116
 
116
 
  int i=1;
117
 
  while( uiCbGroup->find( i ) )
118
 
    uiCbGroup->find( i++ )->setEnabled( isUiSave );
 
117
    int i = 1;
 
118
    while (uiCbGroup->find(i))
 
119
        uiCbGroup->find(i++)->setEnabled(isUiSave);
119
120
}
120
121
 
121
122
#include "kgstartup.moc"