Profile: make profile abstract

This commit is contained in:
zt515 2017-12-12 23:43:41 +08:00
parent 98852aeaec
commit d8c6ff82e3
8 changed files with 20 additions and 13 deletions

View File

@ -1,7 +1,7 @@
package io.neoterm.component.config
import io.neoterm.component.config.loader.NeoLangConfigureLoader
import io.neoterm.component.config.loader.OldConfigureLoader
import io.neoterm.component.config.loaders.NeoLangConfigureLoader
import io.neoterm.component.config.loaders.OldConfigureLoader
import io.neoterm.frontend.component.NeoComponent
import java.io.File
@ -24,7 +24,7 @@ class ConfigureComponent : NeoComponent {
return CONFIG_LOADER_VERSION
}
fun newLoader(configFile: File): IConfigureFileLoader {
fun newLoader(configFile: File): IConfigureLoader {
return when (configFile.extension) {
"nl" -> NeoLangConfigureLoader(configFile)
else -> OldConfigureLoader(configFile)

View File

@ -5,6 +5,6 @@ import io.neoterm.frontend.config.NeoConfigureFile
/**
* @author kiva
*/
interface IConfigureFileLoader {
interface IConfigureLoader {
fun loadConfigure() : NeoConfigureFile?
}

View File

@ -1,13 +1,13 @@
package io.neoterm.component.config.loader
package io.neoterm.component.config.loaders
import io.neoterm.component.config.IConfigureFileLoader
import io.neoterm.component.config.IConfigureLoader
import io.neoterm.frontend.config.NeoConfigureFile
import java.io.File
/**
* @author kiva
*/
class NeoLangConfigureLoader(val configFile: File) : IConfigureFileLoader {
class NeoLangConfigureLoader(private val configFile: File) : IConfigureLoader {
override fun loadConfigure(): NeoConfigureFile? {
val configureFile = NeoConfigureFile(configFile)
return if (configureFile.parseConfigure()) configureFile else null

View File

@ -1,4 +1,4 @@
package io.neoterm.component.config.loader
package io.neoterm.component.config.loaders
import io.neolang.runtime.type.NeoLangValue
import io.neoterm.component.color.NeoColorScheme

View File

@ -1,13 +1,13 @@
package io.neoterm.component.config.loader
package io.neoterm.component.config.loaders
import io.neoterm.component.config.IConfigureFileLoader
import io.neoterm.component.config.IConfigureLoader
import io.neoterm.frontend.config.NeoConfigureFile
import java.io.File
/**
* @author kiva
*/
class OldConfigureLoader(val configFile: File) : IConfigureFileLoader {
class OldConfigureLoader(private val configFile: File) : IConfigureLoader {
override fun loadConfigure(): NeoConfigureFile? {
return when (configFile.extension) {
"eks" -> returnConfigure(OldExtraKeysConfigureFile(configFile))

View File

@ -1,4 +1,4 @@
package io.neoterm.component.config.loader
package io.neoterm.component.config.loaders
import io.neolang.runtime.type.NeoLangValue
import io.neolang.visitor.ConfigVisitor

View File

@ -0,0 +1,6 @@
package io.neoterm.component.profile
/**
* @author kiva
*/
abstract class NeoProfile

View File

@ -2,6 +2,7 @@ package io.neoterm.frontend.session.shell
import io.neoterm.component.color.ColorSchemeComponent
import io.neoterm.component.font.FontComponent
import io.neoterm.component.profile.NeoProfile
import io.neoterm.frontend.component.ComponentManager
import io.neoterm.frontend.config.DefaultValues
import io.neoterm.frontend.config.NeoPreference
@ -9,7 +10,7 @@ import io.neoterm.frontend.config.NeoPreference
/**
* @author kiva
*/
class ShellProfile {
class ShellProfile : NeoProfile() {
var loginShell = DefaultValues.loginShell
var initialCommand = DefaultValues.initialCommand