Example #1
0
        public frmNumberTracks(int First, int Range)
            : base(Localization.Get(UI_Key.Number_Tracks_Title), ButtonCreateType.OKAndCancel)
        {
            range = Range;

            this.ClientSize     = new System.Drawing.Size(350, 100);
            lblHeading          = new QLabel(Localization.Get(UI_Key.Number_Tracks_Heading));
            lblHeading.Location = new System.Drawing.Point(MARGIN, MARGIN);
            this.Controls.Add(lblHeading);
            lblHeading.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN);

            int ypos = lblHeading.Bottom + SPACING;

            spnFirst               = new QSpin(false, false, Localization.Get(UI_Key.Number_Tracks_First), String.Empty, 1, 200, 1, 1, this.BackColor);
            spnFirst.Value         = First;
            spnFirst.Location      = new System.Drawing.Point(MARGIN + MARGIN, ypos);
            spnFirst.ValueChanged += valueChanged;
            this.Controls.Add(spnFirst);

            ypos = spnFirst.Bottom + SPACING;

            lblLast          = new QLabel(Localization.Get(UI_Key.Number_Tracks_Last, (First + range - 1).ToString()));
            lblLast.Location = new System.Drawing.Point(MARGIN + MARGIN, ypos);
            lblLast.SetWidth(this.ClientRectangle.Width - MARGIN - MARGIN - MARGIN);
            this.Controls.Add(lblLast);

            ypos = lblLast.Bottom + SPACING;

            PlaceButtons(this.ClientRectangle.Right, ypos);

            this.ClientSize = new System.Drawing.Size(this.ClientSize.Width, btnOK.Bottom + MARGIN);

            spnFirst.Focus();
        }
Example #2
0
        public frmSleep(Controller Controller) : base(Localization.Get(UI_Key.Sleep_Title), ButtonCreateType.OKAndCancel)
        {
            this.controller = Controller;

            this.SuspendLayout();

            lblInstructions          = new QLabel(Localization.Get(UI_Key.Sleep_Instructions, Application.ProductName));
            lblInstructions.AutoSize = false;
            this.Controls.Add(lblInstructions);

            txtTime = new QSpin(true, true, Localization.Get(UI_Key.Sleep_Play_For_Another), Localization.Get(UI_Key.Sleep_Minutes), 1, 24 * 60, 60, 5, this.BackColor);
            txtTime.CheckedChanged += new EventHandler(txtTime_CheckedChanged);
            txtTime.ValueChanged   += new EventHandler(txtTime_ValueChanged);
            this.Controls.Add(txtTime);

            lblAndThen = new QLabel(Localization.Get(UI_Key.Sleep_And_Then));
            this.Controls.Add(lblAndThen);

            cboAction = new QComboBox(false);
            cboAction.Items.Add(SHUTDOWN_TEXT);
            cboAction.Items.Add(STANDBY_TEXT);
            cboAction.Items.Add(HIBERNATE_TEXT);
            cboAction.Items.Add(EXIT_TEXT);

            cboAction.SelectedIndexChanged += new EventHandler(cboAction_SelectedIndexChanged);
            cboAction.Width = TextRenderer.MeasureText(SHUTDOWN_TEXT, this.Font).Width + 40;
            this.Controls.Add(cboAction);

            txtFadeTime = new QSpin(true, true, Localization.Get(UI_Key.Sleep_Gradually_Reduce_Volume_After), Localization.Get(UI_Key.Sleep_Minutes), 0, 24 * 60, 0, 5, this.BackColor);
            txtFadeTime.ValueChanged += new EventHandler(txtFadeTime_ValueChanged);
            this.Controls.Add(txtFadeTime);

            chkForce = new QCheckBox(Localization.Get(UI_Key.Sleep_Force_Shutdown), this.BackColor);
            chkForce.EnabledChanged += (s, e) => { this.Invalidate(); };
            this.Controls.Add(chkForce);

            Sleep = new Sleep(controller);

            txtFadeTime_ValueChanged(this, EventArgs.Empty);
            txtTime_ValueChanged(this, EventArgs.Empty);

            setupControls();

            this.ResumeLayout(false);
        }
Example #3
0
        public frmOptions() : base(Localization.Get(UI_Key.Options_Title, Application.ProductName), ButtonCreateType.OKAndCancel)
        {
            this.SPACING = 4;

            tabs = new Dictionary <QButton, List <Control> >();

            InitializeComponent();

            QButton        button   = new QButton("Primary Options", true, false);
            List <Control> controls = new List <Control>();

            tabs.Add(button, controls);
            button.Value          = true;
            button.ButtonPressed += clickTab;

            topMargin = PADDING + button.Height + SPACING + SPACING;

            lblSound = new QLabel(Localization.Get(UI_Key.Options_Label_Sound), Styles.FontBold);
            controls.Add(lblSound);

            chkAutoClippingControl = new QCheckBox(Localization.Get(UI_Key.Options_Auto_Clipping_Control), this.BackColor);
            controls.Add(chkAutoClippingControl);

            lblSoundDevice = new QLabel("Specify a sound output device:");
            controls.Add(lblSoundDevice);

            cboSoundDevice = new QComboBox(false);
            cboSoundDevice.Items.AddRange(OutputDX.GetDeviceNames());
            cboSoundDevice.SelectedIndexChanged += new EventHandler(cboSoundDevice_SelectedIndexChanged);

            asioDevices = OutputASIO.GetDeviceNames().ToArray();
            cboSoundDevice.Items.AddRange(asioDevices);

            chkVolumeControlsWindowsVolume = new QCheckBox(Localization.Get(UI_Key.Options_Volume_Controls_Windows_Volume, Application.ProductName), this.BackColor);

            if (!Lib.IsVistaOrLater)
            {
                controls.Add(chkVolumeControlsWindowsVolume);
            }
            else
            {
                chkVolumeControlsWindowsVolume.Visible = false;
            }

            if (cboSoundDevice.Items.Count > 0)
            {
                cboSoundDevice.SelectedIndex = 0;
                cboSoundDevice.AutoSetWidth();
            }
            controls.Add(cboSoundDevice);

            lblDisplay = new QLabel(Localization.Get(UI_Key.Options_Label_Display), Styles.FontBold);
            controls.Add(lblDisplay);

            chkIncludeTagCloud = new QCheckBox(Localization.Get(UI_Key.Options_Include_Tag_Cloud), this.BackColor);
            controls.Add(chkIncludeTagCloud);

            chkDisableScreensavers = new QCheckBox(Localization.Get(UI_Key.Options_Disable_Screensaver), this.BackColor);
            controls.Add(chkDisableScreensavers);

            chkDisableScreensaversOnlyWhenPlaying = new QCheckBox("Only When Playing", this.BackColor);
            controls.Add(chkDisableScreensaversOnlyWhenPlaying);

            chkShowGridOnSpectrum = new QCheckBox(Localization.Get(UI_Key.Options_Spectrum_Show_Grid), this.BackColor);
            controls.Add(chkShowGridOnSpectrum);

            button                = new QButton("Secondary Options", true, false);
            button.Value          = false;
            button.ButtonPressed += clickTab;
            controls              = new List <Control>();
            tabs.Add(button, controls);

            lblInternet = new QLabel(Localization.Get(UI_Key.Options_Label_Internet), Styles.FontBold);
            controls.Add(lblInternet);

            chkAutoCheckUpdates = new QCheckBox(Localization.Get(UI_Key.Options_Auto_Check_Updates), this.BackColor);
            controls.Add(chkAutoCheckUpdates);

            chkDownloadCoverArt = new QCheckBox(Localization.Get(UI_Key.Options_Download_Cover_Art), this.BackColor);
            controls.Add(chkDownloadCoverArt);

            lblArtSave         = new QLabel(Localization.Get(UI_Key.Options_Save_Art_Caption));
            lblArtSave.Enabled = false;
            controls.Add(lblArtSave);

            cboArtSave = new QComboBox(false);
            cboArtSave.Items.Add(Localization.Get(UI_Key.Options_Save_Art_Folder_JPG));
            cboArtSave.Items.Add(Localization.Get(UI_Key.Options_Save_Art_Artist_Album));
            cboArtSave.Items.Add(Localization.Get(UI_Key.Options_Save_Art_None));
            cboArtSave.AutoSetWidth();
            cboArtSave.Enabled = false;
            controls.Add(cboArtSave);

            lblMisc = new QLabel(Localization.Get(UI_Key.Options_Label_Other), Styles.FontBold);
            controls.Add(lblMisc);

            chkUseGlobalHotkeys = new QCheckBox(Localization.Get(UI_Key.Options_Use_Global_Hotkeys), this.BackColor);
            controls.Add(chkUseGlobalHotkeys);

            spnShortTracks = new QSpin(true,
                                       true,
                                       Localization.Get(UI_Key.Options_Dont_Load_Shorter_Than),
                                       Localization.Get(UI_Key.Options_Dont_Load_Seconds),
                                       1,
                                       60,
                                       10,
                                       5,
                                       this.BackColor);

            spnShortTracks.OffEquivalent = 0;
            controls.Add(spnShortTracks);

            chkDownloadCoverArt.CheckedChanged += (s, e) =>
            {
                lblArtSave.Enabled = chkDownloadCoverArt.Checked;
                cboArtSave.Enabled = chkDownloadCoverArt.Checked;
            };

            chkStopClearsNowPlaying = new QCheckBox("Stop clears Now Playing", this.BackColor);
            controls.Add(chkStopClearsNowPlaying);

            chkSaveNowPlayingOnExit = new QCheckBox("Save Now Playing on exit", this.BackColor);
            controls.Add(chkSaveNowPlayingOnExit);

            bool isFirst  = true;
            int  tabIndex = 0;

            foreach (KeyValuePair <QButton, List <Control> > kvp in tabs)
            {
                this.Controls.Add(kvp.Key);
                kvp.Key.TabIndex = tabIndex++;
                foreach (Control c in kvp.Value)
                {
                    c.Visible = isFirst;
                    this.Controls.Add(c);
                }
                isFirst = false;
            }

            cboSoundDevice.TabIndex = tabIndex++;

            if (!Lib.IsVistaOrLater)
            {
                chkVolumeControlsWindowsVolume.TabIndex = tabIndex++;
            }

            chkAutoClippingControl.TabIndex = tabIndex++;

            chkIncludeTagCloud.TabIndex     = tabIndex++;
            chkDisableScreensavers.TabIndex = tabIndex++;
            chkDisableScreensaversOnlyWhenPlaying.TabIndex = tabIndex++;
            chkShowGridOnSpectrum.TabIndex = tabIndex++;
            chkAutoCheckUpdates.TabIndex   = tabIndex++;
            chkDownloadCoverArt.TabIndex   = tabIndex++;
            cboArtSave.TabIndex            = tabIndex++;

            chkUseGlobalHotkeys.TabIndex     = tabIndex++;
            chkStopClearsNowPlaying.TabIndex = tabIndex++;
            chkSaveNowPlayingOnExit.TabIndex = tabIndex++;
            spnShortTracks.TabIndex          = tabIndex++;

            btnOK.TabIndex     = tabIndex++;
            btnCancel.TabIndex = tabIndex++;

            arrangeLayout();
        }